@ketvietlab/ketsuite 0.1.29 → 0.1.31

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 (781) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/modules/account_backend/index.js +0 -6
  3. package/dist/modules/account_backend/index.js.map +1 -1
  4. package/dist/modules/account_backend/screens/account-defaults.d.ts.map +1 -1
  5. package/dist/modules/account_backend/screens/account-defaults.js +1 -1
  6. package/dist/modules/account_backend/screens/account-defaults.js.map +1 -1
  7. package/dist/modules/account_backend/screens/account-form.d.ts.map +1 -1
  8. package/dist/modules/account_backend/screens/account-form.js +3 -1
  9. package/dist/modules/account_backend/screens/account-form.js.map +1 -1
  10. package/dist/modules/account_backend/screens/accounts-list.d.ts.map +1 -1
  11. package/dist/modules/account_backend/screens/accounts-list.js +1 -1
  12. package/dist/modules/account_backend/screens/accounts-list.js.map +1 -1
  13. package/dist/modules/account_backend/screens/customer-invoice-form.d.ts.map +1 -1
  14. package/dist/modules/account_backend/screens/customer-invoice-form.js +1 -1
  15. package/dist/modules/account_backend/screens/customer-invoice-form.js.map +1 -1
  16. package/dist/modules/account_backend/screens/customer-invoices-list.d.ts.map +1 -1
  17. package/dist/modules/account_backend/screens/customer-invoices-list.js +1 -1
  18. package/dist/modules/account_backend/screens/customer-invoices-list.js.map +1 -1
  19. package/dist/modules/account_backend/screens/journal-entries-list.d.ts.map +1 -1
  20. package/dist/modules/account_backend/screens/journal-entries-list.js +1 -1
  21. package/dist/modules/account_backend/screens/journal-entries-list.js.map +1 -1
  22. package/dist/modules/account_backend/screens/journal-entry-create.d.ts.map +1 -1
  23. package/dist/modules/account_backend/screens/journal-entry-create.js +1 -1
  24. package/dist/modules/account_backend/screens/journal-entry-create.js.map +1 -1
  25. package/dist/modules/account_backend/screens/journal-form.d.ts.map +1 -1
  26. package/dist/modules/account_backend/screens/journal-form.js +3 -3
  27. package/dist/modules/account_backend/screens/journal-form.js.map +1 -1
  28. package/dist/modules/account_backend/screens/journals-list.d.ts.map +1 -1
  29. package/dist/modules/account_backend/screens/journals-list.js +1 -1
  30. package/dist/modules/account_backend/screens/journals-list.js.map +1 -1
  31. package/dist/modules/account_backend/screens/move-detail.d.ts.map +1 -1
  32. package/dist/modules/account_backend/screens/move-detail.js +3 -1
  33. package/dist/modules/account_backend/screens/move-detail.js.map +1 -1
  34. package/dist/modules/account_backend/screens/opening-balances.d.ts.map +1 -1
  35. package/dist/modules/account_backend/screens/opening-balances.js +2 -2
  36. package/dist/modules/account_backend/screens/opening-balances.js.map +1 -1
  37. package/dist/modules/account_backend/screens/overview.js +4 -2
  38. package/dist/modules/account_backend/screens/overview.js.map +1 -1
  39. package/dist/modules/account_backend/screens/payment-form.d.ts.map +1 -1
  40. package/dist/modules/account_backend/screens/payment-form.js +1 -1
  41. package/dist/modules/account_backend/screens/payment-form.js.map +1 -1
  42. package/dist/modules/account_backend/screens/payment-term-form.d.ts.map +1 -1
  43. package/dist/modules/account_backend/screens/payment-term-form.js +4 -2
  44. package/dist/modules/account_backend/screens/payment-term-form.js.map +1 -1
  45. package/dist/modules/account_backend/screens/payment-terms-list.d.ts.map +1 -1
  46. package/dist/modules/account_backend/screens/payment-terms-list.js +1 -1
  47. package/dist/modules/account_backend/screens/payment-terms-list.js.map +1 -1
  48. package/dist/modules/account_backend/screens/payments-list.d.ts.map +1 -1
  49. package/dist/modules/account_backend/screens/payments-list.js +1 -1
  50. package/dist/modules/account_backend/screens/payments-list.js.map +1 -1
  51. package/dist/modules/account_backend/screens/period-closes.d.ts.map +1 -1
  52. package/dist/modules/account_backend/screens/period-closes.js +1 -1
  53. package/dist/modules/account_backend/screens/period-closes.js.map +1 -1
  54. package/dist/modules/account_backend/screens/tax-form.d.ts.map +1 -1
  55. package/dist/modules/account_backend/screens/tax-form.js +3 -1
  56. package/dist/modules/account_backend/screens/tax-form.js.map +1 -1
  57. package/dist/modules/account_backend/screens/taxes-list.d.ts.map +1 -1
  58. package/dist/modules/account_backend/screens/taxes-list.js +1 -1
  59. package/dist/modules/account_backend/screens/taxes-list.js.map +1 -1
  60. package/dist/modules/account_backend/screens/vendor-bill-form.d.ts.map +1 -1
  61. package/dist/modules/account_backend/screens/vendor-bill-form.js +1 -1
  62. package/dist/modules/account_backend/screens/vendor-bill-form.js.map +1 -1
  63. package/dist/modules/account_backend/screens/vendor-bills-list.d.ts.map +1 -1
  64. package/dist/modules/account_backend/screens/vendor-bills-list.js +1 -1
  65. package/dist/modules/account_backend/screens/vendor-bills-list.js.map +1 -1
  66. package/dist/modules/account_partner_backend/screens/accounting-terms.d.ts.map +1 -1
  67. package/dist/modules/account_partner_backend/screens/accounting-terms.js +1 -1
  68. package/dist/modules/account_partner_backend/screens/accounting-terms.js.map +1 -1
  69. package/dist/modules/activity_backend/index.d.ts.map +1 -1
  70. package/dist/modules/activity_backend/index.js +0 -2
  71. package/dist/modules/activity_backend/index.js.map +1 -1
  72. package/dist/modules/activity_backend/screens/activities-list.d.ts.map +1 -1
  73. package/dist/modules/activity_backend/screens/activities-list.js +1 -1
  74. package/dist/modules/activity_backend/screens/activities-list.js.map +1 -1
  75. package/dist/modules/address_backend/index.d.ts.map +1 -1
  76. package/dist/modules/address_backend/index.js +0 -2
  77. package/dist/modules/address_backend/index.js.map +1 -1
  78. package/dist/modules/address_backend/screens/catalogs-list.d.ts.map +1 -1
  79. package/dist/modules/address_backend/screens/catalogs-list.js +1 -1
  80. package/dist/modules/address_backend/screens/catalogs-list.js.map +1 -1
  81. package/dist/modules/attendance_backend/screens/credentials.d.ts.map +1 -1
  82. package/dist/modules/attendance_backend/screens/credentials.js +1 -1
  83. package/dist/modules/attendance_backend/screens/credentials.js.map +1 -1
  84. package/dist/modules/attendance_backend/screens/period.d.ts.map +1 -1
  85. package/dist/modules/attendance_backend/screens/period.js +1 -1
  86. package/dist/modules/attendance_backend/screens/period.js.map +1 -1
  87. package/dist/modules/backend/current-company.d.ts +4 -0
  88. package/dist/modules/backend/current-company.d.ts.map +1 -0
  89. package/dist/modules/backend/current-company.js +27 -0
  90. package/dist/modules/backend/current-company.js.map +1 -0
  91. package/dist/modules/backend/design/client/backend-shell.d.mts +2 -2
  92. package/dist/modules/backend/design/client/backend-shell.d.mts.map +1 -1
  93. package/dist/modules/backend/design/client/backend-shell.mjs +1 -1
  94. package/dist/modules/backend/design/client/backend-shell.mjs.map +4 -4
  95. package/dist/modules/backend/design/client/ket-table.d.mts +2 -2
  96. package/dist/modules/backend/design/client/ket-table.d.mts.map +1 -1
  97. package/dist/modules/backend/design/client/ket-table.mjs +1 -1
  98. package/dist/modules/backend/design/client/ket-table.mjs.map +3 -3
  99. package/dist/modules/backend/design/client/search-filter.d.mts +2 -2
  100. package/dist/modules/backend/design/client/search-filter.d.mts.map +1 -1
  101. package/dist/modules/backend/design/client/search-filter.mjs +1 -1
  102. package/dist/modules/backend/design/client/search-filter.mjs.map +3 -3
  103. package/dist/modules/backend/design/content.css +5 -5
  104. package/dist/modules/backend/design/controls.css +10 -36
  105. package/dist/modules/backend/design/forms.css +33 -188
  106. package/dist/modules/backend/design/lists.css +1 -50
  107. package/dist/modules/backend/index.d.ts +1 -0
  108. package/dist/modules/backend/index.d.ts.map +1 -1
  109. package/dist/modules/backend/index.js +1 -0
  110. package/dist/modules/backend/index.js.map +1 -1
  111. package/dist/modules/backend/optional-read.d.ts +4 -0
  112. package/dist/modules/backend/optional-read.d.ts.map +1 -0
  113. package/dist/modules/backend/optional-read.js +7 -0
  114. package/dist/modules/backend/optional-read.js.map +1 -0
  115. package/dist/modules/company_backend/index.d.ts.map +1 -1
  116. package/dist/modules/company_backend/index.js +0 -2
  117. package/dist/modules/company_backend/index.js.map +1 -1
  118. package/dist/modules/company_backend/screens/branch-form.d.ts.map +1 -1
  119. package/dist/modules/company_backend/screens/branch-form.js +3 -1
  120. package/dist/modules/company_backend/screens/branch-form.js.map +1 -1
  121. package/dist/modules/company_backend/screens/companies-list.d.ts.map +1 -1
  122. package/dist/modules/company_backend/screens/companies-list.js +1 -1
  123. package/dist/modules/company_backend/screens/companies-list.js.map +1 -1
  124. package/dist/modules/company_backend/screens/company-form.d.ts.map +1 -1
  125. package/dist/modules/company_backend/screens/company-form.js +1 -3
  126. package/dist/modules/company_backend/screens/company-form.js.map +1 -1
  127. package/dist/modules/company_backend/screens/context.d.ts.map +1 -1
  128. package/dist/modules/company_backend/screens/context.js +1 -1
  129. package/dist/modules/company_backend/screens/context.js.map +1 -1
  130. package/dist/modules/company_backend/screens/hierarchy.d.ts.map +1 -1
  131. package/dist/modules/company_backend/screens/hierarchy.js +1 -1
  132. package/dist/modules/company_backend/screens/hierarchy.js.map +1 -1
  133. package/dist/modules/crm_backend/client/crm-case-modal.d.mts +8 -8
  134. package/dist/modules/crm_backend/client/crm-case-modal.d.mts.map +1 -1
  135. package/dist/modules/crm_backend/client/crm-case-modal.mjs +1 -1
  136. package/dist/modules/crm_backend/client/crm-case-modal.mjs.map +3 -3
  137. package/dist/modules/crm_backend/client/crm-configuration-modal.d.mts +55 -55
  138. package/dist/modules/crm_backend/client/crm-configuration-modal.d.mts.map +1 -1
  139. package/dist/modules/crm_backend/client/crm-configuration-modal.mjs +1 -1
  140. package/dist/modules/crm_backend/client/crm-configuration-modal.mjs.map +3 -3
  141. package/dist/modules/crm_backend/messages.d.ts +0 -10
  142. package/dist/modules/crm_backend/messages.d.ts.map +1 -1
  143. package/dist/modules/crm_backend/messages.js +0 -10
  144. package/dist/modules/crm_backend/messages.js.map +1 -1
  145. package/dist/modules/crm_backend/screens/activity-planner.d.ts.map +1 -1
  146. package/dist/modules/crm_backend/screens/activity-planner.js +1 -1
  147. package/dist/modules/crm_backend/screens/activity-planner.js.map +1 -1
  148. package/dist/modules/crm_backend/screens/case-create.d.ts.map +1 -1
  149. package/dist/modules/crm_backend/screens/case-create.js +1 -1
  150. package/dist/modules/crm_backend/screens/case-create.js.map +1 -1
  151. package/dist/modules/crm_backend/screens/case-detail.d.ts.map +1 -1
  152. package/dist/modules/crm_backend/screens/case-detail.js +2 -2
  153. package/dist/modules/crm_backend/screens/case-detail.js.map +1 -1
  154. package/dist/modules/crm_backend/screens/cases-list.d.ts.map +1 -1
  155. package/dist/modules/crm_backend/screens/cases-list.js +1 -1
  156. package/dist/modules/crm_backend/screens/cases-list.js.map +1 -1
  157. package/dist/modules/crm_backend/screens/configuration.d.ts.map +1 -1
  158. package/dist/modules/crm_backend/screens/configuration.js +1 -1
  159. package/dist/modules/crm_backend/screens/configuration.js.map +1 -1
  160. package/dist/modules/crm_backend/screens/leaderboard.d.ts.map +1 -1
  161. package/dist/modules/crm_backend/screens/leaderboard.js +1 -1
  162. package/dist/modules/crm_backend/screens/leaderboard.js.map +1 -1
  163. package/dist/modules/crm_backend/screens/pipeline.d.ts.map +1 -1
  164. package/dist/modules/crm_backend/screens/pipeline.js +1 -1
  165. package/dist/modules/crm_backend/screens/pipeline.js.map +1 -1
  166. package/dist/modules/flow/domain/command-check.d.ts +3 -0
  167. package/dist/modules/flow/domain/command-check.d.ts.map +1 -0
  168. package/dist/modules/flow/domain/command-check.js +9 -0
  169. package/dist/modules/flow/domain/command-check.js.map +1 -0
  170. package/dist/modules/flow/domain/command.d.ts +33 -0
  171. package/dist/modules/flow/domain/command.d.ts.map +1 -0
  172. package/dist/modules/flow/domain/command.js +35 -0
  173. package/dist/modules/flow/domain/command.js.map +1 -0
  174. package/dist/modules/flow/domain/issue-bulk.d.ts +50 -0
  175. package/dist/modules/flow/domain/issue-bulk.d.ts.map +1 -0
  176. package/dist/modules/flow/domain/issue-bulk.js +97 -0
  177. package/dist/modules/flow/domain/issue-bulk.js.map +1 -0
  178. package/dist/modules/flow/domain/issue-dependency.d.ts +19 -0
  179. package/dist/modules/flow/domain/issue-dependency.d.ts.map +1 -0
  180. package/dist/modules/flow/domain/issue-dependency.js +59 -0
  181. package/dist/modules/flow/domain/issue-dependency.js.map +1 -0
  182. package/dist/modules/flow/domain/issue-discussion.d.ts +52 -0
  183. package/dist/modules/flow/domain/issue-discussion.d.ts.map +1 -0
  184. package/dist/modules/flow/domain/issue-discussion.js +114 -0
  185. package/dist/modules/flow/domain/issue-discussion.js.map +1 -0
  186. package/dist/modules/flow/domain/issue-transfer.d.ts +62 -0
  187. package/dist/modules/flow/domain/issue-transfer.d.ts.map +1 -0
  188. package/dist/modules/flow/domain/issue-transfer.js +171 -0
  189. package/dist/modules/flow/domain/issue-transfer.js.map +1 -0
  190. package/dist/modules/flow/domain/issue-validation.d.ts +68 -0
  191. package/dist/modules/flow/domain/issue-validation.d.ts.map +1 -0
  192. package/dist/modules/flow/domain/issue-validation.js +136 -0
  193. package/dist/modules/flow/domain/issue-validation.js.map +1 -0
  194. package/dist/modules/flow/domain/issue-write.d.ts +118 -0
  195. package/dist/modules/flow/domain/issue-write.d.ts.map +1 -0
  196. package/dist/modules/flow/domain/issue-write.js +372 -0
  197. package/dist/modules/flow/domain/issue-write.js.map +1 -0
  198. package/dist/modules/flow/domain/sprint-lifecycle.d.ts +61 -0
  199. package/dist/modules/flow/domain/sprint-lifecycle.d.ts.map +1 -0
  200. package/dist/modules/flow/domain/sprint-lifecycle.js +145 -0
  201. package/dist/modules/flow/domain/sprint-lifecycle.js.map +1 -0
  202. package/dist/modules/flow/functions/board.d.ts +7 -0
  203. package/dist/modules/flow/functions/board.d.ts.map +1 -0
  204. package/dist/modules/flow/functions/board.js +59 -0
  205. package/dist/modules/flow/functions/board.js.map +1 -0
  206. package/dist/modules/flow/functions/column.d.ts +8 -0
  207. package/dist/modules/flow/functions/column.d.ts.map +1 -0
  208. package/dist/modules/flow/functions/column.js +64 -0
  209. package/dist/modules/flow/functions/column.js.map +1 -0
  210. package/dist/modules/flow/functions/effects.d.ts +21 -0
  211. package/dist/modules/flow/functions/effects.d.ts.map +1 -0
  212. package/dist/modules/flow/functions/effects.js +96 -0
  213. package/dist/modules/flow/functions/effects.js.map +1 -0
  214. package/dist/modules/flow/functions/entity-save.d.ts +4 -0
  215. package/dist/modules/flow/functions/entity-save.d.ts.map +1 -0
  216. package/dist/modules/flow/functions/entity-save.js +60 -0
  217. package/dist/modules/flow/functions/entity-save.js.map +1 -0
  218. package/dist/modules/flow/functions/epic.d.ts +26 -0
  219. package/dist/modules/flow/functions/epic.d.ts.map +1 -0
  220. package/dist/modules/flow/functions/epic.js +151 -0
  221. package/dist/modules/flow/functions/epic.js.map +1 -0
  222. package/dist/modules/flow/functions/field.d.ts +9 -0
  223. package/dist/modules/flow/functions/field.d.ts.map +1 -0
  224. package/dist/modules/flow/functions/field.js +117 -0
  225. package/dist/modules/flow/functions/field.js.map +1 -0
  226. package/dist/modules/flow/functions/index.d.ts +5 -0
  227. package/dist/modules/flow/functions/index.d.ts.map +1 -0
  228. package/dist/modules/flow/functions/index.js +42 -0
  229. package/dist/modules/flow/functions/index.js.map +1 -0
  230. package/dist/modules/flow/functions/issue-batch.d.ts +6 -0
  231. package/dist/modules/flow/functions/issue-batch.d.ts.map +1 -0
  232. package/dist/modules/flow/functions/issue-batch.js +149 -0
  233. package/dist/modules/flow/functions/issue-batch.js.map +1 -0
  234. package/dist/modules/flow/functions/issue-dependency.d.ts +8 -0
  235. package/dist/modules/flow/functions/issue-dependency.d.ts.map +1 -0
  236. package/dist/modules/flow/functions/issue-dependency.js +54 -0
  237. package/dist/modules/flow/functions/issue-dependency.js.map +1 -0
  238. package/dist/modules/flow/functions/issue-discussion.d.ts +6 -0
  239. package/dist/modules/flow/functions/issue-discussion.d.ts.map +1 -0
  240. package/dist/modules/flow/functions/issue-discussion.js +86 -0
  241. package/dist/modules/flow/functions/issue-discussion.js.map +1 -0
  242. package/dist/modules/flow/functions/issue-read.d.ts +18 -0
  243. package/dist/modules/flow/functions/issue-read.d.ts.map +1 -0
  244. package/dist/modules/flow/functions/issue-read.js +159 -0
  245. package/dist/modules/flow/functions/issue-read.js.map +1 -0
  246. package/dist/modules/flow/functions/issue-write.d.ts +9 -0
  247. package/dist/modules/flow/functions/issue-write.d.ts.map +1 -0
  248. package/dist/modules/flow/functions/issue-write.js +149 -0
  249. package/dist/modules/flow/functions/issue-write.js.map +1 -0
  250. package/dist/modules/flow/functions/issueType.d.ts +8 -0
  251. package/dist/modules/flow/functions/issueType.d.ts.map +1 -0
  252. package/dist/modules/flow/functions/issueType.js +66 -0
  253. package/dist/modules/flow/functions/issueType.js.map +1 -0
  254. package/dist/modules/flow/functions/page.d.ts +22 -0
  255. package/dist/modules/flow/functions/page.d.ts.map +1 -0
  256. package/dist/modules/flow/functions/page.js +202 -0
  257. package/dist/modules/flow/functions/page.js.map +1 -0
  258. package/dist/modules/flow/functions/project.d.ts +26 -0
  259. package/dist/modules/flow/functions/project.d.ts.map +1 -0
  260. package/dist/modules/flow/functions/project.js +381 -0
  261. package/dist/modules/flow/functions/project.js.map +1 -0
  262. package/dist/modules/flow/functions/sprint.d.ts +17 -0
  263. package/dist/modules/flow/functions/sprint.d.ts.map +1 -0
  264. package/dist/modules/flow/functions/sprint.js +173 -0
  265. package/dist/modules/flow/functions/sprint.js.map +1 -0
  266. package/dist/modules/flow/functions/tag.d.ts +14 -0
  267. package/dist/modules/flow/functions/tag.d.ts.map +1 -0
  268. package/dist/modules/flow/functions/tag.js +88 -0
  269. package/dist/modules/flow/functions/tag.js.map +1 -0
  270. package/dist/modules/flow/index.d.ts +8 -2
  271. package/dist/modules/flow/index.d.ts.map +1 -1
  272. package/dist/modules/flow/index.js +7 -2
  273. package/dist/modules/flow/index.js.map +1 -1
  274. package/dist/modules/flow/pages.d.ts +1 -1
  275. package/dist/modules/flow/pages.d.ts.map +1 -1
  276. package/dist/modules/flow/pages.js +1 -1
  277. package/dist/modules/flow/pages.js.map +1 -1
  278. package/dist/modules/flow/queries/calendar.d.ts +21 -0
  279. package/dist/modules/flow/queries/calendar.d.ts.map +1 -0
  280. package/dist/modules/flow/queries/calendar.js +31 -0
  281. package/dist/modules/flow/queries/calendar.js.map +1 -0
  282. package/dist/modules/flow/queries/issue-dependencies.d.ts +17 -0
  283. package/dist/modules/flow/queries/issue-dependencies.d.ts.map +1 -0
  284. package/dist/modules/flow/queries/issue-dependencies.js +46 -0
  285. package/dist/modules/flow/queries/issue-dependencies.js.map +1 -0
  286. package/dist/modules/flow/queries/issue-followers.d.ts +6 -0
  287. package/dist/modules/flow/queries/issue-followers.d.ts.map +1 -0
  288. package/dist/modules/flow/queries/issue-followers.js +18 -0
  289. package/dist/modules/flow/queries/issue-followers.js.map +1 -0
  290. package/dist/modules/flow/queries/issue-list.d.ts +153 -0
  291. package/dist/modules/flow/queries/issue-list.d.ts.map +1 -0
  292. package/dist/modules/flow/queries/issue-list.js +439 -0
  293. package/dist/modules/flow/queries/issue-list.js.map +1 -0
  294. package/dist/modules/flow/queries/options.d.ts +4 -0
  295. package/dist/modules/flow/queries/options.d.ts.map +1 -0
  296. package/dist/modules/flow/queries/options.js +13 -0
  297. package/dist/modules/flow/queries/options.js.map +1 -0
  298. package/dist/modules/flow/queries/progress.d.ts +24 -0
  299. package/dist/modules/flow/queries/progress.d.ts.map +1 -0
  300. package/dist/modules/flow/queries/progress.js +54 -0
  301. package/dist/modules/flow/queries/progress.js.map +1 -0
  302. package/dist/modules/flow/queries/project-list.d.ts +4 -0
  303. package/dist/modules/flow/queries/project-list.d.ts.map +1 -0
  304. package/dist/modules/flow/queries/project-list.js +19 -0
  305. package/dist/modules/flow/queries/project-list.js.map +1 -0
  306. package/dist/modules/flow_backend/messages.d.ts +1 -2
  307. package/dist/modules/flow_backend/messages.d.ts.map +1 -1
  308. package/dist/modules/flow_backend/messages.js +0 -2
  309. package/dist/modules/flow_backend/messages.js.map +1 -1
  310. package/dist/modules/flow_backend/routes.js +1 -1
  311. package/dist/modules/flow_backend/routes.js.map +1 -1
  312. package/dist/modules/flow_backend/screens/all-epics.d.ts.map +1 -1
  313. package/dist/modules/flow_backend/screens/all-epics.js +1 -1
  314. package/dist/modules/flow_backend/screens/all-epics.js.map +1 -1
  315. package/dist/modules/flow_backend/screens/all-pages.d.ts.map +1 -1
  316. package/dist/modules/flow_backend/screens/all-pages.js +1 -1
  317. package/dist/modules/flow_backend/screens/all-pages.js.map +1 -1
  318. package/dist/modules/flow_backend/screens/epic-detail.js +1 -1
  319. package/dist/modules/flow_backend/screens/epic-detail.js.map +1 -1
  320. package/dist/modules/flow_backend/screens/gantt.d.ts.map +1 -1
  321. package/dist/modules/flow_backend/screens/gantt.js +1 -1
  322. package/dist/modules/flow_backend/screens/gantt.js.map +1 -1
  323. package/dist/modules/flow_backend/screens/issue-detail.js +2 -1
  324. package/dist/modules/flow_backend/screens/issue-detail.js.map +1 -1
  325. package/dist/modules/flow_backend/screens/issues.d.ts.map +1 -1
  326. package/dist/modules/flow_backend/screens/issues.js +1 -1
  327. package/dist/modules/flow_backend/screens/issues.js.map +1 -1
  328. package/dist/modules/flow_backend/screens/map.js +1 -1
  329. package/dist/modules/flow_backend/screens/map.js.map +1 -1
  330. package/dist/modules/flow_backend/screens/my-work.d.ts.map +1 -1
  331. package/dist/modules/flow_backend/screens/my-work.js +1 -1
  332. package/dist/modules/flow_backend/screens/my-work.js.map +1 -1
  333. package/dist/modules/flow_backend/screens/page-detail.js +1 -1
  334. package/dist/modules/flow_backend/screens/page-detail.js.map +1 -1
  335. package/dist/modules/flow_backend/screens/project-create.d.ts.map +1 -1
  336. package/dist/modules/flow_backend/screens/project-create.js +1 -1
  337. package/dist/modules/flow_backend/screens/project-create.js.map +1 -1
  338. package/dist/modules/flow_backend/screens/project-pages.d.ts.map +1 -1
  339. package/dist/modules/flow_backend/screens/project-pages.js +1 -1
  340. package/dist/modules/flow_backend/screens/project-pages.js.map +1 -1
  341. package/dist/modules/flow_backend/screens/projects-list.d.ts.map +1 -1
  342. package/dist/modules/flow_backend/screens/projects-list.js +1 -1
  343. package/dist/modules/flow_backend/screens/projects-list.js.map +1 -1
  344. package/dist/modules/flow_backend/screens/sprints.d.ts.map +1 -1
  345. package/dist/modules/flow_backend/screens/sprints.js +1 -1
  346. package/dist/modules/flow_backend/screens/sprints.js.map +1 -1
  347. package/dist/modules/flow_staff_channel/channel-routes.js +1 -1
  348. package/dist/modules/flow_staff_channel/channel-routes.js.map +1 -1
  349. package/dist/modules/hospitality_billing/messages.d.ts.map +1 -1
  350. package/dist/modules/hospitality_billing/messages.js +0 -2
  351. package/dist/modules/hospitality_billing/messages.js.map +1 -1
  352. package/dist/modules/hospitality_billing/screens/billing.d.ts.map +1 -1
  353. package/dist/modules/hospitality_billing/screens/billing.js +1 -1
  354. package/dist/modules/hospitality_billing/screens/billing.js.map +1 -1
  355. package/dist/modules/hospitality_billing/screens/page-frame.d.ts +1 -2
  356. package/dist/modules/hospitality_billing/screens/page-frame.d.ts.map +1 -1
  357. package/dist/modules/hospitality_billing/screens/page-frame.js +1 -1
  358. package/dist/modules/hospitality_billing/screens/page-frame.js.map +1 -1
  359. package/dist/modules/hospitality_core/messages.js +2 -2
  360. package/dist/modules/hospitality_core/messages.js.map +1 -1
  361. package/dist/modules/hospitality_core/screens/check-out-prep.d.ts.map +1 -1
  362. package/dist/modules/hospitality_core/screens/check-out-prep.js +1 -1
  363. package/dist/modules/hospitality_core/screens/check-out-prep.js.map +1 -1
  364. package/dist/modules/hospitality_core/screens/front-desk.d.ts.map +1 -1
  365. package/dist/modules/hospitality_core/screens/front-desk.js +40 -40
  366. package/dist/modules/hospitality_core/screens/front-desk.js.map +1 -1
  367. package/dist/modules/hospitality_core/screens/page-frame.d.ts +2 -3
  368. package/dist/modules/hospitality_core/screens/page-frame.d.ts.map +1 -1
  369. package/dist/modules/hospitality_core/screens/page-frame.js +3 -3
  370. package/dist/modules/hospitality_core/screens/page-frame.js.map +1 -1
  371. package/dist/modules/hospitality_core/screens/tape-chart.d.ts.map +1 -1
  372. package/dist/modules/hospitality_core/screens/tape-chart.js +3 -12
  373. package/dist/modules/hospitality_core/screens/tape-chart.js.map +1 -1
  374. package/dist/modules/hr_backend/screens/employee-form.d.ts.map +1 -1
  375. package/dist/modules/hr_backend/screens/employee-form.js +1 -1
  376. package/dist/modules/hr_backend/screens/employee-form.js.map +1 -1
  377. package/dist/modules/hr_backend/screens/leaves-list.d.ts.map +1 -1
  378. package/dist/modules/hr_backend/screens/leaves-list.js +1 -1
  379. package/dist/modules/hr_backend/screens/leaves-list.js.map +1 -1
  380. package/dist/modules/livedoc/islands.d.ts +9 -0
  381. package/dist/modules/livedoc/islands.d.ts.map +1 -1
  382. package/dist/modules/loyalty_backend/messages.d.ts +0 -10
  383. package/dist/modules/loyalty_backend/messages.d.ts.map +1 -1
  384. package/dist/modules/loyalty_backend/messages.js +0 -10
  385. package/dist/modules/loyalty_backend/messages.js.map +1 -1
  386. package/dist/modules/loyalty_backend/screens/index.d.ts.map +1 -1
  387. package/dist/modules/loyalty_backend/screens/index.js +5 -5
  388. package/dist/modules/loyalty_backend/screens/index.js.map +1 -1
  389. package/dist/modules/loyalty_backend/screens/page-frame.d.ts +2 -3
  390. package/dist/modules/loyalty_backend/screens/page-frame.d.ts.map +1 -1
  391. package/dist/modules/loyalty_backend/screens/page-frame.js +2 -2
  392. package/dist/modules/loyalty_backend/screens/page-frame.js.map +1 -1
  393. package/dist/modules/mail_backend/index.d.ts.map +1 -1
  394. package/dist/modules/mail_backend/index.js +0 -2
  395. package/dist/modules/mail_backend/index.js.map +1 -1
  396. package/dist/modules/mail_backend/screens/inbox-list.d.ts.map +1 -1
  397. package/dist/modules/mail_backend/screens/inbox-list.js +1 -1
  398. package/dist/modules/mail_backend/screens/inbox-list.js.map +1 -1
  399. package/dist/modules/mail_inbound_backend/index.d.ts.map +1 -1
  400. package/dist/modules/mail_inbound_backend/index.js +0 -2
  401. package/dist/modules/mail_inbound_backend/index.js.map +1 -1
  402. package/dist/modules/mail_inbound_backend/screens/inbound-list.d.ts.map +1 -1
  403. package/dist/modules/mail_inbound_backend/screens/inbound-list.js +1 -1
  404. package/dist/modules/mail_inbound_backend/screens/inbound-list.js.map +1 -1
  405. package/dist/modules/mail_transport_backend/index.d.ts.map +1 -1
  406. package/dist/modules/mail_transport_backend/index.js +0 -2
  407. package/dist/modules/mail_transport_backend/index.js.map +1 -1
  408. package/dist/modules/mail_transport_backend/screens/outbox-list.d.ts.map +1 -1
  409. package/dist/modules/mail_transport_backend/screens/outbox-list.js +1 -1
  410. package/dist/modules/mail_transport_backend/screens/outbox-list.js.map +1 -1
  411. package/dist/modules/manufacturing_backend/screens/order-execution.d.ts.map +1 -1
  412. package/dist/modules/manufacturing_backend/screens/order-execution.js +1 -1
  413. package/dist/modules/manufacturing_backend/screens/order-execution.js.map +1 -1
  414. package/dist/modules/oauth_backend/messages.d.ts +0 -4
  415. package/dist/modules/oauth_backend/messages.d.ts.map +1 -1
  416. package/dist/modules/oauth_backend/messages.js +0 -4
  417. package/dist/modules/oauth_backend/messages.js.map +1 -1
  418. package/dist/modules/oauth_backend/screens/index.d.ts.map +1 -1
  419. package/dist/modules/oauth_backend/screens/index.js +5 -5
  420. package/dist/modules/oauth_backend/screens/index.js.map +1 -1
  421. package/dist/modules/partner_backend/screens/form.d.ts.map +1 -1
  422. package/dist/modules/partner_backend/screens/form.js +3 -1
  423. package/dist/modules/partner_backend/screens/form.js.map +1 -1
  424. package/dist/modules/partner_backend/screens/list.d.ts.map +1 -1
  425. package/dist/modules/partner_backend/screens/list.js +1 -1
  426. package/dist/modules/partner_backend/screens/list.js.map +1 -1
  427. package/dist/modules/partner_backend/screens/new.d.ts.map +1 -1
  428. package/dist/modules/partner_backend/screens/new.js +1 -1
  429. package/dist/modules/partner_backend/screens/new.js.map +1 -1
  430. package/dist/modules/pricing_backend/index.js +0 -2
  431. package/dist/modules/pricing_backend/index.js.map +1 -1
  432. package/dist/modules/pricing_backend/screens/pricelist-detail.d.ts.map +1 -1
  433. package/dist/modules/pricing_backend/screens/pricelist-detail.js +1 -1
  434. package/dist/modules/pricing_backend/screens/pricelist-detail.js.map +1 -1
  435. package/dist/modules/pricing_backend/screens/pricelists-list.d.ts.map +1 -1
  436. package/dist/modules/pricing_backend/screens/pricelists-list.js +1 -1
  437. package/dist/modules/pricing_backend/screens/pricelists-list.js.map +1 -1
  438. package/dist/modules/product_backend/client/attribute-modal.d.mts +5 -5
  439. package/dist/modules/product_backend/client/attribute-modal.d.mts.map +1 -1
  440. package/dist/modules/product_backend/client/attribute-modal.mjs +1 -1
  441. package/dist/modules/product_backend/client/attribute-modal.mjs.map +3 -3
  442. package/dist/modules/product_backend/client/product-modal.d.mts +8 -8
  443. package/dist/modules/product_backend/client/product-modal.d.mts.map +1 -1
  444. package/dist/modules/product_backend/client/product-modal.mjs +1 -1
  445. package/dist/modules/product_backend/client/product-modal.mjs.map +3 -3
  446. package/dist/modules/product_backend/client/variant-editor.d.mts +3 -3
  447. package/dist/modules/product_backend/client/variant-editor.d.mts.map +1 -1
  448. package/dist/modules/product_backend/client/variant-editor.mjs +1 -1
  449. package/dist/modules/product_backend/client/variant-editor.mjs.map +3 -3
  450. package/dist/modules/product_backend/screens/detail.d.ts.map +1 -1
  451. package/dist/modules/product_backend/screens/detail.js +3 -2
  452. package/dist/modules/product_backend/screens/detail.js.map +1 -1
  453. package/dist/modules/product_backend/screens/variant.d.ts.map +1 -1
  454. package/dist/modules/product_backend/screens/variant.js +3 -2
  455. package/dist/modules/product_backend/screens/variant.js.map +1 -1
  456. package/dist/modules/purchase_backend/client/purchase-order-modal.d.mts +185 -0
  457. package/dist/modules/purchase_backend/client/purchase-order-modal.d.mts.map +1 -0
  458. package/dist/modules/purchase_backend/client/purchase-order-modal.mjs +2 -0
  459. package/dist/modules/purchase_backend/client/purchase-order-modal.mjs.map +7 -0
  460. package/dist/modules/purchase_backend/client/vendor-pricelist-modal.d.mts +52 -0
  461. package/dist/modules/purchase_backend/client/vendor-pricelist-modal.d.mts.map +1 -0
  462. package/dist/modules/purchase_backend/client/vendor-pricelist-modal.mjs +2 -0
  463. package/dist/modules/purchase_backend/client/vendor-pricelist-modal.mjs.map +7 -0
  464. package/dist/modules/purchase_backend/index.js +83 -14
  465. package/dist/modules/purchase_backend/index.js.map +1 -1
  466. package/dist/modules/purchase_backend/modal/context.d.ts +4 -0
  467. package/dist/modules/purchase_backend/modal/context.d.ts.map +1 -0
  468. package/dist/modules/purchase_backend/modal/context.js +94 -0
  469. package/dist/modules/purchase_backend/modal/context.js.map +1 -0
  470. package/dist/modules/purchase_backend/modal/order-modal-view.d.ts +18 -0
  471. package/dist/modules/purchase_backend/modal/order-modal-view.d.ts.map +1 -0
  472. package/dist/modules/purchase_backend/modal/order-modal-view.js +290 -0
  473. package/dist/modules/purchase_backend/modal/order-modal-view.js.map +1 -0
  474. package/dist/modules/purchase_backend/modal/pricelist-context.d.ts +3 -0
  475. package/dist/modules/purchase_backend/modal/pricelist-context.d.ts.map +1 -0
  476. package/dist/modules/purchase_backend/modal/pricelist-context.js +36 -0
  477. package/dist/modules/purchase_backend/modal/pricelist-context.js.map +1 -0
  478. package/dist/modules/purchase_backend/modal/pricelist-view.d.ts +12 -0
  479. package/dist/modules/purchase_backend/modal/pricelist-view.d.ts.map +1 -0
  480. package/dist/modules/purchase_backend/modal/pricelist-view.js +78 -0
  481. package/dist/modules/purchase_backend/modal/pricelist-view.js.map +1 -0
  482. package/dist/modules/purchase_backend/screens/order-detail.d.ts.map +1 -1
  483. package/dist/modules/purchase_backend/screens/order-detail.js +4 -2
  484. package/dist/modules/purchase_backend/screens/order-detail.js.map +1 -1
  485. package/dist/modules/purchase_backend/screens/overview.d.ts +5 -0
  486. package/dist/modules/purchase_backend/screens/overview.d.ts.map +1 -1
  487. package/dist/modules/purchase_backend/screens/overview.js +27 -6
  488. package/dist/modules/purchase_backend/screens/overview.js.map +1 -1
  489. package/dist/modules/purchase_backend/screens/rfq-create.d.ts.map +1 -1
  490. package/dist/modules/purchase_backend/screens/rfq-create.js +1 -1
  491. package/dist/modules/purchase_backend/screens/rfq-create.js.map +1 -1
  492. package/dist/modules/purchase_backend/screens/rfqs-list.d.ts +1 -1
  493. package/dist/modules/purchase_backend/screens/rfqs-list.d.ts.map +1 -1
  494. package/dist/modules/purchase_backend/screens/rfqs-list.js +1 -1
  495. package/dist/modules/purchase_backend/screens/rfqs-list.js.map +1 -1
  496. package/dist/modules/purchase_backend/screens/vendor-pricelist-create.d.ts.map +1 -1
  497. package/dist/modules/purchase_backend/screens/vendor-pricelist-create.js +1 -1
  498. package/dist/modules/purchase_backend/screens/vendor-pricelist-create.js.map +1 -1
  499. package/dist/modules/purchase_backend/screens/vendor-pricelists-list.d.ts +2 -1
  500. package/dist/modules/purchase_backend/screens/vendor-pricelists-list.d.ts.map +1 -1
  501. package/dist/modules/purchase_backend/screens/vendor-pricelists-list.js +2 -2
  502. package/dist/modules/purchase_backend/screens/vendor-pricelists-list.js.map +1 -1
  503. package/dist/modules/purchase_backend/search.d.ts +1 -1
  504. package/dist/modules/sale/functions/line-edit.d.ts +4 -0
  505. package/dist/modules/sale/functions/line-edit.d.ts.map +1 -0
  506. package/dist/modules/sale/functions/line-edit.js +120 -0
  507. package/dist/modules/sale/functions/line-edit.js.map +1 -0
  508. package/dist/modules/sale/index.d.ts.map +1 -1
  509. package/dist/modules/sale/index.js +16 -1
  510. package/dist/modules/sale/index.js.map +1 -1
  511. package/dist/modules/sale_backend/client/invoicing-policy-modal.d.mts +53 -0
  512. package/dist/modules/sale_backend/client/invoicing-policy-modal.d.mts.map +1 -0
  513. package/dist/modules/sale_backend/client/invoicing-policy-modal.mjs +2 -0
  514. package/dist/modules/sale_backend/client/invoicing-policy-modal.mjs.map +7 -0
  515. package/dist/modules/sale_backend/client/sale-order-modal.d.mts +161 -0
  516. package/dist/modules/sale_backend/client/sale-order-modal.d.mts.map +1 -0
  517. package/dist/modules/sale_backend/client/sale-order-modal.mjs +2 -0
  518. package/dist/modules/sale_backend/client/sale-order-modal.mjs.map +7 -0
  519. package/dist/modules/sale_backend/index.js +81 -20
  520. package/dist/modules/sale_backend/index.js.map +1 -1
  521. package/dist/modules/sale_backend/modal/context.d.ts +4 -0
  522. package/dist/modules/sale_backend/modal/context.d.ts.map +1 -0
  523. package/dist/modules/sale_backend/modal/context.js +94 -0
  524. package/dist/modules/sale_backend/modal/context.js.map +1 -0
  525. package/dist/modules/sale_backend/modal/order-modal-view.d.ts +18 -0
  526. package/dist/modules/sale_backend/modal/order-modal-view.d.ts.map +1 -0
  527. package/dist/modules/sale_backend/modal/order-modal-view.js +289 -0
  528. package/dist/modules/sale_backend/modal/order-modal-view.js.map +1 -0
  529. package/dist/modules/sale_backend/modal/policy-context.d.ts +3 -0
  530. package/dist/modules/sale_backend/modal/policy-context.d.ts.map +1 -0
  531. package/dist/modules/sale_backend/modal/policy-context.js +26 -0
  532. package/dist/modules/sale_backend/modal/policy-context.js.map +1 -0
  533. package/dist/modules/sale_backend/modal/policy-view.d.ts +11 -0
  534. package/dist/modules/sale_backend/modal/policy-view.d.ts.map +1 -0
  535. package/dist/modules/sale_backend/modal/policy-view.js +70 -0
  536. package/dist/modules/sale_backend/modal/policy-view.js.map +1 -0
  537. package/dist/modules/sale_backend/screens/invoicing-policies-list.d.ts +1 -1
  538. package/dist/modules/sale_backend/screens/invoicing-policies-list.d.ts.map +1 -1
  539. package/dist/modules/sale_backend/screens/invoicing-policies-list.js +1 -1
  540. package/dist/modules/sale_backend/screens/invoicing-policies-list.js.map +1 -1
  541. package/dist/modules/sale_backend/screens/invoicing-policy-create.d.ts.map +1 -1
  542. package/dist/modules/sale_backend/screens/invoicing-policy-create.js +1 -1
  543. package/dist/modules/sale_backend/screens/invoicing-policy-create.js.map +1 -1
  544. package/dist/modules/sale_backend/screens/order-detail.d.ts.map +1 -1
  545. package/dist/modules/sale_backend/screens/order-detail.js +3 -1
  546. package/dist/modules/sale_backend/screens/order-detail.js.map +1 -1
  547. package/dist/modules/sale_backend/screens/overview.d.ts +3 -0
  548. package/dist/modules/sale_backend/screens/overview.d.ts.map +1 -1
  549. package/dist/modules/sale_backend/screens/overview.js +22 -14
  550. package/dist/modules/sale_backend/screens/overview.js.map +1 -1
  551. package/dist/modules/sale_backend/screens/quotation-create.d.ts.map +1 -1
  552. package/dist/modules/sale_backend/screens/quotation-create.js +1 -1
  553. package/dist/modules/sale_backend/screens/quotation-create.js.map +1 -1
  554. package/dist/modules/sale_backend/screens/quotations-list.d.ts +1 -1
  555. package/dist/modules/sale_backend/screens/quotations-list.d.ts.map +1 -1
  556. package/dist/modules/sale_backend/screens/quotations-list.js +1 -1
  557. package/dist/modules/sale_backend/screens/quotations-list.js.map +1 -1
  558. package/dist/modules/sale_backend/screens/sales-orders-list.d.ts.map +1 -1
  559. package/dist/modules/sale_backend/screens/sales-orders-list.js +1 -1
  560. package/dist/modules/sale_backend/screens/sales-orders-list.js.map +1 -1
  561. package/dist/modules/stock/functions/inventory-preview.d.ts +4 -0
  562. package/dist/modules/stock/functions/inventory-preview.d.ts.map +1 -0
  563. package/dist/modules/stock/functions/inventory-preview.js +68 -0
  564. package/dist/modules/stock/functions/inventory-preview.js.map +1 -0
  565. package/dist/modules/stock/index.d.ts.map +1 -1
  566. package/dist/modules/stock/index.js +14 -1
  567. package/dist/modules/stock/index.js.map +1 -1
  568. package/dist/modules/stock_backend/client/inventory-count-modal.d.mts +60 -0
  569. package/dist/modules/stock_backend/client/inventory-count-modal.d.mts.map +1 -0
  570. package/dist/modules/stock_backend/client/inventory-count-modal.mjs +2 -0
  571. package/dist/modules/stock_backend/client/inventory-count-modal.mjs.map +7 -0
  572. package/dist/modules/stock_backend/client/stock-configuration-modal.d.mts +105 -0
  573. package/dist/modules/stock_backend/client/stock-configuration-modal.d.mts.map +1 -0
  574. package/dist/modules/stock_backend/client/stock-configuration-modal.mjs +2 -0
  575. package/dist/modules/stock_backend/client/stock-configuration-modal.mjs.map +7 -0
  576. package/dist/modules/stock_backend/client/stock-transfer-modal.d.mts +130 -0
  577. package/dist/modules/stock_backend/client/stock-transfer-modal.d.mts.map +1 -0
  578. package/dist/modules/stock_backend/client/stock-transfer-modal.mjs +2 -0
  579. package/dist/modules/stock_backend/client/stock-transfer-modal.mjs.map +7 -0
  580. package/dist/modules/stock_backend/functions/index.d.ts +10 -0
  581. package/dist/modules/stock_backend/functions/index.d.ts.map +1 -0
  582. package/dist/modules/stock_backend/functions/index.js +20 -0
  583. package/dist/modules/stock_backend/functions/index.js.map +1 -0
  584. package/dist/modules/stock_backend/functions.d.ts +1 -9
  585. package/dist/modules/stock_backend/functions.d.ts.map +1 -1
  586. package/dist/modules/stock_backend/functions.js +1 -18
  587. package/dist/modules/stock_backend/functions.js.map +1 -1
  588. package/dist/modules/stock_backend/index.js +52 -0
  589. package/dist/modules/stock_backend/index.js.map +1 -1
  590. package/dist/modules/stock_backend/islands.d.ts +8 -0
  591. package/dist/modules/stock_backend/islands.d.ts.map +1 -1
  592. package/dist/modules/stock_backend/islands.js +41 -0
  593. package/dist/modules/stock_backend/islands.js.map +1 -1
  594. package/dist/modules/stock_backend/modal/configuration-context.d.ts +3 -0
  595. package/dist/modules/stock_backend/modal/configuration-context.d.ts.map +1 -0
  596. package/dist/modules/stock_backend/modal/configuration-context.js +65 -0
  597. package/dist/modules/stock_backend/modal/configuration-context.js.map +1 -0
  598. package/dist/modules/stock_backend/modal/configuration-view.d.ts +21 -0
  599. package/dist/modules/stock_backend/modal/configuration-view.d.ts.map +1 -0
  600. package/dist/modules/stock_backend/modal/configuration-view.js +201 -0
  601. package/dist/modules/stock_backend/modal/configuration-view.js.map +1 -0
  602. package/dist/modules/stock_backend/modal/configuration.d.ts +20 -0
  603. package/dist/modules/stock_backend/modal/configuration.d.ts.map +1 -0
  604. package/dist/modules/stock_backend/modal/configuration.js +117 -0
  605. package/dist/modules/stock_backend/modal/configuration.js.map +1 -0
  606. package/dist/modules/stock_backend/modal/inventory-context.d.ts +3 -0
  607. package/dist/modules/stock_backend/modal/inventory-context.d.ts.map +1 -0
  608. package/dist/modules/stock_backend/modal/inventory-context.js +37 -0
  609. package/dist/modules/stock_backend/modal/inventory-context.js.map +1 -0
  610. package/dist/modules/stock_backend/modal/inventory-view.d.ts +14 -0
  611. package/dist/modules/stock_backend/modal/inventory-view.d.ts.map +1 -0
  612. package/dist/modules/stock_backend/modal/inventory-view.js +142 -0
  613. package/dist/modules/stock_backend/modal/inventory-view.js.map +1 -0
  614. package/dist/modules/stock_backend/modal/transfer-context.d.ts +3 -0
  615. package/dist/modules/stock_backend/modal/transfer-context.d.ts.map +1 -0
  616. package/dist/modules/stock_backend/modal/transfer-context.js +54 -0
  617. package/dist/modules/stock_backend/modal/transfer-context.js.map +1 -0
  618. package/dist/modules/stock_backend/modal/transfer-view.d.ts +15 -0
  619. package/dist/modules/stock_backend/modal/transfer-view.d.ts.map +1 -0
  620. package/dist/modules/stock_backend/modal/transfer-view.js +252 -0
  621. package/dist/modules/stock_backend/modal/transfer-view.js.map +1 -0
  622. package/dist/modules/stock_backend/routes.d.ts.map +1 -1
  623. package/dist/modules/stock_backend/routes.js +117 -34
  624. package/dist/modules/stock_backend/routes.js.map +1 -1
  625. package/dist/modules/stock_backend/screens/forecast.d.ts.map +1 -1
  626. package/dist/modules/stock_backend/screens/forecast.js +5 -32
  627. package/dist/modules/stock_backend/screens/forecast.js.map +1 -1
  628. package/dist/modules/stock_backend/screens/inventory.d.ts +3 -1
  629. package/dist/modules/stock_backend/screens/inventory.d.ts.map +1 -1
  630. package/dist/modules/stock_backend/screens/inventory.js +27 -74
  631. package/dist/modules/stock_backend/screens/inventory.js.map +1 -1
  632. package/dist/modules/stock_backend/screens/location-create.d.ts.map +1 -1
  633. package/dist/modules/stock_backend/screens/location-create.js +1 -1
  634. package/dist/modules/stock_backend/screens/location-create.js.map +1 -1
  635. package/dist/modules/stock_backend/screens/locations-list.d.ts +1 -1
  636. package/dist/modules/stock_backend/screens/locations-list.d.ts.map +1 -1
  637. package/dist/modules/stock_backend/screens/locations-list.js +1 -1
  638. package/dist/modules/stock_backend/screens/locations-list.js.map +1 -1
  639. package/dist/modules/stock_backend/screens/lot-create.d.ts.map +1 -1
  640. package/dist/modules/stock_backend/screens/lot-create.js +1 -1
  641. package/dist/modules/stock_backend/screens/lot-create.js.map +1 -1
  642. package/dist/modules/stock_backend/screens/lot-detail.d.ts.map +1 -1
  643. package/dist/modules/stock_backend/screens/lot-detail.js +3 -2
  644. package/dist/modules/stock_backend/screens/lot-detail.js.map +1 -1
  645. package/dist/modules/stock_backend/screens/lots-list.d.ts +1 -1
  646. package/dist/modules/stock_backend/screens/lots-list.d.ts.map +1 -1
  647. package/dist/modules/stock_backend/screens/lots-list.js +1 -1
  648. package/dist/modules/stock_backend/screens/lots-list.js.map +1 -1
  649. package/dist/modules/stock_backend/screens/overview.d.ts +9 -0
  650. package/dist/modules/stock_backend/screens/overview.d.ts.map +1 -0
  651. package/dist/modules/stock_backend/screens/overview.js +38 -0
  652. package/dist/modules/stock_backend/screens/overview.js.map +1 -0
  653. package/dist/modules/stock_backend/screens/picking-type-create.d.ts.map +1 -1
  654. package/dist/modules/stock_backend/screens/picking-type-create.js +1 -1
  655. package/dist/modules/stock_backend/screens/picking-type-create.js.map +1 -1
  656. package/dist/modules/stock_backend/screens/picking-types-list.d.ts +1 -1
  657. package/dist/modules/stock_backend/screens/picking-types-list.d.ts.map +1 -1
  658. package/dist/modules/stock_backend/screens/picking-types-list.js +1 -1
  659. package/dist/modules/stock_backend/screens/picking-types-list.js.map +1 -1
  660. package/dist/modules/stock_backend/screens/replenishment-create.d.ts.map +1 -1
  661. package/dist/modules/stock_backend/screens/replenishment-create.js +1 -1
  662. package/dist/modules/stock_backend/screens/replenishment-create.js.map +1 -1
  663. package/dist/modules/stock_backend/screens/replenishment-list.d.ts +2 -2
  664. package/dist/modules/stock_backend/screens/replenishment-list.d.ts.map +1 -1
  665. package/dist/modules/stock_backend/screens/replenishment-list.js +2 -2
  666. package/dist/modules/stock_backend/screens/replenishment-list.js.map +1 -1
  667. package/dist/modules/stock_backend/screens/stock-route-create.d.ts.map +1 -1
  668. package/dist/modules/stock_backend/screens/stock-route-create.js +1 -1
  669. package/dist/modules/stock_backend/screens/stock-route-create.js.map +1 -1
  670. package/dist/modules/stock_backend/screens/stock-route-detail.js +2 -1
  671. package/dist/modules/stock_backend/screens/stock-route-detail.js.map +1 -1
  672. package/dist/modules/stock_backend/screens/stock-routes-list.d.ts +1 -1
  673. package/dist/modules/stock_backend/screens/stock-routes-list.d.ts.map +1 -1
  674. package/dist/modules/stock_backend/screens/stock-routes-list.js +1 -1
  675. package/dist/modules/stock_backend/screens/stock-routes-list.js.map +1 -1
  676. package/dist/modules/stock_backend/screens/transfer-create.d.ts.map +1 -1
  677. package/dist/modules/stock_backend/screens/transfer-create.js +1 -1
  678. package/dist/modules/stock_backend/screens/transfer-create.js.map +1 -1
  679. package/dist/modules/stock_backend/screens/transfer-detail.d.ts.map +1 -1
  680. package/dist/modules/stock_backend/screens/transfer-detail.js +3 -2
  681. package/dist/modules/stock_backend/screens/transfer-detail.js.map +1 -1
  682. package/dist/modules/stock_backend/screens/transfers-list.d.ts +1 -1
  683. package/dist/modules/stock_backend/screens/transfers-list.d.ts.map +1 -1
  684. package/dist/modules/stock_backend/screens/transfers-list.js +1 -1
  685. package/dist/modules/stock_backend/screens/transfers-list.js.map +1 -1
  686. package/dist/modules/stock_backend/screens/warehouse-create.d.ts.map +1 -1
  687. package/dist/modules/stock_backend/screens/warehouse-create.js +1 -1
  688. package/dist/modules/stock_backend/screens/warehouse-create.js.map +1 -1
  689. package/dist/modules/stock_backend/screens/warehouses-list.d.ts +1 -1
  690. package/dist/modules/stock_backend/screens/warehouses-list.d.ts.map +1 -1
  691. package/dist/modules/stock_backend/screens/warehouses-list.js +1 -1
  692. package/dist/modules/stock_backend/screens/warehouses-list.js.map +1 -1
  693. package/dist/modules/stock_backend/search.d.ts +29 -0
  694. package/dist/modules/stock_backend/search.d.ts.map +1 -1
  695. package/dist/modules/stock_backend/search.js +22 -0
  696. package/dist/modules/stock_backend/search.js.map +1 -1
  697. package/dist/modules/user_backend/client/access-policy-modal.d.mts +4 -4
  698. package/dist/modules/user_backend/client/access-policy-modal.d.mts.map +1 -1
  699. package/dist/modules/user_backend/client/access-policy-modal.mjs +1 -1
  700. package/dist/modules/user_backend/client/access-policy-modal.mjs.map +3 -3
  701. package/dist/modules/user_backend/client/role-modal.d.mts +6 -6
  702. package/dist/modules/user_backend/client/role-modal.d.mts.map +1 -1
  703. package/dist/modules/user_backend/client/role-modal.mjs +1 -1
  704. package/dist/modules/user_backend/client/role-modal.mjs.map +3 -3
  705. package/dist/modules/user_backend/client/user-modal.d.mts +9 -9
  706. package/dist/modules/user_backend/client/user-modal.d.mts.map +1 -1
  707. package/dist/modules/user_backend/client/user-modal.mjs +1 -1
  708. package/dist/modules/user_backend/client/user-modal.mjs.map +3 -3
  709. package/dist/modules/user_backend/messages.d.ts +0 -6
  710. package/dist/modules/user_backend/messages.d.ts.map +1 -1
  711. package/dist/modules/user_backend/messages.js +0 -6
  712. package/dist/modules/user_backend/messages.js.map +1 -1
  713. package/dist/modules/user_backend/screens/access-policies-list.d.ts.map +1 -1
  714. package/dist/modules/user_backend/screens/access-policies-list.js +1 -1
  715. package/dist/modules/user_backend/screens/access-policies-list.js.map +1 -1
  716. package/dist/modules/user_backend/screens/profile-form.d.ts.map +1 -1
  717. package/dist/modules/user_backend/screens/profile-form.js +1 -1
  718. package/dist/modules/user_backend/screens/profile-form.js.map +1 -1
  719. package/dist/modules/user_backend/screens/roles-list.d.ts.map +1 -1
  720. package/dist/modules/user_backend/screens/roles-list.js +1 -1
  721. package/dist/modules/user_backend/screens/roles-list.js.map +1 -1
  722. package/dist/modules/user_backend/screens/users-list.d.ts.map +1 -1
  723. package/dist/modules/user_backend/screens/users-list.js +1 -1
  724. package/dist/modules/user_backend/screens/users-list.js.map +1 -1
  725. package/dist/modules/website_backend/screens/page-frame.d.ts +2 -3
  726. package/dist/modules/website_backend/screens/page-frame.d.ts.map +1 -1
  727. package/dist/modules/website_backend/screens/page-frame.js +2 -2
  728. package/dist/modules/website_backend/screens/page-frame.js.map +1 -1
  729. package/dist/permission-catalogue.d.ts.map +1 -1
  730. package/dist/permission-catalogue.js +2 -0
  731. package/dist/permission-catalogue.js.map +1 -1
  732. package/dist/role-templates.d.ts.map +1 -1
  733. package/dist/role-templates.js +23 -3
  734. package/dist/role-templates.js.map +1 -1
  735. package/dist/scaffold/index.js +1 -1
  736. package/dist/ui/client/live-doc-shell.d.ts +27 -1
  737. package/dist/ui/client/live-doc-shell.d.ts.map +1 -1
  738. package/dist/ui/client/live-doc-shell.js +43 -5
  739. package/dist/ui/client/live-doc-shell.js.map +1 -1
  740. package/dist/ui/client/live-doc-tail.d.ts +4 -0
  741. package/dist/ui/client/live-doc-tail.d.ts.map +1 -0
  742. package/dist/ui/client/live-doc-tail.js +21 -0
  743. package/dist/ui/client/live-doc-tail.js.map +1 -0
  744. package/dist/ui/client/live-doc-view.d.ts +18 -0
  745. package/dist/ui/client/live-doc-view.d.ts.map +1 -1
  746. package/dist/ui/client/live-doc-view.js +183 -4
  747. package/dist/ui/client/live-doc-view.js.map +1 -1
  748. package/dist/ui/client/live-doc.css +81 -0
  749. package/dist/ui/client/live-doc.d.mts +6 -3
  750. package/dist/ui/client/live-doc.d.mts.map +1 -1
  751. package/dist/ui/client/live-doc.mjs +14 -10
  752. package/dist/ui/client/live-doc.mjs.map +4 -4
  753. package/dist/ui/client/record-modal-form.d.ts +10 -0
  754. package/dist/ui/client/record-modal-form.d.ts.map +1 -1
  755. package/dist/ui/client/record-modal-form.js +3 -1
  756. package/dist/ui/client/record-modal-form.js.map +1 -1
  757. package/dist/ui/client/record-modal.d.ts +9 -1
  758. package/dist/ui/client/record-modal.d.ts.map +1 -1
  759. package/dist/ui/client/record-modal.js +78 -17
  760. package/dist/ui/client/record-modal.js.map +1 -1
  761. package/dist/ui/index.d.ts +2 -2
  762. package/dist/ui/index.d.ts.map +1 -1
  763. package/dist/ui/index.js +2 -2
  764. package/dist/ui/index.js.map +1 -1
  765. package/dist/ui/layout.d.ts +2 -2
  766. package/dist/ui/layout.d.ts.map +1 -1
  767. package/dist/ui/layout.js +3 -3
  768. package/dist/ui/layout.js.map +1 -1
  769. package/dist/ui/record-modal.d.ts +3 -0
  770. package/dist/ui/record-modal.d.ts.map +1 -1
  771. package/dist/ui/record-modal.js +15 -1
  772. package/dist/ui/record-modal.js.map +1 -1
  773. package/package.json +4 -4
  774. package/dist/modules/flow/functions.d.ts +0 -3
  775. package/dist/modules/flow/functions.d.ts.map +0 -1
  776. package/dist/modules/flow/functions.js +0 -1857
  777. package/dist/modules/flow/functions.js.map +0 -1
  778. package/dist/modules/flow/operations.d.ts +0 -414
  779. package/dist/modules/flow/operations.d.ts.map +0 -1
  780. package/dist/modules/flow/operations.js +0 -1671
  781. package/dist/modules/flow/operations.js.map +0 -1
@@ -1,16 +1,16 @@
1
- declare function ji(e: any): {
1
+ declare function Qn(e: any): {
2
2
  view: () => any;
3
3
  mount: ({ root: t, lifetime: a }: {
4
4
  lifetime: any;
5
5
  root: any;
6
6
  }) => void;
7
7
  };
8
- declare var Yi: (e: any) => string, Pf: (e: any) => {
8
+ declare var ei: (e: any) => string, jf: (e: any) => {
9
9
  view: () => any;
10
10
  mount: ({ root: t, lifetime: a }: {
11
11
  lifetime: any;
12
12
  root: any;
13
13
  }) => void;
14
14
  };
15
- export { ji as createVariantEditorView, Pf as variantEditor, Yi as variantEditorSaveForm };
15
+ export { Qn as createVariantEditorView, jf as variantEditor, ei as variantEditorSaveForm };
16
16
  //# sourceMappingURL=variant-editor.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variant-editor.d.mts","sourceRoot":"","sources":["../../../../../../../packages/ketsuite/src/modules/product_backend/client/variant-editor.mjs"],"names":[],"mappings":"AAC++sD,iBAAS,EAAE,CAAC,CAAC,KAAA;;;;;;EAAuskB;AAAA,QAAA,IAAI,EAAE,oBAAe,EAAC,EAAE;;;;;;CAAS,CAAC;AAAA,OAAM,EAAC,EAAE,IAAI,uBAAuB,EAAC,EAAE,IAAI,aAAa,EAAC,EAAE,IAAI,qBAAqB,EAAC,CAAC"}
1
+ {"version":3,"file":"variant-editor.d.mts","sourceRoot":"","sources":["../../../../../../../packages/ketsuite/src/modules/product_backend/client/variant-editor.mjs"],"names":[],"mappings":"AACykuD,iBAAS,EAAE,CAAC,CAAC,KAAA;;;;;;EAAuskB;AAAA,QAAA,IAAI,EAAE,oBAAe,EAAC,EAAE;;;;;;CAAS,CAAC;AAAA,OAAM,EAAC,EAAE,IAAI,uBAAuB,EAAC,EAAE,IAAI,aAAa,EAAC,EAAE,IAAI,qBAAqB,EAAC,CAAC"}
@@ -1,2 +1,2 @@
1
1
  // @ts-nocheck Generated by tools/build-backend-client.mjs — do not edit.
2
- import{each as Qe,effect as Ba,signal as j}from"/_ket/view/index.js";import{each as ci}from"/_ket/view/index.js";import{Fragment as Et,jsx as se,jsxs as ui}from"/_ket/view/jsx-runtime.js";var Pt=["action","action-leading","action-label","action-spinner","action-group"],Lt=e=>ui(Et,{children:[e.loading===!0&&se("span",{"data-ui":"action-spinner","aria-hidden":"true"}),e.loading!==!0&&e.leading!==void 0&&se("span",{"data-ui":"action-leading","aria-hidden":"true",children:e.leading}),!e.iconOnly&&se("span",{"data-ui":"action-label",children:e.label})]}),$=e=>se("button",{"data-ui":"action","data-variant":e.variant??"secondary","data-size":e.size??"default",type:e.type??"button",name:e.name??null,value:e.value??null,form:e.form??null,disabled:e.disabled===!0||e.loading===!0,"aria-busy":e.loading===!0?"true":null,"aria-describedby":e.describedBy??null,"aria-expanded":e.expanded===void 0?null:String(e.expanded),"aria-controls":e.controls??null,children:se(Lt,{...e})}),ot=e=>se("button",{"data-ui":"action","data-icon-only":"true","data-variant":e.variant??"tertiary","data-size":e.size??"default",type:e.type??"button",name:e.name??null,value:e.value??null,form:e.form??null,disabled:e.disabled===!0||e.loading===!0,"aria-label":e.label,"aria-pressed":e.pressed===void 0?null:String(e.pressed),"aria-busy":e.loading===!0?"true":null,"aria-describedby":e.describedBy??null,"aria-expanded":e.expanded===void 0?null:String(e.expanded),"aria-controls":e.controls??null,title:e.label,children:se(Lt,{...e,leading:e.icon,iconOnly:!0})});var we=e=>se("div",{"data-ui":"action-group",role:"group","aria-label":e.label??null,children:ci(e.actions,(d,i)=>i,d=>se(Et,{children:d}))});import{jsx as mi,jsxs as nn}from"/_ket/view/jsx-runtime.js";var Ft=["badge","tag","tag-remove","count-badge","avatar","code","text","media-label","media-label-image","media-label-copy"];var ie=e=>mi("span",{"data-ui":"badge","data-pattern":"badge","data-tone":e.tone??"neutral","data-value":e.value??"",children:e.label});import{each as ln}from"/_ket/view/index.js";import{Fragment as Je,jsx as N,jsxs as be}from"/_ket/view/jsx-runtime.js";var Ht=["notice","notice-mark","notice-copy","notice-title","notice-message","notice-actions","empty","empty-mark","empty-title","empty-message","empty-actions","loading","loading-label"],gi={info:()=>be(Je,{children:[N("circle",{cx:"12",cy:"12",r:"10"}),N("path",{d:"M12 16v-4"}),N("path",{d:"M12 8h.01"})]}),positive:()=>be(Je,{children:[N("circle",{cx:"12",cy:"12",r:"10"}),N("path",{d:"m9 12 2 2 4-4"})]}),warning:()=>be(Je,{children:[N("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),N("path",{d:"M12 9v4"}),N("path",{d:"M12 17h.01"})]}),danger:()=>be(Je,{children:[N("circle",{cx:"12",cy:"12",r:"10"}),N("path",{d:"M12 8v4"}),N("path",{d:"M12 16h.01"})]})},te=e=>be("aside",{"data-ui":"notice","data-pattern":"notice","data-tone":e.tone??"info",role:e.tone==="danger"?"alert":"status",children:[N("span",{"data-ui":"notice-mark","aria-hidden":"true",children:N("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false",children:gi[e.tone??"info"]()})}),be("div",{"data-ui":"notice-copy",children:[N("p",{"data-ui":"notice-title",children:e.title}),N("p",{"data-ui":"notice-message",children:e.message})]}),e.actions!==void 0&&N("div",{"data-ui":"notice-actions",children:e.actions})]}),de=e=>be("div",{"data-ui":"empty",role:"status",children:[N("span",{"data-ui":"empty-mark","aria-hidden":"true",children:"\u25C7"}),N("p",{"data-ui":"empty-title",children:e.title}),N("p",{"data-ui":"empty-message",children:e.message}),e.actions!==void 0&&N("div",{"data-ui":"empty-actions",children:e.actions})]});import{each as dt}from"/_ket/view/index.js";import{each as Ln}from"/_ket/view/index.js";import{jsx as un,jsxs as mn}from"/_ket/view/jsx-runtime.js";var It=["modal-layer","modal-backdrop","modal-sheet","modal-head","modal-heading","modal-title-row","modal-title","modal-description","modal-close","modal-body","modal-actions"];import{Fragment as hn,jsx as bn,jsxs as pn}from"/_ket/view/jsx-runtime.js";import{Fragment as wn,jsx as kn,jsxs as Tn}from"/_ket/view/jsx-runtime.js";var Dt=["app-shell","app-shell-topbar","app-topbar","app-location-bar","app-location-context","app-brand","app-topbar-brand","app-topbar-context","global-search-trigger","global-search-trigger-label","global-search-shortcut","global-search-dialog","global-search","global-search-input","global-search-submit","app-sidebar","app-main","app-right-rail","page","page-context","page-header","page-heading","page-eyebrow","page-title-row","page-title","page-description","page-subline","page-status","page-actions","page-meta","page-body","record-canvas","record-content","record-section","record-section-title"];import{Fragment as Hn,jsx as pe,jsxs as qe}from"/_ket/view/jsx-runtime.js";var At=["stack","inline","grid","card-grid","surface","surface-head","surface-heading","surface-title","surface-description","surface-actions","disclosure","disclosure-summary","disclosure-body","section","section-head","section-eyebrow","section-title","section-description","section-actions","section-body","content-card","card-media","card-head","card-leading","card-heading","card-eyebrow","card-title","card-summary","card-status","card-body","card-meta","card-actions","kanban","kanban-card","kanban-media","kanban-title","kanban-meta","kanban-note","kanban-actions","metric","metric-icon","metric-label","metric-value","metric-detail"];var He=e=>qe("details",{"data-ui":"disclosure",open:e.open===!0?!0:void 0,children:[pe("summary",{"data-ui":"disclosure-summary",children:e.summary}),pe("div",{"data-ui":"disclosure-body",children:e.body})]}),he=e=>qe("section",{"data-ui":"section",children:[qe("header",{"data-ui":"section-head",children:[qe("div",{children:[!!e.eyebrow&&pe("p",{"data-ui":"section-eyebrow",children:e.eyebrow}),pe("h2",{"data-ui":"section-title",children:e.title}),!!e.description&&pe("p",{"data-ui":"section-description",children:e.description})]}),e.actions!==void 0&&pe("div",{"data-ui":"section-actions",children:e.actions})]}),pe("div",{"data-ui":"section-body",children:e.body})]});import{each as yi}from"/_ket/view/index.js";import{Fragment as xi,jsx as Ie}from"/_ket/view/jsx-runtime.js";var st=(e,d)=>e.control!==void 0?Ie(xi,{children:e.control}):e.type==="textarea"?Ie("textarea",{"data-ui":"field-control",id:e.id,name:e.name,placeholder:e.placeholder??null,required:e.required===!0,disabled:e.disabled===!0,readonly:e.readOnly===!0,"aria-invalid":e.error?"true":null,"aria-describedby":d,children:String(e.value??"")}):e.type==="select"?Ie("select",{"data-ui":"field-control",id:e.id,name:e.name,required:e.required===!0,disabled:e.disabled===!0,"aria-invalid":e.error?"true":null,"aria-describedby":d,children:yi(e.options??[],i=>i.value,i=>Ie("option",{value:i.value,selected:String(e.value??"")===i.value,disabled:i.disabled===!0,children:i.label}))}):Ie("input",{"data-ui":"field-control",id:e.id,type:e.type==="decimal"?"number":e.type??"text",name:e.name,value:e.type==="checkbox"?"1":String(e.value??""),checked:e.type==="checkbox"&&(e.value===!0||e.value==="1"),placeholder:e.placeholder??null,required:e.required===!0,disabled:e.disabled===!0,readonly:e.readOnly===!0,min:e.min,max:e.max,"aria-invalid":e.error?"true":null,"aria-describedby":d,autocomplete:e.autocomplete??"off",step:e.type==="decimal"?e.step??"any":e.step??null});import{jsx as J,jsxs as ce}from"/_ket/view/jsx-runtime.js";var $t=["field","field-label","field-required","field-control","field-options","field-option","field-option-input","field-help","field-error"],Kt=e=>!!e.error||(e.fields?.some(Kt)??!1),W=e=>{let d=e.help?`${e.id}-help`:null,i=e.error?`${e.id}-error`:null,m=[d,i].filter(Boolean).join(" ")||null,l=ce("span",{"data-ui":"field-label",children:[e.label,e.required&&J("span",{"data-ui":"field-required","aria-hidden":"true",children:" *"})]});return e.fields?ce("div",{"data-ui":"field","data-kind":"group","data-span":"full","data-invalid":String(!!e.error),children:[J(He,{summary:e.label,open:e.open||Kt(e),body:J("div",{"data-ui":"form-grid",children:dt(e.fields.map(c=>({...c,disabled:e.disabled||c.disabled,readOnly:e.readOnly||c.readOnly})),c=>c.id,c=>J(W,{...c}))})}),!!e.help&&J("small",{"data-ui":"field-help",id:d??void 0,children:e.help}),!!e.error&&J("small",{"data-ui":"field-error",id:i??void 0,children:e.error})]}):e.type==="checkbox-group"?ce("div",{"data-ui":"field","data-kind":"checkbox-group","data-span":e.span??"half","data-invalid":String(!!e.error),children:[ce("span",{"data-ui":"field-label",id:`${e.id}-label`,children:[e.label,e.required&&J("span",{"data-ui":"field-required","aria-hidden":"true",children:" *"})]}),J("div",{"data-ui":"field-options","data-orientation":e.optionsOrientation==="vertical"?"vertical":null,role:"group","aria-labelledby":`${e.id}-label`,children:dt(e.options??[],c=>c.name??c.value,c=>ce("label",{"data-ui":"field-option",children:[J("input",{"data-ui":"field-option-input",type:"checkbox",name:c.name??`${e.name}[]`,value:c.value,checked:c.checked===!0,disabled:e.disabled===!0||c.disabled===!0,"aria-invalid":e.error?"true":null,"aria-describedby":m,autocomplete:"off"}),J("span",{children:c.label})]}))}),!!e.help&&J("small",{"data-ui":"field-help",id:d??void 0,children:e.help}),!!e.error&&J("small",{"data-ui":"field-error",id:i??void 0,children:e.error})]}):e.type==="radio"?ce("div",{"data-ui":"field","data-kind":"radio","data-span":e.span??"half","data-invalid":String(!!e.error),children:[ce("span",{"data-ui":"field-label",id:`${e.id}-label`,children:[e.label,e.required&&J("span",{"data-ui":"field-required","aria-hidden":"true",children:" *"})]}),J("div",{"data-ui":"field-options","data-orientation":e.optionsOrientation==="vertical"?"vertical":null,role:"radiogroup","aria-labelledby":`${e.id}-label`,children:dt(e.options??[],c=>c.value,c=>ce("label",{"data-ui":"field-option",children:[J("input",{"data-ui":"field-option-input",type:"radio",name:e.name,value:c.value,checked:String(e.value??"")===c.value,required:e.required===!0,disabled:e.disabled===!0||c.disabled===!0,"aria-invalid":e.error?"true":null,"aria-describedby":m,autocomplete:"off"}),J("span",{children:c.label})]}))}),!!e.help&&J("small",{"data-ui":"field-help",id:d??void 0,children:e.help}),!!e.error&&J("small",{"data-ui":"field-error",id:i??void 0,children:e.error})]}):ce("label",{"data-ui":"field","data-kind":e.type??"text","data-span":e.span??"half","data-invalid":String(!!e.error),for:e.id,children:[e.type==="checkbox"&&st(e,m),l,e.type!=="checkbox"&&st(e,m),!!e.help&&J("small",{"data-ui":"field-help",id:d??void 0,children:e.help}),!!e.error&&J("small",{"data-ui":"field-error",id:i??void 0,children:e.error})]})};import{each as zn}from"/_ket/view/index.js";import{jsx as _n,jsxs as Un}from"/_ket/view/jsx-runtime.js";var Bt=["breadcrumbs","breadcrumb","breadcrumb-overflow","breadcrumb-overflow-trigger","breadcrumb-overflow-list","nav-list","nav-item","nav-item-leading","nav-item-label","nav-item-count","tabs","tab","tab-count","tabbed-view","tabbed-view-context","tab-panel"];import{jsx as jn,jsxs as Yn}from"/_ket/view/jsx-runtime.js";var Nt=["progress","progress-label","progress-value","progress-track","progress-bar"];import{each as tr}from"/_ket/view/index.js";import{Fragment as rr,jsx as ir,jsxs as nr}from"/_ket/view/jsx-runtime.js";var Jt=["menu","menu-trigger","menu-trigger-count","menu-panel","menu-search","menu-search-input","menu-label","menu-separator","menu-item","menu-item-leading","menu-item-copy","menu-item-check","menu-item-shortcut"];import{jsx as sr,jsxs as dr}from"/_ket/view/jsx-runtime.js";var Vt=["popover","popover-trigger","popover-panel","popover-close"];import{jsx as mr,jsxs as gr}from"/_ket/view/jsx-runtime.js";var qt=["tooltip","tooltip-trigger","tooltip-content"];import{jsx as vr}from"/_ket/view/jsx-runtime.js";var Xt=["dialog","confirm-dialog-message"];import{each as Sr}from"/_ket/view/index.js";import{jsx as Tr,jsxs as wr}from"/_ket/view/jsx-runtime.js";var zt=["toast-region","toast","toast-copy","toast-title","toast-message","toast-actions"];import{jsx as Mr}from"/_ket/view/jsx-runtime.js";var Gt=["spinner","visually-hidden"];import{each as Er}from"/_ket/view/index.js";import{jsx as Hr}from"/_ket/view/jsx-runtime.js";var _t=["skeleton","skeleton-line"];import{each as Re,effect as Si,signal as ne}from"/_ket/view/index.js";import{jsx as x,jsxs as D}from"/_ket/view/jsx-runtime.js";var Ut=["relation-select","relation-native","relation-trigger","relation-value","relation-caret","relation-chips","relation-chip","relation-chip-clear","relation-menu","relation-search","relation-options","relation-option","relation-footer","relation-empty","relation-editor","relation-dialog-toolbar","relation-search-field","relation-search-icon","relation-dialog-list","relation-dialog-row","relation-dialog-main","relation-dialog-meta","relation-dialog-actions"],ve=e=>Array.isArray(e)?e:[],P=e=>e==null?"":String(e),ct=async(e,d,i)=>{let m=await fetch(`/_ket/fn/${encodeURIComponent(e)}`,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify(d),signal:i}),l=await m.json();if(!m.ok||l.ok===!1){let c=ve(l.errors)[0];throw new Error(P(c?.message??c?.code??l.message??`HTTP ${m.status}`))}return l.value};function ut(e,d={}){let{id:i,config:m}=e,l=m.labels,c=m.manager,R=m.multiple===!0,v=ne(R?ve(m.values).map(P).filter(Boolean):[P(m.value)].filter(Boolean)),g=()=>v()[0]??"",h=o=>v().includes(P(o)),f=ne(ve(m.options)),A=()=>d.options?.()??f(),B=()=>d.disabled?.()??m.disabled===!0,I=ne(!1),C=ne(!1),S=ne(""),K=ne([]),E=ne(!1),T=ne(""),F=ne(null),y=ne(""),p=null,M,ae=!1,z=o=>P(o[c?.idField??"id"]),w=o=>P(o[c?.labelField??"name"])||l.noRecords,oe=o=>P(o[c?.descriptionField??"ref"]),Q=()=>f().find(o=>P(o.value)===g())?.label??l.choose,G=()=>{let o=S().trim().toLocaleLowerCase(),b=o?A().filter(L=>`${P(L.label)} ${P(L.description)}`.toLocaleLowerCase().includes(o)):A();return d.options?b:b.slice(0,7)},me=(o,b,L="")=>{if(B())return;let O=P(o);if(f().some(H=>P(H.value)===O)||f.set([...f(),{value:O,label:P(b),description:P(L)}]),R){v.set(h(O)?v().filter(H=>H!==O):[...v(),O]),d.onSelect?.({value:O,label:P(b),description:P(L)});return}v.set(O?[O]:[]),I.set(!1),C.set(!1),S.set(""),F.set(null),y.set(""),d.resetAfterSelect&&v.set([]),d.onSelect?.({value:O,label:P(b),description:P(L)})},Se=o=>{v.set(v().filter(b=>b!==P(o)))},ke=o=>f().find(b=>P(b.value)===P(o))?.label??P(o),le=async()=>{if(!c?.listFunction)return;p?.abort();let o=new AbortController;p=o,E.set(!0),T.set("");try{let b={...c.listInput??{}};b[c.searchParam??"search"]=S().trim(),b[c.limitParam??"limit"]=c.limit??80;let L=await ct(c.listFunction,b,o.signal),O=new Set(ve(c.excludeIds).map(P));K.set(ve(L).filter(H=>!O.has(z(H))))}catch(b){if(ae||b instanceof Error&&b.name==="AbortError")return;T.set(b instanceof Error?b.message:l.loadError)}finally{p===o&&E.set(!1)}},Ae=async()=>{I.set(!1),C.set(!0),F.set(null),y.set(""),await le()},Te=()=>{C.set(!1),F.set(null),y.set(""),T.set("")},$e=o=>{o.currentTarget instanceof HTMLInputElement&&(S.set(o.currentTarget.value),clearTimeout(M),M=setTimeout(le,180))},at=async o=>{if(o.preventDefault(),!c?.saveFunction||!(o.currentTarget instanceof HTMLFormElement))return;let b=F(),L=b?.id||crypto.randomUUID(),O={...c.saveDefaults??{},id:L};for(let[H,ee]of new FormData(o.currentTarget).entries())O[H]=P(ee);E.set(!0),T.set("");try{await ct(c.saveFunction,O);let H=P(O[c.labelField??"name"]);if(!b?.id){me(L,H),R&&(F.set(null),await le());return}f.set(f().map(ee=>P(ee.value)===L?{...ee,label:H||ee.label}:ee)),F.set(null),await le()}catch(H){T.set(H instanceof Error?H.message:l.loadError)}finally{E.set(!1)}},Ke=async o=>{let b=z(o);if(y()!==b){y.set(b);return}if(c?.removeFunction){E.set(!0),T.set("");try{await ct(c.removeFunction,{...c.removeDefaults??{},id:b}),Se(b),f.set(f().filter(L=>P(L.value)!==b)),y.set(""),await le()}catch(L){T.set(L instanceof Error?L.message:l.loadError)}finally{E.set(!1)}}},Pe=o=>{let b=F()?.row??c?.saveDefaults??{},L=P(b[o.name]),O=`${i}-relation-editor-${o.name}`;return D("label",{"data-ui":"form-field","data-span":"full",htmlFor:O,children:[D("span",{"data-ui":"form-label",children:[o.label,o.required?D("span",{"data-ui":"form-required","aria-hidden":"true",children:[" ","*"]}):null]}),o.type==="select"?x("select",{"data-ui":"form-control",id:O,name:o.name,required:o.required===!0,children:Re(ve(o.options),H=>H.value,H=>x("option",{value:H.value,selected:P(H.value)===L,children:H.label}))}):x("input",{"data-ui":"form-control",id:O,type:o.type??"text",name:o.name,value:L,autocomplete:"off",required:o.required===!0})]})},Be=()=>D("form",{"data-ui":"relation-editor",onSubmit:at,children:[x("div",{"data-ui":"form-grid",children:Re(ve(c?.fields),o=>o.name,Pe)}),x("div",{"data-ui":"form-actions",children:D("div",{"data-ui":"action-group",children:[x("button",{"data-ui":"action","data-variant":"primary",type:"submit",disabled:E(),children:l.save}),x("button",{"data-ui":"action","data-variant":"tertiary",type:"button",onClick:()=>F.set(null),children:l.cancel})]})})]}),Le=o=>{let b=z(o),L=oe(o);return D("li",{"data-ui":"relation-dialog-row","data-selected":String(h(b)),children:[D("button",{"data-ui":"relation-dialog-main",type:"button","aria-pressed":R?String(h(b)):null,onClick:()=>me(b,w(o),L),children:[x("strong",{children:w(o)}),L?x("small",{"data-ui":"relation-dialog-meta",children:L}):null]}),D("div",{"data-ui":"relation-dialog-actions",children:[x("button",{"data-ui":"action","data-size":"compact","data-variant":h(b)?"primary":"secondary",type:"button",onClick:()=>me(b,w(o),L),children:h(b)?l.chosen:l.select}),c?.saveFunction?x("button",{"data-ui":"action","data-size":"compact","data-variant":"tertiary",type:"button",onClick:()=>F.set({id:b,row:o}),children:l.edit}):null,c?.removeFunction?x("button",{"data-ui":"action","data-size":"compact","data-variant":"destructive",type:"button",onClick:()=>Ke(o),children:y()===b?l.confirmRemove:l.remove}):null]})]})},Ee=()=>D("div",{"data-ui":"modal-layer","data-presentation":"dialog",children:[x("button",{"data-ui":"modal-backdrop",type:"button","aria-label":l.close,onClick:Te,children:x("span",{children:l.close})}),D("section",{"data-ui":"modal-sheet",role:"dialog","aria-modal":"true","aria-labelledby":`${i}-relation-title`,children:[D("header",{"data-ui":"modal-head",children:[x("h2",{"data-ui":"modal-title",id:`${i}-relation-title`,children:l.dialogTitle}),x("button",{"data-ui":"modal-close",type:"button","aria-label":l.close,title:l.close,onClick:Te,children:"\xD7"})]}),D("div",{"data-ui":"modal-body",children:[D("div",{"data-ui":"relation-dialog-toolbar",children:[D("div",{"data-ui":"relation-search-field",children:[x("span",{"data-ui":"relation-search-icon","aria-hidden":"true",children:D("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false",children:[x("circle",{cx:"11",cy:"11",r:"8"}),x("path",{d:"m21 21-4.3-4.3"})]})}),x("input",{"data-ui":"field-control",type:"search",value:S(),autocomplete:"off",placeholder:l.search,"aria-label":l.search,onInput:$e})]}),c?.saveFunction?x("button",{"data-ui":"action","data-variant":"primary",type:"button",onClick:()=>F.set({id:"",row:c.saveDefaults??{}}),children:l.create}):null]}),T()?D("aside",{"data-ui":"notice","data-tone":"danger",role:"alert",children:[D("div",{"data-ui":"notice-copy",children:[x("p",{"data-ui":"notice-title",children:l.loadError}),x("p",{"data-ui":"notice-message",children:T()})]}),x("button",{"data-ui":"action","data-variant":"secondary",type:"button",onClick:le,children:l.retry})]}):null,F()?Be():null,E()?x("p",{"data-ui":"relation-empty",role:"status",children:l.loading}):null,!E()&&!F()?K().length?x("ul",{"data-ui":"relation-dialog-list",children:Re(K(),z,Le)}):x("p",{"data-ui":"relation-empty",children:l.noRecords}):null]})]})]}),Fe=o=>{if(!(o instanceof KeyboardEvent)||o.key!=="Escape"||!I()&&!C())return;o.preventDefault(),o.stopPropagation();let b=o.currentTarget?.querySelector('[data-ui="relation-trigger"]');I.set(!1),Te(),b?.focus()},fe=o=>{o.preventDefault(),I.set(!0),o.currentTarget instanceof HTMLSelectElement&&o.currentTarget.nextElementSibling?.focus()};return{view:()=>D("div",{"data-ui":"relation-select",role:"group","aria-label":m.ariaLabel,onKeydown:Fe,children:[D("select",{"data-ui":"relation-native",name:m.name,required:m.required===!0,disabled:B(),tabindex:"-1","aria-hidden":"true",onInvalid:fe,children:[x("option",{value:"",selected:!v().length}),R?v().length?x("option",{value:v().join(","),selected:!0,children:v().map(ke).join(", ")}):null:Re(f().filter(o=>P(o.value)),o=>o.value,o=>x("option",{value:o.value,selected:P(o.value)===g(),children:o.label}))]}),D("button",{"data-ui":"relation-trigger","data-empty":String(!v().length),type:"button","aria-haspopup":"listbox","aria-label":m.ariaLabel,"aria-expanded":String(I()),"aria-controls":`${i}-relation-menu`,disabled:B(),onClick:()=>I.set(!I()),children:[x("span",{"data-ui":"relation-value",children:R?l.choose:Q()}),x("span",{"data-ui":"relation-caret","aria-hidden":"true",children:"\u25BE"})]}),R&&v().length?x("ul",{"data-ui":"relation-chips","aria-label":l.chosen,children:Re(v(),o=>o,o=>D("li",{"data-ui":"relation-chip",children:[x("span",{children:ke(o)}),x("button",{"data-ui":"relation-chip-clear",type:"button","aria-label":`${l.clear}: ${ke(o)}`,title:l.clear,disabled:B(),onClick:()=>Se(o),children:"\xD7"})]}))}):null,I()?D("div",{"data-ui":"relation-menu",id:`${i}-relation-menu`,children:[x("input",{"data-ui":"relation-search",type:"search",value:S(),autocomplete:"off",placeholder:l.search,"aria-label":l.search,onInput:o=>{o.currentTarget instanceof HTMLInputElement&&S.set(o.currentTarget.value)}}),x("div",{"data-ui":"relation-options",role:"listbox",children:G().length?Re(G(),o=>o.value,o=>D("button",{"data-ui":"relation-option",type:"button",role:"option","data-selected":String(h(o.value)),"aria-selected":String(h(o.value)),onClick:()=>me(o.value,o.label,o.description),children:[x("span",{children:o.label}),o.description?x("small",{children:o.description}):null]})):x("p",{"data-ui":"relation-empty",children:l.noRecords})}),c||!d.options||d.onCreate?D("footer",{"data-ui":"relation-footer",children:[c||!d.options?x("button",{"data-ui":"action","data-variant":"tertiary",type:"button",onClick:Ae,children:l.more}):null,d.onCreate?x("button",{"data-ui":"action","data-variant":"tertiary",type:"button",disabled:B(),onClick:()=>{if(B())return;let o=S().trim();I.set(!1),S.set(""),d.onCreate?.(o)},children:l.create}):null]}):null]}):null,C()?Ee():null]}),mount:({root:o,lifetime:b})=>{let L=!0,O=Si(()=>{if(v(),L){L=!1;return}queueMicrotask(()=>{if(ae)return;let H=[...o.querySelectorAll('[data-ui="relation-native"]')][0];H instanceof HTMLSelectElement&&H.dispatchEvent(new Event("change",{bubbles:!0}))})});b.addEventListener("abort",O),document.addEventListener("click",H=>{if(!I())return;let ee=H.target;ee instanceof Node&&o.contains(ee)||I.set(!1)},{signal:b})},dispose:()=>{ae=!0,clearTimeout(M),p?.abort()}}}import{each as Kr,signal as Oe}from"/_ket/view/index.js";import{jsx as Z,jsxs as jt}from"/_ket/view/jsx-runtime.js";var Yt=["lightbox","lightbox-thumbs","lightbox-thumb","lightbox-empty","lightbox-layer","lightbox-backdrop","lightbox-toolbar","lightbox-counter","lightbox-tool","lightbox-stage","lightbox-image","lightbox-nav","lightbox-caption"],re=1,Wt=4,ze=.5,Qt=(e,d)=>e.replace(/\{(\w+)\}/g,(i,m)=>String(d[m]??`{${m}}`)),Zt=(e,d,i)=>Math.min(i,Math.max(d,e));function mt(e,d="lightbox"){let i=Oe([]),m=Oe(!1),l=Oe(0),c=Oe(re),R=Oe({x:0,y:0}),v=null,g=new Map,h=null,f=()=>{c.set(re),R.set({x:0,y:0})},A=(y,p,M)=>{y.length&&(v=M instanceof HTMLElement?M:null,i.set(y),l.set(Zt(p,0,y.length-1)),f(),m.set(!0),queueMicrotask(()=>{typeof document>"u"||document.getElementById(`${d}-lightbox-close`)?.focus()}))},B=()=>{m()&&(m.set(!1),f(),g.clear(),h=null,v?.focus(),v=null)},I=y=>{let p=i().length;p<2||(l.set((l()+y+p)%p),f())},C=y=>{let p=Zt(y,re,Wt);c.set(p),p===re&&R.set({x:0,y:0})},S=()=>{let y=[...g.values()];return y.length?{x:y.reduce((p,M)=>p+M.x,0)/y.length,y:y.reduce((p,M)=>p+M.y,0)/y.length}:{x:0,y:0}},K=()=>{let[y,p]=[...g.values()];return y&&p?Math.hypot(y.x-p.x,y.y-p.y):0},E=(y,p)=>{if(p&&h&&g.size===1&&c()===re&&h.distance===null){let M=y.clientX-h.start.x;Math.abs(M)>60&&Math.abs(M)>Math.abs(y.clientY-h.start.y)&&I(M<0?1:-1)}if(g.delete(y.pointerId),y.currentTarget?.releasePointerCapture?.(y.pointerId),!g.size){let M=h;M&&p?setTimeout(()=>h===M?h=null:null,0):h=null;return}h&&(h={...h,start:S(),origin:R(),zoom:c(),distance:null})};return{open:A,close:B,isOpen:()=>m(),layer:()=>{let y=i(),p=y[l()];if(!m()||!p)return null;let M=c(),ae=R(),z=y.length>1;return jt("div",{"data-ui":"lightbox-layer",role:"dialog","aria-modal":"true","aria-label":p.alt,id:`${d}-lightbox`,children:[Z("div",{"data-ui":"lightbox-backdrop","aria-hidden":"true",onClick:B}),jt("div",{"data-ui":"lightbox-toolbar",children:[Z("span",{"data-ui":"lightbox-counter","aria-live":"polite",children:z?Qt(e.counter,{index:l()+1,total:y.length}):""}),Z("button",{type:"button","data-ui":"lightbox-tool","data-tool":"zoom-out","aria-label":e.zoomOut,title:e.zoomOut,disabled:M<=re,onClick:()=>C(M-ze),children:"\u2212"}),Z("button",{type:"button","data-ui":"lightbox-tool","data-tool":"zoom-in","aria-label":e.zoomIn,title:e.zoomIn,disabled:M>=Wt,onClick:()=>C(M+ze),children:"+"}),Z("button",{type:"button","data-ui":"lightbox-tool","data-tool":"close",id:`${d}-lightbox-close`,"aria-label":e.close,title:e.close,onClick:B,children:"\xD7"})]}),Z("div",{role:"presentation","data-ui":"lightbox-stage","data-zoomed":String(M>re),onClick:w=>{w.target===w.currentTarget&&!h?.moved&&B()},onWheel:w=>{w.preventDefault(),C(c()*(w.deltaY<0?1.15:1/1.15))},onPointerDown:w=>{g.set(w.pointerId,{x:w.clientX,y:w.clientY}),w.currentTarget.setPointerCapture?.(w.pointerId),h={start:S(),origin:R(),zoom:c(),distance:g.size>1?K():null,moved:h?.moved===!0&&g.size>1}},onPointerMove:w=>{if(!h||!g.has(w.pointerId))return;g.set(w.pointerId,{x:w.clientX,y:w.clientY});let oe=S(),Q=oe.x-h.start.x,G=oe.y-h.start.y;Math.abs(Q)+Math.abs(G)>4&&(h.moved=!0),g.size>1&&h.distance&&(C(h.zoom*(K()/h.distance)),h.moved=!0),c()>re&&R.set({x:h.origin.x+Q,y:h.origin.y+G})},onPointerUp:w=>E(w,!0),onPointerCancel:w=>E(w,!1),children:Z("img",{"data-ui":"lightbox-image",src:p.src,alt:p.alt,draggable:"false",style:`transform: translate(${ae.x}px, ${ae.y}px) scale(${M})`,onClick:()=>{h?.moved||C(c()>re?re:2)}})}),z?Z("button",{type:"button","data-ui":"lightbox-nav","data-direction":"previous","aria-label":e.previous,title:e.previous,onClick:()=>I(-1),children:"\u2039"}):null,z?Z("button",{type:"button","data-ui":"lightbox-nav","data-direction":"next","aria-label":e.next,title:e.next,onClick:()=>I(1),children:"\u203A"}):null,p.caption?Z("p",{"data-ui":"lightbox-caption",children:p.caption}):null]})},attach:y=>{document.addEventListener("keydown",p=>{if(m()){if(p.key==="Escape")B();else if(p.key==="ArrowLeft")I(-1);else if(p.key==="ArrowRight")I(1);else if(p.key==="+"||p.key==="=")C(c()+ze);else if(p.key==="-")C(c()-ze);else return;p.preventDefault(),p.stopImmediatePropagation()}},{signal:y,capture:!0}),y.addEventListener("abort",()=>{m.set(!1),g.clear(),h=null})}}}var gt=e=>Z("button",{type:"button","data-ui":"lightbox-thumb","data-size":e.size??"medium","aria-label":Qt(e.labels.open,{alt:e.item.alt}),"aria-haspopup":"dialog",onClick:d=>e.onOpen(d.currentTarget),children:Z("img",{src:e.item.thumbnail??e.item.src,alt:"",loading:"lazy",decoding:"async"})});import{each as qr,signal as Xr}from"/_ket/view/index.js";import{Fragment as Ur,jsx as _r,jsxs as Gr}from"/_ket/view/jsx-runtime.js";var ea=["search-filter","search-filter-bar","search-filter-section-toggle","search-filter-sheet","search-filter-clear","search-filter-icon","search-filter-field","search-filter-input","search-filter-facets","search-filter-facet","search-filter-facet-remove","search-filter-suggestions","search-filter-suggestion","search-filter-toggle","search-filter-columns","search-filter-column","search-filter-column-title","search-filter-empty","search-filter-grouping","search-filter-grouping-head","search-filter-grouping-list","search-filter-grouping-item","search-filter-grouping-order","search-filter-grouping-label","search-filter-grouping-actions","search-filter-grouping-action","search-filter-grouping-clear","search-filter-grouping-add-label","custom-filter","custom-filter-row","custom-filter-add","custom-group-by","favorite-list","favorite-item","favorite-item-default","favorite-item-remove","favorite-save","favorite-save-toggle","favorite-save-row"];import{each as eo,effect as to,signal as ao}from"/_ket/view/index.js";import{jsx as jr}from"/_ket/view/jsx-runtime.js";var ta=["formatted-date","formatted-number","formatted-money"];import{Fragment as lo,jsx as so,jsxs as co}from"/_ket/view/jsx-runtime.js";var ia=["ket-table","kt-scroll","kt-selection-target","kt-grid","kt-select-col","kt-select-all","kt-col","kt-sort-button","kt-sort-icon","kt-row","kt-cell","kt-person","kt-select-cell","kt-row-select","kt-row-link","kt-group-row","kt-group-cell","kt-group-toggle","kt-group-indent","kt-group-count","kt-group-pager","kt-pager","kt-pager-label","kt-pager-button","kt-select-persisted","kt-caption","kt-tools"];var mo=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","summary",'[tabindex]:not([tabindex="-1"])'].join(",");var Ci=['[data-ui="timeframe-menu"]','[data-ui="view-settings"]'],go=Ci.map(e=>`${e}[open]`).join(", ");import{jsx as ft,jsxs as na}from"/_ket/view/jsx-runtime.js";var Ce=(e,d)=>e?.find(i=>i.path===d)?.message??null,Ge=e=>{let d=e.help?`${e.id}-help`:null,i=e.error?`${e.id}-error`:null;return na("div",{"data-ui":"field","data-kind":e.kind,"data-span":e.span??"half","data-invalid":String(!!e.error),children:[na("label",{"data-ui":"field-label",for:e.id,children:[e.label,e.required&&ft("span",{"data-ui":"field-required","aria-hidden":"true",children:" *"})]}),e.control,!!e.help&&ft("small",{"data-ui":"field-help",id:d??void 0,children:e.help}),!!e.error&&ft("small",{"data-ui":"field-error",id:i??void 0,children:e.error})]})},_e=(e,d,i)=>[d?`${e}-help`:null,i?`${e}-error`:null].filter(Boolean).join(" ")||null;import{jsx as We,jsxs as xo}from"/_ket/view/jsx-runtime.js";var ra=["switch-control","switch-track"],Ue=e=>({...e,error:e.error??Ce(e.issues,e.name)}),bt=e=>We(W,{...Ue(e),type:"text"});var pt=e=>We(W,{...Ue({...e,step:e.step??"0.01"}),type:"decimal"});var ht=e=>We(W,{...Ue(e),type:"checkbox-group"});var vt=e=>We(W,{...Ue(e),type:"select"});import{each as To}from"/_ket/view/index.js";import{Fragment as Po,jsx as Co,jsxs as Mo}from"/_ket/view/jsx-runtime.js";var oa=["combobox","combobox-input-row","combobox-toggle","combobox-listbox","combobox-option","combobox-empty","tag-picker"];import{jsx as Io,jsxs as Oo}from"/_ket/view/jsx-runtime.js";var la=["date-range"];import{jsx as yt,jsxs as Li}from"/_ket/view/jsx-runtime.js";var sa=["file-upload","drop-zone","upload-status"],Mi=(e,d,i)=>Li("div",{"data-ui":i?"drop-zone":"file-upload",children:[yt("input",{"data-ui":"field-control",id:e.id,type:"file",name:e.name,accept:e.accept,multiple:e.multiple===!0,required:e.required===!0,disabled:e.disabled===!0,"aria-invalid":d?"true":null,"aria-describedby":_e(e.id,e.help,d)}),e.status!==void 0&&yt("div",{"data-ui":"upload-status",children:e.status})]}),Pi=(e,d)=>{let i=e.error??Ce(e.issues,e.name);return yt(Ge,{...e,kind:d?"drop-zone":"file-upload",error:i,control:Mi(e,i,d)})};var xt=e=>Pi(e,!0);import{jsx as Jo}from"/_ket/view/jsx-runtime.js";var da=["relation-picker"];import{each as Xo}from"/_ket/view/index.js";import{jsx as Uo,jsxs as Wo}from"/_ket/view/jsx-runtime.js";var ca=["search-bar","filter-bar","applied-filters","applied-filter","saved-views","saved-view","view-settings","view-settings-options"];import{jsx as Qo,jsxs as el}from"/_ket/view/jsx-runtime.js";var ua=["inline-edit","inline-edit-value","inline-edit-form","inline-edit-actions"];import{each as gl}from"/_ket/view/index.js";import{each as rl}from"/_ket/view/index.js";import{Fragment as cl,jsx as sl,jsxs as dl}from"/_ket/view/jsx-runtime.js";var ma=["list-chrome","list-chrome-row","list-search","list-search-label","list-search-input","list-search-submit","list-filter-menus","list-facets","list-facet","list-facet-count","list-view-switch","list-view","list-sort","list-sort-label","list-sort-select","list-status","list-actions","bulk-actions","bulk-summary","bulk-count","bulk-action-list","pager-bar","pager-summary","pager-pages","pager-page","pager-actions","pager-link"];import{jsx as hl,jsxs as vl}from"/_ket/view/jsx-runtime.js";var ga=["resource-list","resource-list-item","resource-list-select","resource-list-link"];import{each as Sl}from"/_ket/view/index.js";import{jsx as Tl,jsxs as wl}from"/_ket/view/jsx-runtime.js";var fa=["data-grid-scroll","data-grid","data-grid-cap","data-grid-cell"];import{each as Ml}from"/_ket/view/index.js";import{jsx as Ll,jsxs as El}from"/_ket/view/jsx-runtime.js";var ba=["tree","tree-item","tree-link","tree-grid","tree-grid-row"];import{each as Il}from"/_ket/view/index.js";import{jsx as Dl,jsxs as Al}from"/_ket/view/jsx-runtime.js";var pa=["data-matrix","data-matrix-head","data-matrix-heading","data-matrix-eyebrow","data-matrix-title","data-matrix-description","data-matrix-summary","data-matrix-scroll","data-matrix-table","data-matrix-column","data-matrix-row-head","data-matrix-row-leading","data-matrix-row-title","data-matrix-row-description","data-matrix-row-status","data-matrix-row-actions","data-matrix-cell"];import{each as Bl}from"/_ket/view/index.js";import{jsx as Jl,jsxs as Vl}from"/_ket/view/jsx-runtime.js";var ha=["bar-chart","bar-chart-rows","bar-chart-row","bar-chart-label","bar-chart-caption","bar-chart-track","bar-chart-fill","bar-chart-segment","bar-chart-value","bar-chart-scale","bar-chart-legend","bar-chart-legend-item","bar-chart-legend-swatch","bar-chart-empty"];import{each as zl}from"/_ket/view/index.js";import{jsx as _l,jsxs as Ul}from"/_ket/view/jsx-runtime.js";var va=["timeframe","timeframe-menu","timeframe-trigger","timeframe-label","timeframe-value","timeframe-content","timeframe-option","timeframe-option-label","timeframe-option-detail","timeframe-range","timeframe-asof","timeframe-note"];import{each as jl}from"/_ket/view/index.js";import{jsx as es,jsxs as ts}from"/_ket/view/jsx-runtime.js";var ya=["description-list","key-value","key-value-label","key-value-value","person","person-body","avatar-group","status"];import{each as ns}from"/_ket/view/index.js";import{jsx as ds,jsxs as cs}from"/_ket/view/jsx-runtime.js";var Sa=["record-summary","record-summary-main","record-actions","record-rail"];import{each as gs}from"/_ket/view/index.js";import{jsx as hs,jsxs as vs}from"/_ket/view/jsx-runtime.js";var ka=["activity-timeline","activity-item","activity-marker","audit-log","audit-item"];import{each as Ss}from"/_ket/view/index.js";import{jsx as ws,jsxs as Rs}from"/_ket/view/jsx-runtime.js";var Ta=["attachments","attachment","media-gallery","media-item"];import{each as Ps}from"/_ket/view/index.js";import{Fragment as Hs,jsx as Es,jsxs as Fs}from"/_ket/view/jsx-runtime.js";var wa=["app-navigation","navigation-trigger","navigation-toggle","navigation-trigger-icon","navigation-trigger-identity","navigation-trigger-label","navigation-layer","navigation-backdrop","navigation-drawer","navigation-header","navigation-identity","navigation-context","navigation-close","navigation-groups","navigation-group","navigation-group-label","navigation-items","navigation-supplementary","navigation-item","navigation-branch","navigation-branch-trigger","navigation-children","navigation-item-leading","navigation-item-copy","navigation-item-label","navigation-item-description","navigation-item-count","navigation-footer"];import{each as $s}from"/_ket/view/index.js";import{Fragment as qs,jsx as Js,jsxs as Vs}from"/_ket/view/jsx-runtime.js";var Ra=["table-scroll","table","table-caption","select-col","select-all","col","sort-link","sort-icon","row","group-row","group-cell","group-link","group-indent","group-count","group-pager","group-pager-actions","cell","select-cell","row-select","row-link"];import{Fragment as Ys,jsx as js,jsxs as Qs}from"/_ket/view/jsx-runtime.js";var Ca=["list-page","list-page-context","list-page-header","list-page-heading","list-page-title-row","list-page-eyebrow","list-page-title","list-page-description","list-page-actions","list-page-tools","list-page-toolbar","list-page-controls","list-page-status","list-page-body","list-page-footer"];import{jsx as id,jsxs as nd}from"/_ket/view/jsx-runtime.js";var Ma=["record-page","record-page-context","record-page-header","record-page-title-row","record-page-heading","record-page-title","record-page-subline","record-page-status","record-page-description","record-page-actions","record-page-meta","record-page-controller","record-page-navigation","record-page-layout","record-page-body","record-page-aside"];var Pa=["form-page","form-page-context","form-page-header","form-page-title-row","form-page-heading","form-page-title","form-page-subline","form-page-status","form-page-description","form-page-actions","form-page-meta","form-page-controller","form-page-navigation","form-page-layout","form-page-body","form-page-aside"];import{jsx as gd,jsxs as fd}from"/_ket/view/jsx-runtime.js";var La=["dashboard-page","dashboard-page-context","dashboard-page-header","dashboard-page-heading","dashboard-page-eyebrow","dashboard-page-title-row","dashboard-page-title","dashboard-page-subline","dashboard-page-status","dashboard-page-description","dashboard-page-actions","dashboard-page-meta","dashboard-page-body"];var Ea=["board-page","board-page-context","board-page-header","board-page-heading","board-page-eyebrow","board-page-title-row","board-page-title","board-page-subline","board-page-status","board-page-description","board-page-actions","board-page-meta","board-page-toolbar","board-page-controls","board-page-body"];import{each as Td}from"/_ket/view/index.js";import{jsx as Rd,jsxs as Cd}from"/_ket/view/jsx-runtime.js";var Fa=["pipeline","pipeline-step","pipeline-arrow","pipeline-step-label","pipeline-step-value","pipeline-step-node"];import{each as Fd}from"/_ket/view/index.js";import{jsx as Dd,jsxs as Ad}from"/_ket/view/jsx-runtime.js";var Ha=["record-form","form-errors","form-grid","form-actions"];import{each as Xd}from"/_ket/view/index.js";import{jsx as Ud,jsxs as Wd}from"/_ket/view/jsx-runtime.js";var Ia=["reorder-list","reorder-list-value","reorder-list-rows","reorder-list-row","reorder-list-content","reorder-list-controls"];var Oa={actions:Pt,feedback:Ht,fields:$t,status:Ft,navigation:Bt,progress:Nt,menu:Jt,reorderList:Ia,popover:Vt,tooltip:qt,dialog:Xt,toast:zt,spinner:Gt,skeleton:_t,lightbox:Yt,relationSelect:Ut,searchFilter:ea,ketTable:ia,scalarFields:ra,combobox:oa,dateTime:la,upload:sa,relationPicker:da,listControls:ca,inlineEdit:ua,resourceList:ga,dataGrid:fa,tree:ba,matrix:pa,barChart:ha,timeframe:va,recordDisplay:ya,formattedValues:ta,recordComposition:Sa,activity:ka,media:Ta,layouts:At,shell:Dt,appNavigation:wa,table:Ra,listChrome:ma,listPage:Ca,formPage:Pa,recordPage:Ma,dashboardPage:La,boardPage:Ea,modal:It,pipeline:Fa,form:Ha},$i=[...new Set(Object.values(Oa).flat())].sort(),Ki=Object.freeze(Object.fromEntries(Object.entries(Oa).map(([e,d])=>[e,[...d]])));import{trustedMarkup as Ni}from"/_ket/view/index.js";var Da={package:'<path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z" /> <path d="M12 22V12" /> <polyline points="3.29 7 12 12 20.71 7" /> <path d="m7.5 4.27 9 5.15" />',warehouse:'<path d="M18 21V10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1v11" /> <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 1.132-1.803l7.95-3.974a2 2 0 0 1 1.837 0l7.948 3.974A2 2 0 0 1 22 8z" /> <path d="M6 13h12" /> <path d="M6 17h12" />',"shopping-cart":'<circle cx="8" cy="21" r="1" /> <circle cx="19" cy="21" r="1" /> <path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12" />',globe:'<circle cx="12" cy="12" r="10" /> <path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" /> <path d="M2 12h20" />',users:'<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" /> <path d="M16 3.128a4 4 0 0 1 0 7.744" /> <path d="M22 21v-2a4 4 0 0 0-3-3.87" /> <circle cx="9" cy="7" r="4" />',"layout-grid":'<rect width="7" height="7" x="3" y="3" rx="1" /> <rect width="7" height="7" x="14" y="3" rx="1" /> <rect width="7" height="7" x="14" y="14" rx="1" /> <rect width="7" height="7" x="3" y="14" rx="1" />',settings:'<path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" /> <circle cx="12" cy="12" r="3" />',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" /> <path d="M14 2v4a2 2 0 0 0 2 2h4" /> <path d="M10 9H8" /> <path d="M16 13H8" /> <path d="M16 17H8" />',"message-circle":'<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719" />',"check-circle":'<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14" /> <path d="m22 4-10 10.01-3-3" />',send:'<path d="m22 2-7 20-4-9-9-4Z" /> <path d="M22 2 11 13" />',download:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /> <path d="m7 10 5 5 5-5" /> <path d="M12 15V3" />',headphones:'<path d="M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3" />',calendar:'<path d="M8 2v4" /> <path d="M16 2v4" /> <rect width="18" height="18" x="3" y="4" rx="2" /> <path d="M3 10h18" />',"contact-round":'<path d="M16 2v2" /> <path d="M17.915 22a6 6 0 0 0-12 0" /> <path d="M8 2v2" /> <circle cx="12" cy="12" r="4" /> <rect x="3" y="4" width="18" height="18" rx="2" />',handshake:'<path d="m11 17 2 2a1 1 0 1 0 3-3" /> <path d="m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4" /> <path d="m21 3 1 11h-2" /> <path d="M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3" /> <path d="M3 4h8" />',"layout-dashboard":'<rect width="7" height="9" x="3" y="3" rx="1" /> <rect width="7" height="5" x="14" y="3" rx="1" /> <rect width="7" height="9" x="14" y="12" rx="1" /> <rect width="7" height="5" x="3" y="16" rx="1" />',store:'<path d="M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5" /> <path d="M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244" /> <path d="M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05" />',"receipt-text":'<path d="M13 16H8" /> <path d="M14 8H8" /> <path d="M16 12H8" /> <path d="M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z" />',truck:'<path d="M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2" /> <path d="M15 18H9" /> <path d="M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14" /> <circle cx="17" cy="18" r="2" /> <circle cx="7" cy="18" r="2" />',"shopping-bag":'<path d="M16 10a4 4 0 0 1-8 0" /> <path d="M3.103 6.034h17.794" /> <path d="M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z" />',factory:'<path d="M12 16h.01" /> <path d="M16 16h.01" /> <path d="M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z" /> <path d="M8 16h.01" />',fingerprint:'<path d="M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4" /> <path d="M14 13.12c0 2.38 0 6.38-1 8.88" /> <path d="M17.29 21.02c.12-.6.43-2.3.5-3.02" /> <path d="M2 12a10 10 0 0 1 18-6" /> <path d="M2 16h.01" /> <path d="M21.8 16c.2-2 .131-5.354 0-6" /> <path d="M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2" /> <path d="M8.65 22c.21-.66.45-1.32.57-2" /> <path d="M9 6.8a6 6 0 0 1 9 5.2v2" />',wallet:'<path d="M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1" /> <path d="M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4" />',banknote:'<rect width="20" height="12" x="2" y="6" rx="2" /> <circle cx="12" cy="12" r="2" /> <path d="M6 12h.01" /> <path d="M18 12h.01" />',hotel:'<path d="M10 22v-6.57" /> <path d="M12 11h.01" /> <path d="M12 7h.01" /> <path d="M14 15.43V22" /> <path d="M15 16a5 5 0 0 0-6 0" /> <path d="M16 11h.01" /> <path d="M16 7h.01" /> <path d="M8 11h.01" /> <path d="M8 7h.01" /> <rect x="4" y="2" width="16" height="20" rx="2" />',tag:'<path d="M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z" /> <circle cx="7.5" cy="7.5" r=".5" fill="currentColor" />',search:'<path d="m21 21-4.34-4.34" /> <circle cx="11" cy="11" r="8" />',"chevron-down":'<path d="m6 9 6 6 6-6" />',"chevron-right":'<path d="m9 18 6-6-6-6" />',"chevron-left":'<path d="m15 18-6-6 6-6" />',plus:'<path d="M5 12h14" /> <path d="M12 5v14" />',"more-horizontal":'<circle cx="5" cy="12" r="1" fill="currentColor" /> <circle cx="12" cy="12" r="1" fill="currentColor" /> <circle cx="19" cy="12" r="1" fill="currentColor" />',x:'<path d="M18 6 6 18" /> <path d="m6 6 12 12" />',list:'<path d="M3 5h.01" /> <path d="M3 12h.01" /> <path d="M3 19h.01" /> <path d="M8 5h13" /> <path d="M8 12h13" /> <path d="M8 19h13" />',"sliders-horizontal":'<path d="M10 5H3" /> <path d="M12 19H3" /> <path d="M14 3v4" /> <path d="M16 17v4" /> <path d="M21 12h-9" /> <path d="M21 19h-5" /> <path d="M21 5h-7" /> <path d="M8 10v4" /> <path d="M8 12H3" />',"grip-vertical":'<circle cx="9" cy="5" r="1" fill="currentColor" /> <circle cx="9" cy="12" r="1" fill="currentColor" /> <circle cx="9" cy="19" r="1" fill="currentColor" /> <circle cx="15" cy="5" r="1" fill="currentColor" /> <circle cx="15" cy="12" r="1" fill="currentColor" /> <circle cx="15" cy="19" r="1" fill="currentColor" />',pencil:'<path d="M12 20h9" /> <path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" />',"trash-2":'<path d="M3 6h18" /> <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" /> <path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" /> <path d="M10 11v6" /> <path d="M14 11v6" />',"refresh-cw":'<path d="M21 12a9 9 0 0 0-15.38-6.36L3 8" /> <path d="M3 3v5h5" /> <path d="M3 12a9 9 0 0 0 15.38 6.36L21 16" /> <path d="M16 16h5v5" />',"arrow-up":'<path d="m18 15-6-6-6 6" />',"arrow-down":'<path d="m6 9 6 6 6-6" />',check:'<path d="M20 6 9 17l-5-5" />',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" /> <path d="M12 9v4" /> <path d="M12 17h.01" />',info:'<circle cx="12" cy="12" r="10" /> <path d="M12 16v-4" /> <path d="M12 8h.01" />',bell:'<path d="M10.268 21a2 2 0 0 0 3.464 0" /> <path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" />',mail:'<path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7" /> <rect x="2" y="4" width="20" height="16" rx="2" />',moon:'<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" />',sun:'<circle cx="12" cy="12" r="4" /> <path d="M12 2v2" /> <path d="M12 20v2" /> <path d="m4.93 4.93 1.42 1.42" /> <path d="m17.66 17.66 1.41 1.41" /> <path d="M2 12h2" /> <path d="M20 12h2" /> <path d="m6.34 17.66-1.41 1.41" /> <path d="m19.07 4.93-1.41 1.41" />',"log-out":'<path d="m16 17 5-5-5-5" /> <path d="M21 12H9" /> <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />',"building-2":'<path d="M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18" /> <path d="M6 12H4a2 2 0 0 0-2 2v8h20v-8a2 2 0 0 0-2-2h-2" /> <path d="M10 6h4" /> <path d="M10 10h4" /> <path d="M10 14h4" /> <path d="M10 18h4" />'},Ji='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-ui="icon" aria-hidden="true">';var je=e=>Ni(e&&Da[e]?Ji+Da[e]+"</svg>":"");import{signal as of}from"/_ket/view/index.js";import{jsx as Bg}from"/_ket/view/jsx-runtime.js";import{jsx as Ye,jsxs as Vi}from"/_ket/view/jsx-runtime.js";var St=e=>Vi("form",{"data-ui":"record-form",method:"post",action:"","data-record-kind":e.kind,id:e.id,"data-record-dirty":e.dirty===!0?"true":null,children:[e.command?Ye("input",{type:"hidden",name:Aa,value:e.command,autocomplete:"off"}):"",Object.entries(e.hidden??{}).map(([d,i])=>Ye("input",{type:"hidden",name:d,value:i,autocomplete:"off"})),Ye("div",{"data-ui":"form-grid",children:e.fields.map(d=>W(d))}),e.body,e.actions?.length?Ye("div",{"data-ui":"form-actions",children:we({actions:e.actions})}):""]});import{Fragment as mf,jsx as ff,jsxs as gf}from"/_ket/view/jsx-runtime.js";var $a=e=>{let d=e??{};return(Array.isArray(d.errors)?d.errors:Array.isArray(d.issues)?d.issues:[]).map(m=>{let l=m??{},c=Array.isArray(l.path)?l.path.join("."):null;return{field:typeof l.field=="string"?l.field:c,code:String(l.code??"invalid"),message:typeof l.message=="string"?l.message:null,params:l.params&&typeof l.params=="object"?l.params:{}}})},qi=async(e,d,i={})=>{let m=new URL(e,"https://record.invalid");if(m.origin!=="https://record.invalid"||!e.startsWith("/")||e.startsWith("//"))throw new Error("Record commands require a same-origin route");let l=await fetch(m.pathname+m.search,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json",...i.idempotencyKey?{"idempotency-key":i.idempotencyKey}:{}},body:JSON.stringify(d),signal:i.signal}),c=await l.json().catch(()=>({}));if(!l.ok||c.ok===!1)return{ok:!1,issues:$a(c.error??c),message:l.status>=500?null:c.error?.message??c.message??null,status:l.status};let R=c.value;return R&&typeof R=="object"&&R.ok===!1?{ok:!1,issues:$a(R),message:null,status:l.status}:{ok:!0,value:c.value}},ye=(e,d,i={})=>qi(`/_ket/fn/${encodeURIComponent(e)}`,d,i);var df=Object.freeze({"recordModal.close":"Close","recordModal.loading":"Loading\u2026","recordModal.loadFailed":"The record could not be read.","recordModal.notFound":"The record is gone or you cannot see it.","recordModal.retry":"Retry","recordModal.errorTitle":"Not saved","recordModal.saveFailed":"That did not work. Try again.","recordModal.savedTitle":"Saved","recordModal.saved":"The change is in.","recordModal.unsaved":"Discard what you typed?","recordModal.uploadFailed":"The file could not be uploaded. Try again."});var Aa="__command";var cf=["a[href]","button:not(:disabled)",'input:not(:disabled):not([type="hidden"])',"select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"])'].join(", ");import{signal as Me}from"/_ket/view/index.js";import{Fragment as Xi,jsx as ue,jsxs as zi}from"/_ket/view/jsx-runtime.js";var Ka=e=>{let d=Me(!1),i=Me(!1),m=Me(""),l=Me(""),c=Me({}),R=Me(!1),v="",g=!1,h=new Map,f=`${e.id}-create-attribute`,A=C=>queueMicrotask(()=>{if(g)return;let S=document.getElementById(C);(S?.querySelector("button")??S)?.focus()}),B=()=>{d.set(!1),m.set(""),l.set(""),c.set({}),R.set(!1),h.clear(),e.returnFocus?queueMicrotask(e.returnFocus):A(`${f}-toggle`)},I=async C=>{if(C.preventDefault(),C.stopPropagation(),!e.enabled||e.disabled()||i())return;let S=l().split(/\r?\n/u).map(T=>T.trim()).filter(Boolean),K={};if(m().trim()||(K.name=e.t("attributeNameRequired")),S.length||(K.values=e.t("attributeValuesRequired")),new Set(S.map(T=>T.normalize("NFC").toLowerCase())).size!==S.length&&(K.values=e.t("attributeValuesDuplicate")),c.set(K),R.set(!1),Object.keys(K).length){A(`${f}-${K.name?"name":"values"}`);return}let E={id:v,name:m().trim(),displayType:"select",createVariant:"always",values:S.map(T=>(h.has(T)||h.set(T,crypto.randomUUID()),{id:h.get(T),name:T}))};i.set(!0);try{let T=await ye("product.saveAttributeDraft",E);if(g)return;if(!T.ok){let F={};for(let y of T.issues)y.field==="name"?F.name=e.t(y.code==="product.error.attribute.duplicateName"?"attributeNameDuplicate":"attributeNameRequired"):y.field?.startsWith("values")&&(F.values=e.t("attributeValuesInvalid"));c.set(F),R.set(!Object.keys(F).length),A(`${f}-${F.name?"name":F.values?"values":"submit"}`);return}e.added({attributeId:E.id,name:E.name,createVariant:E.createVariant,values:E.values.map(F=>({valueId:F.id,name:F.name}))}),document.dispatchEvent(new CustomEvent("ket:records-changed",{detail:{kind:"product.attribute",ids:[E.id]}})),B()}catch{if(g)return;R.set(!0),A(`${f}-submit`)}finally{i.set(!1)}};return{open:d,busy:i,start:(C="")=>{!e.enabled||e.disabled()||i()||(v=crypto.randomUUID(),m.set(C),d.set(!0),A(`${f}-name`))},attach:(C,S)=>{S.addEventListener("abort",()=>{g=!0}),C.addEventListener("click",K=>{let E=K.target instanceof Element?K.target.closest("button"):null;!e.enabled||!E||E.disabled||i()||e.disabled()||(E.name==="createAttribute"?(v=crypto.randomUUID(),d.set(!0),A(`${f}-name`)):E.name==="cancelAttribute"&&B())},{signal:S})},view:()=>!e.enabled||e.launcher===!1&&!d()?null:ue("div",{onInput:C=>{let S=C.target;(S instanceof HTMLInputElement||S instanceof HTMLTextAreaElement)&&(S.name==="attributeName"&&m.set(S.value),S.name==="attributeValues"&&l.set(S.value))},onSubmit:I,children:d()?ue(he,{title:e.t("createAttribute"),description:e.t("createAttributeHint"),body:zi(Xi,{children:[R()?ue(te,{tone:"danger",title:e.t("attributeCreateFailed"),message:e.t("attributeRetryHint")}):null,ue(St,{id:f,kind:e.kind,dirty:!!m()||!!l(),fields:[{id:`${f}-name`,name:"attributeName",label:e.t("attributeName"),value:m(),required:!0,disabled:i(),error:c().name,placeholder:e.t("attributeNameExample"),span:"full"},{id:`${f}-values`,name:"attributeValues",label:e.t("attributeValues"),type:"textarea",value:l(),required:!0,disabled:i(),error:c().values,help:e.t("attributeValuesHint"),placeholder:e.t("attributeValuesExample"),span:"full"}],actions:[ue("span",{id:`${f}-submit`,tabIndex:-1,children:ue($,{type:"submit",label:e.t("createAndAddAttribute"),variant:"primary",loading:i()})}),ue($,{name:"cancelAttribute",label:e.t("cancelAttribute"),variant:"tertiary",disabled:i()})]})]})}):ue("span",{id:`${f}-toggle`,tabIndex:-1,children:ue($,{name:"createAttribute",label:e.t("createAttribute"),disabled:e.disabled()})})})}};import{jsx as U,jsxs as q}from"/_ket/view/jsx-runtime.js";var Y="variantAction",et=e=>JSON.parse(JSON.stringify(e)),Gi=(e,d,i={})=>(e[d]??d).replace(/\{(\w+)\}/g,(m,l)=>String(i[l]??`{${l}}`)),tt=(e,d)=>`/files/${encodeURIComponent(e)}?size=${d}`,_i="image/avif,image/gif,image/jpeg,image/png,image/webp",De=e=>Number.isFinite(e)?e.toLocaleString("vi-VN"):"\u2014",xe=e=>{let d=Number(e);return Number.isFinite(d)?d:0},ge=e=>/^-?\d+(\.\d+)?$/.test(e.trim()),Ui=e=>{if(!ge(e))return e.trim()||"?";let d=xe(e);return`${d>0?"+":""}${De(d)}`},Wi=3,Zi=0,Na=e=>e.map(d=>({...d,valueIds:{...d.valueIds},key:d.id,open:!1}));function ji(e){let d=e.labels,i=(t,a)=>Gi(d,t,a),m=e.editable,l=et(e.setup),c=j(l.listPrice),R=j(l.catalogue),v=j(et(l.lines)),g=j(Na(l.variants)),h=j([]),f=j(!1),A=j(null),B=j({}),I=j(null),C=j(!1),S=j(null),K=j(null),E=mt(e.lightboxLabels,e.id),T=null,F=!1,y=()=>{C.set(!0),I.set(null)},p=t=>{v.set(t),y()},M=t=>{g.set(t),y()},ae=(t,a)=>M(g().map(n=>n.key===t?{...n,...a}:n)),z=t=>g().find(a=>a.key===t),w=(t,a)=>{setTimeout(()=>{if(F||!T)return;(T.querySelector(t)??(a?T.querySelector(a):null))?.focus()},0)},oe=`[id="${e.id}-attribute-picker"] button`,Q=t=>`button[name="${Y}"][value="${t}"]`,G=()=>v().filter(t=>t.createVariant!=="no_variant"&&t.values.length>0),me=t=>{let a=[];for(let n of G()){let r=t.valueIds[n.attributeId];if(!r||!n.values.some(s=>s.valueId===r))return null;a.push(r)}return a.join(",")},Se=()=>{let t=new Map,a=new Map;return g().forEach((n,r)=>{if(!n.active)return;let s=me(n);if(s==null)return;let u=t.get(s);u===void 0?t.set(s,r):(a.set(n.key,u+1),a.set(g()[u].key,r+1))}),a},ke=()=>new Set(g().filter(t=>t.active&&me(t)==null).map(t=>t.key)),le=t=>G().flatMap(a=>{let n=a.values.find(r=>r.valueId===t.valueIds[a.attributeId]);return n?[{line:a,value:n}]:[]}),Ae=t=>le(t).reduce((a,{value:n})=>a+xe(n.priceExtra),xe(c())),Te=()=>{let t=G();if(!t.length)return[];let a=t.reduce((r,s)=>r.flatMap(u=>s.values.map(V=>({...u,[s.attributeId]:V.valueId}))),[{}]),n=new Set(g().filter(r=>r.active).map(me).filter(r=>r!=null));return a.filter(r=>!n.has(t.map(s=>r[s.attributeId]).join(",")))},$e=t=>G().length?G().map(a=>a.values.find(n=>n.valueId===t[a.attributeId])?.name??i("choose",{name:a.name})).join(" / "):i("defaultVariant"),at=(t,a)=>g().filter(n=>n.active&&n.valueIds[t]===a).length,Ke=()=>v().some(t=>t.values.some(a=>!ge(a.priceExtra))),Pe=t=>!ge(t.weight)||!ge(t.volume),Be=()=>g().some(Pe),Le=()=>!m||f()||fe.open()||!C()||Se().size>0||ke().size>0||Ke()||Be(),Ee=t=>{let a=R().find(n=>n.attributeId===t.attributeId)?.values??[];return[...a,...t.values.filter(n=>!a.some(r=>r.valueId===n.valueId))]},Fe=t=>`input[name="values|${t}[]"]`,fe=Ka({id:e.id,kind:e.kind,enabled:m&&e.createAttribute===!0,launcher:!1,returnFocus:()=>T?.querySelector(oe)?.focus(),disabled:f,t:i,added:t=>{R.set([...R(),t]),l.catalogue=[...l.catalogue,t],p([...v(),{attributeId:t.attributeId,name:t.name,createVariant:t.createVariant,displayType:"select",values:t.values.map(a=>({...a,priceExtra:"0"}))}]),w(Fe(t.attributeId))}}),o=t=>{let a=R().find(n=>n.attributeId===t);a&&(p([...v(),{attributeId:t,name:a.name,createVariant:a.createVariant,displayType:"select",values:[]}]),w(Fe(t),oe))},b=ut({id:`${e.id}-attribute-picker`,config:{name:"addAttributeId",ariaLabel:i("addAttribute"),options:[],labels:{...e.relationLabels,choose:i("addAttribute"),create:i("createAttribute")}}},{options:()=>R().filter(t=>!v().some(a=>a.attributeId===t.attributeId)).map(t=>({value:t.attributeId,label:t.name,description:t.values.map(a=>a.name).join(" \xB7 ")})),disabled:()=>!m||f()||fe.open(),resetAfterSelect:!0,onSelect:t=>o(t.value),...m&&e.createAttribute?{onCreate:t=>fe.start(t)}:{}}),L=t=>{p(v().filter(a=>a.attributeId!==t)),M(g().map(a=>{let n={...a.valueIds};return delete n[t],{...a,valueIds:n}})),h.set(h().filter(a=>a!==t)),w(oe)},O=(t,a)=>{let n=v().find(k=>k.attributeId===t);if(!n)return;let r=Ee(n),s=a.filter(k=>!n.values.some(X=>X.valueId===k));if(!s.length)return;let u=l.lines.find(k=>k.attributeId===t),V=s.flatMap(k=>{let X=r.find(rt=>rt.valueId===k);if(!X)return[];let nt=u?.values.find(rt=>rt.valueId===k)?.priceExtra??"0";return[{valueId:k,name:X.name,priceExtra:nt}]}),_=k=>r.findIndex(X=>X.valueId===k);p(v().map(k=>k.attributeId===t?{...k,values:[...k.values,...V].sort((X,nt)=>_(X.valueId)-_(nt.valueId))}:k))},H=(t,a)=>p(v().map(n=>n.attributeId===t?{...n,values:n.values.filter(r=>r.valueId!==a)}:n)),ee=(t,a,n)=>p(v().map(r=>r.attributeId===t?{...r,values:r.values.map(s=>s.valueId===a?{...s,priceExtra:n}:s)}:r)),kt=(t,a)=>({id:"",key:`new-${++Zi}`,valueIds:t,defaultCode:null,barcode:null,weight:"0",volume:"0",active:!0,images:[],open:a}),Ja=()=>{let t=kt({},!0);M([...g(),t]),w(`[name^="combo|${t.key}|"], [name="field|${t.key}|defaultCode"]`)},Va=()=>{let t=Te().map(a=>kt(a,!1));t.length&&(M([...g(),...t]),w(Q(`toggleRow|${t[0].key}`)))},qa=t=>{g.set(g().map(a=>a.key===t?{...a,open:!a.open}:a))},Xa=t=>{let a=z(t);if(!a)return;if(a.id){ae(t,{active:!a.active});return}let n=g().indexOf(a),r=g()[n+1]??g()[n-1];M(g().filter(s=>s.key!==t)),w(Q(r?`toggleRow|${r.key}`:"addRow"),Q("generate"))},Tt=t=>{M(g().filter(a=>a.id||t).map(a=>({...a,active:t}))),w(Q(t?"archiveAll":"activateAll"),Q("addRow"))},wt=(t,a)=>{g.set(g().map(n=>n.key===t.key?{...n,images:a}:n)),l={...l,variants:l.variants.map(n=>n.id===t.id?{...n,images:a}:n)}},Rt=async(t,a)=>{let n=t.images.length>0;if(!(!t.id||!e.media.upload||n&&!e.media.remove)&&!(S()||!a.type.startsWith("image/"))){S.set(t.key),A.set(null);try{let r=new FormData;r.append("resModel","product.Product"),r.append("resId",t.id),r.append("resField","media"),r.append("public","false"),r.append("file",a,a.name);let s=await fetch("/files",{method:"POST",credentials:"same-origin",body:r}),u=await s.json().catch(()=>null);if(!s.ok||typeof u?.id!="string")throw new Error(i("imageFailed"));let V=await ye("product_media.attachMedia",{id:u.id,attachmentId:u.id,productId:t.id,alt:a.name,primary:!0});if(!V.ok)throw new Error(V.message??V.issues[0]?.message??i("imageFailed"));let _=t.images.find(k=>k.primary);_&&await ye("product_media.removeMedia",{id:_.mediaId}),wt(t,[{mediaId:u.id,attachmentId:u.id,alt:a.name,primary:!0},...t.images.filter(k=>k!==_)]),document.dispatchEvent(new CustomEvent("ket:records-changed",{detail:{kind:e.kind,ids:[l.templateId]}}))}catch(r){A.set(r instanceof Error?r.message:i("imageFailed"))}finally{S.set(null)}}},za=async t=>{let a=t.images[0];if(!a||!e.media.remove||S()||!globalThis.confirm(i("imageRemoveConfirm")))return;S.set(t.key),A.set(null);let n=await ye("product_media.removeMedia",{id:a.mediaId}).catch(()=>null);if(S.set(null),!n?.ok){A.set(n&&!n.ok?n.message??i("saveFailed"):i("saveFailed"));return}let r=t.images.slice(1);wt(t,r.map((s,u)=>({...s,primary:u===0})))},Ga=(t,a)=>E.open(t.images.map(n=>({src:tt(n.attachmentId,"large"),thumbnail:tt(n.attachmentId,"thumb"),alt:n.alt||i("image"),caption:n.alt})),0,a),Ct=()=>{c.set(l.listPrice),R.set(l.catalogue),v.set(et(l.lines)),g.set(Na(l.variants)),B.set({}),A.set(null),C.set(!1)},_a=async()=>{if(Le())return;f.set(!0),A.set(null),B.set({});let t=g(),a=await ye(e.saveFunction,{templateId:l.templateId,lines:v().map(r=>({attributeId:r.attributeId,values:r.values.map(s=>({valueId:s.valueId,priceExtra:s.priceExtra.trim()}))})),variants:t.map(r=>({id:r.id||null,valueIds:r.valueIds,defaultCode:r.defaultCode,barcode:r.barcode,weight:r.weight,volume:r.volume,active:r.active}))}).catch(()=>null);if(f.set(!1),!a){A.set(i("saveFailed"));return}if(!a.ok){let r={};for(let s of a.issues){let u=/^variants\.(\d+)(?:\.(\w+))?/.exec(s.field??""),V=u?t[Number(u[1])]:void 0;V&&(r[V.key]=s.message??s.code)}B.set(r),A.set(a.message??a.issues[0]?.message??i("saveFailed")),Object.keys(r).length&&g.set(g().map(s=>r[s.key]?{...s,open:!0}:s));return}let n=a.value.setup;n&&(l=et(n)),Ct(),I.set(i("saved",{created:a.value.created??0,archived:a.value.archived??0})),document.dispatchEvent(new CustomEvent("ket:records-changed",{detail:{kind:e.kind,ids:[l.templateId]}}))},Ua=t=>{let a=t.target instanceof Element?t.target.closest("button"):null;if(!a||a.name!==Y||a.disabled||!Wa(a.value))return;let[n,r=""]=a.value.split("|");if(n==="toggleRow")qa(r);else if(n==="selectAll"){let s=v().find(u=>u.attributeId===r);s&&O(r,Ee(s).map(u=>u.valueId)),w(Fe(r))}else if(n==="removeLine")L(r);else if(n==="removeRow")Xa(r);else if(n==="generate")Va();else if(n==="addRow")Ja();else if(n==="activateAll")Tt(!0);else if(n==="archiveAll")Tt(!1);else if(n==="removeImage"){let s=z(r);s&&za(s)}else n==="reset"&&(Ct(),w(oe))},Wa=t=>t.startsWith("toggleRow|")||m&&!f(),Za=t=>{let a=t.target;if(!(!m||f())){if(a instanceof HTMLInputElement&&a.type==="checkbox"){let n=/^values\|(.+)\[\]$/.exec(a.name);if(!n)return;a.checked?O(n[1],[a.value]):H(n[1],a.value)}else if(a instanceof HTMLSelectElement){let[n,r,s]=a.name.split("|"),u=n==="combo"&&r?z(r):void 0;u&&s&&ae(u.key,{valueIds:{...u.valueIds,[s]:a.value}})}else if(a instanceof HTMLInputElement&&a.type==="file"){let[n,r]=a.name.split("|"),s=n==="image"&&r?z(r):void 0,u=a.files?.[0];a.value="",s&&u&&Rt(s,u)}}},ja=t=>{let a=t.target;if(!m||f()||!(a instanceof HTMLInputElement))return;let[n,r,s]=a.name.split("|");if(!(!r||!s)){if(n==="extra")ee(r,s,a.value);else if(n==="field"&&["defaultCode","barcode","weight","volume"].includes(s)){let u=s==="weight"||s==="volume";ae(r,{[s]:u?a.value:a.value||null})}}},Ya=t=>{let[a,n,r]=t.split("|");if(!n||!r)return;if(a==="extra")return v().find(u=>u.attributeId===n)?.values.find(u=>u.valueId===r)?.priceExtra;let s=z(n);if(s){if(a==="combo")return s.valueIds[r]??"";if(a==="field")return String(s[r]??"")}},Qa=()=>{if(T){for(let t of T.querySelectorAll('input[type="checkbox"][name^="values|"]')){let a=t.name.slice(7,-2),n=v().find(r=>r.attributeId===a)?.values.some(r=>r.valueId===t.value)??!1;t.checked!==n&&(t.checked=n)}for(let t of T.querySelectorAll('input[name^="extra|"], input[name^="field|"], select[name^="combo|"]')){if(t===document.activeElement&&t instanceof HTMLInputElement)continue;let a=Ya(t.name);a!==void 0&&t.value!==a&&(t.value=a)}}},ei=t=>{let a=t.values.filter(r=>!ge(r.priceExtra)||xe(r.priceExtra)!==0),n=t.values.some(r=>!ge(r.priceExtra));return U("div",{"data-ui":"variant-editor-extras","data-attribute":t.attributeId,children:He({summary:a.length?i("priceExtrasSet",{list:a.map(r=>`${r.name} ${Ui(r.priceExtra)}`).join(", ")}):i("priceExtrasNone"),open:n||h().includes(t.attributeId),body:U("div",{"data-ui":"variant-editor-extra-fields",children:Qe(t.values,r=>r.valueId,r=>pt({id:`${e.id}-extra-${t.attributeId}-${r.valueId}`,name:`extra|${t.attributeId}|${r.valueId}`,label:r.name,value:r.priceExtra,step:"any",disabled:!m||f(),help:i("appliesTo",{count:at(t.attributeId,r.valueId)}),error:ge(r.priceExtra)?null:i("invalidNumber")}))})})})},ti=t=>{let a=Ee(t),n=m?a:t.values,r=new Set(t.values.map(u=>u.valueId)),s=t.createVariant==="no_variant";return q("li",{"data-ui":"variant-editor-line","data-empty":String(!t.values.length),children:[q("div",{"data-ui":"variant-editor-line-main",children:[ht({id:`${e.id}-values-${t.attributeId}`,name:`values|${t.attributeId}`,label:t.name,span:"full",disabled:!m||f(),options:n.map(u=>({value:u.valueId,label:u.name,checked:r.has(u.valueId)})),help:s?i("noVariantHint"):t.values.length?i("valuesSelected",{count:t.values.length,total:a.length}):i("valuesNone")}),q("div",{"data-ui":"variant-editor-line-actions",children:[s?ie({label:i("noVariant"),tone:"neutral"}):null,m&&r.size<a.length?$({name:Y,value:`selectAll|${t.attributeId}`,label:i("selectAll"),variant:"tertiary",size:"compact",disabled:f()}):null,m?ot({name:Y,value:`removeLine|${t.attributeId}`,label:i("removeAttributeNamed",{name:t.name}),icon:je("x"),size:"compact",disabled:f()}):null]})]}),t.values.length?ei(t):null]})},ai=()=>he({eyebrow:i("stepAttributes"),title:i("attributesTitle"),description:i("attributesHint"),actions:m?U("div",{"data-ui":"variant-editor-picker",id:`${e.id}-attribute-picker`,children:b.view()}):void 0,body:q("div",{"data-ui":"variant-editor-body",children:[v().length?U("ul",{"data-ui":"variant-editor-lines",children:Qe(v(),t=>t.attributeId,t=>ti(t))}):de({title:i("attributesEmpty"),message:m?i("attributesEmptyHint"):""}),fe.view()]})}),Mt=(t,a)=>{let n=t.images[0];return n?gt({item:{src:tt(n.attachmentId,"large"),thumbnail:tt(n.attachmentId,"thumb"),alt:n.alt||i("image")},labels:e.lightboxLabels,size:a,onOpen:r=>Ga(t,r)}):U("span",{"data-ui":"lightbox-empty","data-size":a,children:a==="small"?"":i("image")})},ii=(t,a)=>{let n=m&&e.media.upload&&(!t.images.length||e.media.remove),r=S()===t.key;return q("div",{role:"group","aria-label":i("image"),"data-ui":"variant-editor-image","data-drag":String(K()===t.key),"data-busy":String(r),onDragOver:s=>{!n||!t.id||(s.preventDefault(),K.set(t.key))},onDragLeave:s=>{let u=s.relatedTarget;u instanceof Node&&s.currentTarget.contains(u)||K.set(null)},onDrop:s=>{if(!n||!t.id)return;s.preventDefault(),K.set(null);let u=s.dataTransfer?.files?.[0];u&&Rt(t,u)},children:[Mt(t,"large"),q("div",{"data-ui":"variant-editor-image-actions",children:[n&&t.id?xt({id:`${a}-image`,name:`image|${t.key}`,label:t.images.length?i("replaceImage"):i("uploadImage"),accept:_i,disabled:r||f(),status:i("dropImage"),span:"full"}):null,n&&!t.id?U("small",{"data-ui":"variant-editor-hint",children:i("imageSaveFirst")}):null,m&&e.media.remove&&t.images.length?$({name:Y,value:`removeImage|${t.key}`,label:i("removeImage"),variant:"tertiary",size:"compact",disabled:r||f()}):null]})]})},Ne=(t,a,n)=>{let r=String(t[n]??""),s={id:`${a}-${n}`,name:`field|${t.key}|${n}`,label:i(n),value:r,disabled:!m||f()};return n==="weight"||n==="volume"?W({...s,type:"decimal",step:"any",error:ge(r)?null:i("invalidNumber")}):bt(s)},ni=(t,a,n)=>t.active?a.has(t.key)?ie({label:i("duplicate",{row:a.get(t.key)}),tone:"danger"}):Pe(t)?ie({label:i("rowInvalid"),tone:"danger"}):n.has(t.key)?ie({label:i("incomplete"),tone:"warning"}):t.id?null:ie({label:i("new"),tone:"info"}):ie({label:i("archived"),tone:"neutral"}),ri=(t,a,n,r)=>{let s=`${e.id}-row-${t.key}`,u=`${s}-title`,V=le(t).filter(({value:k})=>xe(k.priceExtra)!==0),_=B()[t.key];return q("article",{"data-ui":"variant-editor-row",role:"listitem","data-active":String(t.active),"data-open":String(t.open),"data-invalid":String(n.has(t.key)||!!_||Pe(t)),children:[q("div",{"data-ui":"variant-editor-row-head",children:[U("span",{"data-ui":"variant-editor-row-number",children:`#${a+1}`}),Mt(t,"small"),q("div",{"data-ui":"variant-editor-row-title",children:[U("strong",{id:u,"data-incomplete":String(r.has(t.key)),children:$e(t.valueIds)}),t.defaultCode?U("small",{children:t.defaultCode}):null]}),q("div",{"data-ui":"variant-editor-row-meta",children:[ni(t,n,r),U("span",{"data-ui":"variant-editor-row-price",children:De(Ae(t))})]}),q("div",{"data-ui":"variant-editor-row-actions",children:[$({name:Y,value:`toggleRow|${t.key}`,label:t.open?i("collapse"):i(m?"edit":"details"),variant:"tertiary",size:"compact",expanded:t.open,controls:t.open?s:null,describedBy:u}),m?$({name:Y,value:`removeRow|${t.key}`,label:t.id?t.active?i("archive"):i("restore"):i("remove"),variant:"tertiary",size:"compact",disabled:f(),describedBy:u}):null]})]}),_?U("p",{"data-ui":"variant-editor-row-issue",children:_}):null,t.open?q("div",{"data-ui":"variant-editor-row-body",id:s,children:[ii(t,s),q("div",{"data-ui":"variant-editor-fields",children:[Qe(G(),k=>k.attributeId,k=>vt({id:`${s}-${k.attributeId}`,name:`combo|${t.key}|${k.attributeId}`,label:k.name,value:t.valueIds[k.attributeId]??"",disabled:!m||!t.active||f(),options:[{value:"",label:i("choose",{name:k.name})},...k.values.map(X=>({value:X.valueId,label:X.name}))]})),Ne(t,s,"defaultCode"),Ne(t,s,"barcode"),Ne(t,s,"weight"),Ne(t,s,"volume")]}),q("p",{"data-ui":"variant-editor-breakdown",children:[[`${i("listPrice")} ${De(xe(c()))}`,...V.map(({line:k,value:X})=>`${k.name} ${X.name} +${De(xe(X.priceExtra))}`)].join(" \xB7 "),` = ${De(Ae(t))}`]})]}):null]})},oi=t=>{let a=t.slice(0,Wi).map($e),n=t.length-a.length;return te({tone:"info",title:i("missing",{count:t.length}),message:n>0?`${a.join(", ")} ${i("missingMore",{count:n})}`:a.join(", "),actions:$({name:Y,value:"generate",label:i("generate",{count:t.length}),variant:"primary",size:"compact",leading:je("plus"),disabled:f()})})},li=()=>{let t=Se(),a=ke(),n=m?Te():[],r=g().filter(u=>u.active).length,s=m&&(G().length>0||g().length>0);return he({eyebrow:i("stepVariants"),title:i("variantsTitle"),description:g().length?i("variantsCount",{active:r,total:g().length}):null,actions:s?q("div",{"data-ui":"variant-editor-toolbar",children:[$({name:Y,value:"addRow",label:i("addVariant"),variant:"secondary",size:"compact",leading:je("plus"),disabled:f()}),g().some(u=>u.id&&!u.active)?$({name:Y,value:"activateAll",label:i("activateAll"),variant:"tertiary",size:"compact",disabled:f()}):null,r?$({name:Y,value:"archiveAll",label:i("archiveAll"),variant:"tertiary",size:"compact",disabled:f()}):null]}):void 0,body:q("div",{"data-ui":"variant-editor-body",children:[n.length?oi(n):null,g().length?U("div",{"data-ui":"variant-editor-rows",role:"list",children:Qe(g(),u=>u.key,u=>ri(u,g().indexOf(u),t,a))}):n.length?null:de({title:i("variantsEmpty"),message:G().length?i("variantsEmptyHint"):i("variantsNeedAttributes")})]})})},si=()=>{let t=Se().size,a=g().filter(u=>u.id&&!u.active&&l.variants.find(V=>V.id===u.id)?.active).length,n=g().filter(u=>!u.id&&u.active).length,r=[n?i("summaryCreate",{count:n}):"",a?i("summaryArchive",{count:a}):""].filter(Boolean),s=Ke()||Be();return q("footer",{"data-ui":"variant-editor-footer",children:[U("p",{"data-ui":"variant-editor-summary","data-tone":t||s?"danger":"neutral","aria-live":"polite",children:f()?i("saving"):t?i("summaryDuplicate"):s?i("summaryInvalid"):I()??(C()?r.join(" \xB7 ")||i("summaryChanged"):"")}),m?$({name:Y,value:"reset",label:i("reset"),variant:"secondary",size:"compact",disabled:!C()||f()}):null]})},it=Yi(e.id),di=()=>document.querySelector(`button[form="${it}"]`);return{view:()=>q("div",{"data-ui":"variant-editor",id:e.id,"aria-busy":f()?"true":null,onClick:Ua,onChange:Za,onInput:ja,children:[m?null:te({title:i("readOnly"),message:""}),A()?te({title:i("saveFailed"),message:A()??"",tone:"danger"}):null,ai(),li(),si(),U("form",{id:it,"data-record-dirty":C()?"true":null,hidden:!0}),E.layer()]}),mount:({root:t,lifetime:a})=>{T=t,a.addEventListener("abort",()=>{F=!0,T=null}),fe.attach(T,a);let n=T.querySelector(`[id="${e.id}-attribute-picker"]`);n&&b.mount?.({root:n,lifetime:a}),a.addEventListener("abort",()=>b.dispose?.()),E.attach(a),T.addEventListener("toggle",u=>{let V=u.target;if(!(V instanceof HTMLDetailsElement))return;let _=V.closest('[data-ui="variant-editor-extras"]')?.dataset.attribute;if(!_)return;let k=h().filter(X=>X!==_);h.set(V.open?[...k,_]:k)},{signal:a,capture:!0}),document.addEventListener("submit",u=>{!(u.target instanceof HTMLFormElement)||u.target.id!==it||(u.preventDefault(),u.stopImmediatePropagation(),Le()||_a())},{signal:a,capture:!0});let r=Ba(()=>{let u=di();u&&(u.disabled=Le(),f()?u.setAttribute("aria-busy","true"):u.removeAttribute("aria-busy"))}),s=Ba(()=>{v(),g(),queueMicrotask(Qa)});a.addEventListener("abort",()=>{r(),s()})}}}var Yi=e=>`${e}-save`,Pf=e=>ji(e);export{ji as createVariantEditorView,Pf as variantEditor,Yi as variantEditorSaveForm};
2
+ import{each as tt,effect as Ka,signal as Z}from"/_ket/view/index.js";import{each as un}from"/_ket/view/index.js";import{Fragment as Pt,jsx as se,jsxs as mn}from"/_ket/view/jsx-runtime.js";var Lt=["action","action-leading","action-label","action-spinner","action-group"],Et=e=>mn(Pt,{children:[e.loading===!0&&se("span",{"data-ui":"action-spinner","aria-hidden":"true"}),e.loading!==!0&&e.leading!==void 0&&se("span",{"data-ui":"action-leading","aria-hidden":"true",children:e.leading}),!e.iconOnly&&se("span",{"data-ui":"action-label",children:e.label})]}),A=e=>se("button",{"data-ui":"action","data-variant":e.variant??"secondary","data-size":e.size??"default",type:e.type??"button",name:e.name??null,value:e.value??null,form:e.form??null,disabled:e.disabled===!0||e.loading===!0,"aria-busy":e.loading===!0?"true":null,"aria-describedby":e.describedBy??null,"aria-expanded":e.expanded===void 0?null:String(e.expanded),"aria-controls":e.controls??null,children:se(Et,{...e})}),Je=e=>se("button",{"data-ui":"action","data-icon-only":"true","data-variant":e.variant??"tertiary","data-size":e.size??"default",type:e.type??"button",name:e.name??null,value:e.value??null,form:e.form??null,disabled:e.disabled===!0||e.loading===!0,"aria-label":e.label,"aria-pressed":e.pressed===void 0?null:String(e.pressed),"aria-busy":e.loading===!0?"true":null,"aria-describedby":e.describedBy??null,"aria-expanded":e.expanded===void 0?null:String(e.expanded),"aria-controls":e.controls??null,title:e.label,children:se(Et,{...e,leading:e.icon,iconOnly:!0})});var be=e=>se("div",{"data-ui":"action-group",role:"group","aria-label":e.label??null,children:un(e.actions,(d,n)=>n,d=>se(Pt,{children:d}))});import{jsx as gn,jsxs as ri}from"/_ket/view/jsx-runtime.js";var Ht=["badge","tag","tag-remove","count-badge","avatar","code","text","media-label","media-label-image","media-label-copy"];var ne=e=>gn("span",{"data-ui":"badge","data-pattern":"badge","data-tone":e.tone??"neutral","data-value":e.value??"",children:e.label});import{each as si}from"/_ket/view/index.js";import{Fragment as Xe,jsx as N,jsxs as pe}from"/_ket/view/jsx-runtime.js";var Ft=["notice","notice-mark","notice-copy","notice-title","notice-message","notice-actions","empty","empty-mark","empty-title","empty-message","empty-actions","loading","loading-label"],fn={info:()=>pe(Xe,{children:[N("circle",{cx:"12",cy:"12",r:"10"}),N("path",{d:"M12 16v-4"}),N("path",{d:"M12 8h.01"})]}),positive:()=>pe(Xe,{children:[N("circle",{cx:"12",cy:"12",r:"10"}),N("path",{d:"m9 12 2 2 4-4"})]}),warning:()=>pe(Xe,{children:[N("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),N("path",{d:"M12 9v4"}),N("path",{d:"M12 17h.01"})]}),danger:()=>pe(Xe,{children:[N("circle",{cx:"12",cy:"12",r:"10"}),N("path",{d:"M12 8v4"}),N("path",{d:"M12 16h.01"})]})},te=e=>pe("aside",{"data-ui":"notice","data-pattern":"notice","data-tone":e.tone??"info",role:e.tone==="danger"?"alert":"status",children:[N("span",{"data-ui":"notice-mark","aria-hidden":"true",children:N("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false",children:fn[e.tone??"info"]()})}),pe("div",{"data-ui":"notice-copy",children:[N("p",{"data-ui":"notice-title",children:e.title}),N("p",{"data-ui":"notice-message",children:e.message})]}),e.actions!==void 0&&N("div",{"data-ui":"notice-actions",children:e.actions})]}),de=e=>pe("div",{"data-ui":"empty",role:"status",children:[N("span",{"data-ui":"empty-mark","aria-hidden":"true",children:"\u25C7"}),N("p",{"data-ui":"empty-title",children:e.title}),N("p",{"data-ui":"empty-message",children:e.message}),e.actions!==void 0&&N("div",{"data-ui":"empty-actions",children:e.actions})]});import{each as dt}from"/_ket/view/index.js";import{each as Pi}from"/_ket/view/index.js";import{jsx as mi,jsxs as gi}from"/_ket/view/jsx-runtime.js";var It=["modal-layer","modal-backdrop","modal-sheet","modal-head","modal-heading","modal-title-row","modal-title","modal-description","modal-close","modal-body","modal-actions"];import{Fragment as vi,jsx as pi,jsxs as hi}from"/_ket/view/jsx-runtime.js";import{Fragment as Ri,jsx as Ti,jsxs as wi}from"/_ket/view/jsx-runtime.js";var Dt=["app-shell","app-shell-topbar","app-topbar","app-location-bar","app-location-context","app-brand","app-topbar-brand","app-topbar-context","global-search-trigger","global-search-trigger-label","global-search-shortcut","global-search-dialog","global-search","global-search-input","global-search-submit","app-sidebar","app-main","app-right-rail","page","page-context","page-header","page-heading","page-eyebrow","page-title-row","page-title","page-subline","page-status","page-actions","page-meta","page-body","record-canvas","record-content","record-section","record-section-title"];import{Fragment as Ii,jsx as he,jsxs as Ge}from"/_ket/view/jsx-runtime.js";var At=["stack","inline","grid","card-grid","surface","surface-head","surface-heading","surface-title","surface-description","surface-actions","disclosure","disclosure-summary","disclosure-body","section","section-head","section-eyebrow","section-title","section-description","section-actions","section-body","content-card","card-media","card-head","card-leading","card-heading","card-eyebrow","card-title","card-summary","card-status","card-body","card-meta","card-actions","kanban","kanban-card","kanban-media","kanban-title","kanban-meta","kanban-note","kanban-actions","metric","metric-icon","metric-label","metric-value","metric-detail"];var Fe=e=>Ge("details",{"data-ui":"disclosure",open:e.open===!0?!0:void 0,children:[he("summary",{"data-ui":"disclosure-summary",children:e.summary}),he("div",{"data-ui":"disclosure-body",children:e.body})]}),ve=e=>Ge("section",{"data-ui":"section",children:[Ge("header",{"data-ui":"section-head",children:[Ge("div",{children:[!!e.eyebrow&&he("p",{"data-ui":"section-eyebrow",children:e.eyebrow}),he("h2",{"data-ui":"section-title",children:e.title}),!!e.description&&he("p",{"data-ui":"section-description",children:e.description})]}),e.actions!==void 0&&he("div",{"data-ui":"section-actions",children:e.actions})]}),he("div",{"data-ui":"section-body",children:e.body})]});import{each as xn}from"/_ket/view/index.js";import{Fragment as Sn,jsx as Ie}from"/_ket/view/jsx-runtime.js";var Ue=(e,d)=>e.control!==void 0?Ie(Sn,{children:e.control}):e.type==="textarea"?Ie("textarea",{"data-ui":"field-control","data-appearance":e.appearance==="embedded"?"embedded":null,id:e.id,name:e.name,placeholder:e.placeholder??null,required:e.required===!0,disabled:e.disabled===!0,readonly:e.readOnly===!0,"aria-invalid":e.error?"true":null,"aria-describedby":d,children:String(e.value??"")}):e.type==="select"?Ie("select",{"data-ui":"field-control","data-appearance":e.appearance==="embedded"?"embedded":null,id:e.id,name:e.name,required:e.required===!0,disabled:e.disabled===!0,"aria-invalid":e.error?"true":null,"aria-describedby":d,children:xn(e.options??[],n=>n.value,n=>Ie("option",{value:n.value,selected:String(e.value??"")===n.value,disabled:n.disabled===!0,children:n.label}))}):Ie("input",{"data-ui":"field-control","data-appearance":e.appearance==="embedded"?"embedded":null,id:e.id,type:e.type==="decimal"?"number":e.type??"text",name:e.name,value:e.type==="checkbox"?"1":String(e.value??""),checked:e.type==="checkbox"&&(e.value===!0||e.value==="1"),placeholder:e.placeholder??null,required:e.required===!0,disabled:e.disabled===!0,readonly:e.readOnly===!0,min:e.min,max:e.max,"aria-invalid":e.error?"true":null,"aria-describedby":d,autocomplete:e.autocomplete??"off",step:e.type==="decimal"?e.step??"any":e.step??null});import{jsx as q,jsxs as ce}from"/_ket/view/jsx-runtime.js";var $t=["field","field-label","field-required","field-control","field-options","field-option","field-option-input","field-help","field-error"],Bt=e=>!!e.error||(e.fields?.some(Bt)??!1),W=e=>{let d=e.help?`${e.id}-help`:null,n=e.error?`${e.id}-error`:null,m=[d,n].filter(Boolean).join(" ")||null,l=ce("span",{"data-ui":"field-label",children:[e.label,e.required&&q("span",{"data-ui":"field-required","aria-hidden":"true",children:" *"})]});return e.fields?ce("div",{"data-ui":"field","data-kind":"group","data-span":"full","data-invalid":String(!!e.error),children:[q(Fe,{summary:e.label,open:e.open||Bt(e),body:q("div",{"data-ui":"form-grid",children:dt(e.fields.map(c=>({...c,disabled:e.disabled||c.disabled,readOnly:e.readOnly||c.readOnly})),c=>c.id,c=>q(W,{...c}))})}),!!e.help&&q("small",{"data-ui":"field-help",id:d??void 0,children:e.help}),!!e.error&&q("small",{"data-ui":"field-error",id:n??void 0,children:e.error})]}):e.type==="checkbox-group"?ce("div",{"data-ui":"field","data-kind":"checkbox-group","data-span":e.span??"half","data-invalid":String(!!e.error),children:[ce("span",{"data-ui":"field-label",id:`${e.id}-label`,children:[e.label,e.required&&q("span",{"data-ui":"field-required","aria-hidden":"true",children:" *"})]}),q("div",{"data-ui":"field-options","data-orientation":e.optionsOrientation==="vertical"?"vertical":null,role:"group","aria-labelledby":`${e.id}-label`,children:dt(e.options??[],c=>c.name??c.value,c=>ce("label",{"data-ui":"field-option",children:[q("input",{"data-ui":"field-option-input",type:"checkbox",name:c.name??`${e.name}[]`,value:c.value,checked:c.checked===!0,disabled:e.disabled===!0||c.disabled===!0,"aria-invalid":e.error?"true":null,"aria-describedby":m,autocomplete:"off"}),q("span",{children:c.label})]}))}),!!e.help&&q("small",{"data-ui":"field-help",id:d??void 0,children:e.help}),!!e.error&&q("small",{"data-ui":"field-error",id:n??void 0,children:e.error})]}):e.type==="radio"?ce("div",{"data-ui":"field","data-kind":"radio","data-span":e.span??"half","data-invalid":String(!!e.error),children:[ce("span",{"data-ui":"field-label",id:`${e.id}-label`,children:[e.label,e.required&&q("span",{"data-ui":"field-required","aria-hidden":"true",children:" *"})]}),q("div",{"data-ui":"field-options","data-orientation":e.optionsOrientation==="vertical"?"vertical":null,role:"radiogroup","aria-labelledby":`${e.id}-label`,children:dt(e.options??[],c=>c.value,c=>ce("label",{"data-ui":"field-option",children:[q("input",{"data-ui":"field-option-input",type:"radio",name:e.name,value:c.value,checked:String(e.value??"")===c.value,required:e.required===!0,disabled:e.disabled===!0||c.disabled===!0,"aria-invalid":e.error?"true":null,"aria-describedby":m,autocomplete:"off"}),q("span",{children:c.label})]}))}),!!e.help&&q("small",{"data-ui":"field-help",id:d??void 0,children:e.help}),!!e.error&&q("small",{"data-ui":"field-error",id:n??void 0,children:e.error})]}):ce("label",{"data-ui":"field","data-kind":e.type??"text","data-label-hidden":e.labelHidden?"true":null,"data-selection-hidden":e.selectionHidden?"true":null,"data-span":e.span??"half","data-invalid":String(!!e.error),for:e.id,children:[e.type==="checkbox"&&Ue(e,m),l,e.type!=="checkbox"&&Ue(e,m),!!e.help&&q("small",{"data-ui":"field-help",id:d??void 0,children:e.help}),!!e.error&&q("small",{"data-ui":"field-error",id:n??void 0,children:e.error})]})};import{each as Gi}from"/_ket/view/index.js";import{jsx as _i,jsxs as Wi}from"/_ket/view/jsx-runtime.js";var Kt=["breadcrumbs","breadcrumb","breadcrumb-overflow","breadcrumb-overflow-trigger","breadcrumb-overflow-list","nav-list","nav-item","nav-item-leading","nav-item-label","nav-item-count","tabs","tab","tab-count","tabbed-view","tabbed-view-context","tab-panel"];import{jsx as Yi,jsxs as Qi}from"/_ket/view/jsx-runtime.js";var Nt=["progress","progress-label","progress-value","progress-track","progress-bar"];import{each as ar}from"/_ket/view/index.js";import{Fragment as or,jsx as ir,jsxs as rr}from"/_ket/view/jsx-runtime.js";var qt=["menu","menu-trigger","menu-trigger-count","menu-panel","menu-search","menu-search-input","menu-label","menu-separator","menu-item","menu-item-leading","menu-item-copy","menu-item-check","menu-item-shortcut"];import{jsx as dr,jsxs as cr}from"/_ket/view/jsx-runtime.js";var Vt=["popover","popover-trigger","popover-panel","popover-close"];import{jsx as gr,jsxs as fr}from"/_ket/view/jsx-runtime.js";var Jt=["tooltip","tooltip-trigger","tooltip-content"];import{jsx as yr}from"/_ket/view/jsx-runtime.js";var Xt=["dialog","confirm-dialog-message"];import{each as kr}from"/_ket/view/index.js";import{jsx as wr,jsxs as Rr}from"/_ket/view/jsx-runtime.js";var zt=["toast-region","toast","toast-copy","toast-title","toast-message","toast-actions"];import{jsx as Lr}from"/_ket/view/jsx-runtime.js";var Gt=["spinner","visually-hidden"];import{each as Hr}from"/_ket/view/index.js";import{jsx as Ir}from"/_ket/view/jsx-runtime.js";var Ut=["skeleton","skeleton-line"];import{each as Re,effect as kn,signal as ie}from"/_ket/view/index.js";import{jsx as x,jsxs as D}from"/_ket/view/jsx-runtime.js";var _t=["relation-select","relation-native","relation-trigger","relation-value","relation-caret","relation-chips","relation-chip","relation-chip-clear","relation-menu","relation-search","relation-options","relation-option","relation-footer","relation-empty","relation-editor","relation-dialog-toolbar","relation-search-field","relation-search-icon","relation-dialog-list","relation-dialog-row","relation-dialog-main","relation-dialog-meta","relation-dialog-actions"],ye=e=>Array.isArray(e)?e:[],L=e=>e==null?"":String(e),ct=async(e,d,n)=>{let m=await fetch(`/_ket/fn/${encodeURIComponent(e)}`,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify(d),signal:n}),l=await m.json();if(!m.ok||l.ok===!1){let c=ye(l.errors)[0];throw new Error(L(c?.message??c?.code??l.message??`HTTP ${m.status}`))}return l.value};function ut(e,d={}){let{id:n,config:m}=e,l=m.labels,c=m.manager,R=m.multiple===!0,v=ie(R?ye(m.values).map(L).filter(Boolean):[L(m.value)].filter(Boolean)),g=()=>v()[0]??"",h=o=>v().includes(L(o)),f=ie(ye(m.options)),$=()=>d.options?.()??f(),K=()=>d.disabled?.()??m.disabled===!0,I=ie(!1),C=ie(!1),S=ie(""),B=ie([]),P=ie(!1),T=ie(""),H=ie(null),y=ie(""),p=null,M,ae=!1,z=o=>L(o[c?.idField??"id"]),w=o=>L(o[c?.labelField??"name"])||l.noRecords,oe=o=>L(o[c?.descriptionField??"ref"]),Q=()=>f().find(o=>L(o.value)===g())?.label??l.choose,G=()=>{let o=S().trim().toLocaleLowerCase(),b=o?$().filter(E=>`${L(E.label)} ${L(E.description)}`.toLocaleLowerCase().includes(o)):$();return d.options?b:b.slice(0,7)},me=(o,b,E="")=>{if(K())return;let O=L(o);if(f().some(F=>L(F.value)===O)||f.set([...f(),{value:O,label:L(b),description:L(E)}]),R){v.set(h(O)?v().filter(F=>F!==O):[...v(),O]),d.onSelect?.({value:O,label:L(b),description:L(E)});return}v.set(O?[O]:[]),I.set(!1),C.set(!1),S.set(""),H.set(null),y.set(""),d.resetAfterSelect&&v.set([]),d.onSelect?.({value:O,label:L(b),description:L(E)})},ke=o=>{v.set(v().filter(b=>b!==L(o)))},Te=o=>f().find(b=>L(b.value)===L(o))?.label??L(o),le=async()=>{if(!c?.listFunction)return;p?.abort();let o=new AbortController;p=o,P.set(!0),T.set("");try{let b={...c.listInput??{}};b[c.searchParam??"search"]=S().trim(),b[c.limitParam??"limit"]=c.limit??80;let E=await ct(c.listFunction,b,o.signal),O=new Set(ye(c.excludeIds).map(L));B.set(ye(E).filter(F=>!O.has(z(F))))}catch(b){if(ae||b instanceof Error&&b.name==="AbortError")return;T.set(b instanceof Error?b.message:l.loadError)}finally{p===o&&P.set(!1)}},Be=async()=>{I.set(!1),C.set(!0),H.set(null),y.set(""),await le()},we=()=>{C.set(!1),H.set(null),y.set(""),T.set("")},Ke=o=>{o.currentTarget instanceof HTMLInputElement&&(S.set(o.currentTarget.value),clearTimeout(M),M=setTimeout(le,180))},it=async o=>{if(o.preventDefault(),!c?.saveFunction||!(o.currentTarget instanceof HTMLFormElement))return;let b=H(),E=b?.id||crypto.randomUUID(),O={...c.saveDefaults??{},id:E};for(let[F,ee]of new FormData(o.currentTarget).entries())O[F]=L(ee);P.set(!0),T.set("");try{await ct(c.saveFunction,O);let F=L(O[c.labelField??"name"]);if(!b?.id){me(E,F),R&&(H.set(null),await le());return}f.set(f().map(ee=>L(ee.value)===E?{...ee,label:F||ee.label}:ee)),H.set(null),await le()}catch(F){T.set(F instanceof Error?F.message:l.loadError)}finally{P.set(!1)}},Ne=async o=>{let b=z(o);if(y()!==b){y.set(b);return}if(c?.removeFunction){P.set(!0),T.set("");try{await ct(c.removeFunction,{...c.removeDefaults??{},id:b}),ke(b),f.set(f().filter(E=>L(E.value)!==b)),y.set(""),await le()}catch(E){T.set(E instanceof Error?E.message:l.loadError)}finally{P.set(!1)}}},Le=o=>{let b=H()?.row??c?.saveDefaults??{},E=L(b[o.name]),O=`${n}-relation-editor-${o.name}`;return D("label",{"data-ui":"form-field","data-span":"full",htmlFor:O,children:[D("span",{"data-ui":"form-label",children:[o.label,o.required?D("span",{"data-ui":"form-required","aria-hidden":"true",children:[" ","*"]}):null]}),o.type==="select"?x("select",{"data-ui":"form-control",id:O,name:o.name,required:o.required===!0,children:Re(ye(o.options),F=>F.value,F=>x("option",{value:F.value,selected:L(F.value)===E,children:F.label}))}):x("input",{"data-ui":"form-control",id:O,type:o.type??"text",name:o.name,value:E,autocomplete:"off",required:o.required===!0})]})},qe=()=>D("form",{"data-ui":"relation-editor",onSubmit:it,children:[x("div",{"data-ui":"form-grid",children:Re(ye(c?.fields),o=>o.name,Le)}),x("div",{"data-ui":"form-actions",children:D("div",{"data-ui":"action-group",children:[x("button",{"data-ui":"action","data-variant":"primary",type:"submit",disabled:P(),children:l.save}),x("button",{"data-ui":"action","data-variant":"tertiary",type:"button",onClick:()=>H.set(null),children:l.cancel})]})})]}),Ee=o=>{let b=z(o),E=oe(o);return D("li",{"data-ui":"relation-dialog-row","data-selected":String(h(b)),children:[D("button",{"data-ui":"relation-dialog-main",type:"button","aria-pressed":R?String(h(b)):null,onClick:()=>me(b,w(o),E),children:[x("strong",{children:w(o)}),E?x("small",{"data-ui":"relation-dialog-meta",children:E}):null]}),D("div",{"data-ui":"relation-dialog-actions",children:[x("button",{"data-ui":"action","data-size":"compact","data-variant":h(b)?"primary":"secondary",type:"button",onClick:()=>me(b,w(o),E),children:h(b)?l.chosen:l.select}),c?.saveFunction?x("button",{"data-ui":"action","data-size":"compact","data-variant":"tertiary",type:"button",onClick:()=>H.set({id:b,row:o}),children:l.edit}):null,c?.removeFunction?x("button",{"data-ui":"action","data-size":"compact","data-variant":"destructive",type:"button",onClick:()=>Ne(o),children:y()===b?l.confirmRemove:l.remove}):null]})]})},Pe=()=>D("div",{"data-ui":"modal-layer","data-presentation":"dialog",children:[x("button",{"data-ui":"modal-backdrop",type:"button","aria-label":l.close,onClick:we,children:x("span",{children:l.close})}),D("section",{"data-ui":"modal-sheet",role:"dialog","aria-modal":"true","aria-labelledby":`${n}-relation-title`,children:[D("header",{"data-ui":"modal-head",children:[x("h2",{"data-ui":"modal-title",id:`${n}-relation-title`,children:l.dialogTitle}),x("button",{"data-ui":"modal-close",type:"button","aria-label":l.close,title:l.close,onClick:we,children:"\xD7"})]}),D("div",{"data-ui":"modal-body",children:[D("div",{"data-ui":"relation-dialog-toolbar",children:[D("div",{"data-ui":"relation-search-field",children:[x("span",{"data-ui":"relation-search-icon","aria-hidden":"true",children:D("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false",children:[x("circle",{cx:"11",cy:"11",r:"8"}),x("path",{d:"m21 21-4.3-4.3"})]})}),x("input",{"data-ui":"field-control",type:"search",value:S(),autocomplete:"off",placeholder:l.search,"aria-label":l.search,onInput:Ke})]}),c?.saveFunction?x("button",{"data-ui":"action","data-variant":"primary",type:"button",onClick:()=>H.set({id:"",row:c.saveDefaults??{}}),children:l.create}):null]}),T()?D("aside",{"data-ui":"notice","data-tone":"danger",role:"alert",children:[D("div",{"data-ui":"notice-copy",children:[x("p",{"data-ui":"notice-title",children:l.loadError}),x("p",{"data-ui":"notice-message",children:T()})]}),x("button",{"data-ui":"action","data-variant":"secondary",type:"button",onClick:le,children:l.retry})]}):null,H()?qe():null,P()?x("p",{"data-ui":"relation-empty",role:"status",children:l.loading}):null,!P()&&!H()?B().length?x("ul",{"data-ui":"relation-dialog-list",children:Re(B(),z,Ee)}):x("p",{"data-ui":"relation-empty",children:l.noRecords}):null]})]})]}),He=o=>{if(!(o instanceof KeyboardEvent)||o.key!=="Escape"||!I()&&!C())return;o.preventDefault(),o.stopPropagation();let b=o.currentTarget?.querySelector('[data-ui="relation-trigger"]');I.set(!1),we(),b?.focus()},fe=o=>{o.preventDefault(),I.set(!0),o.currentTarget instanceof HTMLSelectElement&&o.currentTarget.nextElementSibling?.focus()};return{view:()=>D("div",{"data-ui":"relation-select",role:"group","aria-label":m.ariaLabel,onKeydown:He,children:[D("select",{"data-ui":"relation-native",name:m.name,required:m.required===!0,disabled:K(),tabindex:"-1","aria-hidden":"true",onInvalid:fe,children:[x("option",{value:"",selected:!v().length}),R?v().length?x("option",{value:v().join(","),selected:!0,children:v().map(Te).join(", ")}):null:Re(f().filter(o=>L(o.value)),o=>o.value,o=>x("option",{value:o.value,selected:L(o.value)===g(),children:o.label}))]}),D("button",{"data-ui":"relation-trigger","data-empty":String(!v().length),type:"button","aria-haspopup":"listbox","aria-label":m.ariaLabel,"aria-expanded":String(I()),"aria-controls":`${n}-relation-menu`,disabled:K(),onClick:()=>I.set(!I()),children:[x("span",{"data-ui":"relation-value",children:R?l.choose:Q()}),x("span",{"data-ui":"relation-caret","aria-hidden":"true",children:"\u25BE"})]}),R&&v().length?x("ul",{"data-ui":"relation-chips","aria-label":l.chosen,children:Re(v(),o=>o,o=>D("li",{"data-ui":"relation-chip",children:[x("span",{children:Te(o)}),x("button",{"data-ui":"relation-chip-clear",type:"button","aria-label":`${l.clear}: ${Te(o)}`,title:l.clear,disabled:K(),onClick:()=>ke(o),children:"\xD7"})]}))}):null,I()?D("div",{"data-ui":"relation-menu",id:`${n}-relation-menu`,children:[x("input",{"data-ui":"relation-search",type:"search",value:S(),autocomplete:"off",placeholder:l.search,"aria-label":l.search,onInput:o=>{o.currentTarget instanceof HTMLInputElement&&S.set(o.currentTarget.value)}}),x("div",{"data-ui":"relation-options",role:"listbox",children:G().length?Re(G(),o=>o.value,o=>D("button",{"data-ui":"relation-option",type:"button",role:"option","data-selected":String(h(o.value)),"aria-selected":String(h(o.value)),onClick:()=>me(o.value,o.label,o.description),children:[x("span",{children:o.label}),o.description?x("small",{children:o.description}):null]})):x("p",{"data-ui":"relation-empty",children:l.noRecords})}),c||!d.options||d.onCreate?D("footer",{"data-ui":"relation-footer",children:[c||!d.options?x("button",{"data-ui":"action","data-variant":"tertiary",type:"button",onClick:Be,children:l.more}):null,d.onCreate?x("button",{"data-ui":"action","data-variant":"tertiary",type:"button",disabled:K(),onClick:()=>{if(K())return;let o=S().trim();I.set(!1),S.set(""),d.onCreate?.(o)},children:l.create}):null]}):null]}):null,C()?Pe():null]}),mount:({root:o,lifetime:b})=>{let E=!0,O=kn(()=>{if(v(),E){E=!1;return}queueMicrotask(()=>{if(ae)return;let F=[...o.querySelectorAll('[data-ui="relation-native"]')][0];F instanceof HTMLSelectElement&&F.dispatchEvent(new Event("change",{bubbles:!0}))})});b.addEventListener("abort",O),document.addEventListener("click",F=>{if(!I())return;let ee=F.target;ee instanceof Node&&o.contains(ee)||I.set(!1)},{signal:b})},dispose:()=>{ae=!0,clearTimeout(M),p?.abort()}}}import{each as Kr,signal as Oe}from"/_ket/view/index.js";import{jsx as j,jsxs as Zt}from"/_ket/view/jsx-runtime.js";var Yt=["lightbox","lightbox-thumbs","lightbox-thumb","lightbox-empty","lightbox-layer","lightbox-backdrop","lightbox-toolbar","lightbox-counter","lightbox-tool","lightbox-stage","lightbox-image","lightbox-nav","lightbox-caption"],re=1,Wt=4,We=.5,Qt=(e,d)=>e.replace(/\{(\w+)\}/g,(n,m)=>String(d[m]??`{${m}}`)),jt=(e,d,n)=>Math.min(n,Math.max(d,e));function mt(e,d="lightbox"){let n=Oe([]),m=Oe(!1),l=Oe(0),c=Oe(re),R=Oe({x:0,y:0}),v=null,g=new Map,h=null,f=()=>{c.set(re),R.set({x:0,y:0})},$=(y,p,M)=>{y.length&&(v=M instanceof HTMLElement?M:null,n.set(y),l.set(jt(p,0,y.length-1)),f(),m.set(!0),queueMicrotask(()=>{typeof document>"u"||document.getElementById(`${d}-lightbox-close`)?.focus()}))},K=()=>{m()&&(m.set(!1),f(),g.clear(),h=null,v?.focus(),v=null)},I=y=>{let p=n().length;p<2||(l.set((l()+y+p)%p),f())},C=y=>{let p=jt(y,re,Wt);c.set(p),p===re&&R.set({x:0,y:0})},S=()=>{let y=[...g.values()];return y.length?{x:y.reduce((p,M)=>p+M.x,0)/y.length,y:y.reduce((p,M)=>p+M.y,0)/y.length}:{x:0,y:0}},B=()=>{let[y,p]=[...g.values()];return y&&p?Math.hypot(y.x-p.x,y.y-p.y):0},P=(y,p)=>{if(p&&h&&g.size===1&&c()===re&&h.distance===null){let M=y.clientX-h.start.x;Math.abs(M)>60&&Math.abs(M)>Math.abs(y.clientY-h.start.y)&&I(M<0?1:-1)}if(g.delete(y.pointerId),y.currentTarget?.releasePointerCapture?.(y.pointerId),!g.size){let M=h;M&&p?setTimeout(()=>h===M?h=null:null,0):h=null;return}h&&(h={...h,start:S(),origin:R(),zoom:c(),distance:null})};return{open:$,close:K,isOpen:()=>m(),layer:()=>{let y=n(),p=y[l()];if(!m()||!p)return null;let M=c(),ae=R(),z=y.length>1;return Zt("div",{"data-ui":"lightbox-layer",role:"dialog","aria-modal":"true","aria-label":p.alt,id:`${d}-lightbox`,children:[j("div",{"data-ui":"lightbox-backdrop","aria-hidden":"true",onClick:K}),Zt("div",{"data-ui":"lightbox-toolbar",children:[j("span",{"data-ui":"lightbox-counter","aria-live":"polite",children:z?Qt(e.counter,{index:l()+1,total:y.length}):""}),j("button",{type:"button","data-ui":"lightbox-tool","data-tool":"zoom-out","aria-label":e.zoomOut,title:e.zoomOut,disabled:M<=re,onClick:()=>C(M-We),children:"\u2212"}),j("button",{type:"button","data-ui":"lightbox-tool","data-tool":"zoom-in","aria-label":e.zoomIn,title:e.zoomIn,disabled:M>=Wt,onClick:()=>C(M+We),children:"+"}),j("button",{type:"button","data-ui":"lightbox-tool","data-tool":"close",id:`${d}-lightbox-close`,"aria-label":e.close,title:e.close,onClick:K,children:"\xD7"})]}),j("div",{role:"presentation","data-ui":"lightbox-stage","data-zoomed":String(M>re),onClick:w=>{w.target===w.currentTarget&&!h?.moved&&K()},onWheel:w=>{w.preventDefault(),C(c()*(w.deltaY<0?1.15:1/1.15))},onPointerDown:w=>{g.set(w.pointerId,{x:w.clientX,y:w.clientY}),w.currentTarget.setPointerCapture?.(w.pointerId),h={start:S(),origin:R(),zoom:c(),distance:g.size>1?B():null,moved:h?.moved===!0&&g.size>1}},onPointerMove:w=>{if(!h||!g.has(w.pointerId))return;g.set(w.pointerId,{x:w.clientX,y:w.clientY});let oe=S(),Q=oe.x-h.start.x,G=oe.y-h.start.y;Math.abs(Q)+Math.abs(G)>4&&(h.moved=!0),g.size>1&&h.distance&&(C(h.zoom*(B()/h.distance)),h.moved=!0),c()>re&&R.set({x:h.origin.x+Q,y:h.origin.y+G})},onPointerUp:w=>P(w,!0),onPointerCancel:w=>P(w,!1),children:j("img",{"data-ui":"lightbox-image",src:p.src,alt:p.alt,draggable:"false",style:`transform: translate(${ae.x}px, ${ae.y}px) scale(${M})`,onClick:()=>{h?.moved||C(c()>re?re:2)}})}),z?j("button",{type:"button","data-ui":"lightbox-nav","data-direction":"previous","aria-label":e.previous,title:e.previous,onClick:()=>I(-1),children:"\u2039"}):null,z?j("button",{type:"button","data-ui":"lightbox-nav","data-direction":"next","aria-label":e.next,title:e.next,onClick:()=>I(1),children:"\u203A"}):null,p.caption?j("p",{"data-ui":"lightbox-caption",children:p.caption}):null]})},attach:y=>{document.addEventListener("keydown",p=>{if(m()){if(p.key==="Escape")K();else if(p.key==="ArrowLeft")I(-1);else if(p.key==="ArrowRight")I(1);else if(p.key==="+"||p.key==="=")C(c()+We);else if(p.key==="-")C(c()-We);else return;p.preventDefault(),p.stopImmediatePropagation()}},{signal:y,capture:!0}),y.addEventListener("abort",()=>{m.set(!1),g.clear(),h=null})}}}var gt=e=>j("button",{type:"button","data-ui":"lightbox-thumb","data-size":e.size??"medium","aria-label":Qt(e.labels.open,{alt:e.item.alt}),"aria-haspopup":"dialog",onClick:d=>e.onOpen(d.currentTarget),children:j("img",{src:e.item.thumbnail??e.item.src,alt:"",loading:"lazy",decoding:"async"})});import{each as Xr,signal as zr}from"/_ket/view/index.js";import{Fragment as Wr,jsx as _r,jsxs as Ur}from"/_ket/view/jsx-runtime.js";var ea=["search-filter","search-filter-bar","search-filter-section-toggle","search-filter-sheet","search-filter-clear","search-filter-icon","search-filter-field","search-filter-input","search-filter-facets","search-filter-facet","search-filter-facet-remove","search-filter-suggestions","search-filter-suggestion","search-filter-toggle","search-filter-columns","search-filter-column","search-filter-column-title","search-filter-empty","search-filter-grouping","search-filter-grouping-head","search-filter-grouping-list","search-filter-grouping-item","search-filter-grouping-order","search-filter-grouping-label","search-filter-grouping-actions","search-filter-grouping-action","search-filter-grouping-clear","search-filter-grouping-add-label","custom-filter","custom-filter-row","custom-filter-add","custom-group-by","favorite-list","favorite-item","favorite-item-default","favorite-item-remove","favorite-save","favorite-save-toggle","favorite-save-row"];import{each as to,effect as ao,signal as no}from"/_ket/view/index.js";import{jsx as Yr}from"/_ket/view/jsx-runtime.js";var ta=["formatted-date","formatted-number","formatted-money"];import{Fragment as so,jsx as co,jsxs as uo}from"/_ket/view/jsx-runtime.js";var na=["ket-table","kt-scroll","kt-selection-target","kt-grid","kt-select-col","kt-select-all","kt-col","kt-sort-button","kt-sort-icon","kt-row","kt-cell","kt-person","kt-select-cell","kt-row-select","kt-row-link","kt-group-row","kt-group-cell","kt-group-toggle","kt-group-indent","kt-group-count","kt-group-pager","kt-pager","kt-pager-label","kt-pager-button","kt-select-persisted","kt-caption","kt-tools"];var Co=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","summary",'[tabindex]:not([tabindex="-1"])'].join(",");var Ln=['[data-ui="timeframe-menu"]','[data-ui="view-settings"]'],Mo=Ln.map(e=>`${e}[open]`).join(", ");import{jsx as ft,jsxs as ia}from"/_ket/view/jsx-runtime.js";var Ce=(e,d)=>e?.find(n=>n.path===d)?.message??null,De=e=>{let d=e.help?`${e.id}-help`:null,n=e.error?`${e.id}-error`:null;return ia("div",{"data-ui":"field","data-kind":e.kind,"data-span":e.span??"half","data-invalid":String(!!e.error),children:[ia("label",{"data-ui":"field-label",for:e.id,children:[e.label,e.required&&ft("span",{"data-ui":"field-required","aria-hidden":"true",children:" *"})]}),e.control,!!e.help&&ft("small",{"data-ui":"field-help",id:d??void 0,children:e.help}),!!e.error&&ft("small",{"data-ui":"field-error",id:n??void 0,children:e.error})]})},Ae=(e,d,n)=>[d?`${e}-help`:null,n?`${e}-error`:null].filter(Boolean).join(" ")||null;import{jsx as Ze,jsxs as Oo}from"/_ket/view/jsx-runtime.js";var ra=["switch-control","switch-track"],je=e=>({...e,error:e.error??Ce(e.issues,e.name)}),bt=e=>Ze(W,{...je(e),type:"text"});var pt=e=>Ze(W,{...je({...e,step:e.step??"0.01"}),type:"decimal"});var ht=e=>Ze(W,{...je(e),type:"checkbox-group"});var vt=e=>Ze(W,{...je(e),type:"select"});import{each as $o}from"/_ket/view/index.js";import{Fragment as Vo,jsx as No,jsxs as qo}from"/_ket/view/jsx-runtime.js";var oa=["combobox","combobox-input-row","combobox-toggle","combobox-listbox","combobox-option","combobox-empty","tag-picker"];import{Fragment as Yo,jsx as jo,jsxs as Zo}from"/_ket/view/jsx-runtime.js";var la=["date-picker","date-range","date-inputs","date-control-row","date-tools","date-range-error","date-calendar","date-calendar-head","date-calendar-title","date-calendar-body","date-field-control","date-range-preset","date-boundary","date-calendar-months","date-month","date-month-title","date-grid","date-weekday","date-cell","date-day","date-calendar-footer","date-calendar-status"];import{jsx as yt,jsxs as Hn}from"/_ket/view/jsx-runtime.js";var sa=["file-upload","drop-zone","upload-status"],En=(e,d,n)=>Hn("div",{"data-ui":n?"drop-zone":"file-upload",children:[yt("input",{"data-ui":"field-control",id:e.id,type:"file",name:e.name,accept:e.accept,multiple:e.multiple===!0,required:e.required===!0,disabled:e.disabled===!0,"aria-invalid":d?"true":null,"aria-describedby":Ae(e.id,e.help,d)}),e.status!==void 0&&yt("div",{"data-ui":"upload-status",children:e.status})]}),Pn=(e,d)=>{let n=e.error??Ce(e.issues,e.name);return yt(De,{...e,kind:d?"drop-zone":"file-upload",error:n,control:En(e,n,d)})};var xt=e=>Pn(e,!0);import{jsx as rl}from"/_ket/view/jsx-runtime.js";var da=["relation-picker"];import{each as sl}from"/_ket/view/index.js";import{jsx as ml,jsxs as gl}from"/_ket/view/jsx-runtime.js";var ca=["search-bar","filter-bar","applied-filters","applied-filter","saved-views","saved-view","view-settings","view-settings-options"];import{jsx as hl,jsxs as vl}from"/_ket/view/jsx-runtime.js";var ua=["inline-edit","inline-edit-value","inline-edit-form","inline-edit-actions"];import{each as Hl}from"/_ket/view/index.js";import{each as Tl}from"/_ket/view/index.js";import{Fragment as Ll,jsx as Cl,jsxs as Ml}from"/_ket/view/jsx-runtime.js";var ma=["list-chrome","list-chrome-row","list-search","list-search-label","list-search-input","list-search-submit","list-filter-menus","list-facets","list-facet","list-facet-count","list-view-switch","list-view","list-sort","list-sort-label","list-sort-select","list-status","list-actions","bulk-actions","bulk-summary","bulk-count","bulk-action-list","pager-bar","pager-summary","pager-pages","pager-page","pager-actions","pager-link"];import{jsx as Dl,jsxs as Al}from"/_ket/view/jsx-runtime.js";var ga=["resource-list","resource-list-item","resource-list-select","resource-list-link"];import{each as Kl}from"/_ket/view/index.js";import{jsx as ql,jsxs as Vl}from"/_ket/view/jsx-runtime.js";var fa=["data-grid-scroll","data-grid","data-grid-cap","data-grid-cell"];import{each as zl}from"/_ket/view/index.js";import{jsx as Ul,jsxs as _l}from"/_ket/view/jsx-runtime.js";var ba=["tree","tree-item","tree-link","tree-grid","tree-grid-row"];import{each as Zl}from"/_ket/view/index.js";import{jsx as Ql,jsxs as es}from"/_ket/view/jsx-runtime.js";var pa=["data-matrix","data-matrix-head","data-matrix-heading","data-matrix-eyebrow","data-matrix-title","data-matrix-description","data-matrix-summary","data-matrix-scroll","data-matrix-table","data-matrix-column","data-matrix-row-head","data-matrix-row-leading","data-matrix-row-title","data-matrix-row-description","data-matrix-row-status","data-matrix-row-actions","data-matrix-cell"];import{each as ns}from"/_ket/view/index.js";import{jsx as rs,jsxs as os}from"/_ket/view/jsx-runtime.js";var ha=["bar-chart","bar-chart-rows","bar-chart-row","bar-chart-label","bar-chart-caption","bar-chart-track","bar-chart-fill","bar-chart-segment","bar-chart-value","bar-chart-scale","bar-chart-legend","bar-chart-legend-item","bar-chart-legend-swatch","bar-chart-empty"];import{each as ds}from"/_ket/view/index.js";import{jsx as us,jsxs as ms}from"/_ket/view/jsx-runtime.js";var va=["timeframe","timeframe-menu","timeframe-trigger","timeframe-label","timeframe-value","timeframe-content","timeframe-option","timeframe-option-label","timeframe-option-detail","timeframe-range","timeframe-asof","timeframe-note"];import{each as bs}from"/_ket/view/index.js";import{jsx as vs,jsxs as ys}from"/_ket/view/jsx-runtime.js";var ya=["description-list","key-value","key-value-label","key-value-value","person","person-body","avatar-group","status"];import{each as ks}from"/_ket/view/index.js";import{jsx as Ms,jsxs as Ls}from"/_ket/view/jsx-runtime.js";var Sa=["record-summary","record-summary-main","record-actions","record-rail"];import{each as Hs}from"/_ket/view/index.js";import{jsx as Ds,jsxs as As}from"/_ket/view/jsx-runtime.js";var ka=["activity-timeline","activity-item","activity-marker","audit-log","audit-item"];import{each as Ks}from"/_ket/view/index.js";import{jsx as Vs,jsxs as Js}from"/_ket/view/jsx-runtime.js";var Ta=["attachments","attachment","media-gallery","media-item"];import{each as Gs}from"/_ket/view/index.js";import{Fragment as js,jsx as _s,jsxs as Ws}from"/_ket/view/jsx-runtime.js";var wa=["app-navigation","navigation-trigger","navigation-toggle","navigation-trigger-icon","navigation-trigger-identity","navigation-trigger-label","navigation-layer","navigation-backdrop","navigation-drawer","navigation-header","navigation-identity","navigation-context","navigation-close","navigation-groups","navigation-group","navigation-group-label","navigation-items","navigation-supplementary","navigation-item","navigation-branch","navigation-branch-trigger","navigation-children","navigation-item-leading","navigation-item-copy","navigation-item-label","navigation-item-description","navigation-item-count","navigation-footer"];import{each as td}from"/_ket/view/index.js";import{Fragment as ld,jsx as rd,jsxs as od}from"/_ket/view/jsx-runtime.js";var Ra=["table-scroll","table","table-caption","select-col","select-all","col","sort-link","sort-icon","row","group-row","group-cell","group-link","group-indent","group-count","group-pager","group-pager-actions","cell","select-cell","row-select","row-link"];import{Fragment as pd,jsx as bd,jsxs as hd}from"/_ket/view/jsx-runtime.js";var Ca=["list-page","list-page-context","list-page-header","list-page-heading","list-page-title-row","list-page-eyebrow","list-page-title","list-page-description","list-page-actions","list-page-tools","list-page-toolbar","list-page-controls","list-page-status","list-page-body","list-page-footer"];import{jsx as Sd,jsxs as kd}from"/_ket/view/jsx-runtime.js";var Ma=["record-page","record-page-context","record-page-header","record-page-title-row","record-page-heading","record-page-title","record-page-subline","record-page-status","record-page-actions","record-page-meta","record-page-controller","record-page-navigation","record-page-layout","record-page-body","record-page-aside"];var La=["form-page","form-page-context","form-page-header","form-page-title-row","form-page-heading","form-page-title","form-page-subline","form-page-status","form-page-actions","form-page-meta","form-page-controller","form-page-navigation","form-page-layout","form-page-body","form-page-aside"];import{jsx as Hd,jsxs as Fd}from"/_ket/view/jsx-runtime.js";var Ea=["dashboard-page","dashboard-page-context","dashboard-page-header","dashboard-page-heading","dashboard-page-eyebrow","dashboard-page-title-row","dashboard-page-title","dashboard-page-subline","dashboard-page-status","dashboard-page-actions","dashboard-page-meta","dashboard-page-body"];var Pa=["board-page","board-page-context","board-page-header","board-page-heading","board-page-eyebrow","board-page-title-row","board-page-title","board-page-subline","board-page-status","board-page-actions","board-page-meta","board-page-toolbar","board-page-controls","board-page-body"];import{each as qd}from"/_ket/view/index.js";import{jsx as Jd,jsxs as Xd}from"/_ket/view/jsx-runtime.js";var Ha=["pipeline","pipeline-step","pipeline-arrow","pipeline-step-label","pipeline-step-value","pipeline-step-node"];import{each as Wd}from"/_ket/view/index.js";import{jsx as Qd,jsxs as ec}from"/_ket/view/jsx-runtime.js";var Fa=["record-form","form-errors","form-grid","form-actions"];import{each as sc}from"/_ket/view/index.js";import{jsx as mc,jsxs as gc}from"/_ket/view/jsx-runtime.js";var Ia=["reorder-list","reorder-list-value","reorder-list-rows","reorder-list-row","reorder-list-content","reorder-list-controls"];var Oa={actions:Lt,feedback:Ft,fields:$t,status:Ht,navigation:Kt,progress:Nt,menu:qt,reorderList:Ia,popover:Vt,tooltip:Jt,dialog:Xt,toast:zt,spinner:Gt,skeleton:Ut,lightbox:Yt,relationSelect:_t,searchFilter:ea,ketTable:na,scalarFields:ra,combobox:oa,dateTime:la,upload:sa,relationPicker:da,listControls:ca,inlineEdit:ua,resourceList:ga,dataGrid:fa,tree:ba,matrix:pa,barChart:ha,timeframe:va,recordDisplay:ya,formattedValues:ta,recordComposition:Sa,activity:ka,media:Ta,layouts:At,shell:Dt,appNavigation:wa,table:Ra,listChrome:ma,listPage:Ca,formPage:La,recordPage:Ma,dashboardPage:Ea,boardPage:Pa,modal:It,pipeline:Ha,form:Fa},Kn=[...new Set(Object.values(Oa).flat())].sort(),Nn=Object.freeze(Object.fromEntries(Object.entries(Oa).map(([e,d])=>[e,[...d]])));import{trustedMarkup as Vn}from"/_ket/view/index.js";var Da={package:'<path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z" /> <path d="M12 22V12" /> <polyline points="3.29 7 12 12 20.71 7" /> <path d="m7.5 4.27 9 5.15" />',warehouse:'<path d="M18 21V10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1v11" /> <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 1.132-1.803l7.95-3.974a2 2 0 0 1 1.837 0l7.948 3.974A2 2 0 0 1 22 8z" /> <path d="M6 13h12" /> <path d="M6 17h12" />',"shopping-cart":'<circle cx="8" cy="21" r="1" /> <circle cx="19" cy="21" r="1" /> <path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12" />',globe:'<circle cx="12" cy="12" r="10" /> <path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" /> <path d="M2 12h20" />',users:'<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" /> <path d="M16 3.128a4 4 0 0 1 0 7.744" /> <path d="M22 21v-2a4 4 0 0 0-3-3.87" /> <circle cx="9" cy="7" r="4" />',"layout-grid":'<rect width="7" height="7" x="3" y="3" rx="1" /> <rect width="7" height="7" x="14" y="3" rx="1" /> <rect width="7" height="7" x="14" y="14" rx="1" /> <rect width="7" height="7" x="3" y="14" rx="1" />',settings:'<path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" /> <circle cx="12" cy="12" r="3" />',"file-text":'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" /> <path d="M14 2v4a2 2 0 0 0 2 2h4" /> <path d="M10 9H8" /> <path d="M16 13H8" /> <path d="M16 17H8" />',"message-circle":'<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719" />',"check-circle":'<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14" /> <path d="m22 4-10 10.01-3-3" />',send:'<path d="m22 2-7 20-4-9-9-4Z" /> <path d="M22 2 11 13" />',download:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /> <path d="m7 10 5 5 5-5" /> <path d="M12 15V3" />',headphones:'<path d="M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3" />',calendar:'<path d="M8 2v4" /> <path d="M16 2v4" /> <rect width="18" height="18" x="3" y="4" rx="2" /> <path d="M3 10h18" />',"contact-round":'<path d="M16 2v2" /> <path d="M17.915 22a6 6 0 0 0-12 0" /> <path d="M8 2v2" /> <circle cx="12" cy="12" r="4" /> <rect x="3" y="4" width="18" height="18" rx="2" />',handshake:'<path d="m11 17 2 2a1 1 0 1 0 3-3" /> <path d="m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4" /> <path d="m21 3 1 11h-2" /> <path d="M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3" /> <path d="M3 4h8" />',"layout-dashboard":'<rect width="7" height="9" x="3" y="3" rx="1" /> <rect width="7" height="5" x="14" y="3" rx="1" /> <rect width="7" height="9" x="14" y="12" rx="1" /> <rect width="7" height="5" x="3" y="16" rx="1" />',store:'<path d="M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5" /> <path d="M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244" /> <path d="M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05" />',"receipt-text":'<path d="M13 16H8" /> <path d="M14 8H8" /> <path d="M16 12H8" /> <path d="M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z" />',truck:'<path d="M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2" /> <path d="M15 18H9" /> <path d="M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14" /> <circle cx="17" cy="18" r="2" /> <circle cx="7" cy="18" r="2" />',"shopping-bag":'<path d="M16 10a4 4 0 0 1-8 0" /> <path d="M3.103 6.034h17.794" /> <path d="M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z" />',factory:'<path d="M12 16h.01" /> <path d="M16 16h.01" /> <path d="M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z" /> <path d="M8 16h.01" />',fingerprint:'<path d="M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4" /> <path d="M14 13.12c0 2.38 0 6.38-1 8.88" /> <path d="M17.29 21.02c.12-.6.43-2.3.5-3.02" /> <path d="M2 12a10 10 0 0 1 18-6" /> <path d="M2 16h.01" /> <path d="M21.8 16c.2-2 .131-5.354 0-6" /> <path d="M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2" /> <path d="M8.65 22c.21-.66.45-1.32.57-2" /> <path d="M9 6.8a6 6 0 0 1 9 5.2v2" />',wallet:'<path d="M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1" /> <path d="M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4" />',banknote:'<rect width="20" height="12" x="2" y="6" rx="2" /> <circle cx="12" cy="12" r="2" /> <path d="M6 12h.01" /> <path d="M18 12h.01" />',hotel:'<path d="M10 22v-6.57" /> <path d="M12 11h.01" /> <path d="M12 7h.01" /> <path d="M14 15.43V22" /> <path d="M15 16a5 5 0 0 0-6 0" /> <path d="M16 11h.01" /> <path d="M16 7h.01" /> <path d="M8 11h.01" /> <path d="M8 7h.01" /> <rect x="4" y="2" width="16" height="20" rx="2" />',tag:'<path d="M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z" /> <circle cx="7.5" cy="7.5" r=".5" fill="currentColor" />',search:'<path d="m21 21-4.34-4.34" /> <circle cx="11" cy="11" r="8" />',"chevron-down":'<path d="m6 9 6 6 6-6" />',"chevron-right":'<path d="m9 18 6-6-6-6" />',"chevron-left":'<path d="m15 18-6-6 6-6" />',plus:'<path d="M5 12h14" /> <path d="M12 5v14" />',"more-horizontal":'<circle cx="5" cy="12" r="1" fill="currentColor" /> <circle cx="12" cy="12" r="1" fill="currentColor" /> <circle cx="19" cy="12" r="1" fill="currentColor" />',x:'<path d="M18 6 6 18" /> <path d="m6 6 12 12" />',list:'<path d="M3 5h.01" /> <path d="M3 12h.01" /> <path d="M3 19h.01" /> <path d="M8 5h13" /> <path d="M8 12h13" /> <path d="M8 19h13" />',"sliders-horizontal":'<path d="M10 5H3" /> <path d="M12 19H3" /> <path d="M14 3v4" /> <path d="M16 17v4" /> <path d="M21 12h-9" /> <path d="M21 19h-5" /> <path d="M21 5h-7" /> <path d="M8 10v4" /> <path d="M8 12H3" />',"grip-vertical":'<circle cx="9" cy="5" r="1" fill="currentColor" /> <circle cx="9" cy="12" r="1" fill="currentColor" /> <circle cx="9" cy="19" r="1" fill="currentColor" /> <circle cx="15" cy="5" r="1" fill="currentColor" /> <circle cx="15" cy="12" r="1" fill="currentColor" /> <circle cx="15" cy="19" r="1" fill="currentColor" />',pencil:'<path d="M12 20h9" /> <path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" />',"trash-2":'<path d="M3 6h18" /> <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" /> <path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" /> <path d="M10 11v6" /> <path d="M14 11v6" />',"refresh-cw":'<path d="M21 12a9 9 0 0 0-15.38-6.36L3 8" /> <path d="M3 3v5h5" /> <path d="M3 12a9 9 0 0 0 15.38 6.36L21 16" /> <path d="M16 16h5v5" />',"arrow-up":'<path d="m18 15-6-6-6 6" />',"arrow-down":'<path d="m6 9 6 6 6-6" />',check:'<path d="M20 6 9 17l-5-5" />',"alert-triangle":'<path d="m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" /> <path d="M12 9v4" /> <path d="M12 17h.01" />',info:'<circle cx="12" cy="12" r="10" /> <path d="M12 16v-4" /> <path d="M12 8h.01" />',bell:'<path d="M10.268 21a2 2 0 0 0 3.464 0" /> <path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" />',mail:'<path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7" /> <rect x="2" y="4" width="20" height="16" rx="2" />',moon:'<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" />',sun:'<circle cx="12" cy="12" r="4" /> <path d="M12 2v2" /> <path d="M12 20v2" /> <path d="m4.93 4.93 1.42 1.42" /> <path d="m17.66 17.66 1.41 1.41" /> <path d="M2 12h2" /> <path d="M20 12h2" /> <path d="m6.34 17.66-1.41 1.41" /> <path d="m19.07 4.93-1.41 1.41" />',"log-out":'<path d="m16 17 5-5-5-5" /> <path d="M21 12H9" /> <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />',"building-2":'<path d="M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18" /> <path d="M6 12H4a2 2 0 0 0-2 2v8h20v-8a2 2 0 0 0-2-2h-2" /> <path d="M10 6h4" /> <path d="M10 10h4" /> <path d="M10 14h4" /> <path d="M10 18h4" />'},Jn='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-ui="icon" aria-hidden="true">';var Qe=e=>Vn(e&&Da[e]?Jn+Da[e]+"</svg>":"");import{signal as Lf}from"/_ket/view/index.js";import{jsx as lf}from"/_ket/view/jsx-runtime.js";import{jsx as et,jsxs as Xn}from"/_ket/view/jsx-runtime.js";var St=e=>Xn("form",{"data-ui":"record-form",method:"post",action:"","data-record-kind":e.kind,"data-record-dropzone":e.dropzone?"":null,id:e.id,"data-record-dirty":e.dirty===!0?"true":null,children:[e.command?et("input",{type:"hidden",name:Aa,value:e.command,autocomplete:"off"}):"",Object.entries(e.hidden??{}).map(([d,n])=>et("input",{type:"hidden",name:d,value:n,autocomplete:"off"})),e.fields.length?et("div",{"data-ui":"form-grid",children:e.fields.map(d=>W(d))}):null,e.body,e.actions?.length?et("div",{"data-ui":"form-actions",children:be({actions:e.actions})}):""]});import{Fragment as Of,jsx as Af,jsxs as Df}from"/_ket/view/jsx-runtime.js";var $a=e=>{let d=e??{};return(Array.isArray(d.errors)?d.errors:Array.isArray(d.issues)?d.issues:[]).map(m=>{let l=m??{},c=Array.isArray(l.path)?l.path.join("."):null;return{field:typeof l.field=="string"?l.field:c,code:String(l.code??"invalid"),message:typeof l.message=="string"?l.message:null,params:l.params&&typeof l.params=="object"?l.params:{}}})},zn=async(e,d,n={})=>{let m=new URL(e,"https://record.invalid");if(m.origin!=="https://record.invalid"||!e.startsWith("/")||e.startsWith("//"))throw new Error("Record commands require a same-origin route");let l=await fetch(m.pathname+m.search,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json",...n.idempotencyKey?{"idempotency-key":n.idempotencyKey}:{}},body:JSON.stringify(d),signal:n.signal}),c=await l.json().catch(()=>({}));if(!l.ok||c.ok===!1)return{ok:!1,issues:$a(c.error??c),message:l.status>=500?null:c.error?.message??c.message??null,status:l.status};let R=c.value;return R&&typeof R=="object"&&R.ok===!1?{ok:!1,issues:$a(R),message:null,status:l.status}:{ok:!0,value:c.value}},xe=(e,d,n={})=>zn(`/_ket/fn/${encodeURIComponent(e)}`,d,n);var Hf=Object.freeze({"recordModal.close":"Close","recordModal.loading":"Loading\u2026","recordModal.loadFailed":"The record could not be read.","recordModal.notFound":"The record is gone or you cannot see it.","recordModal.retry":"Retry","recordModal.errorTitle":"Not saved","recordModal.saveFailed":"That did not work. Try again.","recordModal.savedTitle":"Saved","recordModal.saved":"The change is in.","recordModal.unsaved":"Discard what you typed?","recordModal.uploadFailed":"The file could not be uploaded. Try again."});var Aa="__command";var Ff=["a[href]","button:not(:disabled)",'input:not(:disabled):not([type="hidden"])',"select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"])'].join(", ");import{signal as Me}from"/_ket/view/index.js";import{Fragment as Gn,jsx as ue,jsxs as Un}from"/_ket/view/jsx-runtime.js";var Ba=e=>{let d=Me(!1),n=Me(!1),m=Me(""),l=Me(""),c=Me({}),R=Me(!1),v="",g=!1,h=new Map,f=`${e.id}-create-attribute`,$=C=>queueMicrotask(()=>{if(g)return;let S=document.getElementById(C);(S?.querySelector("button")??S)?.focus()}),K=()=>{d.set(!1),m.set(""),l.set(""),c.set({}),R.set(!1),h.clear(),e.returnFocus?queueMicrotask(e.returnFocus):$(`${f}-toggle`)},I=async C=>{if(C.preventDefault(),C.stopPropagation(),!e.enabled||e.disabled()||n())return;let S=l().split(/\r?\n/u).map(T=>T.trim()).filter(Boolean),B={};if(m().trim()||(B.name=e.t("attributeNameRequired")),S.length||(B.values=e.t("attributeValuesRequired")),new Set(S.map(T=>T.normalize("NFC").toLowerCase())).size!==S.length&&(B.values=e.t("attributeValuesDuplicate")),c.set(B),R.set(!1),Object.keys(B).length){$(`${f}-${B.name?"name":"values"}`);return}let P={id:v,name:m().trim(),displayType:"select",createVariant:"always",values:S.map(T=>(h.has(T)||h.set(T,crypto.randomUUID()),{id:h.get(T),name:T}))};n.set(!0);try{let T=await xe("product.saveAttributeDraft",P);if(g)return;if(!T.ok){let H={};for(let y of T.issues)y.field==="name"?H.name=e.t(y.code==="product.error.attribute.duplicateName"?"attributeNameDuplicate":"attributeNameRequired"):y.field?.startsWith("values")&&(H.values=e.t("attributeValuesInvalid"));c.set(H),R.set(!Object.keys(H).length),$(`${f}-${H.name?"name":H.values?"values":"submit"}`);return}e.added({attributeId:P.id,name:P.name,createVariant:P.createVariant,values:P.values.map(H=>({valueId:H.id,name:H.name}))}),document.dispatchEvent(new CustomEvent("ket:records-changed",{detail:{kind:"product.attribute",ids:[P.id]}})),K()}catch{if(g)return;R.set(!0),$(`${f}-submit`)}finally{n.set(!1)}};return{open:d,busy:n,start:(C="")=>{!e.enabled||e.disabled()||n()||(v=crypto.randomUUID(),m.set(C),d.set(!0),$(`${f}-name`))},attach:(C,S)=>{S.addEventListener("abort",()=>{g=!0}),C.addEventListener("click",B=>{let P=B.target instanceof Element?B.target.closest("button"):null;!e.enabled||!P||P.disabled||n()||e.disabled()||(P.name==="createAttribute"?(v=crypto.randomUUID(),d.set(!0),$(`${f}-name`)):P.name==="cancelAttribute"&&K())},{signal:S})},view:()=>!e.enabled||e.launcher===!1&&!d()?null:ue("div",{onInput:C=>{let S=C.target;(S instanceof HTMLInputElement||S instanceof HTMLTextAreaElement)&&(S.name==="attributeName"&&m.set(S.value),S.name==="attributeValues"&&l.set(S.value))},onSubmit:I,children:d()?ue(ve,{title:e.t("createAttribute"),description:e.t("createAttributeHint"),body:Un(Gn,{children:[R()?ue(te,{tone:"danger",title:e.t("attributeCreateFailed"),message:e.t("attributeRetryHint")}):null,ue(St,{id:f,kind:e.kind,dirty:!!m()||!!l(),fields:[{id:`${f}-name`,name:"attributeName",label:e.t("attributeName"),value:m(),required:!0,disabled:n(),error:c().name,placeholder:e.t("attributeNameExample"),span:"full"},{id:`${f}-values`,name:"attributeValues",label:e.t("attributeValues"),type:"textarea",value:l(),required:!0,disabled:n(),error:c().values,help:e.t("attributeValuesHint"),placeholder:e.t("attributeValuesExample"),span:"full"}],actions:[ue("span",{id:`${f}-submit`,tabIndex:-1,children:ue(A,{type:"submit",label:e.t("createAndAddAttribute"),variant:"primary",loading:n()})}),ue(A,{name:"cancelAttribute",label:e.t("cancelAttribute"),variant:"tertiary",disabled:n()})]})]})}):ue("span",{id:`${f}-toggle`,tabIndex:-1,children:ue(A,{name:"createAttribute",label:e.t("createAttribute"),disabled:e.disabled()})})})}};import{jsx as _,jsxs as J}from"/_ket/view/jsx-runtime.js";var Y="variantAction",at=e=>JSON.parse(JSON.stringify(e)),_n=(e,d,n={})=>(e[d]??d).replace(/\{(\w+)\}/g,(m,l)=>String(n[l]??`{${l}}`)),nt=(e,d)=>`/files/${encodeURIComponent(e)}?size=${d}`,Wn="image/avif,image/gif,image/jpeg,image/png,image/webp",$e=e=>Number.isFinite(e)?e.toLocaleString("vi-VN"):"\u2014",Se=e=>{let d=Number(e);return Number.isFinite(d)?d:0},ge=e=>/^-?\d+(\.\d+)?$/.test(e.trim()),jn=e=>{if(!ge(e))return e.trim()||"?";let d=Se(e);return`${d>0?"+":""}${$e(d)}`},Zn=3,Yn=0,Na=e=>e.map(d=>({...d,valueIds:{...d.valueIds},key:d.id,open:!1}));function Qn(e){let d=e.labels,n=(t,a)=>_n(d,t,a),m=e.editable,l=at(e.setup),c=Z(l.listPrice),R=Z(l.catalogue),v=Z(at(l.lines)),g=Z(Na(l.variants)),h=Z([]),f=Z(!1),$=Z(null),K=Z({}),I=Z(null),C=Z(!1),S=Z(null),B=Z(null),P=mt(e.lightboxLabels,e.id),T=null,H=!1,y=()=>{C.set(!0),I.set(null)},p=t=>{v.set(t),y()},M=t=>{g.set(t),y()},ae=(t,a)=>M(g().map(i=>i.key===t?{...i,...a}:i)),z=t=>g().find(a=>a.key===t),w=(t,a)=>{setTimeout(()=>{if(H||!T)return;(T.querySelector(t)??(a?T.querySelector(a):null))?.focus()},0)},oe=`[id="${e.id}-attribute-picker"] button`,Q=t=>`button[name="${Y}"][value="${t}"]`,G=()=>v().filter(t=>t.createVariant!=="no_variant"&&t.values.length>0),me=t=>{let a=[];for(let i of G()){let r=t.valueIds[i.attributeId];if(!r||!i.values.some(s=>s.valueId===r))return null;a.push(r)}return a.join(",")},ke=()=>{let t=new Map,a=new Map;return g().forEach((i,r)=>{if(!i.active)return;let s=me(i);if(s==null)return;let u=t.get(s);u===void 0?t.set(s,r):(a.set(i.key,u+1),a.set(g()[u].key,r+1))}),a},Te=()=>new Set(g().filter(t=>t.active&&me(t)==null).map(t=>t.key)),le=t=>G().flatMap(a=>{let i=a.values.find(r=>r.valueId===t.valueIds[a.attributeId]);return i?[{line:a,value:i}]:[]}),Be=t=>le(t).reduce((a,{value:i})=>a+Se(i.priceExtra),Se(c())),we=()=>{let t=G();if(!t.length)return[];let a=t.reduce((r,s)=>r.flatMap(u=>s.values.map(V=>({...u,[s.attributeId]:V.valueId}))),[{}]),i=new Set(g().filter(r=>r.active).map(me).filter(r=>r!=null));return a.filter(r=>!i.has(t.map(s=>r[s.attributeId]).join(",")))},Ke=t=>G().length?G().map(a=>a.values.find(i=>i.valueId===t[a.attributeId])?.name??n("choose",{name:a.name})).join(" / "):n("defaultVariant"),it=(t,a)=>g().filter(i=>i.active&&i.valueIds[t]===a).length,Ne=()=>v().some(t=>t.values.some(a=>!ge(a.priceExtra))),Le=t=>!ge(t.weight)||!ge(t.volume),qe=()=>g().some(Le),Ee=()=>!m||f()||fe.open()||!C()||ke().size>0||Te().size>0||Ne()||qe(),Pe=t=>{let a=R().find(i=>i.attributeId===t.attributeId)?.values??[];return[...a,...t.values.filter(i=>!a.some(r=>r.valueId===i.valueId))]},He=t=>`input[name="values|${t}[]"]`,fe=Ba({id:e.id,kind:e.kind,enabled:m&&e.createAttribute===!0,launcher:!1,returnFocus:()=>T?.querySelector(oe)?.focus(),disabled:f,t:n,added:t=>{R.set([...R(),t]),l.catalogue=[...l.catalogue,t],p([...v(),{attributeId:t.attributeId,name:t.name,createVariant:t.createVariant,displayType:"select",values:t.values.map(a=>({...a,priceExtra:"0"}))}]),w(He(t.attributeId))}}),o=t=>{let a=R().find(i=>i.attributeId===t);a&&(p([...v(),{attributeId:t,name:a.name,createVariant:a.createVariant,displayType:"select",values:[]}]),w(He(t),oe))},b=ut({id:`${e.id}-attribute-picker`,config:{name:"addAttributeId",ariaLabel:n("addAttribute"),options:[],labels:{...e.relationLabels,choose:n("addAttribute"),create:n("createAttribute")}}},{options:()=>R().filter(t=>!v().some(a=>a.attributeId===t.attributeId)).map(t=>({value:t.attributeId,label:t.name,description:t.values.map(a=>a.name).join(" \xB7 ")})),disabled:()=>!m||f()||fe.open(),resetAfterSelect:!0,onSelect:t=>o(t.value),...m&&e.createAttribute?{onCreate:t=>fe.start(t)}:{}}),E=t=>{p(v().filter(a=>a.attributeId!==t)),M(g().map(a=>{let i={...a.valueIds};return delete i[t],{...a,valueIds:i}})),h.set(h().filter(a=>a!==t)),w(oe)},O=(t,a)=>{let i=v().find(k=>k.attributeId===t);if(!i)return;let r=Pe(i),s=a.filter(k=>!i.values.some(X=>X.valueId===k));if(!s.length)return;let u=l.lines.find(k=>k.attributeId===t),V=s.flatMap(k=>{let X=r.find(lt=>lt.valueId===k);if(!X)return[];let ot=u?.values.find(lt=>lt.valueId===k)?.priceExtra??"0";return[{valueId:k,name:X.name,priceExtra:ot}]}),U=k=>r.findIndex(X=>X.valueId===k);p(v().map(k=>k.attributeId===t?{...k,values:[...k.values,...V].sort((X,ot)=>U(X.valueId)-U(ot.valueId))}:k))},F=(t,a)=>p(v().map(i=>i.attributeId===t?{...i,values:i.values.filter(r=>r.valueId!==a)}:i)),ee=(t,a,i)=>p(v().map(r=>r.attributeId===t?{...r,values:r.values.map(s=>s.valueId===a?{...s,priceExtra:i}:s)}:r)),kt=(t,a)=>({id:"",key:`new-${++Yn}`,valueIds:t,defaultCode:null,barcode:null,weight:"0",volume:"0",active:!0,images:[],open:a}),qa=()=>{let t=kt({},!0);M([...g(),t]),w(`[name^="combo|${t.key}|"], [name="field|${t.key}|defaultCode"]`)},Va=()=>{let t=we().map(a=>kt(a,!1));t.length&&(M([...g(),...t]),w(Q(`toggleRow|${t[0].key}`)))},Ja=t=>{g.set(g().map(a=>a.key===t?{...a,open:!a.open}:a))},Xa=t=>{let a=z(t);if(!a)return;if(a.id){ae(t,{active:!a.active});return}let i=g().indexOf(a),r=g()[i+1]??g()[i-1];M(g().filter(s=>s.key!==t)),w(Q(r?`toggleRow|${r.key}`:"addRow"),Q("generate"))},Tt=t=>{M(g().filter(a=>a.id||t).map(a=>({...a,active:t}))),w(Q(t?"archiveAll":"activateAll"),Q("addRow"))},wt=(t,a)=>{g.set(g().map(i=>i.key===t.key?{...i,images:a}:i)),l={...l,variants:l.variants.map(i=>i.id===t.id?{...i,images:a}:i)}},Rt=async(t,a)=>{let i=t.images.length>0;if(!(!t.id||!e.media.upload||i&&!e.media.remove)&&!(S()||!a.type.startsWith("image/"))){S.set(t.key),$.set(null);try{let r=new FormData;r.append("resModel","product.Product"),r.append("resId",t.id),r.append("resField","media"),r.append("public","false"),r.append("file",a,a.name);let s=await fetch("/files",{method:"POST",credentials:"same-origin",body:r}),u=await s.json().catch(()=>null);if(!s.ok||typeof u?.id!="string")throw new Error(n("imageFailed"));let V=await xe("product_media.attachMedia",{id:u.id,attachmentId:u.id,productId:t.id,alt:a.name,primary:!0});if(!V.ok)throw new Error(V.message??V.issues[0]?.message??n("imageFailed"));let U=t.images.find(k=>k.primary);U&&await xe("product_media.removeMedia",{id:U.mediaId}),wt(t,[{mediaId:u.id,attachmentId:u.id,alt:a.name,primary:!0},...t.images.filter(k=>k!==U)]),document.dispatchEvent(new CustomEvent("ket:records-changed",{detail:{kind:e.kind,ids:[l.templateId]}}))}catch(r){$.set(r instanceof Error?r.message:n("imageFailed"))}finally{S.set(null)}}},za=async t=>{let a=t.images[0];if(!a||!e.media.remove||S()||!globalThis.confirm(n("imageRemoveConfirm")))return;S.set(t.key),$.set(null);let i=await xe("product_media.removeMedia",{id:a.mediaId}).catch(()=>null);if(S.set(null),!i?.ok){$.set(i&&!i.ok?i.message??n("saveFailed"):n("saveFailed"));return}let r=t.images.slice(1);wt(t,r.map((s,u)=>({...s,primary:u===0})))},Ga=(t,a)=>P.open(t.images.map(i=>({src:nt(i.attachmentId,"large"),thumbnail:nt(i.attachmentId,"thumb"),alt:i.alt||n("image"),caption:i.alt})),0,a),Ct=()=>{c.set(l.listPrice),R.set(l.catalogue),v.set(at(l.lines)),g.set(Na(l.variants)),K.set({}),$.set(null),C.set(!1)},Ua=async()=>{if(Ee())return;f.set(!0),$.set(null),K.set({});let t=g(),a=await xe(e.saveFunction,{templateId:l.templateId,lines:v().map(r=>({attributeId:r.attributeId,values:r.values.map(s=>({valueId:s.valueId,priceExtra:s.priceExtra.trim()}))})),variants:t.map(r=>({id:r.id||null,valueIds:r.valueIds,defaultCode:r.defaultCode,barcode:r.barcode,weight:r.weight,volume:r.volume,active:r.active}))}).catch(()=>null);if(f.set(!1),!a){$.set(n("saveFailed"));return}if(!a.ok){let r={};for(let s of a.issues){let u=/^variants\.(\d+)(?:\.(\w+))?/.exec(s.field??""),V=u?t[Number(u[1])]:void 0;V&&(r[V.key]=s.message??s.code)}K.set(r),$.set(a.message??a.issues[0]?.message??n("saveFailed")),Object.keys(r).length&&g.set(g().map(s=>r[s.key]?{...s,open:!0}:s));return}let i=a.value.setup;i&&(l=at(i)),Ct(),I.set(n("saved",{created:a.value.created??0,archived:a.value.archived??0})),document.dispatchEvent(new CustomEvent("ket:records-changed",{detail:{kind:e.kind,ids:[l.templateId]}}))},_a=t=>{let a=t.target instanceof Element?t.target.closest("button"):null;if(!a||a.name!==Y||a.disabled||!Wa(a.value))return;let[i,r=""]=a.value.split("|");if(i==="toggleRow")Ja(r);else if(i==="selectAll"){let s=v().find(u=>u.attributeId===r);s&&O(r,Pe(s).map(u=>u.valueId)),w(He(r))}else if(i==="removeLine")E(r);else if(i==="removeRow")Xa(r);else if(i==="generate")Va();else if(i==="addRow")qa();else if(i==="activateAll")Tt(!0);else if(i==="archiveAll")Tt(!1);else if(i==="removeImage"){let s=z(r);s&&za(s)}else i==="reset"&&(Ct(),w(oe))},Wa=t=>t.startsWith("toggleRow|")||m&&!f(),ja=t=>{let a=t.target;if(!(!m||f())){if(a instanceof HTMLInputElement&&a.type==="checkbox"){let i=/^values\|(.+)\[\]$/.exec(a.name);if(!i)return;a.checked?O(i[1],[a.value]):F(i[1],a.value)}else if(a instanceof HTMLSelectElement){let[i,r,s]=a.name.split("|"),u=i==="combo"&&r?z(r):void 0;u&&s&&ae(u.key,{valueIds:{...u.valueIds,[s]:a.value}})}else if(a instanceof HTMLInputElement&&a.type==="file"){let[i,r]=a.name.split("|"),s=i==="image"&&r?z(r):void 0,u=a.files?.[0];a.value="",s&&u&&Rt(s,u)}}},Za=t=>{let a=t.target;if(!m||f()||!(a instanceof HTMLInputElement))return;let[i,r,s]=a.name.split("|");if(!(!r||!s)){if(i==="extra")ee(r,s,a.value);else if(i==="field"&&["defaultCode","barcode","weight","volume"].includes(s)){let u=s==="weight"||s==="volume";ae(r,{[s]:u?a.value:a.value||null})}}},Ya=t=>{let[a,i,r]=t.split("|");if(!i||!r)return;if(a==="extra")return v().find(u=>u.attributeId===i)?.values.find(u=>u.valueId===r)?.priceExtra;let s=z(i);if(s){if(a==="combo")return s.valueIds[r]??"";if(a==="field")return String(s[r]??"")}},Qa=()=>{if(T){for(let t of T.querySelectorAll('input[type="checkbox"][name^="values|"]')){let a=t.name.slice(7,-2),i=v().find(r=>r.attributeId===a)?.values.some(r=>r.valueId===t.value)??!1;t.checked!==i&&(t.checked=i)}for(let t of T.querySelectorAll('input[name^="extra|"], input[name^="field|"], select[name^="combo|"]')){if(t===document.activeElement&&t instanceof HTMLInputElement)continue;let a=Ya(t.name);a!==void 0&&t.value!==a&&(t.value=a)}}},en=t=>{let a=t.values.filter(r=>!ge(r.priceExtra)||Se(r.priceExtra)!==0),i=t.values.some(r=>!ge(r.priceExtra));return _("div",{"data-ui":"variant-editor-extras","data-attribute":t.attributeId,children:Fe({summary:a.length?n("priceExtrasSet",{list:a.map(r=>`${r.name} ${jn(r.priceExtra)}`).join(", ")}):n("priceExtrasNone"),open:i||h().includes(t.attributeId),body:_("div",{"data-ui":"variant-editor-extra-fields",children:tt(t.values,r=>r.valueId,r=>pt({id:`${e.id}-extra-${t.attributeId}-${r.valueId}`,name:`extra|${t.attributeId}|${r.valueId}`,label:r.name,value:r.priceExtra,step:"any",disabled:!m||f(),help:n("appliesTo",{count:it(t.attributeId,r.valueId)}),error:ge(r.priceExtra)?null:n("invalidNumber")}))})})})},tn=t=>{let a=Pe(t),i=m?a:t.values,r=new Set(t.values.map(u=>u.valueId)),s=t.createVariant==="no_variant";return J("li",{"data-ui":"variant-editor-line","data-empty":String(!t.values.length),children:[J("div",{"data-ui":"variant-editor-line-main",children:[ht({id:`${e.id}-values-${t.attributeId}`,name:`values|${t.attributeId}`,label:t.name,span:"full",disabled:!m||f(),options:i.map(u=>({value:u.valueId,label:u.name,checked:r.has(u.valueId)})),help:s?n("noVariantHint"):t.values.length?n("valuesSelected",{count:t.values.length,total:a.length}):n("valuesNone")}),J("div",{"data-ui":"variant-editor-line-actions",children:[s?ne({label:n("noVariant"),tone:"neutral"}):null,m&&r.size<a.length?A({name:Y,value:`selectAll|${t.attributeId}`,label:n("selectAll"),variant:"tertiary",size:"compact",disabled:f()}):null,m?Je({name:Y,value:`removeLine|${t.attributeId}`,label:n("removeAttributeNamed",{name:t.name}),icon:Qe("x"),size:"compact",disabled:f()}):null]})]}),t.values.length?en(t):null]})},an=()=>ve({eyebrow:n("stepAttributes"),title:n("attributesTitle"),description:n("attributesHint"),actions:m?_("div",{"data-ui":"variant-editor-picker",id:`${e.id}-attribute-picker`,children:b.view()}):void 0,body:J("div",{"data-ui":"variant-editor-body",children:[v().length?_("ul",{"data-ui":"variant-editor-lines",children:tt(v(),t=>t.attributeId,t=>tn(t))}):de({title:n("attributesEmpty"),message:m?n("attributesEmptyHint"):""}),fe.view()]})}),Mt=(t,a)=>{let i=t.images[0];return i?gt({item:{src:nt(i.attachmentId,"large"),thumbnail:nt(i.attachmentId,"thumb"),alt:i.alt||n("image")},labels:e.lightboxLabels,size:a,onOpen:r=>Ga(t,r)}):_("span",{"data-ui":"lightbox-empty","data-size":a,children:a==="small"?"":n("image")})},nn=(t,a)=>{let i=m&&e.media.upload&&(!t.images.length||e.media.remove),r=S()===t.key;return J("div",{role:"group","aria-label":n("image"),"data-ui":"variant-editor-image","data-drag":String(B()===t.key),"data-busy":String(r),onDragOver:s=>{!i||!t.id||(s.preventDefault(),B.set(t.key))},onDragLeave:s=>{let u=s.relatedTarget;u instanceof Node&&s.currentTarget.contains(u)||B.set(null)},onDrop:s=>{if(!i||!t.id)return;s.preventDefault(),B.set(null);let u=s.dataTransfer?.files?.[0];u&&Rt(t,u)},children:[Mt(t,"large"),J("div",{"data-ui":"variant-editor-image-actions",children:[i&&t.id?xt({id:`${a}-image`,name:`image|${t.key}`,label:t.images.length?n("replaceImage"):n("uploadImage"),accept:Wn,disabled:r||f(),status:n("dropImage"),span:"full"}):null,i&&!t.id?_("small",{"data-ui":"variant-editor-hint",children:n("imageSaveFirst")}):null,m&&e.media.remove&&t.images.length?A({name:Y,value:`removeImage|${t.key}`,label:n("removeImage"),variant:"tertiary",size:"compact",disabled:r||f()}):null]})]})},Ve=(t,a,i)=>{let r=String(t[i]??""),s={id:`${a}-${i}`,name:`field|${t.key}|${i}`,label:n(i),value:r,disabled:!m||f()};return i==="weight"||i==="volume"?W({...s,type:"decimal",step:"any",error:ge(r)?null:n("invalidNumber")}):bt(s)},rn=(t,a,i)=>t.active?a.has(t.key)?ne({label:n("duplicate",{row:a.get(t.key)}),tone:"danger"}):Le(t)?ne({label:n("rowInvalid"),tone:"danger"}):i.has(t.key)?ne({label:n("incomplete"),tone:"warning"}):t.id?null:ne({label:n("new"),tone:"info"}):ne({label:n("archived"),tone:"neutral"}),on=(t,a,i,r)=>{let s=`${e.id}-row-${t.key}`,u=`${s}-title`,V=le(t).filter(({value:k})=>Se(k.priceExtra)!==0),U=K()[t.key];return J("article",{"data-ui":"variant-editor-row",role:"listitem","data-active":String(t.active),"data-open":String(t.open),"data-invalid":String(i.has(t.key)||!!U||Le(t)),children:[J("div",{"data-ui":"variant-editor-row-head",children:[_("span",{"data-ui":"variant-editor-row-number",children:`#${a+1}`}),Mt(t,"small"),J("div",{"data-ui":"variant-editor-row-title",children:[_("strong",{id:u,"data-incomplete":String(r.has(t.key)),children:Ke(t.valueIds)}),t.defaultCode?_("small",{children:t.defaultCode}):null]}),J("div",{"data-ui":"variant-editor-row-meta",children:[rn(t,i,r),_("span",{"data-ui":"variant-editor-row-price",children:$e(Be(t))})]}),J("div",{"data-ui":"variant-editor-row-actions",children:[A({name:Y,value:`toggleRow|${t.key}`,label:t.open?n("collapse"):n(m?"edit":"details"),variant:"tertiary",size:"compact",expanded:t.open,controls:t.open?s:null,describedBy:u}),m?A({name:Y,value:`removeRow|${t.key}`,label:t.id?t.active?n("archive"):n("restore"):n("remove"),variant:"tertiary",size:"compact",disabled:f(),describedBy:u}):null]})]}),U?_("p",{"data-ui":"variant-editor-row-issue",children:U}):null,t.open?J("div",{"data-ui":"variant-editor-row-body",id:s,children:[nn(t,s),J("div",{"data-ui":"variant-editor-fields",children:[tt(G(),k=>k.attributeId,k=>vt({id:`${s}-${k.attributeId}`,name:`combo|${t.key}|${k.attributeId}`,label:k.name,value:t.valueIds[k.attributeId]??"",disabled:!m||!t.active||f(),options:[{value:"",label:n("choose",{name:k.name})},...k.values.map(X=>({value:X.valueId,label:X.name}))]})),Ve(t,s,"defaultCode"),Ve(t,s,"barcode"),Ve(t,s,"weight"),Ve(t,s,"volume")]}),J("p",{"data-ui":"variant-editor-breakdown",children:[[`${n("listPrice")} ${$e(Se(c()))}`,...V.map(({line:k,value:X})=>`${k.name} ${X.name} +${$e(Se(X.priceExtra))}`)].join(" \xB7 "),` = ${$e(Be(t))}`]})]}):null]})},ln=t=>{let a=t.slice(0,Zn).map(Ke),i=t.length-a.length;return te({tone:"info",title:n("missing",{count:t.length}),message:i>0?`${a.join(", ")} ${n("missingMore",{count:i})}`:a.join(", "),actions:A({name:Y,value:"generate",label:n("generate",{count:t.length}),variant:"primary",size:"compact",leading:Qe("plus"),disabled:f()})})},sn=()=>{let t=ke(),a=Te(),i=m?we():[],r=g().filter(u=>u.active).length,s=m&&(G().length>0||g().length>0);return ve({eyebrow:n("stepVariants"),title:n("variantsTitle"),description:g().length?n("variantsCount",{active:r,total:g().length}):null,actions:s?J("div",{"data-ui":"variant-editor-toolbar",children:[A({name:Y,value:"addRow",label:n("addVariant"),variant:"secondary",size:"compact",leading:Qe("plus"),disabled:f()}),g().some(u=>u.id&&!u.active)?A({name:Y,value:"activateAll",label:n("activateAll"),variant:"tertiary",size:"compact",disabled:f()}):null,r?A({name:Y,value:"archiveAll",label:n("archiveAll"),variant:"tertiary",size:"compact",disabled:f()}):null]}):void 0,body:J("div",{"data-ui":"variant-editor-body",children:[i.length?ln(i):null,g().length?_("div",{"data-ui":"variant-editor-rows",role:"list",children:tt(g(),u=>u.key,u=>on(u,g().indexOf(u),t,a))}):i.length?null:de({title:n("variantsEmpty"),message:G().length?n("variantsEmptyHint"):n("variantsNeedAttributes")})]})})},dn=()=>{let t=ke().size,a=g().filter(u=>u.id&&!u.active&&l.variants.find(V=>V.id===u.id)?.active).length,i=g().filter(u=>!u.id&&u.active).length,r=[i?n("summaryCreate",{count:i}):"",a?n("summaryArchive",{count:a}):""].filter(Boolean),s=Ne()||qe();return J("footer",{"data-ui":"variant-editor-footer",children:[_("p",{"data-ui":"variant-editor-summary","data-tone":t||s?"danger":"neutral","aria-live":"polite",children:f()?n("saving"):t?n("summaryDuplicate"):s?n("summaryInvalid"):I()??(C()?r.join(" \xB7 ")||n("summaryChanged"):"")}),m?A({name:Y,value:"reset",label:n("reset"),variant:"secondary",size:"compact",disabled:!C()||f()}):null]})},rt=ei(e.id),cn=()=>document.querySelector(`button[form="${rt}"]`);return{view:()=>J("div",{"data-ui":"variant-editor",id:e.id,"aria-busy":f()?"true":null,onClick:_a,onChange:ja,onInput:Za,children:[m?null:te({title:n("readOnly"),message:""}),$()?te({title:n("saveFailed"),message:$()??"",tone:"danger"}):null,an(),sn(),dn(),_("form",{id:rt,"data-record-dirty":C()?"true":null,hidden:!0}),P.layer()]}),mount:({root:t,lifetime:a})=>{T=t,a.addEventListener("abort",()=>{H=!0,T=null}),fe.attach(T,a);let i=T.querySelector(`[id="${e.id}-attribute-picker"]`);i&&b.mount?.({root:i,lifetime:a}),a.addEventListener("abort",()=>b.dispose?.()),P.attach(a),T.addEventListener("toggle",u=>{let V=u.target;if(!(V instanceof HTMLDetailsElement))return;let U=V.closest('[data-ui="variant-editor-extras"]')?.dataset.attribute;if(!U)return;let k=h().filter(X=>X!==U);h.set(V.open?[...k,U]:k)},{signal:a,capture:!0}),document.addEventListener("submit",u=>{!(u.target instanceof HTMLFormElement)||u.target.id!==rt||(u.preventDefault(),u.stopImmediatePropagation(),Ee()||Ua())},{signal:a,capture:!0});let r=Ka(()=>{let u=cn();u&&(u.disabled=Ee(),f()?u.setAttribute("aria-busy","true"):u.removeAttribute("aria-busy"))}),s=Ka(()=>{v(),g(),queueMicrotask(Qa)});a.addEventListener("abort",()=>{r(),s()})}}}var ei=e=>`${e}-save`,jf=e=>Qn(e);export{Qn as createVariantEditorView,jf as variantEditor,ei as variantEditorSaveForm};