@wealthx/shadcn 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/.turbo/turbo-build.log +235 -154
  2. package/CHANGELOG.md +6 -0
  3. package/dist/{chunk-6OJF6XRN.mjs → chunk-24FUO7TD.mjs} +4 -8
  4. package/dist/{chunk-4AJ5HWHD.mjs → chunk-2I5S2AMY.mjs} +3 -3
  5. package/dist/chunk-2SF672SZ.mjs +161 -0
  6. package/dist/{chunk-GPRJQ24C.mjs → chunk-34NWQURD.mjs} +2 -2
  7. package/dist/{chunk-MQ72DIBH.mjs → chunk-3GF7OVTP.mjs} +14 -5
  8. package/dist/chunk-3WMX6KWS.mjs +245 -0
  9. package/dist/{chunk-PMKODV6M.mjs → chunk-462HMNO4.mjs} +6 -10
  10. package/dist/chunk-4CX4SBRO.mjs +153 -0
  11. package/dist/chunk-4MN6UQHG.mjs +443 -0
  12. package/dist/{chunk-GLW2UO6O.mjs → chunk-5QQVZTVZ.mjs} +82 -61
  13. package/dist/{chunk-BGP2N52Z.mjs → chunk-66MI7Q4B.mjs} +5 -5
  14. package/dist/chunk-6FCGKSZX.mjs +268 -0
  15. package/dist/{chunk-CGOKTPXU.mjs → chunk-6JQFUE5I.mjs} +20 -23
  16. package/dist/{chunk-Z3MK2KKZ.mjs → chunk-7DHU4VGG.mjs} +7 -3
  17. package/dist/{chunk-VZ2NR7L3.mjs → chunk-7PYJD5JI.mjs} +35 -27
  18. package/dist/{chunk-JU2RUWHF.mjs → chunk-7XJHLGUV.mjs} +1 -1
  19. package/dist/{chunk-BMFN37JH.mjs → chunk-7YAU5CY6.mjs} +1 -1
  20. package/dist/chunk-A56YQQHG.mjs +402 -0
  21. package/dist/chunk-AH52LG6N.mjs +315 -0
  22. package/dist/{chunk-SLWCCURD.mjs → chunk-CLIN5525.mjs} +8 -4
  23. package/dist/{chunk-3VQNJ235.mjs → chunk-CSDO6VBW.mjs} +7 -0
  24. package/dist/chunk-D4ILTPOG.mjs +293 -0
  25. package/dist/{chunk-HS7TFG7V.mjs → chunk-D6ID6M4V.mjs} +1 -1
  26. package/dist/chunk-DOH3EHX7.mjs +378 -0
  27. package/dist/{chunk-MJIEMGRD.mjs → chunk-EFRENWEJ.mjs} +9 -17
  28. package/dist/{chunk-YBXCIF5Q.mjs → chunk-ERGGHC2V.mjs} +36 -49
  29. package/dist/{chunk-OXQQNQZI.mjs → chunk-FEZKMUCF.mjs} +10 -1
  30. package/dist/{chunk-55CEW76V.mjs → chunk-FH6QVUVZ.mjs} +1 -1
  31. package/dist/chunk-FMAXJ2SI.mjs +71 -0
  32. package/dist/chunk-FZIXGLMV.mjs +173 -0
  33. package/dist/{chunk-DS2AMHN2.mjs → chunk-GYMYRIZP.mjs} +2 -2
  34. package/dist/{chunk-KQDD5MU3.mjs → chunk-H45TKD34.mjs} +5 -5
  35. package/dist/{chunk-BBJBJSXQ.mjs → chunk-J5UICVJS.mjs} +1 -1
  36. package/dist/{chunk-RL772EH7.mjs → chunk-JHJHG4GO.mjs} +4 -12
  37. package/dist/{chunk-RN67642N.mjs → chunk-KMCGSZTX.mjs} +47 -41
  38. package/dist/{chunk-FHNT55I5.mjs → chunk-KUDCQ4FI.mjs} +4 -4
  39. package/dist/chunk-LE6YFY6D.mjs +209 -0
  40. package/dist/{chunk-NLLKTU4B.mjs → chunk-LLVQKSU3.mjs} +21 -17
  41. package/dist/{chunk-KKHTJNMM.mjs → chunk-MARPPFOJ.mjs} +8 -4
  42. package/dist/{chunk-6AFMNC42.mjs → chunk-N2PT566P.mjs} +15 -11
  43. package/dist/chunk-NLCKVHWB.mjs +161 -0
  44. package/dist/{chunk-YN5SYTOO.mjs → chunk-NQPOYKAQ.mjs} +9 -5
  45. package/dist/{chunk-ZZV5JVNW.mjs → chunk-NSLMILBT.mjs} +3 -7
  46. package/dist/chunk-NXA3CZ7A.mjs +248 -0
  47. package/dist/chunk-OGOYQ7BG.mjs +150 -0
  48. package/dist/{chunk-3NQGYJEZ.mjs → chunk-P6AM5V7O.mjs} +10 -18
  49. package/dist/{chunk-CZ3BW5GL.mjs → chunk-P76HMUI6.mjs} +5 -11
  50. package/dist/chunk-PCPLO5HT.mjs +671 -0
  51. package/dist/chunk-PG6K5XEC.mjs +475 -0
  52. package/dist/{chunk-5JGQAAQV.mjs → chunk-PJHPSRYD.mjs} +84 -62
  53. package/dist/{chunk-DDPA2XXS.mjs → chunk-PMB3A7V3.mjs} +2 -2
  54. package/dist/chunk-PR6V5XKM.mjs +209 -0
  55. package/dist/{chunk-46OFHMQA.mjs → chunk-Q76O3RIQ.mjs} +10 -6
  56. package/dist/chunk-QVKWW6KE.mjs +272 -0
  57. package/dist/chunk-RGU7HOEC.mjs +140 -0
  58. package/dist/{chunk-JF4PHPD5.mjs → chunk-RGVKLTLH.mjs} +4 -4
  59. package/dist/{chunk-VG6UF6UT.mjs → chunk-RP3SQYA3.mjs} +2 -2
  60. package/dist/chunk-RRBS6D63.mjs +163 -0
  61. package/dist/{chunk-UEL4RD5P.mjs → chunk-SMQ3DG25.mjs} +80 -67
  62. package/dist/chunk-SPJ5KXW7.mjs +199 -0
  63. package/dist/chunk-SYOD63OZ.mjs +225 -0
  64. package/dist/chunk-UFYSFDER.mjs +42 -0
  65. package/dist/chunk-VACKZOMY.mjs +190 -0
  66. package/dist/chunk-VLQZANBF.mjs +42 -0
  67. package/dist/chunk-WA6O6EUR.mjs +1885 -0
  68. package/dist/{chunk-E3K6O4FZ.mjs → chunk-WAZD7NFU.mjs} +5 -2
  69. package/dist/chunk-WG6JGJXB.mjs +165 -0
  70. package/dist/{chunk-I64K754C.mjs → chunk-WNGWBVLV.mjs} +2 -2
  71. package/dist/{chunk-3U7SD3MS.mjs → chunk-WOEHFRGB.mjs} +3 -3
  72. package/dist/{chunk-DKZRJOMF.mjs → chunk-XIRTEFKH.mjs} +12 -12
  73. package/dist/chunk-Y6DWJSKZ.mjs +79 -0
  74. package/dist/chunk-YKPROFLB.mjs +161 -0
  75. package/dist/{chunk-CJ46PDXE.mjs → chunk-ZRO5JO3H.mjs} +106 -66
  76. package/dist/{chunk-VYMHBV6D.mjs → chunk-ZU4NV6RG.mjs} +5 -3
  77. package/dist/components/ui/accordion.js +40 -4
  78. package/dist/components/ui/accordion.mjs +2 -2
  79. package/dist/components/ui/add-column-modal.js +789 -0
  80. package/dist/components/ui/add-column-modal.mjs +17 -0
  81. package/dist/components/ui/add-lead-modal.js +647 -0
  82. package/dist/components/ui/add-lead-modal.mjs +16 -0
  83. package/dist/components/ui/ai-assistant-drawer.js +686 -0
  84. package/dist/components/ui/ai-assistant-drawer.mjs +16 -0
  85. package/dist/components/ui/alert-dialog.js +37 -5
  86. package/dist/components/ui/alert-dialog.mjs +4 -4
  87. package/dist/components/ui/alert.js +37 -11
  88. package/dist/components/ui/alert.mjs +2 -2
  89. package/dist/components/ui/avatar.js +36 -8
  90. package/dist/components/ui/avatar.mjs +2 -2
  91. package/dist/components/ui/backoffice-alert-history-chart.js +624 -0
  92. package/dist/components/ui/backoffice-alert-history-chart.mjs +16 -0
  93. package/dist/components/ui/backoffice-contact-history-chart.js +687 -0
  94. package/dist/components/ui/backoffice-contact-history-chart.mjs +16 -0
  95. package/dist/components/ui/badge.js +37 -2
  96. package/dist/components/ui/badge.mjs +2 -2
  97. package/dist/components/ui/borrowing-capacity-line-chart.js +639 -0
  98. package/dist/components/ui/borrowing-capacity-line-chart.mjs +16 -0
  99. package/dist/components/ui/button.js +35 -3
  100. package/dist/components/ui/button.mjs +2 -2
  101. package/dist/components/ui/calendar.js +43 -19
  102. package/dist/components/ui/calendar.mjs +3 -3
  103. package/dist/components/ui/card.js +40 -4
  104. package/dist/components/ui/card.mjs +2 -2
  105. package/dist/components/ui/cash-balance-line-chart.js +627 -0
  106. package/dist/components/ui/cash-balance-line-chart.mjs +16 -0
  107. package/dist/components/ui/cashflow-bar-chart.js +123 -69
  108. package/dist/components/ui/cashflow-bar-chart.mjs +8 -8
  109. package/dist/components/ui/checkbox.js +36 -5
  110. package/dist/components/ui/checkbox.mjs +2 -3
  111. package/dist/components/ui/chip.js +37 -2
  112. package/dist/components/ui/chip.mjs +3 -3
  113. package/dist/components/ui/combobox.js +68 -49
  114. package/dist/components/ui/combobox.mjs +2 -2
  115. package/dist/components/ui/data-table.js +160 -88
  116. package/dist/components/ui/data-table.mjs +10 -11
  117. package/dist/components/ui/date-picker.js +44 -20
  118. package/dist/components/ui/date-picker.mjs +6 -7
  119. package/dist/components/ui/dialog.js +44 -12
  120. package/dist/components/ui/dialog.mjs +4 -4
  121. package/dist/components/ui/drawer.js +46 -10
  122. package/dist/components/ui/drawer.mjs +3 -3
  123. package/dist/components/ui/dropdown-menu.js +40 -16
  124. package/dist/components/ui/dropdown-menu.mjs +3 -3
  125. package/dist/components/ui/empty.js +41 -5
  126. package/dist/components/ui/empty.mjs +2 -2
  127. package/dist/components/ui/expense-bar-chart.js +165 -66
  128. package/dist/components/ui/expense-bar-chart.mjs +8 -8
  129. package/dist/components/ui/field.js +53 -21
  130. package/dist/components/ui/field.mjs +4 -4
  131. package/dist/components/ui/financial-cards.js +1002 -0
  132. package/dist/components/ui/financial-cards.mjs +24 -0
  133. package/dist/components/ui/financial-drawers.js +637 -0
  134. package/dist/components/ui/financial-drawers.mjs +17 -0
  135. package/dist/components/ui/financial-primitives.js +218 -0
  136. package/dist/components/ui/financial-primitives.mjs +22 -0
  137. package/dist/components/ui/financial-sections.js +1422 -0
  138. package/dist/components/ui/financial-sections.mjs +30 -0
  139. package/dist/components/ui/form-primitives.js +682 -0
  140. package/dist/components/ui/form-primitives.mjs +19 -0
  141. package/dist/components/ui/income-bar-chart.js +163 -65
  142. package/dist/components/ui/income-bar-chart.mjs +8 -8
  143. package/dist/components/ui/input-group.js +43 -7
  144. package/dist/components/ui/input-group.mjs +5 -5
  145. package/dist/components/ui/input-otp.js +39 -3
  146. package/dist/components/ui/input-otp.mjs +2 -2
  147. package/dist/components/ui/input.js +34 -2
  148. package/dist/components/ui/input.mjs +2 -2
  149. package/dist/components/ui/kanban-column.js +1143 -0
  150. package/dist/components/ui/kanban-column.mjs +20 -0
  151. package/dist/components/ui/label.js +35 -7
  152. package/dist/components/ui/label.mjs +2 -2
  153. package/dist/components/ui/opportunity-card.js +960 -0
  154. package/dist/components/ui/opportunity-card.mjs +20 -0
  155. package/dist/components/ui/opportunity-edit-modals.js +3360 -0
  156. package/dist/components/ui/opportunity-edit-modals.mjs +37 -0
  157. package/dist/components/ui/opportunity-summary-tab.js +4365 -0
  158. package/dist/components/ui/opportunity-summary-tab.mjs +34 -0
  159. package/dist/components/ui/pagination.js +35 -3
  160. package/dist/components/ui/pagination.mjs +3 -3
  161. package/dist/components/ui/pipeline-alerts.js +103 -0
  162. package/dist/components/ui/pipeline-alerts.mjs +8 -0
  163. package/dist/components/ui/pipeline-board.js +1408 -0
  164. package/dist/components/ui/pipeline-board.mjs +24 -0
  165. package/dist/components/ui/pipeline-chart.js +216 -0
  166. package/dist/components/ui/pipeline-chart.mjs +10 -0
  167. package/dist/components/ui/pipeline-dialogs.js +1183 -0
  168. package/dist/components/ui/pipeline-dialogs.mjs +23 -0
  169. package/dist/components/ui/pipeline-primitives.js +300 -0
  170. package/dist/components/ui/pipeline-primitives.mjs +11 -0
  171. package/dist/components/ui/popover.js +45 -4
  172. package/dist/components/ui/popover.mjs +3 -3
  173. package/dist/components/ui/progress.js +33 -1
  174. package/dist/components/ui/progress.mjs +2 -2
  175. package/dist/components/ui/property-cashflow-doughnut-chart.js +523 -0
  176. package/dist/components/ui/property-cashflow-doughnut-chart.mjs +16 -0
  177. package/dist/components/ui/property-debt-equity-doughnut-chart.js +521 -0
  178. package/dist/components/ui/property-debt-equity-doughnut-chart.mjs +16 -0
  179. package/dist/components/ui/property-mobile-estimate-line-chart.js +682 -0
  180. package/dist/components/ui/property-mobile-estimate-line-chart.mjs +16 -0
  181. package/dist/components/ui/radio-group.js +33 -1
  182. package/dist/components/ui/radio-group.mjs +2 -2
  183. package/dist/components/ui/select.js +66 -26
  184. package/dist/components/ui/select.mjs +3 -3
  185. package/dist/components/ui/separator.js +33 -1
  186. package/dist/components/ui/separator.mjs +2 -2
  187. package/dist/components/ui/sheet.js +37 -9
  188. package/dist/components/ui/sheet.mjs +3 -3
  189. package/dist/components/ui/skeleton.js +33 -1
  190. package/dist/components/ui/skeleton.mjs +2 -2
  191. package/dist/components/ui/slider.js +86 -102
  192. package/dist/components/ui/slider.mjs +2 -2
  193. package/dist/components/ui/spinner.js +33 -1
  194. package/dist/components/ui/spinner.mjs +2 -2
  195. package/dist/components/ui/stage-timeline.js +579 -0
  196. package/dist/components/ui/stage-timeline.mjs +15 -0
  197. package/dist/components/ui/switch.js +37 -4
  198. package/dist/components/ui/switch.mjs +2 -3
  199. package/dist/components/ui/table.js +37 -5
  200. package/dist/components/ui/table.mjs +2 -2
  201. package/dist/components/ui/tabs.js +36 -12
  202. package/dist/components/ui/tabs.mjs +2 -2
  203. package/dist/components/ui/textarea.js +34 -2
  204. package/dist/components/ui/textarea.mjs +2 -2
  205. package/dist/components/ui/toggle-group.js +35 -4
  206. package/dist/components/ui/toggle-group.mjs +3 -4
  207. package/dist/components/ui/toggle.js +35 -4
  208. package/dist/components/ui/toggle.mjs +2 -3
  209. package/dist/components/ui/tooltip.js +51 -22
  210. package/dist/components/ui/tooltip.mjs +3 -3
  211. package/dist/components/ui/transactions-expense-categories-doughnut-chart.js +528 -0
  212. package/dist/components/ui/transactions-expense-categories-doughnut-chart.mjs +16 -0
  213. package/dist/components/ui/transactions-income-expense-bar-chart.js +76 -38
  214. package/dist/components/ui/transactions-income-expense-bar-chart.mjs +8 -8
  215. package/dist/components/ui/transactions-liabilities-breakdown-doughnut-chart.js +528 -0
  216. package/dist/components/ui/transactions-liabilities-breakdown-doughnut-chart.mjs +16 -0
  217. package/dist/index.js +11616 -3831
  218. package/dist/index.mjs +333 -161
  219. package/dist/lib/theme-provider.js +10 -1
  220. package/dist/lib/theme-provider.mjs +1 -1
  221. package/dist/lib/typography.js +8 -0
  222. package/dist/lib/typography.mjs +3 -1
  223. package/dist/lib/utils.js +33 -1
  224. package/dist/lib/utils.mjs +1 -1
  225. package/dist/styles.css +1 -1
  226. package/package.json +140 -5
  227. package/src/components/index.tsx +296 -42
  228. package/src/components/ui/accordion.tsx +6 -3
  229. package/src/components/ui/add-column-modal.tsx +339 -0
  230. package/src/components/ui/add-lead-modal.tsx +290 -0
  231. package/src/components/ui/ai-assistant-drawer.tsx +408 -0
  232. package/src/components/ui/alert-dialog.tsx +80 -54
  233. package/src/components/ui/alert.tsx +28 -28
  234. package/src/components/ui/avatar.tsx +30 -29
  235. package/src/components/ui/backoffice-alert-history-chart.tsx +260 -0
  236. package/src/components/ui/backoffice-contact-history-chart.tsx +325 -0
  237. package/src/components/ui/badge.tsx +17 -15
  238. package/src/components/ui/borrowing-capacity-line-chart.tsx +357 -0
  239. package/src/components/ui/button.tsx +30 -27
  240. package/src/components/ui/calendar.tsx +53 -67
  241. package/src/components/ui/card.tsx +27 -24
  242. package/src/components/ui/cash-balance-line-chart.tsx +302 -0
  243. package/src/components/ui/cashflow-bar-chart.tsx +104 -77
  244. package/src/components/ui/chart-shared.tsx +176 -15
  245. package/src/components/ui/checkbox.tsx +30 -26
  246. package/src/components/ui/combobox.tsx +78 -72
  247. package/src/components/ui/data-table.tsx +160 -99
  248. package/src/components/ui/date-picker.tsx +0 -2
  249. package/src/components/ui/dialog.tsx +70 -60
  250. package/src/components/ui/drawer.tsx +57 -48
  251. package/src/components/ui/dropdown-menu.tsx +90 -82
  252. package/src/components/ui/empty.tsx +31 -27
  253. package/src/components/ui/expense-bar-chart.tsx +83 -65
  254. package/src/components/ui/field.tsx +70 -62
  255. package/src/components/ui/financial-cards.tsx +830 -0
  256. package/src/components/ui/financial-drawers.tsx +339 -0
  257. package/src/components/ui/financial-primitives.tsx +331 -0
  258. package/src/components/ui/financial-sections.tsx +672 -0
  259. package/src/components/ui/form-primitives.tsx +536 -0
  260. package/src/components/ui/income-bar-chart.tsx +79 -60
  261. package/src/components/ui/input-group.tsx +41 -34
  262. package/src/components/ui/input-otp.tsx +29 -24
  263. package/src/components/ui/input.tsx +8 -8
  264. package/src/components/ui/kanban-column.tsx +333 -0
  265. package/src/components/ui/label.tsx +9 -12
  266. package/src/components/ui/opportunity-card.tsx +616 -0
  267. package/src/components/ui/opportunity-edit-modals.tsx +2528 -0
  268. package/src/components/ui/opportunity-summary-tab.tsx +579 -0
  269. package/src/components/ui/pipeline-alerts.tsx +74 -0
  270. package/src/components/ui/pipeline-board.tsx +268 -0
  271. package/src/components/ui/pipeline-chart.tsx +173 -0
  272. package/src/components/ui/pipeline-dialogs.tsx +303 -0
  273. package/src/components/ui/pipeline-primitives.tsx +108 -0
  274. package/src/components/ui/popover.tsx +41 -36
  275. package/src/components/ui/property-cashflow-doughnut-chart.tsx +188 -0
  276. package/src/components/ui/property-debt-equity-doughnut-chart.tsx +185 -0
  277. package/src/components/ui/property-mobile-estimate-line-chart.tsx +393 -0
  278. package/src/components/ui/select.tsx +65 -52
  279. package/src/components/ui/sheet.tsx +55 -52
  280. package/src/components/ui/slider.tsx +54 -77
  281. package/src/components/ui/stage-timeline.tsx +205 -0
  282. package/src/components/ui/switch.tsx +42 -29
  283. package/src/components/ui/table.tsx +28 -28
  284. package/src/components/ui/tabs.tsx +22 -28
  285. package/src/components/ui/textarea.tsx +8 -8
  286. package/src/components/ui/toggle-group.tsx +0 -2
  287. package/src/components/ui/toggle.tsx +13 -15
  288. package/src/components/ui/tooltip.tsx +30 -28
  289. package/src/components/ui/transactions-expense-categories-doughnut-chart.tsx +191 -0
  290. package/src/components/ui/transactions-income-expense-bar-chart.tsx +45 -38
  291. package/src/components/ui/transactions-liabilities-breakdown-doughnut-chart.tsx +191 -0
  292. package/src/lib/theme-provider.tsx +10 -0
  293. package/src/lib/typography.ts +9 -0
  294. package/src/lib/utils.ts +41 -3
  295. package/src/styles/globals.css +371 -124
  296. package/src/styles/styles-css.ts +1 -1
  297. package/tsup.config.ts +27 -0
  298. package/dist/chunk-3EQP72AW.mjs +0 -58
  299. package/dist/chunk-K74JRTJR.mjs +0 -105
  300. package/dist/chunk-V7CNWJT3.mjs +0 -10
@@ -0,0 +1,3360 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, { get: all[name], enumerable: true });
40
+ };
41
+ var __copyProps = (to, from, except, desc) => {
42
+ if (from && typeof from === "object" || typeof from === "function") {
43
+ for (let key of __getOwnPropNames(from))
44
+ if (!__hasOwnProp.call(to, key) && key !== except)
45
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
+ }
47
+ return to;
48
+ };
49
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
50
+ // If the importer is in node compatibility mode or this is not an ESM
51
+ // file that has been converted to a CommonJS file using a Babel-
52
+ // compatible transform (i.e. "__esModule" has not been set), then set
53
+ // "default" to the CommonJS "module.exports" for node compatibility.
54
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
55
+ mod
56
+ ));
57
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
58
+
59
+ // src/components/ui/opportunity-edit-modals.tsx
60
+ var opportunity_edit_modals_exports = {};
61
+ __export(opportunity_edit_modals_exports, {
62
+ EditAboutApplicantModal: () => EditAboutApplicantModal,
63
+ EditAssetsModal: () => EditAssetsModal,
64
+ EditDebtsModal: () => EditDebtsModal,
65
+ EditExpensesModal: () => EditExpensesModal,
66
+ EditIncomeModal: () => EditIncomeModal,
67
+ EditLoanScenarioModal: () => EditLoanScenarioModal
68
+ });
69
+ module.exports = __toCommonJS(opportunity_edit_modals_exports);
70
+ var React8 = __toESM(require("react"));
71
+ var import_lucide_react10 = require("lucide-react");
72
+
73
+ // src/lib/utils.ts
74
+ var import_clsx = require("clsx");
75
+ var import_tailwind_merge = require("tailwind-merge");
76
+ var twMerge = (0, import_tailwind_merge.extendTailwindMerge)({
77
+ extend: {
78
+ classGroups: {
79
+ "font-size": [
80
+ {
81
+ text: [
82
+ "display-large",
83
+ "display-medium",
84
+ "display-small",
85
+ "h1",
86
+ "h2",
87
+ "h3",
88
+ "h4",
89
+ "h5",
90
+ "h6",
91
+ "body-large",
92
+ "body-medium",
93
+ "body-small",
94
+ "label-large",
95
+ "label-medium",
96
+ "label-small",
97
+ "button",
98
+ "button-xs",
99
+ "caption",
100
+ "overline",
101
+ "code"
102
+ ]
103
+ }
104
+ ]
105
+ }
106
+ }
107
+ });
108
+ function cn(...inputs) {
109
+ return twMerge((0, import_clsx.clsx)(inputs));
110
+ }
111
+
112
+ // src/components/ui/dialog.tsx
113
+ var import_lucide_react2 = require("lucide-react");
114
+ var import_dialog = require("@base-ui/react/dialog");
115
+
116
+ // src/lib/theme-provider.tsx
117
+ var import_react = require("react");
118
+ var import_jsx_runtime = require("react/jsx-runtime");
119
+ var ThemeVarsContext = (0, import_react.createContext)({});
120
+ function useThemeVars() {
121
+ return (0, import_react.useContext)(ThemeVarsContext);
122
+ }
123
+
124
+ // src/components/ui/button.tsx
125
+ var import_react2 = require("react");
126
+ var import_class_variance_authority = require("class-variance-authority");
127
+ var import_lucide_react = require("lucide-react");
128
+
129
+ // src/lib/slot.tsx
130
+ var React2 = __toESM(require("react"));
131
+ function mergeRefs(...refs) {
132
+ return (value) => {
133
+ for (const ref of refs) {
134
+ if (typeof ref === "function") ref(value);
135
+ else if (ref !== null)
136
+ ref.current = value;
137
+ }
138
+ };
139
+ }
140
+ var Slot = React2.forwardRef(
141
+ (_a, forwardedRef) => {
142
+ var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
143
+ const child = React2.Children.only(children);
144
+ if (!React2.isValidElement(child)) return null;
145
+ const childProps = child.props;
146
+ const merged = __spreadValues({}, props);
147
+ for (const key of Object.keys(childProps)) {
148
+ if (key === "className") {
149
+ merged.className = [props.className, childProps.className].filter(Boolean).join(" ");
150
+ } else if (key === "style") {
151
+ merged.style = __spreadValues(__spreadValues({}, props.style), childProps.style);
152
+ } else if (key.startsWith("on") && typeof childProps[key] === "function") {
153
+ const parentHandler = props[key];
154
+ if (typeof parentHandler === "function") {
155
+ merged[key] = (...args) => {
156
+ childProps[key](...args);
157
+ parentHandler(...args);
158
+ };
159
+ } else {
160
+ merged[key] = childProps[key];
161
+ }
162
+ } else {
163
+ merged[key] = childProps[key];
164
+ }
165
+ }
166
+ const childRef = child.ref;
167
+ merged.ref = forwardedRef ? mergeRefs(forwardedRef, childRef) : childRef;
168
+ return React2.cloneElement(
169
+ child,
170
+ merged
171
+ );
172
+ }
173
+ );
174
+ Slot.displayName = "Slot";
175
+
176
+ // src/components/ui/button.tsx
177
+ var import_jsx_runtime2 = require("react/jsx-runtime");
178
+ var buttonVariants = (0, import_class_variance_authority.cva)(
179
+ "inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 font-sans text-button whitespace-nowrap transition-all active:scale-[0.98] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
180
+ {
181
+ variants: {
182
+ variant: {
183
+ default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
184
+ secondary: "bg-brand-secondary text-brand-secondary-foreground shadow-xs hover:bg-brand-secondary/80 focus-visible:ring-brand-secondary/30",
185
+ destructive: "bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
186
+ outline: "border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
187
+ "outline-primary": "border border-primary text-foreground bg-transparent shadow-xs hover:bg-primary/5 focus-visible:ring-primary/50",
188
+ "outline-secondary": "border border-brand-secondary text-brand-secondary bg-transparent shadow-xs hover:bg-brand-secondary/10 focus-visible:ring-brand-secondary/30",
189
+ ghost: "hover:bg-accent hover:text-accent-foreground hover:shadow-xs dark:hover:bg-accent/50",
190
+ link: "text-primary underline-offset-4 hover:underline"
191
+ },
192
+ size: {
193
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
194
+ xs: "h-6 gap-1 px-2 text-button-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
195
+ sm: "h-8 gap-1.5 px-3 has-[>svg]:px-2.5",
196
+ lg: "h-10 px-6 has-[>svg]:px-4",
197
+ icon: "size-9",
198
+ "icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3",
199
+ "icon-sm": "size-8",
200
+ "icon-lg": "size-10"
201
+ }
202
+ },
203
+ defaultVariants: {
204
+ variant: "default",
205
+ size: "default"
206
+ }
207
+ }
208
+ );
209
+ var Button = (0, import_react2.forwardRef)(function Button2(_a, ref) {
210
+ var _b = _a, {
211
+ className,
212
+ variant,
213
+ size,
214
+ asChild = false,
215
+ loading = false,
216
+ disabled,
217
+ type = "button",
218
+ children
219
+ } = _b, props = __objRest(_b, [
220
+ "className",
221
+ "variant",
222
+ "size",
223
+ "asChild",
224
+ "loading",
225
+ "disabled",
226
+ "type",
227
+ "children"
228
+ ]);
229
+ const Comp = asChild ? Slot : "button";
230
+ const isIconOnly = size === "icon" || size === "icon-xs" || size === "icon-sm" || size === "icon-lg";
231
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
232
+ Comp,
233
+ __spreadProps(__spreadValues({
234
+ className: cn(buttonVariants({ variant, size, className })),
235
+ "data-size": size,
236
+ "data-slot": "button",
237
+ "data-variant": variant,
238
+ disabled: loading || disabled,
239
+ ref,
240
+ type
241
+ }, props), {
242
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
243
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.Loader2, { "aria-hidden": "true", className: "animate-spin" }),
244
+ !isIconOnly && children
245
+ ] }) : children
246
+ })
247
+ );
248
+ });
249
+
250
+ // src/components/ui/dialog.tsx
251
+ var import_jsx_runtime3 = require("react/jsx-runtime");
252
+ function Dialog(_a) {
253
+ var props = __objRest(_a, []);
254
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog.Dialog.Root, __spreadValues({ "data-slot": "dialog" }, props));
255
+ }
256
+ function DialogPortal(_a) {
257
+ var props = __objRest(_a, []);
258
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog.Dialog.Portal, __spreadValues({ "data-slot": "dialog-portal" }, props));
259
+ }
260
+ function DialogOverlay(_a) {
261
+ var _b = _a, {
262
+ className
263
+ } = _b, props = __objRest(_b, [
264
+ "className"
265
+ ]);
266
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
267
+ import_dialog.Dialog.Backdrop,
268
+ __spreadValues({
269
+ className: cn(
270
+ // WealthX: foreground/50 scrim (matches Figma — foreground token at 50% opacity)
271
+ "fixed inset-0 z-50 bg-foreground/50 data-ending-style:animate-out data-ending-style:fade-out-0 data-ending-style:fill-mode-forwards data-open:animate-in data-open:fade-in-0",
272
+ className
273
+ ),
274
+ "data-slot": "dialog-overlay"
275
+ }, props)
276
+ );
277
+ }
278
+ function DialogContent(_a) {
279
+ var _b = _a, {
280
+ className,
281
+ children,
282
+ showCloseButton = true,
283
+ style
284
+ } = _b, props = __objRest(_b, [
285
+ "className",
286
+ "children",
287
+ "showCloseButton",
288
+ "style"
289
+ ]);
290
+ const themeVars = useThemeVars();
291
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(DialogPortal, { children: [
292
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DialogOverlay, { style: themeVars }),
293
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
294
+ import_dialog.Dialog.Popup,
295
+ __spreadProps(__spreadValues({
296
+ className: cn(
297
+ // WealthX: removed rounded-lg (sharp corners), shadow-lg (flat panels), foreground/50 scrim via DialogOverlay
298
+ "fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 duration-200 outline-none data-ending-style:animate-out data-ending-style:fade-out-0 data-ending-style:zoom-out-95 data-ending-style:fill-mode-forwards data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 sm:max-w-lg",
299
+ className
300
+ ),
301
+ "data-slot": "dialog-content",
302
+ style: __spreadValues(__spreadValues({}, themeVars), style)
303
+ }, props), {
304
+ children: [
305
+ children,
306
+ showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
307
+ import_dialog.Dialog.Close,
308
+ {
309
+ className: "absolute top-4 right-4 transition-colors hover:bg-foreground/5 focus:outline-hidden focus:ring-2 focus:ring-border focus:ring-offset-0 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
310
+ "data-slot": "dialog-close",
311
+ children: [
312
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react2.XIcon, {}),
313
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "sr-only", children: "Close" })
314
+ ]
315
+ }
316
+ ) : null
317
+ ]
318
+ })
319
+ )
320
+ ] });
321
+ }
322
+ function DialogHeader(_a) {
323
+ var _b = _a, {
324
+ className
325
+ } = _b, props = __objRest(_b, [
326
+ "className"
327
+ ]);
328
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
329
+ "div",
330
+ __spreadValues({
331
+ className: cn("flex flex-col gap-1.5", className),
332
+ "data-slot": "dialog-header"
333
+ }, props)
334
+ );
335
+ }
336
+ function DialogFooter(_a) {
337
+ var _b = _a, {
338
+ className,
339
+ showCloseButton = false,
340
+ children
341
+ } = _b, props = __objRest(_b, [
342
+ "className",
343
+ "showCloseButton",
344
+ "children"
345
+ ]);
346
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
347
+ "div",
348
+ __spreadProps(__spreadValues({
349
+ className: cn(
350
+ // WealthX: always row layout, right-aligned, separator above footer
351
+ "flex flex-row justify-end gap-2 border-t border-border pt-4",
352
+ className
353
+ ),
354
+ "data-slot": "dialog-footer"
355
+ }, props), {
356
+ children: [
357
+ children,
358
+ showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
359
+ import_dialog.Dialog.Close,
360
+ {
361
+ className: cn(buttonVariants({ variant: "outline" })),
362
+ children: "Close"
363
+ }
364
+ ) : null
365
+ ]
366
+ })
367
+ );
368
+ }
369
+ function DialogTitle(_a) {
370
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
371
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
372
+ import_dialog.Dialog.Title,
373
+ __spreadValues({
374
+ className: cn("text-h5 leading-none", className),
375
+ "data-slot": "dialog-title"
376
+ }, props)
377
+ );
378
+ }
379
+
380
+ // src/components/ui/input.tsx
381
+ var import_jsx_runtime4 = require("react/jsx-runtime");
382
+ function Input(_a) {
383
+ var _b = _a, { className, type } = _b, props = __objRest(_b, ["className", "type"]);
384
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
385
+ "input",
386
+ __spreadValues({
387
+ className: cn(
388
+ "h-9 w-full min-w-0 border border-input bg-transparent px-3 py-1 text-body-medium font-sans shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-label-medium file:text-foreground placeholder:font-normal placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 dark:bg-input/30",
389
+ "focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/20",
390
+ "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
391
+ className
392
+ ),
393
+ "data-slot": "input",
394
+ type
395
+ }, props)
396
+ );
397
+ }
398
+
399
+ // src/components/ui/label.tsx
400
+ var import_jsx_runtime5 = (
401
+ // eslint-disable-next-line jsx-a11y/label-has-associated-control -- htmlFor is passed by the consumer
402
+ require("react/jsx-runtime")
403
+ );
404
+ function Label(_a) {
405
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
406
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
407
+ "label",
408
+ __spreadValues({
409
+ className: cn(
410
+ "flex items-center gap-2 text-label-medium leading-none select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
411
+ className
412
+ ),
413
+ "data-slot": "label"
414
+ }, props)
415
+ );
416
+ }
417
+
418
+ // src/components/ui/textarea.tsx
419
+ var import_jsx_runtime6 = require("react/jsx-runtime");
420
+ function Textarea(_a) {
421
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
422
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
423
+ "textarea",
424
+ __spreadValues({
425
+ className: cn(
426
+ // WealthX: removed shadow-xs (flat panels), added font-sans
427
+ "flex field-sizing-content min-h-16 w-full border border-input bg-transparent px-3 py-2 text-body-medium font-sans transition-[color,box-shadow] outline-none placeholder:font-normal placeholder:text-muted-foreground focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/20 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
428
+ className
429
+ ),
430
+ "data-slot": "textarea"
431
+ }, props)
432
+ );
433
+ }
434
+
435
+ // src/components/ui/select.tsx
436
+ var import_lucide_react3 = require("lucide-react");
437
+ var import_select = require("@base-ui/react/select");
438
+ var import_jsx_runtime7 = require("react/jsx-runtime");
439
+ function Select(_a) {
440
+ var props = __objRest(_a, []);
441
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select.Select.Root, __spreadValues({ "data-slot": "select" }, props));
442
+ }
443
+ function SelectValue(_a) {
444
+ var props = __objRest(_a, []);
445
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select.Select.Value, __spreadValues({ "data-slot": "select-value" }, props));
446
+ }
447
+ function SelectTrigger(_a) {
448
+ var _b = _a, {
449
+ className,
450
+ size = "default",
451
+ children
452
+ } = _b, props = __objRest(_b, [
453
+ "className",
454
+ "size",
455
+ "children"
456
+ ]);
457
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
458
+ import_select.Select.Trigger,
459
+ __spreadProps(__spreadValues({
460
+ className: cn(
461
+ "flex w-fit items-center justify-between gap-2 border border-input bg-transparent px-3 py-2 text-body-medium whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/20 data-popup-open:border-primary data-popup-open:ring-[3px] data-popup-open:ring-primary/20 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-placeholder:font-normal data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
462
+ className
463
+ ),
464
+ "data-size": size,
465
+ "data-slot": "select-trigger"
466
+ }, props), {
467
+ children: [
468
+ children,
469
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select.Select.Icon, { className: "transition-transform duration-200 data-popup-open:rotate-180", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ChevronDownIcon, { className: "size-4 opacity-50" }) })
470
+ ]
471
+ })
472
+ );
473
+ }
474
+ function SelectContent(_a) {
475
+ var _b = _a, {
476
+ className,
477
+ children,
478
+ style
479
+ } = _b, props = __objRest(_b, [
480
+ "className",
481
+ "children",
482
+ "style"
483
+ ]);
484
+ const themeVars = useThemeVars();
485
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select.Select.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
486
+ import_select.Select.Positioner,
487
+ {
488
+ className: "z-[200]",
489
+ align: "start",
490
+ alignItemWithTrigger: false,
491
+ sideOffset: 4,
492
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
493
+ import_select.Select.Popup,
494
+ __spreadProps(__spreadValues({
495
+ className: cn(
496
+ "relative max-h-[var(--available-height)] min-w-[var(--anchor-width,8rem)] overflow-x-hidden overflow-y-auto border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-ending-style:animate-out data-ending-style:fade-out-0 data-ending-style:zoom-out-95 data-ending-style:fill-mode-forwards data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95",
497
+ className
498
+ ),
499
+ "data-slot": "select-content",
500
+ style: __spreadValues(__spreadValues({}, themeVars), style)
501
+ }, props), {
502
+ children: [
503
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SelectScrollUpButton, {}),
504
+ children,
505
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SelectScrollDownButton, {})
506
+ ]
507
+ })
508
+ )
509
+ }
510
+ ) });
511
+ }
512
+ function SelectItem(_a) {
513
+ var _b = _a, {
514
+ className,
515
+ children
516
+ } = _b, props = __objRest(_b, [
517
+ "className",
518
+ "children"
519
+ ]);
520
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
521
+ import_select.Select.Item,
522
+ __spreadProps(__spreadValues({
523
+ className: cn(
524
+ "relative flex w-full cursor-default items-center gap-2 py-1.5 pr-8 pl-2 text-body-small outline-hidden select-none data-highlighted:bg-primary/5 data-highlighted:text-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
525
+ className
526
+ ),
527
+ "data-slot": "select-item"
528
+ }, props), {
529
+ children: [
530
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
531
+ "span",
532
+ {
533
+ className: "absolute right-2 flex size-3.5 items-center justify-center",
534
+ "data-slot": "select-item-indicator",
535
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select.Select.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.CheckIcon, { className: "size-4" }) })
536
+ }
537
+ ),
538
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select.Select.ItemText, { children })
539
+ ]
540
+ })
541
+ );
542
+ }
543
+ function SelectScrollUpButton(_a) {
544
+ var _b = _a, {
545
+ className
546
+ } = _b, props = __objRest(_b, [
547
+ "className"
548
+ ]);
549
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
550
+ import_select.Select.ScrollUpArrow,
551
+ __spreadProps(__spreadValues({
552
+ className: cn(
553
+ "flex cursor-default items-center justify-center py-1",
554
+ className
555
+ ),
556
+ "data-slot": "select-scroll-up-button"
557
+ }, props), {
558
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ChevronUpIcon, { className: "size-4" })
559
+ })
560
+ );
561
+ }
562
+ function SelectScrollDownButton(_a) {
563
+ var _b = _a, {
564
+ className
565
+ } = _b, props = __objRest(_b, [
566
+ "className"
567
+ ]);
568
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
569
+ import_select.Select.ScrollDownArrow,
570
+ __spreadProps(__spreadValues({
571
+ className: cn(
572
+ "flex cursor-default items-center justify-center py-1",
573
+ className
574
+ ),
575
+ "data-slot": "select-scroll-down-button"
576
+ }, props), {
577
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ChevronDownIcon, { className: "size-4" })
578
+ })
579
+ );
580
+ }
581
+
582
+ // src/components/ui/accordion.tsx
583
+ var import_lucide_react4 = require("lucide-react");
584
+ var import_accordion = require("@base-ui/react/accordion");
585
+ var import_jsx_runtime8 = require("react/jsx-runtime");
586
+ function Accordion(props) {
587
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_accordion.Accordion.Root, __spreadValues({ "data-slot": "accordion" }, props));
588
+ }
589
+ function AccordionItem(_a) {
590
+ var _b = _a, {
591
+ className
592
+ } = _b, props = __objRest(_b, [
593
+ "className"
594
+ ]);
595
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
596
+ import_accordion.Accordion.Item,
597
+ __spreadValues({
598
+ className: cn("border-b", className),
599
+ "data-slot": "accordion-item"
600
+ }, props)
601
+ );
602
+ }
603
+ function AccordionContent(_a) {
604
+ var _b = _a, {
605
+ className,
606
+ children
607
+ } = _b, props = __objRest(_b, [
608
+ "className",
609
+ "children"
610
+ ]);
611
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
612
+ import_accordion.Accordion.Panel,
613
+ __spreadProps(__spreadValues({
614
+ className: "overflow-hidden text-body-small h-(--accordion-panel-height) transition-[height] duration-200 ease-out data-starting-style:h-0 data-ending-style:h-0",
615
+ "data-slot": "accordion-content"
616
+ }, props), {
617
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: cn("pb-4 text-muted-foreground", className), children })
618
+ })
619
+ );
620
+ }
621
+
622
+ // src/components/ui/checkbox.tsx
623
+ var import_react3 = require("react");
624
+ var import_lucide_react5 = require("lucide-react");
625
+ var import_checkbox = require("@base-ui/react/checkbox");
626
+ var import_jsx_runtime9 = require("react/jsx-runtime");
627
+ function Checkbox(_a) {
628
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
629
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
630
+ import_checkbox.Checkbox.Root,
631
+ __spreadProps(__spreadValues({
632
+ className: cn(
633
+ "peer group inline-flex size-4 shrink-0 border border-input shadow-xs transition-all outline-none",
634
+ "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
635
+ "disabled:cursor-not-allowed disabled:opacity-50",
636
+ "aria-invalid:border-destructive aria-invalid:ring-destructive/20",
637
+ "data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground",
638
+ "data-indeterminate:border-primary data-indeterminate:bg-primary data-indeterminate:text-primary-foreground",
639
+ // Dark mode (upstream shadcn)
640
+ "dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-checked:bg-primary",
641
+ // Stacked (2 attr selectors) → wins over single-attr rules above
642
+ "aria-invalid:data-checked:border-destructive aria-invalid:data-checked:bg-destructive aria-invalid:data-checked:text-destructive-foreground",
643
+ "aria-invalid:data-indeterminate:border-destructive aria-invalid:data-indeterminate:bg-destructive aria-invalid:data-indeterminate:text-destructive-foreground",
644
+ className
645
+ ),
646
+ "data-slot": "checkbox"
647
+ }, props), {
648
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
649
+ import_checkbox.Checkbox.Indicator,
650
+ {
651
+ className: "grid place-content-center text-current transition-none",
652
+ "data-slot": "checkbox-indicator",
653
+ children: [
654
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react5.CheckIcon, { className: "size-3.5 group-data-indeterminate:hidden" }),
655
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react5.MinusIcon, { className: "size-3.5 hidden group-data-indeterminate:block" })
656
+ ]
657
+ }
658
+ )
659
+ })
660
+ );
661
+ }
662
+
663
+ // src/components/ui/date-picker.tsx
664
+ var React4 = __toESM(require("react"));
665
+ var import_date_fns = require("date-fns");
666
+ var import_lucide_react7 = require("lucide-react");
667
+
668
+ // src/components/ui/calendar.tsx
669
+ var React3 = __toESM(require("react"));
670
+ var import_lucide_react6 = require("lucide-react");
671
+ var import_react_day_picker = require("react-day-picker");
672
+ var import_jsx_runtime10 = require("react/jsx-runtime");
673
+ function CalendarRoot(_a) {
674
+ var _b = _a, {
675
+ className,
676
+ rootRef
677
+ } = _b, props = __objRest(_b, [
678
+ "className",
679
+ "rootRef"
680
+ ]);
681
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
682
+ "div",
683
+ __spreadValues({
684
+ className: cn(className),
685
+ "data-slot": "calendar",
686
+ ref: rootRef
687
+ }, props)
688
+ );
689
+ }
690
+ function CalendarChevron(_a) {
691
+ var _b = _a, {
692
+ className,
693
+ orientation
694
+ } = _b, props = __objRest(_b, [
695
+ "className",
696
+ "orientation"
697
+ ]);
698
+ if (orientation === "left") {
699
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.ChevronLeftIcon, __spreadValues({ className: cn("size-4", className) }, props));
700
+ }
701
+ if (orientation === "right") {
702
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.ChevronRightIcon, __spreadValues({ className: cn("size-4", className) }, props));
703
+ }
704
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.ChevronDownIcon, __spreadValues({ className: cn("size-4", className) }, props));
705
+ }
706
+ function CalendarWeekNumber(_a) {
707
+ var _b = _a, {
708
+ children
709
+ } = _b, props = __objRest(_b, [
710
+ "children"
711
+ ]);
712
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) }));
713
+ }
714
+ function Calendar(_a) {
715
+ var _b = _a, {
716
+ className,
717
+ classNames,
718
+ showOutsideDays = true,
719
+ captionLayout = "dropdown",
720
+ buttonVariant = "ghost",
721
+ formatters,
722
+ components
723
+ } = _b, props = __objRest(_b, [
724
+ "className",
725
+ "classNames",
726
+ "showOutsideDays",
727
+ "captionLayout",
728
+ "buttonVariant",
729
+ "formatters",
730
+ "components"
731
+ ]);
732
+ const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
733
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
734
+ import_react_day_picker.DayPicker,
735
+ __spreadValues({
736
+ captionLayout,
737
+ className: cn(
738
+ "group/calendar bg-background p-3 font-sans border border-border shadow-sm [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
739
+ String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
740
+ String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
741
+ className
742
+ ),
743
+ classNames: __spreadValues({
744
+ root: cn("w-fit", defaultClassNames.root),
745
+ months: cn(
746
+ "relative flex flex-col gap-4 md:flex-row",
747
+ defaultClassNames.months
748
+ ),
749
+ month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
750
+ nav: cn(
751
+ "absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
752
+ defaultClassNames.nav
753
+ ),
754
+ button_previous: cn(
755
+ buttonVariants({ variant: buttonVariant }),
756
+ "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
757
+ defaultClassNames.button_previous
758
+ ),
759
+ button_next: cn(
760
+ buttonVariants({ variant: buttonVariant }),
761
+ "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
762
+ defaultClassNames.button_next
763
+ ),
764
+ month_caption: cn(
765
+ "flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
766
+ defaultClassNames.month_caption
767
+ ),
768
+ dropdowns: cn(
769
+ "flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-label-small",
770
+ defaultClassNames.dropdowns
771
+ ),
772
+ dropdown_root: cn(
773
+ "relative border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50",
774
+ defaultClassNames.dropdown_root
775
+ ),
776
+ dropdown: cn(
777
+ "absolute inset-0 bg-popover opacity-0",
778
+ defaultClassNames.dropdown
779
+ ),
780
+ caption_label: cn(
781
+ "select-none",
782
+ captionLayout === "label" ? "text-label-small" : "flex h-8 items-center gap-1 pr-1 pl-2 text-label-small [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
783
+ defaultClassNames.caption_label
784
+ ),
785
+ table: "w-full border-collapse",
786
+ weekdays: cn("flex", defaultClassNames.weekdays),
787
+ weekday: cn(
788
+ "flex-1 text-caption font-normal text-muted-foreground select-none",
789
+ defaultClassNames.weekday
790
+ ),
791
+ week: cn("mt-2 flex w-full", defaultClassNames.week),
792
+ week_number_header: cn(
793
+ "w-(--cell-size) select-none",
794
+ defaultClassNames.week_number_header
795
+ ),
796
+ week_number: cn(
797
+ "text-caption text-muted-foreground select-none",
798
+ defaultClassNames.week_number
799
+ ),
800
+ day: cn(
801
+ "group/day relative aspect-square h-full w-full p-0 text-center select-none",
802
+ defaultClassNames.day
803
+ ),
804
+ range_start: cn("bg-accent", defaultClassNames.range_start),
805
+ range_middle: cn("rounded-none", defaultClassNames.range_middle),
806
+ range_end: cn("bg-accent", defaultClassNames.range_end),
807
+ today: cn("bg-accent text-accent-foreground", defaultClassNames.today),
808
+ outside: cn(
809
+ "text-muted-foreground aria-selected:text-muted-foreground",
810
+ defaultClassNames.outside
811
+ ),
812
+ disabled: cn(
813
+ "text-muted-foreground opacity-50",
814
+ defaultClassNames.disabled
815
+ ),
816
+ hidden: cn("invisible", defaultClassNames.hidden)
817
+ }, classNames),
818
+ components: __spreadValues({
819
+ Root: CalendarRoot,
820
+ Chevron: CalendarChevron,
821
+ DayButton: CalendarDayButton,
822
+ WeekNumber: CalendarWeekNumber
823
+ }, components),
824
+ formatters: __spreadValues({
825
+ formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" })
826
+ }, formatters),
827
+ showOutsideDays
828
+ }, props)
829
+ );
830
+ }
831
+ function CalendarDayButton(_a) {
832
+ var _b = _a, {
833
+ className,
834
+ day,
835
+ modifiers
836
+ } = _b, props = __objRest(_b, [
837
+ "className",
838
+ "day",
839
+ "modifiers"
840
+ ]);
841
+ const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
842
+ const ref = React3.useRef(null);
843
+ React3.useEffect(() => {
844
+ var _a2;
845
+ if (modifiers.focused) (_a2 = ref.current) == null ? void 0 : _a2.focus();
846
+ }, [modifiers.focused]);
847
+ const selectedSingle = modifiers.selected && !modifiers.range_start && !modifiers.range_end ? !modifiers.range_middle : null;
848
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
849
+ Button,
850
+ __spreadValues({
851
+ className: cn(
852
+ "flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 font-normal rounded-none group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-accent-foreground [&>span]:text-caption [&>span]:opacity-70",
853
+ defaultClassNames.day,
854
+ className
855
+ ),
856
+ "data-day": day.date.toLocaleDateString(),
857
+ "data-range-end": modifiers.range_end,
858
+ "data-range-middle": modifiers.range_middle,
859
+ "data-range-start": modifiers.range_start,
860
+ "data-selected-single": selectedSingle,
861
+ ref,
862
+ size: "icon",
863
+ variant: "ghost"
864
+ }, props)
865
+ );
866
+ }
867
+
868
+ // src/components/ui/popover.tsx
869
+ var import_popover = require("@base-ui/react/popover");
870
+ var import_jsx_runtime11 = require("react/jsx-runtime");
871
+ function Popover(_a) {
872
+ var props = __objRest(_a, []);
873
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_popover.Popover.Root, __spreadValues({ "data-slot": "popover" }, props));
874
+ }
875
+ function PopoverTrigger(_a) {
876
+ var props = __objRest(_a, []);
877
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_popover.Popover.Trigger, __spreadValues({ "data-slot": "popover-trigger" }, props));
878
+ }
879
+ function PopoverContent(_a) {
880
+ var _b = _a, {
881
+ className,
882
+ align = "center",
883
+ sideOffset = 4,
884
+ style
885
+ } = _b, props = __objRest(_b, [
886
+ "className",
887
+ "align",
888
+ "sideOffset",
889
+ "style"
890
+ ]);
891
+ const themeVars = useThemeVars();
892
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_popover.Popover.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
893
+ import_popover.Popover.Positioner,
894
+ {
895
+ className: "z-[200]",
896
+ align,
897
+ sideOffset,
898
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
899
+ import_popover.Popover.Popup,
900
+ __spreadValues({
901
+ className: cn(
902
+ "z-50 w-72 border border-border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-ending-style:animate-out data-ending-style:fade-out-0 data-ending-style:zoom-out-95 data-ending-style:fill-mode-forwards data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95",
903
+ className
904
+ ),
905
+ "data-slot": "popover-content",
906
+ style: __spreadValues(__spreadValues({}, themeVars), style)
907
+ }, props)
908
+ )
909
+ }
910
+ ) });
911
+ }
912
+
913
+ // src/components/ui/date-picker.tsx
914
+ var import_jsx_runtime12 = require("react/jsx-runtime");
915
+ function DatePicker({
916
+ value,
917
+ onChange,
918
+ placeholder = "Pick a date",
919
+ showTimePicker = false,
920
+ disabled = false,
921
+ className,
922
+ calendarProps
923
+ }) {
924
+ const [open, setOpen] = React4.useState(false);
925
+ function handleDaySelect(day) {
926
+ if (!day) {
927
+ onChange == null ? void 0 : onChange(void 0);
928
+ return;
929
+ }
930
+ if (showTimePicker && value) {
931
+ day.setHours(value.getHours(), value.getMinutes());
932
+ }
933
+ onChange == null ? void 0 : onChange(day);
934
+ if (!showTimePicker) setOpen(false);
935
+ }
936
+ function handleTimeChange(e) {
937
+ const [hours, minutes] = e.target.value.split(":").map(Number);
938
+ const next = value ? new Date(value) : /* @__PURE__ */ new Date();
939
+ next.setHours(hours, minutes, 0, 0);
940
+ onChange == null ? void 0 : onChange(next);
941
+ }
942
+ const timeValue = value ? `${String(value.getHours()).padStart(2, "0")}:${String(value.getMinutes()).padStart(2, "0")}` : "";
943
+ let displayValue;
944
+ if (value && showTimePicker) {
945
+ displayValue = (0, import_date_fns.format)(value, "dd/MM/yyyy HH:mm");
946
+ } else if (value) {
947
+ displayValue = (0, import_date_fns.format)(value, "dd/MM/yyyy");
948
+ }
949
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Popover, { onOpenChange: disabled ? void 0 : setOpen, open, children: [
950
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
951
+ PopoverTrigger,
952
+ {
953
+ render: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
954
+ Button,
955
+ {
956
+ className: cn(
957
+ "w-full justify-start rounded-none font-normal data-[empty=true]:text-muted-foreground",
958
+ className
959
+ ),
960
+ "data-empty": !value,
961
+ "data-slot": "date-picker-trigger",
962
+ disabled,
963
+ variant: "outline"
964
+ }
965
+ ),
966
+ children: [
967
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react7.CalendarIcon, {}),
968
+ value ? displayValue : placeholder
969
+ ]
970
+ }
971
+ ),
972
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
973
+ PopoverContent,
974
+ {
975
+ align: "start",
976
+ className: "w-auto rounded-none p-0 shadow-sm",
977
+ children: [
978
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
979
+ Calendar,
980
+ __spreadProps(__spreadValues({
981
+ captionLayout: "dropdown",
982
+ mode: "single",
983
+ onSelect: handleDaySelect,
984
+ selected: value
985
+ }, calendarProps), {
986
+ className: cn(
987
+ "rounded-none border-0 shadow-none",
988
+ calendarProps == null ? void 0 : calendarProps.className
989
+ )
990
+ })
991
+ ),
992
+ showTimePicker ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "border-t border-border px-3 pb-3 pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "mb-1.5 block text-xs font-medium text-muted-foreground", children: [
993
+ "Time",
994
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
995
+ "input",
996
+ {
997
+ className: "mt-1.5 h-8 w-full rounded-none border border-input bg-transparent px-2 text-sm font-sans outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
998
+ onChange: handleTimeChange,
999
+ type: "time",
1000
+ value: timeValue
1001
+ }
1002
+ )
1003
+ ] }) }) : null
1004
+ ]
1005
+ }
1006
+ )
1007
+ ] });
1008
+ }
1009
+
1010
+ // src/components/ui/slider.tsx
1011
+ var React5 = __toESM(require("react"));
1012
+ var import_slider = require("@base-ui/react/slider");
1013
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1014
+ var Slider = React5.forwardRef(
1015
+ ({
1016
+ className,
1017
+ value,
1018
+ defaultValue = 0,
1019
+ min = 0,
1020
+ max = 100,
1021
+ step = 1,
1022
+ disabled = false,
1023
+ onValueChange
1024
+ }, ref) => {
1025
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1026
+ import_slider.Slider.Root,
1027
+ {
1028
+ ref,
1029
+ value,
1030
+ defaultValue,
1031
+ min,
1032
+ max,
1033
+ step,
1034
+ disabled,
1035
+ thumbAlignment: "edge",
1036
+ onValueChange: (val) => onValueChange == null ? void 0 : onValueChange(val),
1037
+ "data-slot": "slider",
1038
+ className: cn(
1039
+ "relative w-full touch-none select-none",
1040
+ disabled && "opacity-50",
1041
+ className
1042
+ ),
1043
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1044
+ import_slider.Slider.Control,
1045
+ {
1046
+ className: "relative flex h-5 w-full cursor-pointer items-center",
1047
+ "data-slot": "slider-control",
1048
+ children: [
1049
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1050
+ import_slider.Slider.Track,
1051
+ {
1052
+ className: "relative h-2 w-full overflow-hidden rounded-full bg-muted",
1053
+ "data-slot": "slider-track",
1054
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1055
+ import_slider.Slider.Indicator,
1056
+ {
1057
+ className: "absolute h-full rounded-full bg-primary",
1058
+ "data-slot": "slider-indicator"
1059
+ }
1060
+ )
1061
+ }
1062
+ ),
1063
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1064
+ import_slider.Slider.Thumb,
1065
+ {
1066
+ className: cn(
1067
+ "block size-5 rounded-full border-2 border-primary bg-background shadow-sm",
1068
+ "outline-none"
1069
+ ),
1070
+ "data-slot": "slider-thumb"
1071
+ }
1072
+ )
1073
+ ]
1074
+ }
1075
+ )
1076
+ }
1077
+ );
1078
+ }
1079
+ );
1080
+ Slider.displayName = "Slider";
1081
+
1082
+ // src/components/ui/radio-group.tsx
1083
+ var import_lucide_react8 = require("lucide-react");
1084
+ var import_radio_group = require("@base-ui/react/radio-group");
1085
+ var import_radio = require("@base-ui/react/radio");
1086
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1087
+ var CIRCLE_BASE = "inline-flex items-center justify-center aspect-square size-4 shrink-0 rounded-full border border-primary bg-background";
1088
+ var INDICATOR_DOT = "size-2 fill-background text-background";
1089
+ function RadioGroup(_a) {
1090
+ var _b = _a, {
1091
+ className
1092
+ } = _b, props = __objRest(_b, [
1093
+ "className"
1094
+ ]);
1095
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1096
+ import_radio_group.RadioGroup,
1097
+ __spreadValues({
1098
+ className: cn("grid gap-3", className),
1099
+ "data-slot": "radio-group"
1100
+ }, props)
1101
+ );
1102
+ }
1103
+ function RadioGroupItem(_a) {
1104
+ var _b = _a, {
1105
+ className
1106
+ } = _b, props = __objRest(_b, [
1107
+ "className"
1108
+ ]);
1109
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1110
+ import_radio.Radio.Root,
1111
+ __spreadProps(__spreadValues({
1112
+ className: cn(
1113
+ CIRCLE_BASE,
1114
+ "transition-all outline-none",
1115
+ "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
1116
+ "disabled:cursor-not-allowed disabled:opacity-50",
1117
+ "data-checked:bg-primary",
1118
+ "aria-invalid:border-destructive aria-invalid:ring-destructive/20",
1119
+ "aria-invalid:data-checked:border-destructive aria-invalid:data-checked:bg-destructive",
1120
+ "dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
1121
+ className
1122
+ ),
1123
+ "data-slot": "radio-group-item"
1124
+ }, props), {
1125
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1126
+ import_radio.Radio.Indicator,
1127
+ {
1128
+ "data-slot": "radio-group-indicator",
1129
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.CircleIcon, { className: INDICATOR_DOT })
1130
+ }
1131
+ )
1132
+ })
1133
+ );
1134
+ }
1135
+
1136
+ // src/components/ui/form-primitives.tsx
1137
+ var React7 = __toESM(require("react"));
1138
+ var import_lucide_react9 = require("lucide-react");
1139
+
1140
+ // src/components/ui/toggle-group.tsx
1141
+ var React6 = __toESM(require("react"));
1142
+ var import_toggle_group = require("@base-ui/react/toggle-group");
1143
+ var import_toggle2 = require("@base-ui/react/toggle");
1144
+
1145
+ // src/components/ui/toggle.tsx
1146
+ var import_class_variance_authority2 = require("class-variance-authority");
1147
+ var import_toggle = require("@base-ui/react/toggle");
1148
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1149
+ var toggleVariants = (0, import_class_variance_authority2.cva)(
1150
+ "inline-flex items-center justify-center gap-2 text-label-medium whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-pressed:bg-primary/10 data-pressed:inset-ring data-pressed:inset-ring-primary data-pressed:text-foreground data-pressed:hover:bg-primary/10 data-pressed:hover:text-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1151
+ {
1152
+ variants: {
1153
+ variant: {
1154
+ default: "bg-transparent hover:bg-muted hover:text-muted-foreground",
1155
+ outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"
1156
+ },
1157
+ size: {
1158
+ default: "h-9 min-w-9 px-2",
1159
+ sm: "h-8 min-w-8 px-1.5 text-caption",
1160
+ lg: "h-10 min-w-10 px-2.5"
1161
+ }
1162
+ },
1163
+ defaultVariants: {
1164
+ variant: "default",
1165
+ size: "default"
1166
+ }
1167
+ }
1168
+ );
1169
+
1170
+ // src/components/ui/toggle-group.tsx
1171
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1172
+ var ToggleGroupContext = React6.createContext({
1173
+ size: "default",
1174
+ variant: "default",
1175
+ spacing: 0
1176
+ });
1177
+ function ToggleGroup(_a) {
1178
+ var _b = _a, {
1179
+ className,
1180
+ variant,
1181
+ size,
1182
+ spacing = 0,
1183
+ type,
1184
+ children
1185
+ } = _b, props = __objRest(_b, [
1186
+ "className",
1187
+ "variant",
1188
+ "size",
1189
+ "spacing",
1190
+ "type",
1191
+ "children"
1192
+ ]);
1193
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1194
+ import_toggle_group.ToggleGroup,
1195
+ __spreadProps(__spreadValues({
1196
+ className: cn(
1197
+ // WealthX: removed rounded-md (sharp corners) and shadow-xs (flat panels)
1198
+ "group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))]",
1199
+ className
1200
+ ),
1201
+ "data-size": size,
1202
+ "data-slot": "toggle-group",
1203
+ "data-spacing": spacing,
1204
+ "data-variant": variant,
1205
+ multiple: type === "multiple",
1206
+ style: { "--gap": spacing }
1207
+ }, props), {
1208
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToggleGroupContext.Provider, { value: { variant, size, spacing }, children })
1209
+ })
1210
+ );
1211
+ }
1212
+ function ToggleGroupItem(_a) {
1213
+ var _b = _a, {
1214
+ className,
1215
+ children,
1216
+ variant,
1217
+ size
1218
+ } = _b, props = __objRest(_b, [
1219
+ "className",
1220
+ "children",
1221
+ "variant",
1222
+ "size"
1223
+ ]);
1224
+ const context = React6.useContext(ToggleGroupContext);
1225
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1226
+ import_toggle2.Toggle,
1227
+ __spreadProps(__spreadValues({
1228
+ className: cn(
1229
+ toggleVariants({
1230
+ variant: context.variant || variant,
1231
+ size: context.size || size
1232
+ }),
1233
+ "w-auto min-w-0 shrink-0 focus:z-10 focus-visible:z-10",
1234
+ // WealthX: no rounded corners on grouped items
1235
+ "data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",
1236
+ className
1237
+ ),
1238
+ "data-size": context.size || size,
1239
+ "data-slot": "toggle-group-item",
1240
+ "data-spacing": context.spacing,
1241
+ "data-variant": context.variant || variant
1242
+ }, props), {
1243
+ children
1244
+ })
1245
+ );
1246
+ }
1247
+
1248
+ // src/components/ui/form-primitives.tsx
1249
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1250
+ function parseCurrencyToNumber(raw) {
1251
+ const cleaned = raw.replace(/[^0-9.]/g, "");
1252
+ const n = parseFloat(cleaned);
1253
+ return isNaN(n) ? 0 : n;
1254
+ }
1255
+ function formatNumberToCurrency(n) {
1256
+ return "$" + Math.round(n).toLocaleString("en-AU");
1257
+ }
1258
+ function CurrencyInputWithSlider({
1259
+ value: controlledValue,
1260
+ defaultValue = 0,
1261
+ min = 0,
1262
+ max = 5e6,
1263
+ step = 1e4,
1264
+ disabled = false,
1265
+ onValueChange,
1266
+ className
1267
+ }) {
1268
+ const [internalValue, setInternalValue] = React7.useState(defaultValue);
1269
+ const numericValue = controlledValue !== void 0 ? controlledValue : internalValue;
1270
+ const [inputText, setInputText] = React7.useState(
1271
+ formatNumberToCurrency(numericValue)
1272
+ );
1273
+ const [isFocused, setIsFocused] = React7.useState(false);
1274
+ React7.useEffect(() => {
1275
+ if (!isFocused) {
1276
+ setInputText(formatNumberToCurrency(numericValue));
1277
+ }
1278
+ }, [numericValue, isFocused]);
1279
+ const commitValue = (n) => {
1280
+ const clamped = Math.max(min, Math.min(max, n));
1281
+ if (controlledValue === void 0) setInternalValue(clamped);
1282
+ onValueChange == null ? void 0 : onValueChange(clamped);
1283
+ setInputText(formatNumberToCurrency(clamped));
1284
+ };
1285
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cn("flex flex-col gap-3", className), children: [
1286
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1287
+ Input,
1288
+ {
1289
+ type: "text",
1290
+ value: isFocused ? inputText : formatNumberToCurrency(numericValue),
1291
+ disabled,
1292
+ onFocus: () => {
1293
+ setIsFocused(true);
1294
+ setInputText(formatNumberToCurrency(numericValue));
1295
+ },
1296
+ onChange: (e) => setInputText(e.target.value),
1297
+ onBlur: () => {
1298
+ setIsFocused(false);
1299
+ commitValue(parseCurrencyToNumber(inputText));
1300
+ },
1301
+ onKeyDown: (e) => {
1302
+ if (e.key === "Enter") {
1303
+ e.target.blur();
1304
+ }
1305
+ },
1306
+ className: "tabular-nums",
1307
+ "aria-label": "Currency amount"
1308
+ }
1309
+ ),
1310
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1311
+ Slider,
1312
+ {
1313
+ value: numericValue,
1314
+ min,
1315
+ max,
1316
+ step,
1317
+ disabled,
1318
+ onValueChange: (n) => {
1319
+ if (controlledValue === void 0) setInternalValue(n);
1320
+ onValueChange == null ? void 0 : onValueChange(n);
1321
+ }
1322
+ }
1323
+ )
1324
+ ] });
1325
+ }
1326
+ var DEFAULT_SUGGESTIONS = [
1327
+ {
1328
+ id: "1",
1329
+ label: "12 Harbour View Terrace, Mosman NSW 2088",
1330
+ suburb: "Mosman",
1331
+ state: "NSW",
1332
+ postcode: "2088"
1333
+ },
1334
+ {
1335
+ id: "2",
1336
+ label: "5 Coastal Road, Manly NSW 2095",
1337
+ suburb: "Manly",
1338
+ state: "NSW",
1339
+ postcode: "2095"
1340
+ },
1341
+ {
1342
+ id: "3",
1343
+ label: "24 Collins Street, Melbourne VIC 3000",
1344
+ suburb: "Melbourne",
1345
+ state: "VIC",
1346
+ postcode: "3000"
1347
+ },
1348
+ {
1349
+ id: "4",
1350
+ label: "88 Pacific Highway, St Leonards NSW 2065",
1351
+ suburb: "St Leonards",
1352
+ state: "NSW",
1353
+ postcode: "2065"
1354
+ },
1355
+ {
1356
+ id: "5",
1357
+ label: "1 Queen Street, Brisbane QLD 4000",
1358
+ suburb: "Brisbane",
1359
+ state: "QLD",
1360
+ postcode: "4000"
1361
+ }
1362
+ ];
1363
+ function AddressAutocomplete({
1364
+ value: controlledValue,
1365
+ placeholder = "Start typing an address\u2026",
1366
+ suggestions = DEFAULT_SUGGESTIONS,
1367
+ disabled = false,
1368
+ onValueChange,
1369
+ onSelect,
1370
+ className
1371
+ }) {
1372
+ const [internalValue, setInternalValue] = React7.useState("");
1373
+ const inputValue = controlledValue !== void 0 ? controlledValue : internalValue;
1374
+ const [open, setOpen] = React7.useState(false);
1375
+ const [activeIndex, setActiveIndex] = React7.useState(-1);
1376
+ const containerRef = React7.useRef(null);
1377
+ const listRef = React7.useRef(null);
1378
+ const filtered = React7.useMemo(() => {
1379
+ if (!inputValue.trim()) return suggestions.slice(0, 5);
1380
+ const q = inputValue.toLowerCase();
1381
+ return suggestions.filter((s) => s.label.toLowerCase().includes(q)).slice(0, 5);
1382
+ }, [inputValue, suggestions]);
1383
+ const setValue = (v) => {
1384
+ if (controlledValue === void 0) setInternalValue(v);
1385
+ onValueChange == null ? void 0 : onValueChange(v);
1386
+ };
1387
+ const handleSelect = (opt) => {
1388
+ setValue(opt.label);
1389
+ onSelect == null ? void 0 : onSelect(opt);
1390
+ setOpen(false);
1391
+ setActiveIndex(-1);
1392
+ };
1393
+ const handleKeyDown = (e) => {
1394
+ if (!open) return;
1395
+ if (e.key === "ArrowDown") {
1396
+ e.preventDefault();
1397
+ setActiveIndex((i) => Math.min(i + 1, filtered.length - 1));
1398
+ } else if (e.key === "ArrowUp") {
1399
+ e.preventDefault();
1400
+ setActiveIndex((i) => Math.max(i - 1, -1));
1401
+ } else if (e.key === "Enter" && activeIndex >= 0) {
1402
+ e.preventDefault();
1403
+ handleSelect(filtered[activeIndex]);
1404
+ } else if (e.key === "Escape") {
1405
+ setOpen(false);
1406
+ }
1407
+ };
1408
+ React7.useEffect(() => {
1409
+ const handler = (e) => {
1410
+ if (containerRef.current && !containerRef.current.contains(e.target)) {
1411
+ setOpen(false);
1412
+ }
1413
+ };
1414
+ document.addEventListener("mousedown", handler);
1415
+ return () => document.removeEventListener("mousedown", handler);
1416
+ }, []);
1417
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { ref: containerRef, className: cn("relative", className), children: [
1418
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "relative", children: [
1419
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react9.Search, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground pointer-events-none" }),
1420
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1421
+ Input,
1422
+ {
1423
+ type: "text",
1424
+ value: inputValue,
1425
+ placeholder,
1426
+ disabled,
1427
+ className: "pl-8",
1428
+ onChange: (e) => {
1429
+ setValue(e.target.value);
1430
+ setOpen(true);
1431
+ setActiveIndex(-1);
1432
+ },
1433
+ onFocus: () => setOpen(true),
1434
+ onKeyDown: handleKeyDown,
1435
+ "aria-autocomplete": "list",
1436
+ "aria-expanded": open
1437
+ }
1438
+ )
1439
+ ] }),
1440
+ open && filtered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1441
+ "ul",
1442
+ {
1443
+ ref: listRef,
1444
+ role: "listbox",
1445
+ className: cn(
1446
+ "absolute z-50 top-full left-0 right-0 mt-1",
1447
+ "border border-border bg-popover shadow-md",
1448
+ "max-h-48 overflow-y-auto py-1"
1449
+ ),
1450
+ children: filtered.map((opt, idx) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
1451
+ "li",
1452
+ {
1453
+ role: "option",
1454
+ "aria-selected": idx === activeIndex,
1455
+ onMouseEnter: () => setActiveIndex(idx),
1456
+ onMouseDown: (e) => {
1457
+ e.preventDefault();
1458
+ handleSelect(opt);
1459
+ },
1460
+ className: cn(
1461
+ "flex items-center gap-2 px-3 py-2 text-sm cursor-pointer",
1462
+ idx === activeIndex ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
1463
+ ),
1464
+ children: [
1465
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex-1 truncate", children: opt.label }),
1466
+ idx === activeIndex && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react9.Check, { className: "h-3.5 w-3.5 shrink-0 text-primary" })
1467
+ ]
1468
+ },
1469
+ opt.id
1470
+ ))
1471
+ }
1472
+ )
1473
+ ] });
1474
+ }
1475
+ var DEFAULT_OWNERS = [
1476
+ { id: "main", name: "Main Applicant", share: 50 },
1477
+ { id: "co", name: "Co-Applicant", share: 50 }
1478
+ ];
1479
+ function OwnershipSplit({
1480
+ owners: controlledOwners,
1481
+ disabled = false,
1482
+ onOwnersChange,
1483
+ className
1484
+ }) {
1485
+ const [internalOwners, setInternalOwners] = React7.useState(DEFAULT_OWNERS);
1486
+ const owners = controlledOwners !== void 0 ? controlledOwners : internalOwners;
1487
+ const setOwners = (updated) => {
1488
+ if (controlledOwners === void 0) setInternalOwners(updated);
1489
+ onOwnersChange == null ? void 0 : onOwnersChange(updated);
1490
+ };
1491
+ const handleSliderChange = (id, newShare) => {
1492
+ if (owners.length !== 2) return;
1493
+ const clamped = Math.max(0, Math.min(100, Math.round(newShare)));
1494
+ const other = owners.find((o) => o.id !== id);
1495
+ if (!other) return;
1496
+ setOwners(
1497
+ owners.map(
1498
+ (o) => o.id === id ? __spreadProps(__spreadValues({}, o), { share: clamped }) : __spreadProps(__spreadValues({}, o), { share: 100 - clamped })
1499
+ )
1500
+ );
1501
+ };
1502
+ const handleInputChange = (id, raw) => {
1503
+ const n = parseInt(raw.replace(/[^0-9]/g, ""), 10);
1504
+ if (isNaN(n)) return;
1505
+ handleSliderChange(id, n);
1506
+ };
1507
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: cn("flex gap-4", className), children: owners.map((owner) => {
1508
+ const pct = Math.max(0, Math.min(100, owner.share));
1509
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-2 flex-1", children: [
1510
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center justify-between", children: [
1511
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Label, { className: "text-xs font-medium", children: owner.name }),
1512
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1513
+ Input,
1514
+ {
1515
+ type: "text",
1516
+ value: `${pct}%`,
1517
+ disabled,
1518
+ className: "w-14 h-7 text-xs text-right tabular-nums px-2",
1519
+ onChange: (e) => handleInputChange(owner.id, e.target.value),
1520
+ onBlur: (e) => handleInputChange(owner.id, e.target.value)
1521
+ }
1522
+ )
1523
+ ] }),
1524
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1525
+ Slider,
1526
+ {
1527
+ value: pct,
1528
+ min: 0,
1529
+ max: 100,
1530
+ step: 1,
1531
+ disabled,
1532
+ onValueChange: (n) => handleSliderChange(owner.id, n)
1533
+ }
1534
+ )
1535
+ ] }, owner.id);
1536
+ }) });
1537
+ }
1538
+
1539
+ // src/components/ui/opportunity-edit-modals.tsx
1540
+ var import_accordion3 = require("@base-ui/react/accordion");
1541
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1542
+ var LOAN_PURPOSES = [
1543
+ "Purchase a home",
1544
+ "Refinance my home loan",
1545
+ "Buy an investment property",
1546
+ "Refinance investment loan",
1547
+ "Renovate/build",
1548
+ "Equity release"
1549
+ ];
1550
+ var ASSET_TYPES = [
1551
+ "Primary Residence",
1552
+ "Investment Property",
1553
+ "Holiday Home",
1554
+ "Commercial Property",
1555
+ "Rural Property",
1556
+ "Cash & Savings",
1557
+ "Term Deposit",
1558
+ "Shares / ETFs",
1559
+ "Managed Funds",
1560
+ "Superannuation",
1561
+ "Motor Vehicle",
1562
+ "Business Equity",
1563
+ "Cryptocurrency",
1564
+ "Personal Belongings",
1565
+ "Life Insurance",
1566
+ "Trust Assets",
1567
+ "SMSF",
1568
+ "Bonds / Fixed Income",
1569
+ "Other"
1570
+ ];
1571
+ var PROPERTY_ASSET_TYPES = /* @__PURE__ */ new Set([
1572
+ "Primary Residence",
1573
+ "Investment Property",
1574
+ "Holiday Home",
1575
+ "Commercial Property",
1576
+ "Rural Property"
1577
+ ]);
1578
+ var PROPERTY_SUBTYPES = [
1579
+ "House",
1580
+ "Unit / Apartment",
1581
+ "Townhouse",
1582
+ "Land",
1583
+ "Rural / Farm",
1584
+ "Commercial"
1585
+ ];
1586
+ var PROPERTY_USED_AS = ["Owner Occupied", "Investment", "Vacant Land"];
1587
+ var FINANCIAL_ACCOUNT_ASSET_TYPES = /* @__PURE__ */ new Set([
1588
+ "Cash & Savings",
1589
+ "Term Deposit"
1590
+ ]);
1591
+ var INVESTMENT_ASSET_TYPES = /* @__PURE__ */ new Set([
1592
+ "Shares / ETFs",
1593
+ "Managed Funds",
1594
+ "Bonds / Fixed Income",
1595
+ "Cryptocurrency"
1596
+ ]);
1597
+ var SUPER_ASSET_TYPES = /* @__PURE__ */ new Set(["Superannuation", "SMSF"]);
1598
+ function assetFields(type) {
1599
+ return {
1600
+ isProperty: PROPERTY_ASSET_TYPES.has(type),
1601
+ isVehicle: type === "Motor Vehicle",
1602
+ isFinancialAccount: FINANCIAL_ACCOUNT_ASSET_TYPES.has(type),
1603
+ isInvestment: INVESTMENT_ASSET_TYPES.has(type),
1604
+ isSuper: SUPER_ASSET_TYPES.has(type),
1605
+ isBusiness: type === "Business Equity",
1606
+ isInsurance: type === "Life Insurance"
1607
+ };
1608
+ }
1609
+ var PROPERTY_LOAN_DEBT_TYPES = /* @__PURE__ */ new Set([
1610
+ "Home Loan (Owner Occupied)",
1611
+ "Home Loan (Investment)",
1612
+ "Construction Loan"
1613
+ ]);
1614
+ var GENERAL_LOAN_DEBT_TYPES = /* @__PURE__ */ new Set([
1615
+ "Personal Loan",
1616
+ "Business Loan",
1617
+ "Overdraft",
1618
+ "Line of Credit",
1619
+ "Guarantor Liability"
1620
+ ]);
1621
+ var CARD_DEBT_TYPES = /* @__PURE__ */ new Set([
1622
+ "Credit Card",
1623
+ "Store Card",
1624
+ "Buy Now Pay Later"
1625
+ ]);
1626
+ var VEHICLE_DEBT_TYPES = /* @__PURE__ */ new Set(["Car Loan", "Vehicle Lease"]);
1627
+ function debtFields(type) {
1628
+ return {
1629
+ isPropertyLoan: PROPERTY_LOAN_DEBT_TYPES.has(type),
1630
+ isGeneralLoan: GENERAL_LOAN_DEBT_TYPES.has(type),
1631
+ isCard: CARD_DEBT_TYPES.has(type),
1632
+ isVehicle: VEHICLE_DEBT_TYPES.has(type),
1633
+ isHecs: type === "HECS / Student Debt",
1634
+ isTax: type === "Tax Debt",
1635
+ isGuarantor: type === "Guarantor Liability"
1636
+ };
1637
+ }
1638
+ var DEBT_TYPES = [
1639
+ "Home Loan (Owner Occupied)",
1640
+ "Home Loan (Investment)",
1641
+ "Construction Loan",
1642
+ "Personal Loan",
1643
+ "Car Loan",
1644
+ "Credit Card",
1645
+ "Store Card",
1646
+ "HECS / Student Debt",
1647
+ "Business Loan",
1648
+ "Overdraft",
1649
+ "Tax Debt",
1650
+ "Buy Now Pay Later",
1651
+ "Vehicle Lease",
1652
+ "Guarantor Liability",
1653
+ "Line of Credit",
1654
+ "Other"
1655
+ ];
1656
+ var TITLE_OPTIONS = ["Mr", "Mrs", "Ms", "Dr", "Prof"];
1657
+ var GENDER_OPTIONS = ["Male", "Female", "Non-binary", "Prefer not to say"];
1658
+ var MARITAL_OPTIONS = [
1659
+ "Single",
1660
+ "Married",
1661
+ "De facto",
1662
+ "Divorced",
1663
+ "Widowed"
1664
+ ];
1665
+ var CITIZEN_OPTIONS = [
1666
+ "Australian Citizen",
1667
+ "Permanent Resident",
1668
+ "Temporary Resident",
1669
+ "Foreign National"
1670
+ ];
1671
+ var RESIDENTIAL_STATUS_OPTIONS = [
1672
+ "Own",
1673
+ "Renting",
1674
+ "Boarding",
1675
+ "With Parents",
1676
+ "Other"
1677
+ ];
1678
+ var PROPERTY_IN_TRUST_OPTIONS = ["None", "Yes - Discretionary", "Yes - Unit"];
1679
+ var COMPANY_OWNERSHIP_OPTIONS = [
1680
+ "None",
1681
+ "Yes - Director",
1682
+ "Yes - Shareholder"
1683
+ ];
1684
+ var INCOME_TYPES = [
1685
+ "PAYG",
1686
+ "Self-employed",
1687
+ "Contractor",
1688
+ "Casual",
1689
+ "Commission",
1690
+ "Government Benefits",
1691
+ "Rental",
1692
+ "Other"
1693
+ ];
1694
+ var EXPENSE_TYPES = [
1695
+ "Groceries",
1696
+ "Dining Out",
1697
+ "Transport",
1698
+ "Fuel",
1699
+ "Utilities",
1700
+ "Phone Plan",
1701
+ "Internet",
1702
+ "Medical",
1703
+ "Entertainment",
1704
+ "Clothing",
1705
+ "Gym & Fitness",
1706
+ "Subscriptions",
1707
+ "Childcare",
1708
+ "Education",
1709
+ "Pet Care",
1710
+ "Insurance",
1711
+ "Council Rates",
1712
+ "Body Corp / Strata",
1713
+ "Home Maintenance",
1714
+ "Travel & Holidays",
1715
+ "Donations",
1716
+ "Other"
1717
+ ];
1718
+ var PRIORITIES = [
1719
+ "Maximize Borrow Amount",
1720
+ "Cheapest Interest Rate",
1721
+ "The Best Features",
1722
+ "Major Lender",
1723
+ "Small Lender",
1724
+ "Regional Lender",
1725
+ "Non-Bank Lender",
1726
+ "Branch Network",
1727
+ "Good Customer Service",
1728
+ "Environmentally Friendly Lender"
1729
+ ];
1730
+ function FormField({
1731
+ label,
1732
+ children,
1733
+ className
1734
+ }) {
1735
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: cn("flex flex-col gap-1.5", className), children: [
1736
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label, { className: "text-sm font-medium text-muted-foreground", children: label }),
1737
+ children
1738
+ ] });
1739
+ }
1740
+ function ModalScroll({ children }) {
1741
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "max-h-[65vh] overflow-y-auto flex flex-col gap-4 py-1 pr-1", children });
1742
+ }
1743
+ function FrequencyToggle({
1744
+ value,
1745
+ onValueChange
1746
+ }) {
1747
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1748
+ ToggleGroup,
1749
+ {
1750
+ variant: "outline",
1751
+ value,
1752
+ onValueChange: (val) => {
1753
+ if (val === "Monthly" || val === "Weekly") {
1754
+ onValueChange(val);
1755
+ }
1756
+ },
1757
+ children: [
1758
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ToggleGroupItem, { value: "Monthly", size: "sm", children: "Monthly" }),
1759
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ToggleGroupItem, { value: "Weekly", size: "sm", children: "Weekly" })
1760
+ ]
1761
+ }
1762
+ );
1763
+ }
1764
+ function AccordionItemHeader({
1765
+ label,
1766
+ onRemove,
1767
+ removeLabel = "Remove item"
1768
+ }) {
1769
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_accordion3.Accordion.Header, { className: "flex items-center", children: [
1770
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1771
+ import_accordion3.Accordion.Trigger,
1772
+ {
1773
+ className: cn(
1774
+ "flex flex-1 items-center justify-between gap-4 py-4 text-left",
1775
+ "text-label-medium rounded-none outline-none transition-[color,opacity]",
1776
+ "hover:underline focus-visible:ring-2 focus-visible:ring-foreground/30",
1777
+ "[&[data-panel-open]>svg]:rotate-180"
1778
+ ),
1779
+ children: [
1780
+ label,
1781
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react10.ChevronDownIcon, { className: "pointer-events-none size-4 shrink-0 text-muted-foreground transition-transform duration-200" })
1782
+ ]
1783
+ }
1784
+ ),
1785
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1786
+ "button",
1787
+ {
1788
+ type: "button",
1789
+ onClick: onRemove,
1790
+ className: "p-2 hover:bg-foreground/5 transition-colors",
1791
+ "aria-label": removeLabel,
1792
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react10.Trash2, { className: "h-3.5 w-3.5 text-destructive" })
1793
+ }
1794
+ )
1795
+ ] });
1796
+ }
1797
+ var LOAN_SCENARIO_DEFAULTS = {
1798
+ loanPurpose: "",
1799
+ propertyEstimate: 0,
1800
+ cashEquity: 0,
1801
+ loanAmount: 0,
1802
+ loanDuration: 30,
1803
+ knowsFeatures: "",
1804
+ featureFixedRate: false,
1805
+ featureVariableRate: false,
1806
+ featureSplitLoan: false,
1807
+ featureInterestOnly: false,
1808
+ featureRedrawFacility: false,
1809
+ feature100Offset: false,
1810
+ priorities: [],
1811
+ borrowOtherThanProperty: "",
1812
+ concernedAboutRates: "",
1813
+ considerFixedRate: "",
1814
+ retirementAge: "",
1815
+ anticipatedChanges: ""
1816
+ };
1817
+ var ABOUT_APPLICANT_DEFAULTS = {
1818
+ title: "",
1819
+ firstName: "",
1820
+ lastName: "",
1821
+ phone: "",
1822
+ email: "",
1823
+ dob: "",
1824
+ gender: "",
1825
+ maritalStatus: "",
1826
+ numDependants: "",
1827
+ dependants: [],
1828
+ citizenStatus: "",
1829
+ residentialAddress: "",
1830
+ residentialStatus: "",
1831
+ timeAtAddressYears: "",
1832
+ timeAtAddressMonths: "",
1833
+ previousAddress: "",
1834
+ driversLicence: "",
1835
+ passport: "",
1836
+ propertyInTrust: "",
1837
+ companyOwnership: ""
1838
+ };
1839
+ function makeDefaultIncomeItem() {
1840
+ return {
1841
+ id: `income-${Date.now()}-${Math.random()}`,
1842
+ incomeType: "",
1843
+ jobTitle: "",
1844
+ startDate: "",
1845
+ stillInPosition: true,
1846
+ endDate: "",
1847
+ companyName: "",
1848
+ companyAddress: "",
1849
+ incomeAmount: 0,
1850
+ frequency: "Monthly",
1851
+ companyType: ""
1852
+ };
1853
+ }
1854
+ function makeDefaultAssetItem() {
1855
+ return {
1856
+ id: `asset-${Date.now()}-${Math.random()}`,
1857
+ assetType: "",
1858
+ value: 0,
1859
+ mainShare: 100,
1860
+ coShare: 0
1861
+ };
1862
+ }
1863
+ function makeDefaultDebtItem() {
1864
+ return {
1865
+ id: `debt-${Date.now()}-${Math.random()}`,
1866
+ debtType: "",
1867
+ amountOwing: 0,
1868
+ originalLoanAmount: 0,
1869
+ repaymentAmount: 0,
1870
+ repaymentFrequency: "Monthly",
1871
+ interestRate: "",
1872
+ details: "",
1873
+ mainShare: 100,
1874
+ coShare: 0
1875
+ };
1876
+ }
1877
+ function makeDefaultExpenseItem() {
1878
+ return {
1879
+ id: `expense-${Date.now()}-${Math.random()}`,
1880
+ expenseType: "",
1881
+ amount: 0,
1882
+ frequency: "Monthly",
1883
+ mainShare: 100,
1884
+ coShare: 0
1885
+ };
1886
+ }
1887
+ function EditLoanScenarioModal({
1888
+ open,
1889
+ onOpenChange,
1890
+ initialData,
1891
+ onSave,
1892
+ className
1893
+ }) {
1894
+ const [form, setForm] = React8.useState(__spreadValues(__spreadValues({}, LOAN_SCENARIO_DEFAULTS), initialData));
1895
+ React8.useEffect(() => {
1896
+ if (open) {
1897
+ setForm(__spreadValues(__spreadValues({}, LOAN_SCENARIO_DEFAULTS), initialData));
1898
+ }
1899
+ }, [open]);
1900
+ const set = (key, val) => setForm((prev) => __spreadProps(__spreadValues({}, prev), { [key]: val }));
1901
+ const togglePriority = (priority) => {
1902
+ setForm((prev) => {
1903
+ const exists = prev.priorities.includes(priority);
1904
+ if (exists) {
1905
+ return __spreadProps(__spreadValues({}, prev), {
1906
+ priorities: prev.priorities.filter((p) => p !== priority)
1907
+ });
1908
+ }
1909
+ if (prev.priorities.length >= 3) return prev;
1910
+ return __spreadProps(__spreadValues({}, prev), { priorities: [...prev.priorities, priority] });
1911
+ });
1912
+ };
1913
+ const prioritiesAtMax = form.priorities.length >= 3;
1914
+ const LOAN_FEATURES = [
1915
+ { key: "featureFixedRate", label: "Fixed Rate" },
1916
+ { key: "featureVariableRate", label: "Variable Rate" },
1917
+ { key: "featureSplitLoan", label: "Split Loan" },
1918
+ { key: "featureInterestOnly", label: "Interest Only" },
1919
+ { key: "featureRedrawFacility", label: "Redraw Facility" },
1920
+ { key: "feature100Offset", label: "100% Offset" }
1921
+ ];
1922
+ const YES_NO_FIELDS = [
1923
+ {
1924
+ key: "borrowOtherThanProperty",
1925
+ label: "Do you intend to borrow money other than your property?"
1926
+ },
1927
+ {
1928
+ key: "concernedAboutRates",
1929
+ label: "Are you concerned about rising interest rates?"
1930
+ },
1931
+ {
1932
+ key: "considerFixedRate",
1933
+ label: "Would you consider taking a fixed rate?"
1934
+ },
1935
+ {
1936
+ key: "anticipatedChanges",
1937
+ label: "Anticipated changes impacting repayment?"
1938
+ }
1939
+ ];
1940
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogContent, { className: cn("max-w-lg", className), children: [
1941
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogTitle, { children: "Edit Loan Scenario" }) }),
1942
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ModalScroll, { children: [
1943
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "What would you like to do?", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1944
+ Select,
1945
+ {
1946
+ value: form.loanPurpose,
1947
+ onValueChange: (val) => set("loanPurpose", val),
1948
+ children: [
1949
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select purpose" }) }),
1950
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: LOAN_PURPOSES.map((p) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: p, children: p }, p)) })
1951
+ ]
1952
+ }
1953
+ ) }),
1954
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
1955
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Property Estimate", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1956
+ CurrencyInputWithSlider,
1957
+ {
1958
+ value: form.propertyEstimate,
1959
+ min: 0,
1960
+ max: 1e7,
1961
+ step: 5e4,
1962
+ onValueChange: (val) => set("propertyEstimate", val)
1963
+ }
1964
+ ) }),
1965
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Cash/equity towards property", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1966
+ CurrencyInputWithSlider,
1967
+ {
1968
+ value: form.cashEquity,
1969
+ min: 0,
1970
+ max: 2e6,
1971
+ step: 5e3,
1972
+ onValueChange: (val) => set("cashEquity", val)
1973
+ }
1974
+ ) })
1975
+ ] }),
1976
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
1977
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Loan Amount", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1978
+ CurrencyInputWithSlider,
1979
+ {
1980
+ value: form.loanAmount,
1981
+ min: 0,
1982
+ max: 5e6,
1983
+ step: 1e4,
1984
+ onValueChange: (val) => set("loanAmount", val)
1985
+ }
1986
+ ) }),
1987
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Loan Duration", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2", children: [
1988
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
1989
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1990
+ Input,
1991
+ {
1992
+ type: "number",
1993
+ min: 1,
1994
+ max: 40,
1995
+ value: form.loanDuration,
1996
+ onChange: (e) => {
1997
+ const parsed = parseInt(e.target.value, 10);
1998
+ if (!isNaN(parsed)) {
1999
+ set("loanDuration", Math.min(40, Math.max(1, parsed)));
2000
+ }
2001
+ },
2002
+ className: "flex-1"
2003
+ }
2004
+ ),
2005
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm text-muted-foreground", children: "years" })
2006
+ ] }),
2007
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2008
+ Slider,
2009
+ {
2010
+ min: 1,
2011
+ max: 40,
2012
+ step: 1,
2013
+ value: form.loanDuration,
2014
+ onValueChange: (val) => set("loanDuration", val)
2015
+ }
2016
+ )
2017
+ ] }) })
2018
+ ] }),
2019
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Do you know what loan features you want?", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2020
+ Select,
2021
+ {
2022
+ value: form.knowsFeatures,
2023
+ onValueChange: (val) => set("knowsFeatures", val),
2024
+ children: [
2025
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
2026
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(SelectContent, { children: [
2027
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: "Yes", children: "Yes" }),
2028
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: "No", children: "No" })
2029
+ ] })
2030
+ ]
2031
+ }
2032
+ ) }),
2033
+ form.knowsFeatures === "Yes" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2", children: [
2034
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label, { className: "text-sm font-medium text-muted-foreground", children: "What features are important to you?" }),
2035
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "grid grid-cols-2 gap-2", children: LOAN_FEATURES.map(({ key, label }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
2036
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2037
+ Checkbox,
2038
+ {
2039
+ id: `feature-${key}`,
2040
+ checked: form[key],
2041
+ onCheckedChange: (checked) => set(key, checked === true)
2042
+ }
2043
+ ),
2044
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2045
+ "label",
2046
+ {
2047
+ htmlFor: `feature-${key}`,
2048
+ className: "text-sm cursor-pointer select-none",
2049
+ children: label
2050
+ }
2051
+ )
2052
+ ] }, key)) })
2053
+ ] }),
2054
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2", children: [
2055
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label, { className: "text-sm font-medium text-muted-foreground", children: "Top 3 Priorities (Select up to 3)" }),
2056
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "grid grid-cols-2 gap-2", children: PRIORITIES.map((priority) => {
2057
+ const checked = form.priorities.includes(priority);
2058
+ const disabled = prioritiesAtMax && !checked;
2059
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
2060
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2061
+ Checkbox,
2062
+ {
2063
+ id: `priority-${priority}`,
2064
+ checked,
2065
+ disabled,
2066
+ onCheckedChange: () => togglePriority(priority)
2067
+ }
2068
+ ),
2069
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2070
+ "label",
2071
+ {
2072
+ htmlFor: `priority-${priority}`,
2073
+ className: cn(
2074
+ "text-sm cursor-pointer select-none",
2075
+ disabled && "opacity-40 cursor-not-allowed"
2076
+ ),
2077
+ children: priority
2078
+ }
2079
+ )
2080
+ ] }, priority);
2081
+ }) })
2082
+ ] }),
2083
+ YES_NO_FIELDS.map(({ key, label }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2", children: [
2084
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label, { className: "text-sm font-medium text-muted-foreground", children: label }),
2085
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2086
+ RadioGroup,
2087
+ {
2088
+ value: form[key],
2089
+ onValueChange: (val) => {
2090
+ if (val === "Yes" || val === "No") set(key, val);
2091
+ },
2092
+ className: "flex gap-4",
2093
+ children: ["Yes", "No"].map((opt) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2094
+ "label",
2095
+ {
2096
+ className: "flex items-center gap-2 cursor-pointer select-none",
2097
+ children: [
2098
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RadioGroupItem, { value: opt }),
2099
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm", children: opt })
2100
+ ]
2101
+ },
2102
+ opt
2103
+ ))
2104
+ }
2105
+ )
2106
+ ] }, key)),
2107
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "What age are you planning to retire?", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2108
+ Input,
2109
+ {
2110
+ type: "number",
2111
+ min: 0,
2112
+ max: 100,
2113
+ value: form.retirementAge,
2114
+ onChange: (e) => set("retirementAge", e.target.value),
2115
+ placeholder: "e.g. 65"
2116
+ }
2117
+ ) })
2118
+ ] }),
2119
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
2120
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
2121
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2122
+ Button,
2123
+ {
2124
+ onClick: () => {
2125
+ onSave(form);
2126
+ onOpenChange(false);
2127
+ },
2128
+ children: "Save"
2129
+ }
2130
+ )
2131
+ ] })
2132
+ ] }) });
2133
+ }
2134
+ function EditAssetsModal({
2135
+ open,
2136
+ onOpenChange,
2137
+ initialItems = [],
2138
+ onSave,
2139
+ mainApplicantName = "Main Applicant",
2140
+ coApplicantName = "Co-Applicant",
2141
+ className
2142
+ }) {
2143
+ const [items, setItems] = React8.useState(
2144
+ initialItems.length > 0 ? initialItems : [makeDefaultAssetItem()]
2145
+ );
2146
+ React8.useEffect(() => {
2147
+ if (open) {
2148
+ setItems(
2149
+ initialItems.length > 0 ? initialItems : [makeDefaultAssetItem()]
2150
+ );
2151
+ }
2152
+ }, [open]);
2153
+ const updateItem = (id, key, val) => setItems(
2154
+ (prev) => prev.map((item) => item.id === id ? __spreadProps(__spreadValues({}, item), { [key]: val }) : item)
2155
+ );
2156
+ const removeItem = (id) => setItems((prev) => prev.filter((item) => item.id !== id));
2157
+ const addItem = () => setItems((prev) => [...prev, makeDefaultAssetItem()]);
2158
+ const defaultOpenItems = items.length > 0 ? [items[0].id] : [];
2159
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogContent, { className: cn("max-w-lg", className), children: [
2160
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogTitle, { children: "Edit Assets" }) }),
2161
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ModalScroll, { children: [
2162
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2163
+ Accordion,
2164
+ {
2165
+ multiple: true,
2166
+ defaultValue: defaultOpenItems,
2167
+ className: "w-full",
2168
+ children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(AccordionItem, { value: item.id, children: [
2169
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2170
+ AccordionItemHeader,
2171
+ {
2172
+ label: `Asset ${index + 1} \u2014 ${item.assetType || "New Asset"}`,
2173
+ onRemove: () => removeItem(item.id),
2174
+ removeLabel: "Remove asset"
2175
+ }
2176
+ ),
2177
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionContent, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-4 pt-1", children: [
2178
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Asset Type", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2179
+ Select,
2180
+ {
2181
+ value: item.assetType,
2182
+ onValueChange: (val) => updateItem(item.id, "assetType", val),
2183
+ children: [
2184
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select type" }) }),
2185
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: ASSET_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
2186
+ ]
2187
+ }
2188
+ ) }),
2189
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Value", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2190
+ CurrencyInputWithSlider,
2191
+ {
2192
+ value: item.value,
2193
+ min: 0,
2194
+ max: 1e7,
2195
+ step: 1e4,
2196
+ onValueChange: (val) => updateItem(item.id, "value", val)
2197
+ }
2198
+ ) }),
2199
+ (() => {
2200
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2201
+ const f = assetFields(item.assetType);
2202
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
2203
+ f.isProperty && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
2204
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Property Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2205
+ AddressAutocomplete,
2206
+ {
2207
+ value: (_a = item.address) != null ? _a : "",
2208
+ onValueChange: (val) => updateItem(item.id, "address", val),
2209
+ onSelect: (opt) => updateItem(item.id, "address", opt.label)
2210
+ }
2211
+ ) }),
2212
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
2213
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Property Type", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2214
+ Select,
2215
+ {
2216
+ value: (_b = item.propertySubtype) != null ? _b : "",
2217
+ onValueChange: (val) => updateItem(
2218
+ item.id,
2219
+ "propertySubtype",
2220
+ val
2221
+ ),
2222
+ children: [
2223
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
2224
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: PROPERTY_SUBTYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
2225
+ ]
2226
+ }
2227
+ ) }),
2228
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Used As", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2229
+ Select,
2230
+ {
2231
+ value: (_c = item.usedAs) != null ? _c : "",
2232
+ onValueChange: (val) => updateItem(item.id, "usedAs", val),
2233
+ children: [
2234
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
2235
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: PROPERTY_USED_AS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
2236
+ ]
2237
+ }
2238
+ ) })
2239
+ ] })
2240
+ ] }),
2241
+ f.isVehicle && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-3 gap-4", children: [
2242
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Make", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2243
+ Input,
2244
+ {
2245
+ value: (_d = item.make) != null ? _d : "",
2246
+ onChange: (e) => updateItem(item.id, "make", e.target.value),
2247
+ placeholder: "e.g. Toyota"
2248
+ }
2249
+ ) }),
2250
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Model", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2251
+ Input,
2252
+ {
2253
+ value: (_e = item.model) != null ? _e : "",
2254
+ onChange: (e) => updateItem(item.id, "model", e.target.value),
2255
+ placeholder: "e.g. Camry"
2256
+ }
2257
+ ) }),
2258
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Year", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2259
+ Input,
2260
+ {
2261
+ type: "number",
2262
+ min: 1900,
2263
+ max: (/* @__PURE__ */ new Date()).getFullYear() + 1,
2264
+ value: (_f = item.year) != null ? _f : "",
2265
+ onChange: (e) => updateItem(item.id, "year", e.target.value),
2266
+ placeholder: "e.g. 2022"
2267
+ }
2268
+ ) })
2269
+ ] }),
2270
+ (f.isFinancialAccount || f.isInvestment) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Institution / Platform", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2271
+ Input,
2272
+ {
2273
+ value: (_g = item.institution) != null ? _g : "",
2274
+ onChange: (e) => updateItem(
2275
+ item.id,
2276
+ "institution",
2277
+ e.target.value
2278
+ ),
2279
+ placeholder: "e.g. CommBank, Vanguard"
2280
+ }
2281
+ ) }),
2282
+ f.isSuper && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
2283
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Fund Name", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2284
+ Input,
2285
+ {
2286
+ value: (_h = item.fundName) != null ? _h : "",
2287
+ onChange: (e) => updateItem(
2288
+ item.id,
2289
+ "fundName",
2290
+ e.target.value
2291
+ ),
2292
+ placeholder: "e.g. Australian Super"
2293
+ }
2294
+ ) }),
2295
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Member Number", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2296
+ Input,
2297
+ {
2298
+ value: (_i = item.memberNumber) != null ? _i : "",
2299
+ onChange: (e) => updateItem(
2300
+ item.id,
2301
+ "memberNumber",
2302
+ e.target.value
2303
+ ),
2304
+ placeholder: "e.g. 1234567"
2305
+ }
2306
+ ) })
2307
+ ] }),
2308
+ f.isBusiness && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
2309
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Business Name", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2310
+ Input,
2311
+ {
2312
+ value: (_j = item.businessName) != null ? _j : "",
2313
+ onChange: (e) => updateItem(
2314
+ item.id,
2315
+ "businessName",
2316
+ e.target.value
2317
+ ),
2318
+ placeholder: "e.g. Acme Pty Ltd"
2319
+ }
2320
+ ) }),
2321
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "ABN", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2322
+ Input,
2323
+ {
2324
+ value: (_k = item.abn) != null ? _k : "",
2325
+ onChange: (e) => updateItem(item.id, "abn", e.target.value),
2326
+ placeholder: "e.g. 12 345 678 901"
2327
+ }
2328
+ ) })
2329
+ ] }),
2330
+ f.isInsurance && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
2331
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Insurer", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2332
+ Input,
2333
+ {
2334
+ value: (_l = item.insurer) != null ? _l : "",
2335
+ onChange: (e) => updateItem(
2336
+ item.id,
2337
+ "insurer",
2338
+ e.target.value
2339
+ ),
2340
+ placeholder: "e.g. TAL, AIA"
2341
+ }
2342
+ ) }),
2343
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Policy Number", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2344
+ Input,
2345
+ {
2346
+ value: (_m = item.policyNumber) != null ? _m : "",
2347
+ onChange: (e) => updateItem(
2348
+ item.id,
2349
+ "policyNumber",
2350
+ e.target.value
2351
+ ),
2352
+ placeholder: "e.g. POL-123456"
2353
+ }
2354
+ ) })
2355
+ ] })
2356
+ ] });
2357
+ })(),
2358
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Ownership (%)", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2359
+ OwnershipSplit,
2360
+ {
2361
+ owners: [
2362
+ {
2363
+ id: "main",
2364
+ name: mainApplicantName != null ? mainApplicantName : "Main Applicant",
2365
+ share: item.mainShare
2366
+ },
2367
+ {
2368
+ id: "co",
2369
+ name: coApplicantName != null ? coApplicantName : "Co-Applicant",
2370
+ share: item.coShare
2371
+ }
2372
+ ],
2373
+ onOwnersChange: (owners) => {
2374
+ var _a, _b, _c, _d;
2375
+ updateItem(
2376
+ item.id,
2377
+ "mainShare",
2378
+ (_b = (_a = owners.find((o) => o.id === "main")) == null ? void 0 : _a.share) != null ? _b : 50
2379
+ );
2380
+ updateItem(
2381
+ item.id,
2382
+ "coShare",
2383
+ (_d = (_c = owners.find((o) => o.id === "co")) == null ? void 0 : _c.share) != null ? _d : 50
2384
+ );
2385
+ }
2386
+ }
2387
+ ) })
2388
+ ] }) })
2389
+ ] }, item.id))
2390
+ }
2391
+ ),
2392
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2393
+ Button,
2394
+ {
2395
+ variant: "outline",
2396
+ onClick: addItem,
2397
+ className: "w-full gap-1.5",
2398
+ children: [
2399
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react10.Plus, { className: "h-4 w-4" }),
2400
+ "Add More"
2401
+ ]
2402
+ }
2403
+ )
2404
+ ] }),
2405
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
2406
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
2407
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2408
+ Button,
2409
+ {
2410
+ onClick: () => {
2411
+ onSave(items);
2412
+ onOpenChange(false);
2413
+ },
2414
+ children: "Save"
2415
+ }
2416
+ )
2417
+ ] })
2418
+ ] }) });
2419
+ }
2420
+ function EditDebtsModal({
2421
+ open,
2422
+ onOpenChange,
2423
+ initialItems = [],
2424
+ onSave,
2425
+ mainApplicantName = "Main Applicant",
2426
+ coApplicantName = "Co-Applicant",
2427
+ className
2428
+ }) {
2429
+ const [items, setItems] = React8.useState(
2430
+ initialItems.length > 0 ? initialItems : [makeDefaultDebtItem()]
2431
+ );
2432
+ React8.useEffect(() => {
2433
+ if (open) {
2434
+ setItems(
2435
+ initialItems.length > 0 ? initialItems : [makeDefaultDebtItem()]
2436
+ );
2437
+ }
2438
+ }, [open]);
2439
+ const updateItem = (id, key, val) => setItems(
2440
+ (prev) => prev.map((item) => item.id === id ? __spreadProps(__spreadValues({}, item), { [key]: val }) : item)
2441
+ );
2442
+ const removeItem = (id) => setItems((prev) => prev.filter((item) => item.id !== id));
2443
+ const addItem = () => setItems((prev) => [...prev, makeDefaultDebtItem()]);
2444
+ const defaultOpenItems = items.length > 0 ? [items[0].id] : [];
2445
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogContent, { className: cn("max-w-xl", className), children: [
2446
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogTitle, { children: "Edit Debts" }) }),
2447
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ModalScroll, { children: [
2448
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2449
+ Accordion,
2450
+ {
2451
+ multiple: true,
2452
+ defaultValue: defaultOpenItems,
2453
+ className: "w-full",
2454
+ children: items.map((item) => {
2455
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2456
+ const df = debtFields(item.debtType);
2457
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(AccordionItem, { value: item.id, children: [
2458
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2459
+ AccordionItemHeader,
2460
+ {
2461
+ label: item.debtType || "New Debt",
2462
+ onRemove: () => removeItem(item.id),
2463
+ removeLabel: "Remove debt"
2464
+ }
2465
+ ),
2466
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionContent, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-4 pt-1", children: [
2467
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Debt Type", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2468
+ Select,
2469
+ {
2470
+ value: item.debtType,
2471
+ onValueChange: (val) => updateItem(item.id, "debtType", val),
2472
+ children: [
2473
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select type" }) }),
2474
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: DEBT_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
2475
+ ]
2476
+ }
2477
+ ) }),
2478
+ (df.isPropertyLoan || df.isGeneralLoan || df.isVehicle) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
2479
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Lender", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2480
+ Input,
2481
+ {
2482
+ value: (_a = item.lender) != null ? _a : "",
2483
+ onChange: (e) => updateItem(item.id, "lender", e.target.value),
2484
+ placeholder: "e.g. CommBank"
2485
+ }
2486
+ ) }),
2487
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Account Number", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2488
+ Input,
2489
+ {
2490
+ value: (_b = item.accountNumber) != null ? _b : "",
2491
+ onChange: (e) => updateItem(
2492
+ item.id,
2493
+ "accountNumber",
2494
+ e.target.value
2495
+ ),
2496
+ placeholder: "e.g. 123-456"
2497
+ }
2498
+ ) })
2499
+ ] }),
2500
+ df.isPropertyLoan && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Property Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2501
+ AddressAutocomplete,
2502
+ {
2503
+ value: (_c = item.propertyAddress) != null ? _c : "",
2504
+ onValueChange: (val) => updateItem(item.id, "propertyAddress", val),
2505
+ onSelect: (opt) => updateItem(item.id, "propertyAddress", opt.label)
2506
+ }
2507
+ ) }),
2508
+ df.isVehicle && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-3 gap-4", children: [
2509
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Make", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2510
+ Input,
2511
+ {
2512
+ value: (_d = item.vehicleMake) != null ? _d : "",
2513
+ onChange: (e) => updateItem(
2514
+ item.id,
2515
+ "vehicleMake",
2516
+ e.target.value
2517
+ ),
2518
+ placeholder: "e.g. Toyota"
2519
+ }
2520
+ ) }),
2521
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Model", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2522
+ Input,
2523
+ {
2524
+ value: (_e = item.vehicleModel) != null ? _e : "",
2525
+ onChange: (e) => updateItem(
2526
+ item.id,
2527
+ "vehicleModel",
2528
+ e.target.value
2529
+ ),
2530
+ placeholder: "e.g. Camry"
2531
+ }
2532
+ ) }),
2533
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Year", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2534
+ Input,
2535
+ {
2536
+ type: "number",
2537
+ min: 1900,
2538
+ max: (/* @__PURE__ */ new Date()).getFullYear() + 1,
2539
+ value: (_f = item.vehicleYear) != null ? _f : "",
2540
+ onChange: (e) => updateItem(
2541
+ item.id,
2542
+ "vehicleYear",
2543
+ e.target.value
2544
+ ),
2545
+ placeholder: "e.g. 2022"
2546
+ }
2547
+ ) })
2548
+ ] }),
2549
+ df.isCard && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
2550
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Provider", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2551
+ Input,
2552
+ {
2553
+ value: (_g = item.lender) != null ? _g : "",
2554
+ onChange: (e) => updateItem(item.id, "lender", e.target.value),
2555
+ placeholder: "e.g. ANZ, Afterpay"
2556
+ }
2557
+ ) }),
2558
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Credit Limit", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2559
+ CurrencyInputWithSlider,
2560
+ {
2561
+ value: (_h = item.creditLimit) != null ? _h : 0,
2562
+ min: 0,
2563
+ max: 1e5,
2564
+ step: 500,
2565
+ onValueChange: (val) => updateItem(item.id, "creditLimit", val)
2566
+ }
2567
+ ) })
2568
+ ] }),
2569
+ df.isHecs && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Institution", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2570
+ Input,
2571
+ {
2572
+ value: (_i = item.institution) != null ? _i : "",
2573
+ onChange: (e) => updateItem(item.id, "institution", e.target.value),
2574
+ placeholder: "e.g. University of Sydney"
2575
+ }
2576
+ ) }),
2577
+ df.isTax && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
2578
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Tax Year", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2579
+ Input,
2580
+ {
2581
+ value: (_j = item.taxYear) != null ? _j : "",
2582
+ onChange: (e) => updateItem(item.id, "taxYear", e.target.value),
2583
+ placeholder: "e.g. 2023\u201324"
2584
+ }
2585
+ ) }),
2586
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "ATO Reference", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2587
+ Input,
2588
+ {
2589
+ value: (_k = item.referenceNumber) != null ? _k : "",
2590
+ onChange: (e) => updateItem(
2591
+ item.id,
2592
+ "referenceNumber",
2593
+ e.target.value
2594
+ ),
2595
+ placeholder: "e.g. 1234567890"
2596
+ }
2597
+ ) })
2598
+ ] }),
2599
+ df.isGuarantor && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Beneficiary (borrower's name)", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2600
+ Input,
2601
+ {
2602
+ value: (_l = item.beneficiary) != null ? _l : "",
2603
+ onChange: (e) => updateItem(item.id, "beneficiary", e.target.value),
2604
+ placeholder: "e.g. Jane Smith"
2605
+ }
2606
+ ) }),
2607
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
2608
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Amount Owing", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2609
+ CurrencyInputWithSlider,
2610
+ {
2611
+ value: item.amountOwing,
2612
+ min: 0,
2613
+ max: 1e6,
2614
+ step: 1e3,
2615
+ onValueChange: (val) => updateItem(item.id, "amountOwing", val)
2616
+ }
2617
+ ) }),
2618
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Original Loan Amount", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2619
+ CurrencyInputWithSlider,
2620
+ {
2621
+ value: item.originalLoanAmount,
2622
+ min: 0,
2623
+ max: 1e6,
2624
+ step: 1e3,
2625
+ onValueChange: (val) => updateItem(item.id, "originalLoanAmount", val)
2626
+ }
2627
+ ) })
2628
+ ] }),
2629
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start gap-3", children: [
2630
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Repayments", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2631
+ CurrencyInputWithSlider,
2632
+ {
2633
+ value: item.repaymentAmount,
2634
+ min: 0,
2635
+ max: 1e6,
2636
+ step: 100,
2637
+ onValueChange: (val) => updateItem(item.id, "repaymentAmount", val)
2638
+ }
2639
+ ) }) }),
2640
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "shrink-0 mt-[1.625rem]", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2641
+ FrequencyToggle,
2642
+ {
2643
+ value: item.repaymentFrequency,
2644
+ onValueChange: (val) => updateItem(item.id, "repaymentFrequency", val)
2645
+ }
2646
+ ) })
2647
+ ] }),
2648
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Interest Rate", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
2649
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2650
+ Input,
2651
+ {
2652
+ value: item.interestRate,
2653
+ onChange: (e) => updateItem(
2654
+ item.id,
2655
+ "interestRate",
2656
+ e.target.value
2657
+ ),
2658
+ placeholder: "e.g. 6.5",
2659
+ className: "flex-1"
2660
+ }
2661
+ ),
2662
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm text-muted-foreground shrink-0", children: "%" })
2663
+ ] }) }),
2664
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Notes", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2665
+ Textarea,
2666
+ {
2667
+ value: item.details,
2668
+ onChange: (e) => updateItem(item.id, "details", e.target.value),
2669
+ placeholder: "Short comment",
2670
+ rows: 2
2671
+ }
2672
+ ) }),
2673
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Ownership (%)", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2674
+ OwnershipSplit,
2675
+ {
2676
+ owners: [
2677
+ {
2678
+ id: "main",
2679
+ name: mainApplicantName != null ? mainApplicantName : "Main Applicant",
2680
+ share: item.mainShare
2681
+ },
2682
+ {
2683
+ id: "co",
2684
+ name: coApplicantName != null ? coApplicantName : "Co-Applicant",
2685
+ share: item.coShare
2686
+ }
2687
+ ],
2688
+ onOwnersChange: (owners) => {
2689
+ var _a2, _b2, _c2, _d2;
2690
+ updateItem(
2691
+ item.id,
2692
+ "mainShare",
2693
+ (_b2 = (_a2 = owners.find((o) => o.id === "main")) == null ? void 0 : _a2.share) != null ? _b2 : 50
2694
+ );
2695
+ updateItem(
2696
+ item.id,
2697
+ "coShare",
2698
+ (_d2 = (_c2 = owners.find((o) => o.id === "co")) == null ? void 0 : _c2.share) != null ? _d2 : 50
2699
+ );
2700
+ }
2701
+ }
2702
+ ) })
2703
+ ] }) })
2704
+ ] }, item.id);
2705
+ })
2706
+ }
2707
+ ),
2708
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2709
+ Button,
2710
+ {
2711
+ variant: "outline",
2712
+ onClick: addItem,
2713
+ className: "w-full gap-1.5",
2714
+ children: [
2715
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react10.Plus, { className: "h-4 w-4" }),
2716
+ "Add More"
2717
+ ]
2718
+ }
2719
+ )
2720
+ ] }),
2721
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
2722
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
2723
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2724
+ Button,
2725
+ {
2726
+ onClick: () => {
2727
+ onSave(items);
2728
+ onOpenChange(false);
2729
+ },
2730
+ children: "Save"
2731
+ }
2732
+ )
2733
+ ] })
2734
+ ] }) });
2735
+ }
2736
+ function EditAboutApplicantModal({
2737
+ open,
2738
+ onOpenChange,
2739
+ applicantLabel = "Applicant",
2740
+ initialData,
2741
+ onSave,
2742
+ className
2743
+ }) {
2744
+ const [form, setForm] = React8.useState(__spreadValues(__spreadValues({}, ABOUT_APPLICANT_DEFAULTS), initialData));
2745
+ React8.useEffect(() => {
2746
+ if (open) {
2747
+ setForm(__spreadValues(__spreadValues({}, ABOUT_APPLICANT_DEFAULTS), initialData));
2748
+ }
2749
+ }, [open]);
2750
+ const setStr = (key) => (val) => setForm((prev) => __spreadProps(__spreadValues({}, prev), { [key]: val }));
2751
+ const handleNumDependantsChange = (val) => {
2752
+ const n = Math.max(0, Math.min(20, parseInt(val, 10) || 0));
2753
+ setForm((prev) => {
2754
+ var _a;
2755
+ const current = (_a = prev.dependants) != null ? _a : [];
2756
+ const next = n > current.length ? [...current, ...Array(n - current.length).fill({ dob: "" })] : current.slice(0, n);
2757
+ return __spreadProps(__spreadValues({}, prev), { numDependants: val, dependants: next });
2758
+ });
2759
+ };
2760
+ const setDependantDob = (index, dob) => setForm((prev) => {
2761
+ const next = prev.dependants.map((d, i) => i === index ? { dob } : d);
2762
+ return __spreadProps(__spreadValues({}, prev), { dependants: next });
2763
+ });
2764
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogContent, { className: cn("max-w-md", className), children: [
2765
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogTitle, { children: [
2766
+ "Edit About ",
2767
+ applicantLabel
2768
+ ] }) }),
2769
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ModalScroll, { children: [
2770
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex gap-3 items-start", children: [
2771
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-24 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Title", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Select, { value: form.title, onValueChange: setStr("title"), children: [
2772
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Title" }) }),
2773
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: TITLE_OPTIONS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
2774
+ ] }) }) }),
2775
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "First Name", className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2776
+ Input,
2777
+ {
2778
+ value: form.firstName,
2779
+ onChange: (e) => setStr("firstName")(e.target.value),
2780
+ placeholder: "First name"
2781
+ }
2782
+ ) }),
2783
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Last Name", className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2784
+ Input,
2785
+ {
2786
+ value: form.lastName,
2787
+ onChange: (e) => setStr("lastName")(e.target.value),
2788
+ placeholder: "Last name"
2789
+ }
2790
+ ) })
2791
+ ] }),
2792
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
2793
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Phone Number", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2794
+ Input,
2795
+ {
2796
+ value: form.phone,
2797
+ onChange: (e) => setStr("phone")(e.target.value),
2798
+ placeholder: "+61 4xx xxx xxx",
2799
+ type: "tel"
2800
+ }
2801
+ ) }),
2802
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Email", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2803
+ Input,
2804
+ {
2805
+ value: form.email,
2806
+ onChange: (e) => setStr("email")(e.target.value),
2807
+ placeholder: "email@example.com",
2808
+ type: "email"
2809
+ }
2810
+ ) })
2811
+ ] }),
2812
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
2813
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Date of Birth", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2814
+ DatePicker,
2815
+ {
2816
+ value: form.dob ? new Date(form.dob) : void 0,
2817
+ onChange: (d) => setStr("dob")(d ? d.toISOString().slice(0, 10) : ""),
2818
+ calendarProps: {
2819
+ fromYear: 1900,
2820
+ toYear: (/* @__PURE__ */ new Date()).getFullYear() - 16
2821
+ }
2822
+ }
2823
+ ) }),
2824
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Gender", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Select, { value: form.gender, onValueChange: setStr("gender"), children: [
2825
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
2826
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: GENDER_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: g, children: g }, g)) })
2827
+ ] }) })
2828
+ ] }),
2829
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
2830
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Marital Status", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2831
+ Select,
2832
+ {
2833
+ value: form.maritalStatus,
2834
+ onValueChange: setStr("maritalStatus"),
2835
+ children: [
2836
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
2837
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: MARITAL_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: m, children: m }, m)) })
2838
+ ]
2839
+ }
2840
+ ) }),
2841
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "No. of Dependants", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2842
+ Input,
2843
+ {
2844
+ type: "number",
2845
+ min: 0,
2846
+ max: 20,
2847
+ value: form.numDependants,
2848
+ onChange: (e) => handleNumDependantsChange(e.target.value),
2849
+ placeholder: "0"
2850
+ }
2851
+ ) })
2852
+ ] }),
2853
+ form.dependants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-3", children: [
2854
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label, { className: "text-sm font-medium", children: "Dependant Date of Birth" }),
2855
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "grid grid-cols-2 gap-3", children: form.dependants.map((dep, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: `Dependant ${i + 1}`, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2856
+ DatePicker,
2857
+ {
2858
+ value: dep.dob ? new Date(dep.dob) : void 0,
2859
+ onChange: (d) => setDependantDob(
2860
+ i,
2861
+ d ? d.toISOString().slice(0, 10) : ""
2862
+ ),
2863
+ calendarProps: {
2864
+ fromYear: 1900,
2865
+ toYear: (/* @__PURE__ */ new Date()).getFullYear()
2866
+ }
2867
+ }
2868
+ ) }, i)) })
2869
+ ] }),
2870
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Citizen Status", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2871
+ Select,
2872
+ {
2873
+ value: form.citizenStatus,
2874
+ onValueChange: setStr("citizenStatus"),
2875
+ children: [
2876
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select status" }) }),
2877
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: CITIZEN_OPTIONS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: c, children: c }, c)) })
2878
+ ]
2879
+ }
2880
+ ) }),
2881
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Current Residential Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2882
+ AddressAutocomplete,
2883
+ {
2884
+ value: form.residentialAddress,
2885
+ onValueChange: setStr("residentialAddress"),
2886
+ onSelect: (opt) => setStr("residentialAddress")(opt.label)
2887
+ }
2888
+ ) }),
2889
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
2890
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Residential Status", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2891
+ Select,
2892
+ {
2893
+ value: form.residentialStatus,
2894
+ onValueChange: setStr("residentialStatus"),
2895
+ children: [
2896
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
2897
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: RESIDENTIAL_STATUS_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: o, children: o }, o)) })
2898
+ ]
2899
+ }
2900
+ ) }),
2901
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Time at Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex gap-2", children: [
2902
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1 flex-1", children: [
2903
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2904
+ Input,
2905
+ {
2906
+ type: "number",
2907
+ min: 0,
2908
+ value: form.timeAtAddressYears,
2909
+ onChange: (e) => setStr("timeAtAddressYears")(e.target.value),
2910
+ placeholder: "0"
2911
+ }
2912
+ ),
2913
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm text-muted-foreground shrink-0", children: "yr" })
2914
+ ] }),
2915
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1 flex-1", children: [
2916
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2917
+ Input,
2918
+ {
2919
+ type: "number",
2920
+ min: 0,
2921
+ max: 11,
2922
+ value: form.timeAtAddressMonths,
2923
+ onChange: (e) => setStr("timeAtAddressMonths")(e.target.value),
2924
+ placeholder: "0"
2925
+ }
2926
+ ),
2927
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm text-muted-foreground shrink-0", children: "mo" })
2928
+ ] })
2929
+ ] }) })
2930
+ ] }),
2931
+ parseInt(form.timeAtAddressYears || "99") < 2 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Previous Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2932
+ AddressAutocomplete,
2933
+ {
2934
+ value: form.previousAddress,
2935
+ onValueChange: setStr("previousAddress"),
2936
+ onSelect: (opt) => setStr("previousAddress")(opt.label)
2937
+ }
2938
+ ) }),
2939
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
2940
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Driver's Licence", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2941
+ Input,
2942
+ {
2943
+ value: form.driversLicence,
2944
+ onChange: (e) => setStr("driversLicence")(e.target.value),
2945
+ placeholder: "e.g. 12345678"
2946
+ }
2947
+ ) }),
2948
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Passport Number", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2949
+ Input,
2950
+ {
2951
+ value: form.passport,
2952
+ onChange: (e) => setStr("passport")(e.target.value),
2953
+ placeholder: "e.g. PA1234567"
2954
+ }
2955
+ ) })
2956
+ ] }),
2957
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
2958
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Property in Trust", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2959
+ Select,
2960
+ {
2961
+ value: form.propertyInTrust,
2962
+ onValueChange: setStr("propertyInTrust"),
2963
+ children: [
2964
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
2965
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: PROPERTY_IN_TRUST_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: o, children: o }, o)) })
2966
+ ]
2967
+ }
2968
+ ) }),
2969
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Company Ownership", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2970
+ Select,
2971
+ {
2972
+ value: form.companyOwnership,
2973
+ onValueChange: setStr("companyOwnership"),
2974
+ children: [
2975
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
2976
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: COMPANY_OWNERSHIP_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: o, children: o }, o)) })
2977
+ ]
2978
+ }
2979
+ ) })
2980
+ ] })
2981
+ ] }),
2982
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
2983
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
2984
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2985
+ Button,
2986
+ {
2987
+ onClick: () => {
2988
+ onSave(form);
2989
+ onOpenChange(false);
2990
+ },
2991
+ children: "Save"
2992
+ }
2993
+ )
2994
+ ] })
2995
+ ] }) });
2996
+ }
2997
+ function EditIncomeModal({
2998
+ open,
2999
+ onOpenChange,
3000
+ applicantLabel = "Applicant",
3001
+ initialData,
3002
+ onSave,
3003
+ className
3004
+ }) {
3005
+ const defaultItems = React8.useMemo(
3006
+ () => {
3007
+ var _a;
3008
+ return ((_a = initialData == null ? void 0 : initialData.items) == null ? void 0 : _a.length) ? initialData.items : [makeDefaultIncomeItem()];
3009
+ },
3010
+ []
3011
+ // eslint-disable-line react-hooks/exhaustive-deps
3012
+ );
3013
+ const [items, setItems] = React8.useState(defaultItems);
3014
+ React8.useEffect(() => {
3015
+ var _a;
3016
+ if (open) {
3017
+ setItems(
3018
+ ((_a = initialData == null ? void 0 : initialData.items) == null ? void 0 : _a.length) ? initialData.items : [makeDefaultIncomeItem()]
3019
+ );
3020
+ }
3021
+ }, [open]);
3022
+ const updateItem = (id, key, val) => setItems(
3023
+ (prev) => prev.map((item) => item.id === id ? __spreadProps(__spreadValues({}, item), { [key]: val }) : item)
3024
+ );
3025
+ const removeItem = (id) => setItems((prev) => prev.filter((item) => item.id !== id));
3026
+ const addItem = () => setItems((prev) => [...prev, makeDefaultIncomeItem()]);
3027
+ const defaultOpenItems = items.length > 0 ? [items[0].id] : [];
3028
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogContent, { className: cn("max-w-lg", className), children: [
3029
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogTitle, { children: [
3030
+ "Edit Income ",
3031
+ applicantLabel
3032
+ ] }) }),
3033
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ModalScroll, { children: [
3034
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3035
+ Accordion,
3036
+ {
3037
+ multiple: true,
3038
+ defaultValue: defaultOpenItems,
3039
+ className: "w-full",
3040
+ children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(AccordionItem, { value: item.id, children: [
3041
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3042
+ AccordionItemHeader,
3043
+ {
3044
+ label: `Income ${index + 1} \u2014 ${item.incomeType || "New Income"}`,
3045
+ onRemove: () => removeItem(item.id),
3046
+ removeLabel: "Remove income item"
3047
+ }
3048
+ ),
3049
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionContent, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-4 pt-1", children: [
3050
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Income Type", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3051
+ Select,
3052
+ {
3053
+ value: item.incomeType,
3054
+ onValueChange: (val) => updateItem(item.id, "incomeType", val),
3055
+ children: [
3056
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select type" }) }),
3057
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: INCOME_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
3058
+ ]
3059
+ }
3060
+ ) }),
3061
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Job Title", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3062
+ Input,
3063
+ {
3064
+ value: item.jobTitle,
3065
+ onChange: (e) => updateItem(item.id, "jobTitle", e.target.value),
3066
+ placeholder: "Job title"
3067
+ }
3068
+ ) }),
3069
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
3070
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Start Date", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3071
+ DatePicker,
3072
+ {
3073
+ value: item.startDate ? new Date(item.startDate) : void 0,
3074
+ onChange: (d) => updateItem(
3075
+ item.id,
3076
+ "startDate",
3077
+ d ? d.toISOString().slice(0, 10) : ""
3078
+ ),
3079
+ calendarProps: {
3080
+ fromYear: 1950,
3081
+ toYear: (/* @__PURE__ */ new Date()).getFullYear()
3082
+ }
3083
+ }
3084
+ ) }),
3085
+ !item.stillInPosition && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "End Date", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3086
+ DatePicker,
3087
+ {
3088
+ value: item.endDate ? new Date(item.endDate) : void 0,
3089
+ onChange: (d) => updateItem(
3090
+ item.id,
3091
+ "endDate",
3092
+ d ? d.toISOString().slice(0, 10) : ""
3093
+ ),
3094
+ calendarProps: {
3095
+ fromYear: 1950,
3096
+ toYear: (/* @__PURE__ */ new Date()).getFullYear()
3097
+ }
3098
+ }
3099
+ ) })
3100
+ ] }),
3101
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
3102
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3103
+ Checkbox,
3104
+ {
3105
+ id: `still-in-position-${item.id}`,
3106
+ checked: item.stillInPosition,
3107
+ onCheckedChange: (checked) => updateItem(
3108
+ item.id,
3109
+ "stillInPosition",
3110
+ checked === true
3111
+ )
3112
+ }
3113
+ ),
3114
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3115
+ "label",
3116
+ {
3117
+ htmlFor: `still-in-position-${item.id}`,
3118
+ className: "text-sm cursor-pointer select-none",
3119
+ children: "Still in position"
3120
+ }
3121
+ )
3122
+ ] }),
3123
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Company Name", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3124
+ Input,
3125
+ {
3126
+ value: item.companyName,
3127
+ onChange: (e) => updateItem(item.id, "companyName", e.target.value),
3128
+ placeholder: "Company name"
3129
+ }
3130
+ ) }),
3131
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Company Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3132
+ AddressAutocomplete,
3133
+ {
3134
+ value: item.companyAddress,
3135
+ onValueChange: (val) => updateItem(item.id, "companyAddress", val),
3136
+ placeholder: "Search company address"
3137
+ }
3138
+ ) }),
3139
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start gap-3", children: [
3140
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Income Amount", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3141
+ CurrencyInputWithSlider,
3142
+ {
3143
+ value: item.incomeAmount,
3144
+ min: 0,
3145
+ max: 1e6,
3146
+ step: 1e3,
3147
+ onValueChange: (val) => updateItem(item.id, "incomeAmount", val)
3148
+ }
3149
+ ) }) }),
3150
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "shrink-0 mt-[1.625rem]", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3151
+ FrequencyToggle,
3152
+ {
3153
+ value: item.frequency,
3154
+ onValueChange: (val) => updateItem(item.id, "frequency", val)
3155
+ }
3156
+ ) })
3157
+ ] }),
3158
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Type of Company", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3159
+ RadioGroup,
3160
+ {
3161
+ value: item.companyType,
3162
+ onValueChange: (val) => updateItem(
3163
+ item.id,
3164
+ "companyType",
3165
+ val
3166
+ ),
3167
+ className: "flex gap-4",
3168
+ children: ["Public", "Private"].map((opt) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3169
+ "label",
3170
+ {
3171
+ className: "flex items-center gap-2 cursor-pointer text-sm",
3172
+ children: [
3173
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RadioGroupItem, { value: opt }),
3174
+ opt
3175
+ ]
3176
+ },
3177
+ opt
3178
+ ))
3179
+ }
3180
+ ) })
3181
+ ] }) })
3182
+ ] }, item.id))
3183
+ }
3184
+ ),
3185
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3186
+ Button,
3187
+ {
3188
+ variant: "outline",
3189
+ onClick: addItem,
3190
+ className: "w-full gap-1.5",
3191
+ children: [
3192
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react10.Plus, { className: "h-4 w-4" }),
3193
+ "Add More"
3194
+ ]
3195
+ }
3196
+ )
3197
+ ] }),
3198
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
3199
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
3200
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3201
+ Button,
3202
+ {
3203
+ onClick: () => {
3204
+ onSave({ items });
3205
+ onOpenChange(false);
3206
+ },
3207
+ children: "Save"
3208
+ }
3209
+ )
3210
+ ] })
3211
+ ] }) });
3212
+ }
3213
+ function EditExpensesModal({
3214
+ open,
3215
+ onOpenChange,
3216
+ applicantLabel = "Applicant",
3217
+ initialData,
3218
+ onSave,
3219
+ className
3220
+ }) {
3221
+ const defaultItems = React8.useMemo(
3222
+ () => {
3223
+ var _a;
3224
+ return ((_a = initialData == null ? void 0 : initialData.items) == null ? void 0 : _a.length) ? initialData.items : [makeDefaultExpenseItem()];
3225
+ },
3226
+ []
3227
+ // eslint-disable-line react-hooks/exhaustive-deps
3228
+ );
3229
+ const [items, setItems] = React8.useState(defaultItems);
3230
+ React8.useEffect(() => {
3231
+ var _a;
3232
+ if (open) {
3233
+ setItems(
3234
+ ((_a = initialData == null ? void 0 : initialData.items) == null ? void 0 : _a.length) ? initialData.items : [makeDefaultExpenseItem()]
3235
+ );
3236
+ }
3237
+ }, [open]);
3238
+ const updateItem = (id, key, val) => setItems(
3239
+ (prev) => prev.map((item) => item.id === id ? __spreadProps(__spreadValues({}, item), { [key]: val }) : item)
3240
+ );
3241
+ const removeItem = (id) => setItems((prev) => prev.filter((item) => item.id !== id));
3242
+ const addItem = () => setItems((prev) => [...prev, makeDefaultExpenseItem()]);
3243
+ const defaultOpenItems = items.length > 0 ? [items[0].id] : [];
3244
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogContent, { className: cn("max-w-lg", className), children: [
3245
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogTitle, { children: [
3246
+ "Edit Expenses ",
3247
+ applicantLabel
3248
+ ] }) }),
3249
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ModalScroll, { children: [
3250
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3251
+ Accordion,
3252
+ {
3253
+ multiple: true,
3254
+ defaultValue: defaultOpenItems,
3255
+ className: "w-full",
3256
+ children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(AccordionItem, { value: item.id, children: [
3257
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3258
+ AccordionItemHeader,
3259
+ {
3260
+ label: `Expense ${index + 1} \u2014 ${item.expenseType || "New Expense"}`,
3261
+ onRemove: () => removeItem(item.id),
3262
+ removeLabel: "Remove expense item"
3263
+ }
3264
+ ),
3265
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionContent, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-4 pt-1", children: [
3266
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Expense Type", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3267
+ Select,
3268
+ {
3269
+ value: item.expenseType,
3270
+ onValueChange: (val) => updateItem(item.id, "expenseType", val),
3271
+ children: [
3272
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select type" }) }),
3273
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: EXPENSE_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
3274
+ ]
3275
+ }
3276
+ ) }),
3277
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start gap-3", children: [
3278
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Amount", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3279
+ CurrencyInputWithSlider,
3280
+ {
3281
+ value: item.amount,
3282
+ min: 0,
3283
+ max: 1e5,
3284
+ step: 100,
3285
+ onValueChange: (val) => updateItem(item.id, "amount", val)
3286
+ }
3287
+ ) }) }),
3288
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "shrink-0 mt-[1.625rem]", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3289
+ FrequencyToggle,
3290
+ {
3291
+ value: item.frequency,
3292
+ onValueChange: (val) => updateItem(item.id, "frequency", val)
3293
+ }
3294
+ ) })
3295
+ ] }),
3296
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Ownership (%)", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3297
+ OwnershipSplit,
3298
+ {
3299
+ owners: [
3300
+ {
3301
+ id: "main",
3302
+ name: "Main Applicant",
3303
+ share: item.mainShare
3304
+ },
3305
+ {
3306
+ id: "co",
3307
+ name: "Co-Applicant",
3308
+ share: item.coShare
3309
+ }
3310
+ ],
3311
+ onOwnersChange: (owners) => {
3312
+ var _a, _b, _c, _d;
3313
+ const main = (_b = (_a = owners.find((o) => o.id === "main")) == null ? void 0 : _a.share) != null ? _b : item.mainShare;
3314
+ const co = (_d = (_c = owners.find((o) => o.id === "co")) == null ? void 0 : _c.share) != null ? _d : item.coShare;
3315
+ updateItem(item.id, "mainShare", main);
3316
+ updateItem(item.id, "coShare", co);
3317
+ }
3318
+ }
3319
+ ) })
3320
+ ] }) })
3321
+ ] }, item.id))
3322
+ }
3323
+ ),
3324
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3325
+ Button,
3326
+ {
3327
+ variant: "outline",
3328
+ onClick: addItem,
3329
+ className: "w-full gap-1.5",
3330
+ children: [
3331
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react10.Plus, { className: "h-4 w-4" }),
3332
+ "Add More"
3333
+ ]
3334
+ }
3335
+ )
3336
+ ] }),
3337
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
3338
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
3339
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3340
+ Button,
3341
+ {
3342
+ onClick: () => {
3343
+ onSave({ items });
3344
+ onOpenChange(false);
3345
+ },
3346
+ children: "Save"
3347
+ }
3348
+ )
3349
+ ] })
3350
+ ] }) });
3351
+ }
3352
+ // Annotate the CommonJS export names for ESM import in node:
3353
+ 0 && (module.exports = {
3354
+ EditAboutApplicantModal,
3355
+ EditAssetsModal,
3356
+ EditDebtsModal,
3357
+ EditExpensesModal,
3358
+ EditIncomeModal,
3359
+ EditLoanScenarioModal
3360
+ });