@protobase/ui 0.117.7 → 0.118.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 (260) hide show
  1. package/dist/account/messages.d.ts +2 -2
  2. package/dist/activity-chart/activity-chart.d.ts +3 -1
  3. package/dist/activity-chart/activity-chart.js +21 -14
  4. package/dist/activity-chart/messages.d.ts +2 -2
  5. package/dist/app/charts/messages.d.ts +2 -2
  6. package/dist/app/comments/messages.d.ts +2 -2
  7. package/dist/app/conversation/thread-state.d.ts +1 -1
  8. package/dist/app/create/messages.d.ts +2 -2
  9. package/dist/app/custom-section.d.ts +1 -1
  10. package/dist/app/delete/messages.d.ts +2 -2
  11. package/dist/app/displays/list-cards.d.ts +1 -1
  12. package/dist/app/displays/messages.d.ts +2 -2
  13. package/dist/app/embedded-list/messages.d.ts +2 -2
  14. package/dist/app/export/messages.d.ts +2 -2
  15. package/dist/app/field-messages.d.ts +2 -2
  16. package/dist/app/field-types/runner-install/messages.d.ts +2 -2
  17. package/dist/app/field-types/widget-part.d.ts +1 -1
  18. package/dist/app/field-types/workflow/messages.d.ts +2 -2
  19. package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
  20. package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
  21. package/dist/app/field-types/workflow-status/messages.d.ts +2 -2
  22. package/dist/app/gallery/gallery-layout.d.ts +2 -2
  23. package/dist/app/gallery/messages.d.ts +2 -2
  24. package/dist/app/hand-order/messages.d.ts +2 -2
  25. package/dist/app/history/messages.d.ts +2 -2
  26. package/dist/app/import/messages.d.ts +2 -2
  27. package/dist/app/list-chart.d.ts +1 -1
  28. package/dist/app/list-chart.js +6 -4
  29. package/dist/app/list-messages.d.ts +2 -2
  30. package/dist/app/messages.d.ts +2 -2
  31. package/dist/app/meta-gate-messages.d.ts +2 -2
  32. package/dist/app/new-version/messages.d.ts +2 -2
  33. package/dist/app/pages/custom-boundary.d.ts +1 -1
  34. package/dist/app/pages/custom-chosen.d.ts +1 -1
  35. package/dist/app/pages/messages.d.ts +2 -2
  36. package/dist/app/record-chart/messages.d.ts +2 -2
  37. package/dist/app/record-messages.d.ts +2 -2
  38. package/dist/app/record-mode/shown-layout.d.ts +1 -1
  39. package/dist/app/record-row/messages.d.ts +2 -2
  40. package/dist/app/related-cards/messages.d.ts +2 -2
  41. package/dist/app/runtime/messages.d.ts +2 -2
  42. package/dist/app/saved/saved-list.d.ts +1 -1
  43. package/dist/app/searches/messages.d.ts +2 -2
  44. package/dist/app-shell/messages.d.ts +2 -2
  45. package/dist/assistant-dock/messages.d.ts +2 -2
  46. package/dist/auth/messages.d.ts +2 -2
  47. package/dist/calls/messages.d.ts +2 -2
  48. package/dist/carousel/messages.d.ts +2 -2
  49. package/dist/chat/messages.d.ts +2 -2
  50. package/dist/compact-table/messages.d.ts +2 -2
  51. package/dist/data/aggregate-loader.d.ts +38 -0
  52. package/dist/data/aggregate-loader.js +68 -0
  53. package/dist/data/api-provider.d.ts +3 -0
  54. package/dist/data/use-aggregates.js +7 -6
  55. package/dist/data-grid/column-spec.d.ts +1 -1
  56. package/dist/data-grid/messages.d.ts +2 -2
  57. package/dist/filter-panel/facet-combobox.js +38 -31
  58. package/dist/filter-panel/facet-group.js +5 -1
  59. package/dist/filter-panel/filter-config.d.ts +4 -0
  60. package/dist/filter-panel/messages.d.ts +2 -2
  61. package/dist/filter-panel/range-filter.js +4 -0
  62. package/dist/forms/messages.d.ts +2 -2
  63. package/dist/inline-child-table/messages.d.ts +2 -2
  64. package/dist/live/messages.d.ts +2 -2
  65. package/dist/live/use-filter-config.d.ts +3 -2
  66. package/dist/live/use-filter-config.js +31 -8
  67. package/dist/locale/en.js +4 -2
  68. package/dist/locale/en.json.d.ts +2 -0
  69. package/dist/locale/messages.d.ts +4 -0
  70. package/dist/locale/nl.js +4 -2
  71. package/dist/locale/texts-gate.d.ts +1 -1
  72. package/dist/notifications/bell/messages.d.ts +2 -2
  73. package/dist/organizations/messages.d.ts +2 -2
  74. package/dist/package.js +1 -1
  75. package/dist/plugins/before-sign-in.d.ts +1 -1
  76. package/dist/primitives/messages.d.ts +2 -2
  77. package/dist/record-view/messages.d.ts +2 -2
  78. package/dist/shell/assets/{account-page-B_azef82.js → account-page-DOXkanFO.js} +2 -2
  79. package/dist/shell/assets/{app-1j5nx8lw.js → app-B48LQpC1.js} +11 -11
  80. package/dist/shell/assets/{assistant-shell-BDKCWgs7.js → assistant-shell-Drpmyy7B.js} +2 -2
  81. package/dist/shell/assets/board-display-D9PUmRbl.js +2 -0
  82. package/dist/shell/assets/{calendar-display-CWANjACC.js → calendar-display-B8J8DI5J.js} +2 -2
  83. package/dist/shell/assets/call-rings-C7f5skja.js +2 -0
  84. package/dist/shell/assets/{calls-s6XuZsjs.js → calls-Ca2RAgzS.js} +2 -2
  85. package/dist/shell/assets/{circle-alert-CCchwpE2.js → circle-alert-B5-CtUEU.js} +2 -2
  86. package/dist/shell/assets/{composed-page-Cj-OwCZB.js → composed-page-BMYkHKrZ.js} +2 -2
  87. package/dist/shell/assets/{composer-section-BWJgscVY.js → composer-section-CHUNzdVu.js} +2 -2
  88. package/dist/shell/assets/{connect-route-DpM6_5A-.js → connect-route-B_u1trIm.js} +2 -2
  89. package/dist/shell/assets/{copy-field-DJZYMDoO.js → copy-field-9SzlccPw.js} +2 -2
  90. package/dist/shell/assets/create-route-rbublA-_.js +2 -0
  91. package/dist/shell/assets/{custom-step-container-field-B0SWYcOK.js → custom-step-container-field-BqLAbXaI.js} +4 -4
  92. package/dist/shell/assets/embedded-list-CdFZ5TIe.js +3 -0
  93. package/dist/shell/assets/en-wsBk87ZG.js +2 -0
  94. package/dist/shell/assets/{export-dialog-DOtYGy3R.js → export-dialog-DG5H_BHu.js} +2 -2
  95. package/dist/shell/assets/export-worker-CQwKM8Oc.js +15 -0
  96. package/dist/shell/assets/{graph-view-G-uTEd7F.js → graph-view-DFeWGm5G.js} +2 -2
  97. package/dist/shell/assets/{group-donut-C_BThKYK.js → group-donut-D9vSqco5.js} +2 -2
  98. package/dist/shell/assets/{guest-call-page-CUucHFn7.js → guest-call-page-DIEo-q93.js} +3 -3
  99. package/dist/shell/assets/{html-viewer-CxMoymHe.js → html-viewer-F2craD8b.js} +2 -2
  100. package/dist/shell/assets/{import-dialog-DJdNJeuD.js → import-dialog-C6QghYOc.js} +2 -2
  101. package/dist/shell/assets/import-table-dialog-BzpzE7wd.js +2 -0
  102. package/dist/shell/assets/{index-BpuPTpcS.js → index-lcg5mDSu.js} +1 -1
  103. package/dist/shell/assets/invitations-page-nBjy3DSn.js +2 -0
  104. package/dist/shell/assets/{layout-grid-IQchsfWp.js → layout-grid-XTZwSFbV.js} +2 -2
  105. package/dist/shell/assets/{legend-item-BlI2FIuO.js → legend-item-BoeI6b5Y.js} +2 -2
  106. package/dist/shell/assets/list-page-C7h-_WJY.js +4 -0
  107. package/dist/shell/assets/{maplibre-BNosce4R.js → maplibre-CLloBp_X.js} +2 -2
  108. package/dist/shell/assets/{markdown-content-C_-l2O5-.js → markdown-content-CEV942Pa.js} +2 -2
  109. package/dist/shell/assets/members-page-D1uMhOZR.js +2 -0
  110. package/dist/shell/assets/messages-lXPHUGLV.js +2 -0
  111. package/dist/shell/assets/nl-nieWXCy1.js +2 -0
  112. package/dist/shell/assets/organization-page-RMZnMPR0.js +2 -0
  113. package/dist/shell/assets/organizations-page-Ce6Nwl7X.js +2 -0
  114. package/dist/shell/assets/parse-worker-BN8cVWIa.js +35 -0
  115. package/dist/shell/assets/{pending-invitation-row-nDslRIg_.js → pending-invitation-row-T-_gptFs.js} +2 -2
  116. package/dist/shell/assets/{period-chart-Dbykq15D.js → period-chart-BLA0qneK.js} +2 -2
  117. package/dist/shell/assets/{person-row-RUXD4Z6I.js → person-row-CB2jyi4a.js} +2 -2
  118. package/dist/shell/assets/public-form-page-CvtOJGMY.js +2 -0
  119. package/dist/shell/assets/record-lines-C-s6d1b-.js +2 -0
  120. package/dist/shell/assets/{record-map-SrorcD8G.js → record-map-1LgfFbVl.js} +2 -2
  121. package/dist/shell/assets/{record-opens-BkQP4ve9.js → record-opens-DayPkcEp.js} +2 -2
  122. package/dist/shell/assets/record-page-BMFIEvdR.js +3 -0
  123. package/dist/shell/assets/{record-preview-C8xkvcPt.js → record-preview-DYLddBgR.js} +2 -2
  124. package/dist/shell/assets/{records-map-DgQ3MJFS.js → records-map-Dbzp06m5.js} +2 -2
  125. package/dist/shell/assets/render-node-DEeBoZ9i.js +3 -0
  126. package/dist/shell/assets/reorder-button-BauUDONv.js +2 -0
  127. package/dist/shell/assets/{run-trace-view-C2MAxHm8.js → run-trace-view-C7Fa31YF.js} +2 -2
  128. package/dist/shell/assets/{runner-install-field-BYzWk3Ye.js → runner-install-field-Bpj6cGb0.js} +2 -2
  129. package/dist/shell/assets/{runtime-update-CVNAIIII.js → runtime-update-CZ31fRYM.js} +2 -2
  130. package/dist/shell/assets/shared-protobase-ui-BGJ_UVNP.js +1 -0
  131. package/dist/shell/assets/{sheet-source-BNfkNzNO.js → sheet-source-CpQBUfMu.js} +3 -3
  132. package/dist/shell/assets/sign-in-policy-page-BumL1ZPK.js +2 -0
  133. package/dist/shell/assets/start-block-queries-DYE83u9M.js +2 -0
  134. package/dist/shell/assets/step-catalog-DAHY1jbn.js +2 -0
  135. package/dist/shell/assets/{step-panel-DDSMdJhn.js → step-panel-BNu4CT-a.js} +2 -2
  136. package/dist/shell/assets/timeline-display-Dj7rfbX5.js +2 -0
  137. package/dist/shell/assets/{trash-Du1HjUvA.js → trash-DGtnZxzc.js} +2 -2
  138. package/dist/shell/assets/{update-set-BQN3GDI3.js → update-set-DmSoOUGC.js} +2 -2
  139. package/dist/shell/assets/use-calendar-move-r5AsNTri.js +2 -0
  140. package/dist/shell/assets/{use-display-rows-BWZ3ByZb.js → use-display-rows-QMseygYe.js} +2 -2
  141. package/dist/shell/assets/{use-paged-search-DvGQocxR.js → use-paged-search-CI7t7XI0.js} +2 -2
  142. package/dist/shell/assets/{use-run-trace-CNqw_HuX.js → use-run-trace-D0jDOrL8.js} +2 -2
  143. package/dist/shell/assets/{use-workflow-page-jjK3t-vf.js → use-workflow-page-BMjBBt83.js} +2 -2
  144. package/dist/shell/assets/{use-workflow-types-CxeOmx1U.js → use-workflow-types-8ZRuZVuJ.js} +2 -2
  145. package/dist/shell/assets/{workflow-canvas-BgC2BoRd.js → workflow-canvas-DtTiaGIh.js} +4 -4
  146. package/dist/shell/assets/{workflow-field-DAk0UqrK.js → workflow-field-2I9HpR3s.js} +3 -3
  147. package/dist/shell/assets/{workflow-graph-editor-0KyZBj6R.js → workflow-graph-editor-DJoriSTb.js} +2 -2
  148. package/dist/shell/assets/{workflow-run-field-rlISvE35.js → workflow-run-field-BB6DMeK0.js} +3 -3
  149. package/dist/shell/assets/workflow-status-field-L_mimjzo.js +2 -0
  150. package/dist/shell/assets/workflow-workbench-PnPXVcoE.js +4 -0
  151. package/dist/shell/index.html +3 -3
  152. package/dist/shell/protobase.shell.json +2 -2
  153. package/dist/shell/protobase.sw.js +2 -2
  154. package/dist/shell-source-maps/assets/{account-page-B_azef82.js.map → account-page-DOXkanFO.js.map} +1 -1
  155. package/dist/shell-source-maps/assets/app-B48LQpC1.js.map +1 -0
  156. package/dist/shell-source-maps/assets/{assistant-shell-BDKCWgs7.js.map → assistant-shell-Drpmyy7B.js.map} +1 -1
  157. package/dist/shell-source-maps/assets/{board-display-RfXJJ01f.js.map → board-display-D9PUmRbl.js.map} +1 -1
  158. package/dist/shell-source-maps/assets/{calendar-display-CWANjACC.js.map → calendar-display-B8J8DI5J.js.map} +1 -1
  159. package/dist/shell-source-maps/assets/{call-rings-ClQinnwb.js.map → call-rings-C7f5skja.js.map} +1 -1
  160. package/dist/shell-source-maps/assets/{calls-s6XuZsjs.js.map → calls-Ca2RAgzS.js.map} +1 -1
  161. package/dist/shell-source-maps/assets/{circle-alert-CCchwpE2.js.map → circle-alert-B5-CtUEU.js.map} +1 -1
  162. package/dist/shell-source-maps/assets/{composed-page-Cj-OwCZB.js.map → composed-page-BMYkHKrZ.js.map} +1 -1
  163. package/dist/shell-source-maps/assets/{composer-section-BWJgscVY.js.map → composer-section-CHUNzdVu.js.map} +1 -1
  164. package/dist/shell-source-maps/assets/{connect-route-DpM6_5A-.js.map → connect-route-B_u1trIm.js.map} +1 -1
  165. package/dist/shell-source-maps/assets/{copy-field-DJZYMDoO.js.map → copy-field-9SzlccPw.js.map} +1 -1
  166. package/dist/shell-source-maps/assets/{create-route-CQeYkXaB.js.map → create-route-rbublA-_.js.map} +1 -1
  167. package/dist/shell-source-maps/assets/{custom-step-container-field-B0SWYcOK.js.map → custom-step-container-field-BqLAbXaI.js.map} +1 -1
  168. package/dist/shell-source-maps/assets/{embedded-list-CQ7VmI-J.js.map → embedded-list-CdFZ5TIe.js.map} +1 -1
  169. package/dist/shell-source-maps/assets/en-wsBk87ZG.js.map +1 -0
  170. package/dist/shell-source-maps/assets/{export-dialog-DOtYGy3R.js.map → export-dialog-DG5H_BHu.js.map} +1 -1
  171. package/dist/shell-source-maps/assets/{export-worker-CHLq663S.js.map → export-worker-CQwKM8Oc.js.map} +1 -1
  172. package/dist/shell-source-maps/assets/{graph-view-G-uTEd7F.js.map → graph-view-DFeWGm5G.js.map} +1 -1
  173. package/dist/shell-source-maps/assets/{group-donut-C_BThKYK.js.map → group-donut-D9vSqco5.js.map} +1 -1
  174. package/dist/shell-source-maps/assets/{guest-call-page-CUucHFn7.js.map → guest-call-page-DIEo-q93.js.map} +1 -1
  175. package/dist/shell-source-maps/assets/{html-viewer-CxMoymHe.js.map → html-viewer-F2craD8b.js.map} +1 -1
  176. package/dist/shell-source-maps/assets/{import-dialog-DJdNJeuD.js.map → import-dialog-C6QghYOc.js.map} +1 -1
  177. package/dist/shell-source-maps/assets/{import-table-dialog-vxHtntUq.js.map → import-table-dialog-BzpzE7wd.js.map} +1 -1
  178. package/dist/shell-source-maps/assets/{invitations-page-a0oQdGxB.js.map → invitations-page-nBjy3DSn.js.map} +1 -1
  179. package/dist/shell-source-maps/assets/{layout-grid-IQchsfWp.js.map → layout-grid-XTZwSFbV.js.map} +1 -1
  180. package/dist/shell-source-maps/assets/{legend-item-BlI2FIuO.js.map → legend-item-BoeI6b5Y.js.map} +1 -1
  181. package/dist/shell-source-maps/assets/list-page-C7h-_WJY.js.map +1 -0
  182. package/dist/shell-source-maps/assets/{maplibre-BNosce4R.js.map → maplibre-CLloBp_X.js.map} +1 -1
  183. package/dist/shell-source-maps/assets/{markdown-content-C_-l2O5-.js.map → markdown-content-CEV942Pa.js.map} +1 -1
  184. package/dist/shell-source-maps/assets/{members-page-Bm3GFEhM.js.map → members-page-D1uMhOZR.js.map} +1 -1
  185. package/dist/shell-source-maps/assets/{messages-DAlS_OLf.js.map → messages-lXPHUGLV.js.map} +1 -1
  186. package/dist/shell-source-maps/assets/nl-nieWXCy1.js.map +1 -0
  187. package/dist/shell-source-maps/assets/{organization-page-BbzBkLeU.js.map → organization-page-RMZnMPR0.js.map} +1 -1
  188. package/dist/shell-source-maps/assets/{organizations-page-BkarXyu5.js.map → organizations-page-Ce6Nwl7X.js.map} +1 -1
  189. package/dist/shell-source-maps/assets/parse-worker-BN8cVWIa.js.map +1 -0
  190. package/dist/shell-source-maps/assets/{pending-invitation-row-nDslRIg_.js.map → pending-invitation-row-T-_gptFs.js.map} +1 -1
  191. package/dist/shell-source-maps/assets/{period-chart-Dbykq15D.js.map → period-chart-BLA0qneK.js.map} +1 -1
  192. package/dist/shell-source-maps/assets/{person-row-RUXD4Z6I.js.map → person-row-CB2jyi4a.js.map} +1 -1
  193. package/dist/shell-source-maps/assets/{public-form-page-CI1ghnwR.js.map → public-form-page-CvtOJGMY.js.map} +1 -1
  194. package/dist/shell-source-maps/assets/{record-lines-sVjQkysF.js.map → record-lines-C-s6d1b-.js.map} +1 -1
  195. package/dist/shell-source-maps/assets/{record-map-SrorcD8G.js.map → record-map-1LgfFbVl.js.map} +1 -1
  196. package/dist/shell-source-maps/assets/{record-opens-BkQP4ve9.js.map → record-opens-DayPkcEp.js.map} +1 -1
  197. package/dist/shell-source-maps/assets/{record-page-CA2bmhxx.js.map → record-page-BMFIEvdR.js.map} +1 -1
  198. package/dist/shell-source-maps/assets/{record-preview-C8xkvcPt.js.map → record-preview-DYLddBgR.js.map} +1 -1
  199. package/dist/shell-source-maps/assets/{records-map-DgQ3MJFS.js.map → records-map-Dbzp06m5.js.map} +1 -1
  200. package/dist/shell-source-maps/assets/{render-node-eKuGRuq5.js.map → render-node-DEeBoZ9i.js.map} +1 -1
  201. package/dist/shell-source-maps/assets/{reorder-button-DFrAk-Xc.js.map → reorder-button-BauUDONv.js.map} +1 -1
  202. package/dist/shell-source-maps/assets/{run-trace-view-C2MAxHm8.js.map → run-trace-view-C7Fa31YF.js.map} +1 -1
  203. package/dist/shell-source-maps/assets/{runner-install-field-BYzWk3Ye.js.map → runner-install-field-Bpj6cGb0.js.map} +1 -1
  204. package/dist/shell-source-maps/assets/{runtime-update-CVNAIIII.js.map → runtime-update-CZ31fRYM.js.map} +1 -1
  205. package/dist/shell-source-maps/assets/{sheet-source-BNfkNzNO.js.map → sheet-source-CpQBUfMu.js.map} +1 -1
  206. package/dist/shell-source-maps/assets/{sign-in-policy-page-DqH94QZl.js.map → sign-in-policy-page-BumL1ZPK.js.map} +1 -1
  207. package/dist/shell-source-maps/assets/{start-block-queries-CAEd4yVp.js.map → start-block-queries-DYE83u9M.js.map} +1 -1
  208. package/dist/shell-source-maps/assets/{step-catalog-wasAn9L1.js.map → step-catalog-DAHY1jbn.js.map} +1 -1
  209. package/dist/shell-source-maps/assets/{step-panel-DDSMdJhn.js.map → step-panel-BNu4CT-a.js.map} +1 -1
  210. package/dist/shell-source-maps/assets/{timeline-display-CLcdY1TN.js.map → timeline-display-Dj7rfbX5.js.map} +1 -1
  211. package/dist/shell-source-maps/assets/{trash-Du1HjUvA.js.map → trash-DGtnZxzc.js.map} +1 -1
  212. package/dist/shell-source-maps/assets/{update-set-BQN3GDI3.js.map → update-set-DmSoOUGC.js.map} +1 -1
  213. package/dist/shell-source-maps/assets/{use-calendar-move-C8LZwkOo.js.map → use-calendar-move-r5AsNTri.js.map} +1 -1
  214. package/dist/shell-source-maps/assets/{use-display-rows-BWZ3ByZb.js.map → use-display-rows-QMseygYe.js.map} +1 -1
  215. package/dist/shell-source-maps/assets/{use-paged-search-DvGQocxR.js.map → use-paged-search-CI7t7XI0.js.map} +1 -1
  216. package/dist/shell-source-maps/assets/{use-run-trace-CNqw_HuX.js.map → use-run-trace-D0jDOrL8.js.map} +1 -1
  217. package/dist/shell-source-maps/assets/{use-workflow-page-jjK3t-vf.js.map → use-workflow-page-BMjBBt83.js.map} +1 -1
  218. package/dist/shell-source-maps/assets/{use-workflow-types-CxeOmx1U.js.map → use-workflow-types-8ZRuZVuJ.js.map} +1 -1
  219. package/dist/shell-source-maps/assets/{workflow-canvas-BgC2BoRd.js.map → workflow-canvas-DtTiaGIh.js.map} +1 -1
  220. package/dist/shell-source-maps/assets/{workflow-field-DAk0UqrK.js.map → workflow-field-2I9HpR3s.js.map} +1 -1
  221. package/dist/shell-source-maps/assets/{workflow-graph-editor-0KyZBj6R.js.map → workflow-graph-editor-DJoriSTb.js.map} +1 -1
  222. package/dist/shell-source-maps/assets/{workflow-run-field-rlISvE35.js.map → workflow-run-field-BB6DMeK0.js.map} +1 -1
  223. package/dist/shell-source-maps/assets/{workflow-status-field-jZ1pLRdt.js.map → workflow-status-field-L_mimjzo.js.map} +1 -1
  224. package/dist/shell-source-maps/assets/{workflow-workbench-CYjY4iZy.js.map → workflow-workbench-PnPXVcoE.js.map} +1 -1
  225. package/dist/status/messages.d.ts +2 -2
  226. package/dist/users/messages.d.ts +2 -2
  227. package/package.json +5 -5
  228. package/dist/shell/assets/board-display-RfXJJ01f.js +0 -2
  229. package/dist/shell/assets/call-rings-ClQinnwb.js +0 -2
  230. package/dist/shell/assets/create-route-CQeYkXaB.js +0 -2
  231. package/dist/shell/assets/embedded-list-CQ7VmI-J.js +0 -3
  232. package/dist/shell/assets/en-Dm9QE1tF.js +0 -2
  233. package/dist/shell/assets/export-worker-CHLq663S.js +0 -15
  234. package/dist/shell/assets/import-table-dialog-vxHtntUq.js +0 -2
  235. package/dist/shell/assets/invitations-page-a0oQdGxB.js +0 -2
  236. package/dist/shell/assets/list-page-BXVd_Eq3.js +0 -4
  237. package/dist/shell/assets/members-page-Bm3GFEhM.js +0 -2
  238. package/dist/shell/assets/messages-DAlS_OLf.js +0 -2
  239. package/dist/shell/assets/nl-Cyam8kgY.js +0 -2
  240. package/dist/shell/assets/organization-page-BbzBkLeU.js +0 -2
  241. package/dist/shell/assets/organizations-page-BkarXyu5.js +0 -2
  242. package/dist/shell/assets/parse-worker-DI-FeZWV.js +0 -35
  243. package/dist/shell/assets/public-form-page-CI1ghnwR.js +0 -2
  244. package/dist/shell/assets/record-lines-sVjQkysF.js +0 -2
  245. package/dist/shell/assets/record-page-CA2bmhxx.js +0 -3
  246. package/dist/shell/assets/render-node-eKuGRuq5.js +0 -3
  247. package/dist/shell/assets/reorder-button-DFrAk-Xc.js +0 -2
  248. package/dist/shell/assets/shared-protobase-ui-C_Oyn30V.js +0 -1
  249. package/dist/shell/assets/sign-in-policy-page-DqH94QZl.js +0 -2
  250. package/dist/shell/assets/start-block-queries-CAEd4yVp.js +0 -2
  251. package/dist/shell/assets/step-catalog-wasAn9L1.js +0 -2
  252. package/dist/shell/assets/timeline-display-CLcdY1TN.js +0 -2
  253. package/dist/shell/assets/use-calendar-move-C8LZwkOo.js +0 -2
  254. package/dist/shell/assets/workflow-status-field-jZ1pLRdt.js +0 -2
  255. package/dist/shell/assets/workflow-workbench-CYjY4iZy.js +0 -4
  256. package/dist/shell-source-maps/assets/app-1j5nx8lw.js.map +0 -1
  257. package/dist/shell-source-maps/assets/en-Dm9QE1tF.js.map +0 -1
  258. package/dist/shell-source-maps/assets/list-page-BXVd_Eq3.js.map +0 -1
  259. package/dist/shell-source-maps/assets/nl-Cyam8kgY.js.map +0 -1
  260. package/dist/shell-source-maps/assets/parse-worker-DI-FeZWV.js.map +0 -1
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/graph-view-DFeWGm5G.js","assets/rolldown-runtime-DFwUHQ4A.js","assets/react-CuiNlnus.js","assets/app-B48LQpC1.js","assets/vendor-t7Q7QbPu.js","assets/app-Dq5eubgK.css","assets/lib-xyflow-system-hojcPWkY.js","assets/lib-d3-interpolate-C7dFwq8w.js","assets/lib-d3-color-B6XHLQii.js","assets/lib-d3-selection-C1a5EtaJ.js","assets/lib-d3-drag-CUJR_Vab.js","assets/lib-d3-dispatch-Bjkn7q4t.js","assets/lib-d3-zoom-DuEhbOrX.js","assets/lib-d3-transition-CUMO2iZu.js","assets/lib-d3-timer-CduGpaSm.js","assets/lib-d3-ease-ouQSXgQM.js","assets/lib-xyflow-react-CuNAzocq.js","assets/lib-classcat-otpLnDWv.js","assets/lib-zustand-r6mNROKr.js","assets/lib-use-sync-external-store-D4s7MiFL.js","assets/lib-xyflow-react-DLioOiRN.css","assets/use-elk-u1Ql5AOs.js","assets/lib-elkjs-ylMkguT9.js"])))=>i.map(i=>d[i]);
2
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$c as r,$i as i,$n as a,$s as o,$t as s,Ai as c,As as l,At as u,B as d,Bi as f,Bo as p,C as m,Ca as h,Cn as g,Cs as _,D as v,Ds as y,En as b,Es as x,F as S,Fn as C,Fo as w,Fs as T,Gc as E,Go as D,Gs as ee,Gt as te,Ha as O,Hc as ne,Hi as k,Ho as re,In as ie,Ja as ae,Jn as oe,Jo as A,Js as se,Jt as ce,Ko as j,Ks as le,Ln as ue,Lr as de,M as fe,Ma as pe,Ml as me,Ms as he,Mt as ge,Na as _e,Nc as ve,Ns as ye,Nt as be,Oc as xe,Os as Se,Pc as M,Pn as Ce,Po as we,Pr as Te,Ps as Ee,Pt as De,Qa as Oe,Qi as ke,Qn as Ae,Qo as je,R as Me,Rn as Ne,Ro as Pe,Rr as Fe,Si as Ie,So as N,Ss as Le,Tc as Re,Tl as ze,Ua as Be,Un as Ve,Uo as P,Us as He,V as Ue,Va as We,Vc as Ge,Vi as Ke,Vo as F,Vr as qe,Vs as Je,Wa as Ye,Wo as I,Ws as Xe,Xs as L,Xt as Ze,Yc as Qe,Yn as $e,Yo as et,Za as tt,Zc as nt,Zo as R,Zs as z,_ as rt,_l as it,_n as at,_s as ot,_t as st,aa as ct,at as lt,b as ut,ba as dt,bi as ft,bs as pt,cn as mt,cr as B,dc as ht,dr as gt,ds as V,ec as _t,el as vt,eo as yt,es as bt,fa as xt,fr as H,fs as St,gi as Ct,gn as wt,gs as Tt,gt as Et,hc as Dt,hn as Ot,hs as kt,i as At,il as jt,in as U,ir as Mt,is as Nt,js as Pt,jt as Ft,k as It,ka as Lt,ki as Rt,ks as zt,ln as Bt,lr as Vt,mn as Ht,mr as W,ms as G,nn as Ut,nr as Wt,oa as Gt,ol as Kt,on as qt,or as Jt,pn as Yt,pr as K,ps as Xt,qo as Zt,rn as Qt,s as $t,sn as en,so as tn,sr as q,ta as nn,tc as rn,tn as an,tr as on,ts as sn,un as cn,ur as ln,us as J,v as un,va as dn,vc as fn,vl as pn,vn as mn,vs as hn,wl as gn,wn as _n,wt as vn,xs as yn,y as bn,ya as xn,yn as Sn,zo as Cn}from"./app-B48LQpC1.js";import{C as wn,f as Tn,o as En,s as Dn}from"./vendor-t7Q7QbPu.js";import{C as On,Ct as kn,Dt as An,Et as jn,Mt as Mn,O as Nn,Ot as Pn,Q as Fn,St as In,Tt as Ln,X as Rn,Z as zn,_t as Bn,at as Vn,b as Hn,ct as Un,dt as Wn,ft as Gn,gt as Kn,it as qn,k as Jn,kt as Yn,l as Xn,lt as Zn,mt as Qn,n as $n,nt as er,o as tr,ot as nr,rt as rr,st as ir,t as ar,tt as or,ut as sr,wt as cr,x as lr,xt as ur,y as dr}from"./embedded-list-CdFZ5TIe.js";import{t as fr}from"./circle-alert-B5-CtUEU.js";import{t as pr}from"./page-header-Ddz2r5ic.js";import{n as mr,t as hr}from"./pending-invitation-row-T-_gptFs.js";import{n as gr,t as _r}from"./person-row-CB2jyi4a.js";import{n as vr,t as yr}from"./use-paged-search-CI7t7XI0.js";import{n as br,t as xr}from"./client-publisher-D39SlIhp.js";import{t as Sr}from"./copy-field-9SzlccPw.js";var Cr={name:`at-sign`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]};Cr.node;var wr=ve(Cr),Tr={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};Tr.node;var Er=ve(Tr),Dr={name:`key-square`,size:24,node:[[`path`,{d:`M12.4 2.7a2.5 2.5 0 0 1 3.4 0l5.5 5.5a2.5 2.5 0 0 1 0 3.4l-3.7 3.7a2.5 2.5 0 0 1-3.4 0L8.7 9.8a2.5 2.5 0 0 1 0-3.4z`,key:`165ttr`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`m9.4 10.6-6.814 6.814A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814`,key:`1ubxi2`}]]};Dr.node;var Or=ve(Dr),kr={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};kr.node;var Ar=ve(kr),jr={name:`plug-zap`,size:24,node:[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]],aliases:[`plug-zap-2`]};jr.node;var Mr=ve(jr),Nr={name:`shield-user`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M6.376 18.91a6 6 0 0 1 11.249.003`,key:`hnjrf2`}],[`circle`,{cx:`12`,cy:`11`,r:`4`,key:`1gt34v`}]]};Nr.node;var Pr=ve(Nr),Fr={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};Fr.node;var Ir=ve(Fr),Lr={name:`tablet`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]};Lr.node;var Rr=ve(Lr),zr=[`done`,`error`,`running`];Ee(`TextField`,!1),Ee(`NumberField`,!1),Ee(`DateField`,!1),Ee(`BooleanField`,!1),Ee(`UrlField`,!1),Ee(`ChipField`,!1);var Br=new Set([`TextField`,`NumberField`,`DateField`,`BooleanField`,`UrlField`,`ChipField`]),Vr=e=>typeof e!=`string`&&!e.custom&&Br.has(e.type),Hr=e=>typeof e==`string`||Vr(e)||!e.custom&&(e.type===`Link`||e.type===`Trans`||e.type===`Text`&&[`span`,`strong`,`em`].includes(String(e.props.as))),Ur=(e,t)=>e===`BooleanField`?t!==!0&&t!==!1:e===`NumberField`||e===`UrlField`?t==null:t==null||t===``,Wr=e=>typeof e==`object`&&e?JSON.stringify(e):String(e),Gr=(e,{locales:t,options:n},r)=>{let i=typeof e==`string`&&e!==``&&!Number.isNaN(Number(e))?Number(e):e;return typeof i==`number`?i.toLocaleString(t??r,n):String(i)},Kr=(e,t,n)=>{let r=e instanceof Date?e:typeof e==`string`||typeof e==`number`?new Date(e):void 0;if(!r||Number.isNaN(r.getTime()))return``;if(t.format===`relative`)return n.relative(Math.round((n.now-r.getTime())/1e3));let{showDate:i=!0,showTime:a=!1,options:o}=t,s=t.locales??n.locale;if(i&&a)return r.toLocaleString(s,o);if(a)return r.toLocaleTimeString(s,o);let c=o??(typeof e==`string`&&e.length<=10?{timeZone:`UTC`}:void 0);return r.toLocaleDateString(s,c)},qr=(e,t,n)=>e?t.valueLabelTrue??n.yes:t.valueLabelFalse??n.no,Jr=new Set([`http:`,`https:`,`mailto:`,`tel:`]),Yr=e=>{let t=e.replace(/^[\u0000- ]+/,``).replace(/[\t\n\r]/g,``),n=/^([A-Za-z][A-Za-z0-9+.-]*):/.exec(t)?.[1];return n===void 0?t.startsWith(`/`)||!t.includes(`:`)?e:void 0:Jr.has(`${n.toLowerCase()}:`)?e:void 0},Xr=({layout:e,cardWidth:t})=>({layout:e??`stack`,cardWidth:t??`2/3`}),Zr=e=>e==null||e===``?void 0:String(e),Qr=(e,t)=>e<t?-1:+(e>t),$r=({nodes:e,edges:t,key:n,edgeKey:r,fields:i})=>{let a=new Map,o=new Map;for(let t of e){let e=Zr(t[n]);if(e===void 0||a.has(e))continue;let r=i.group===void 0?void 0:t[i.group],s=Zr(r);s!==void 0&&!o.has(s)&&o.set(s,{id:s,value:r}),a.set(e,{id:e,row:t,...s!==void 0&&{group:s}})}let s=t.flatMap(e=>{let t=r.map(t=>Zr(e[t])),n=t.includes(void 0)?void 0:t.length===1?t[0]:JSON.stringify(t),o=Zr(e[i.source]),s=Zr(e[i.target]);return n===void 0||o===void 0||s===void 0||!a.has(o)||!a.has(s)?[]:[{id:n,source:o,target:s,row:e}]});return{groups:[...o.values()].sort((e,t)=>Qr(e.id,t.id)),nodes:[...a.values()].sort((e,t)=>Qr(e.id,t.id)),edges:s.sort((e,t)=>Qr(e.source,t.source)||Qr(e.target,t.target)||Qr(e.id,t.id))}},Y=e(t(),1),X=e(n(),1),ei=({model:e,items:t,name:n,label:r,variant:i,className:a})=>{let{views:s}=R(),c=kn(e.name,void 0),l=f(),[u,d]=(0,Y.useState)(!1),p=s[e.name]?.actions?.find(e=>e.name===n);if(!p||p.run?.kind===`link`)return null;let m=t.map(t=>Ht(e,t)),h=m.filter(e=>c.verdictOn(p,e)!==`skip`);if(h.length===0)return null;let g=m.length-h.length,_=ur(`actionCount`,{label:r??p.label,count:h.length}),v=e=>c.runEach(p,h,g,e);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{size:`sm`,variant:i??p.variant??`secondary`,className:a,loading:c.running===n,onClick:()=>jn(p)?d(!0):void v(),children:_}),u&&(0,X.jsx)(Ln,{action:p,label:_,danger:i===`danger`||i===void 0&&An(p),records:h.map(e=>e.record),names:h.map(t=>In(l(e,s[e.name],t.record,t.key))),onCancel:()=>d(!1),onConfirm:()=>{d(!1),v()},onSubmit:async e=>{d(!1),await v(e)}})]})},ti=({name:e,resource:t,label:n,variant:r,className:i,about:a,onRun:s})=>{let c=Jt(),l=cr(t??c?.model.name??``,e,t===void 0||t===c?.model.name?c:void 0,e=>s?.(n??e.label)),[u,d]=(0,Y.useState)(!1);if(!l.action)return null;let f=n??l.action.label,p=r??l.action.variant??`secondary`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{size:`sm`,variant:p,className:i,loading:l.running,disabled:!!l.blocked,title:l.blocked,"aria-label":a===void 0?void 0:`${f}: ${a}`,onClick:()=>jn(l.action)?d(!0):void l.run(),children:f}),u&&(0,X.jsx)(Ln,{action:l.action,label:f,danger:p===`danger`,records:l.record?[l.record]:[],onCancel:()=>d(!1),onConfirm:()=>{d(!1),l.run()},onSubmit:async e=>{await l.submit(e),d(!1)}})]})},ni=({node:e,className:t})=>{let n=U(e),r=gt(),i=r?.model;return i&&(n.resource===void 0||n.resource===i.name)?(0,X.jsx)(ei,{...n,model:i,items:r.items,className:t}):(0,X.jsx)(ti,{...n,className:t})},ri=({node:e,children:t,slots:n,className:r})=>{let{title:i,description:a}=U(e);return(0,X.jsx)(H,{title:i,description:a,actions:n.actions,className:M(`h-full`,r),children:(0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:t})})},ii=({children:e,wrap:t=(e,t)=>(0,X.jsx)(Y.Fragment,{children:e},t)})=>{let n=gt();if(!n)return null;let{model:r,items:i,planned:a}=n;return i.map((n,o)=>{let s=r?{...Ht(r,n),...a&&{planned:a}}:{item:n},c=`key`in s?s.key:o;return t((0,X.jsx)(Wt,{value:s,row:{index:o,count:i.length},children:e}),c)})},ai=({children:e})=>(0,X.jsx)(ii,{children:e}),oi=({model:e,at:t,filter:n,sort:r,limit:i=12,title:a,description:o,empty:s,actions:c,children:l,className:u})=>{let d=an(t),f=at(e,{filter:n,sort:r,pageSize:i,enabled:!d}),p=d??f,m=d?d.rows:f.data?.items??[];return(0,X.jsx)(H,{title:a,description:o,actions:c,className:u,children:p.isPending?(0,X.jsx)(`div`,{className:`flex gap-3`,children:Array.from({length:3},(e,t)=>(0,X.jsx)(L,{className:`h-24 w-56`},t))}):p.error?(0,X.jsx)(W,{title:O(`couldNotLoad`),error:p.error}):m.length===0?(0,X.jsx)(K,{children:s??O(`nothingYet`)}):(0,X.jsx)(`ul`,{className:`relative -mx-4 flex snap-x gap-3 overflow-x-auto px-4 pb-1`,children:(0,X.jsx)(Vt,{value:{model:e,items:m,...d&&{planned:!0}},children:(0,X.jsx)(ii,{wrap:(e,t)=>(0,X.jsx)(`li`,{className:`flex w-60 shrink-0 snap-start flex-col gap-2 rounded-lg border border-border bg-surface p-3`,children:e},t),children:l})})})})},si=({node:e,at:t,children:n,slots:r})=>{let{resource:i,...a}=U(e),o=R().resources[i];return o?(0,X.jsx)(oi,{...a,model:o,...t!==void 0&&{at:t},actions:r.actions,children:n}):null},ci=({node:e,slots:t,className:n})=>{let{resource:r,title:i,description:a,actions:o,span:s,className:c,...l}=U(e),{resources:u,views:d}=R(),f=u[r];return f?(0,X.jsx)(H,{title:i,description:a,actions:t.actions,className:M(`h-full`,n),children:(0,X.jsx)(Gn,{model:f,view:d[r],...l})}):null},li=({model:e,query:t,className:n=`mt-4 border-t pt-4`,children:r})=>{let i=wt(e,t),a=i.isPending?(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(L,{className:`h-4 w-1/2`}),(0,X.jsx)(L,{className:`h-4 w-1/3`})]}):i.error?(0,X.jsx)(W,{title:O(`couldNotLoad`),error:i.error}):i.data?(0,X.jsx)(Wt,{value:i.data,children:(0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:r})}):(0,X.jsx)(K,{children:O(`nothingYet`)});return(0,X.jsx)(`div`,{className:n,children:a})},ui=e=>{if(typeof e!=`string`&&typeof e!=`number`)return;let t=typeof e==`number`?e:Date.parse(e);return Number.isNaN(t)?void 0:t},di=e=>e==null?``:String(e),fi=(e,t,n)=>n===0?0:(e-t)/n*100,pi=(e,t,n)=>{let r=new Map;for(let i of e){let e=ui(i[t.start]);if(e===void 0)continue;let a=ui(i[t.end]),o=Math.max(e,a??n),s=r.get(di(i[t.lane]))??{value:i[t.lane],bars:new Map};r.set(di(i[t.lane]),s);let c=s.bars.get(di(i[t.bar]))??{value:i[t.bar],records:[]};s.bars.set(di(i[t.bar]),c),c.records.push({record:i,start:e,end:o,open:a===void 0})}return r},mi=e=>{let t=[];for(let n of[...e].sort((e,t)=>e.start-t.start)){let e=t.find(e=>e.at(-1).end<=n.start);e?e.push(n):t.push([n])}return t},hi=(e,t,n)=>{let r=pi(e,t,n),i=[...r.values()].flatMap(e=>[...e.bars.values()].flatMap(e=>e.records));if(i.length===0)return{lanes:[],from:n,to:n};let a=Math.min(...i.map(e=>e.start)),o=Math.max(...i.map(e=>e.end)),s=o-a;return{lanes:[...r.entries()].map(([e,n])=>{let r=[...n.bars.entries()].map(([e,r])=>{let i=r.records.sort((e,t)=>e.start-t.start).map(({record:e,start:n,end:r,open:i})=>({record:e,value:e[t.color],start:n,end:r,open:i,left:fi(n,a,s),width:fi(r,a,s)-fi(n,a,s)})),o=i[0].start,c=Math.max(...i.map(e=>e.end));return{key:e,value:r.value,lane:n.value,start:o,end:c,left:fi(o,a,s),width:fi(c,a,s)-fi(o,a,s),segments:i}});return{key:e,value:n.value,rows:mi(r)}}),from:a,to:o}},gi=(e,t)=>{let n=e.end-e.start;return{left:fi(t.start,e.start,n),width:n===0?100:(t.end-t.start)/n*100}},_i=6e4,vi=60*_i,Z=24*vi,yi=[5*_i,15*_i,30*_i,vi,3*vi,6*vi,12*vi,Z,2*Z,7*Z,14*Z,30*Z,90*Z,365*Z],bi=365*Z,xi=(e,t,n,r,i)=>Math.floor((t+i)/n)-Math.ceil((e+r)/n)+1,Si=(e,t,n=()=>0)=>{let r=t-e;if(r<=0)return{daily:!1,ticks:[]};let i=n(e),a=n(t),o=yi.find(n=>xi(e,t,n,i,a)<=6)??Math.ceil(r/5/bi)*bi,s=[];for(let c=Math.ceil((e+i)/o)*o;c<=t+a;c+=o){let a=c-n(c-i);a+n(a)===c&&a>=e&&a<=t&&s.push({at:a,left:fi(a,e,r)})}return{daily:o>=Z,ticks:s}},Ci=e=>({lane:di(e.lane),bar:e.key}),wi=(e,t)=>t?e.lanes.find(e=>e.key===t.lane)?.rows.flat().find(e=>e.key===t.bar)??null:null,Ti=(e,t)=>{let n=Object.fromEntries(new Intl.DateTimeFormat(`en-US`,{timeZone:t,hourCycle:`h23`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`}).formatToParts(e).map(e=>[e.type,e.value]));return Date.UTC(Number(n.year),Number(n.month)-1,Number(n.day),Number(n.hour),Number(n.minute))-Math.floor(e/6e4)*6e4},Ei=e=>e<8?`translate-x-0`:e>92?`-translate-x-full`:`-translate-x-1/2`,Di=({from:e,to:t,dated:n})=>{let r=n?`UTC`:xt(),i=e=>n?0:Ti(e,r),{daily:a,ticks:o}=Si(e,t,i);return(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`relative h-5 min-w-0 flex-1 border-b border-border text-xs text-muted-foreground tabular-nums`,children:o.map(e=>(0,X.jsx)(`span`,{className:`absolute bottom-1 whitespace-nowrap ${Ei(e.left)}`,style:{left:`${e.left}%`},children:a?nn(e.at+i(e.at)):Gt(e.at,r)},e.at))})},Oi=(e,t,n)=>{let r=String(n),i=t?.waitingValues?.includes(r)??!1,a=t?.valueColors&&Object.hasOwn(t.valueColors,r)?t.valueColors[r]:void 0;return a!==void 0&&Kt(a)?{className:Zt[a],striped:i}:{color:Kn(e,t,n===void 0?null:n,-1),striped:i}},ki=e=>({...e.color!==void 0&&{backgroundColor:e.color},...e.striped&&{backgroundImage:`repeating-linear-gradient(-45deg, transparent 0 4px, color-mix(in srgb, var(--background) 55%, transparent) 4px 6px)`}}),Ai=({bar:e,field:t,hints:n})=>e.segments.map((r,i)=>{let a=Oi(t,n,r.value),{left:o,width:s}=gi(e,r);return(0,X.jsx)(`span`,{"aria-hidden":`true`,className:M(`absolute inset-y-0`,a.className),style:{left:`${o}%`,width:`${s}%`,...ki(a)}},i)}),ji=(e,t)=>t?ke(e):i(e),Mi=(e,t,n,r,i)=>{let a=e.fields[t.start]?.type===`date`;return O(`timelineRange`,{from:ji(n,a),to:i?O(`timelineNow`):ji(r,a)})},Ni=(e,t,n,r)=>`${Ct(t.fields[r.color],e.value,n?.fields[r.color])}: ${Mi(t,r,e.start,e.end,e.open)}`,Pi=(e,t,n,r,i)=>{let a=e.segments.some(t=>t.open&&t.end===e.end);return[`${i??Ct(t.fields[r.bar],e.value,n?.fields[r.bar])}: ${Mi(t,r,e.start,e.end,a)}`,...e.segments.map(e=>Ni(e,t,n,r))].join(`; `)},Fi=`absolute inset-y-0 flex overflow-hidden rounded-sm ring-offset-1 ring-offset-background outline-none hover:ring-2 hover:ring-border-strong focus-visible:ring-2 focus-visible:ring-primary`,Ii=({bar:e,model:t,view:n,fields:r,point:i,choose:a})=>{let o=R().resources[t.fields[r.bar]?.relation?.resource??``],s=b(o??t,e.key,o!==void 0),c=Pi(e,t,n,r,o?s:void 0),l={onMouseEnter:()=>i.hover(e),onMouseLeave:()=>i.hover(null),onFocus:()=>i.focus(e),onBlur:()=>i.focus(null)},u={left:`${e.left}%`,width:`max(${e.width}%, 4px)`},d=(0,X.jsx)(Ai,{bar:e,field:t.fields[r.color],hints:n?.fields[r.color]});if(!a)return(0,X.jsx)(`span`,{role:`img`,tabIndex:0,"aria-label":c,style:u,className:Fi,...l,children:d});let f=a.chosen===e.key;return(0,X.jsx)(se,{to:a.barTo(e.key),"aria-label":c,"aria-current":f?`true`:void 0,style:u,className:M(Fi,f&&`ring-2 ring-foreground`),...l,children:d})},Li=({shape:e,...t})=>{let{model:n,fields:r}=t,i=n.fields[r.lane];return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`div`,{className:`flex sm:pl-40`,children:(0,X.jsx)(Di,{from:e.from,to:e.to,dated:n.fields[r.start]?.type===`date`})}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-3 sm:gap-2`,children:e.lanes.map(e=>(0,X.jsxs)(`li`,{className:`flex flex-col gap-1 sm:flex-row sm:items-center`,children:[(0,X.jsx)(`div`,{className:`min-w-0 truncate text-sm font-medium sm:w-40 sm:shrink-0 sm:pr-3`,children:(0,X.jsx)(Sn,{model:n,field:i,value:e.value})}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 border-l border-border pl-px`,children:e.rows.map((e,n)=>(0,X.jsx)(`div`,{className:`relative h-6 overflow-x-clip`,children:e.map(e=>(0,X.jsx)(Ii,{bar:e,...t},e.key))},n))})]},e.key))})]})},Ri=({model:e,view:t,fields:n,value:r})=>{let i=Oi(e.fields[n.color],t?.fields[n.color],r);return(0,X.jsx)(`span`,{"aria-hidden":`true`,className:M(`inline-block size-3 shrink-0 rounded-sm`,i.className),style:ki(i)})},zi=({values:e,...t})=>{let n=t.model.fields[t.fields.color],r=(n.enumValues??[]).filter(t=>e.has(t));return(0,X.jsx)(`ul`,{className:`flex flex-wrap gap-x-4 gap-y-1.5 text-xs text-muted-foreground`,children:r.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Ri,{...t,value:e}),Ct(n,e,t.view?.fields[t.fields.color])]},e))})},Bi=({bar:e,...t})=>{let{model:n,view:r,fields:i}=t;if(!e)return(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:O(`timelinePoint`)});let a=e.segments.some(t=>t.open&&t.end===e.end);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[(0,X.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:(0,X.jsx)(Sn,{model:n,field:n.fields[i.bar],value:e.value})}),(0,X.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:Mi(n,i,e.start,e.end,a)})]}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-0.5 text-xs text-muted-foreground`,children:e.segments.map((e,a)=>(0,X.jsxs)(`li`,{className:`flex items-center gap-1.5 tabular-nums`,children:[(0,X.jsx)(Ri,{...t,value:e.value}),Ct(n.fields[i.color],e.value,r?.fields[i.color]),`: `,Mi(n,i,e.start,e.end,e.open)]},a))})]})},Vi=500,Hi=(e,t,{filter:n=``,sort:r,fields:i,limit:a})=>({queryKey:[...Ge.list(t.name,n,r,a,`timeline`),i.join(`,`)],queryFn:async()=>{let o=[],s;do{let c=await e.list(t.name,{filter:n||void 0,orderBy:r,pageSize:Math.min(Vi,a-o.length),fields:i,etag:!1,...s&&{pageToken:s}});o.push(...c.items),s=c.nextPageToken||void 0}while(s&&o.length<a);return{rows:o.toReversed(),cut:s!==void 0}}}),Ui=(e,{enabled:t=!0,...n})=>En({...Hi(Nt(),e,n),enabled:t,placeholderData:Tn}),Wi=({model:e,view:t,fields:n,readSort:r,at:i,filter:a,limit:o=zt,title:s,description:c,empty:l,actions:u,className:d,choose:f,details:p})=>{let[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),v=e=>e?Ci(e):null,y={hover:e=>h(v(e)),focus:e=>_(v(e))},b=an(i),x=Ui(e,{filter:a,sort:r,fields:[...new Set([...Object.values(n),...e.primaryKey])],limit:o,enabled:!b}),S=b??x,C=b?b.rows:x.data?.rows??[],w=!b&&x.data?.cut===!0,T=hi(C,n,Date.now());return(0,X.jsxs)(H,{title:s,description:c,actions:u,className:M(`h-full`,d),children:[(()=>{if(S.isPending)return(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from({length:3},(e,t)=>(0,X.jsx)(L,{className:`h-6`},t))});if(S.error)return(0,X.jsx)(W,{title:O(`couldNotLoad`),error:S.error});if(T.lanes.length===0)return(0,X.jsx)(K,{children:l??O(`nothingYet`)});let r=new Set(C.map(e=>String(e[n.color])));return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(zi,{model:e,view:t,fields:n,values:r}),(0,X.jsx)(Li,{shape:T,model:e,view:t,fields:n,point:y,...f&&{choose:f}}),w&&(0,X.jsx)(K,{children:O(`timelineCut`,{count:C.length})}),(0,X.jsx)(`div`,{"aria-live":`polite`,children:(0,X.jsx)(Bi,{bar:wi(T,m)??wi(T,g),model:e,view:t,fields:n})})]})})(),p]})},Gi=(e,t)=>e.type===`integer`?Number(t):t,Ki=({select:e,children:t,...n})=>{let{given:r,linkTo:i}=a(),o=r[e],s=t=>i({[e]:t}),c=n.model.fields[n.fields.bar],l=o===void 0?null:(0,X.jsx)(le,{name:e,children:(0,X.jsx)(li,{model:n.model,query:{filter:Bn(c,Gi(c,o),n.filter),sort:n.sort},children:t},o)});return(0,X.jsx)(Wi,{...n,choose:{barTo:s,chosen:o},details:l})},qi=({node:e,at:t,slots:n,children:r,className:i})=>{let{className:a,resource:o,select:s,lane:c,bar:u,start:d,end:f,color:p,children:m,...h}=U(e),{resources:g,views:_}=R(),v=g[o];if(!v)return null;let y={...h,model:v,view:_[v.name],fields:{lane:c,bar:u,start:d,end:f,color:p},readSort:l(e),sort:Pt(e),...t!==void 0&&{at:t},actions:n.actions,className:i};return s===void 0?(0,X.jsx)(Wi,{...y}):(0,X.jsx)(Ki,{...y,select:s,children:r})},Ji=({node:e,children:t})=>{let n=ye(e),r=on(),{resources:i}=R();if(!n||!r)return t;let a=r.given[n.param],o=n.resource===void 0?void 0:i[n.resource];return a===void 0||!o?null:(0,X.jsx)(le,{name:n.param,children:(0,X.jsx)(li,{model:o,query:{key:a},className:``,children:t},a)})},Yi=(0,Y.lazy)(()=>wn(()=>import(`./graph-view-DFeWGm5G.js`).then(e=>({default:e.GraphView})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]))),Xi=(0,X.jsx)(`div`,{className:`flex h-64 w-full items-center justify-center`,children:(0,X.jsx)(rn,{})}),Zi=({node:e,at:t,slots:n,children:r,className:i})=>{let a=U(e),o=s(e,t),c=on(),l=o.nodes,u=o.edges,{label:d,group:f,status:p,source:m,target:h}=a,g=(0,Y.useMemo)(()=>({label:d,source:m,target:h,...f!==void 0&&{group:f},...p!==void 0&&{status:p}}),[d,m,h,f,p]),_=JSON.stringify([l?.rows,u?.rows,g]),v=(0,Y.useMemo)(()=>l&&u&&$r({nodes:l.rows,edges:u.rows,key:l.model.primaryKey[0],edgeKey:u.model.primaryKey,fields:g}),[_]);if(!l||!u||!v)return null;let y=l.error??u.error;if(y&&e.fallback)throw y;if(y)return(0,X.jsx)(W,{title:O(`couldNotLoad`),error:y});if(l.isPending||u.isPending)return Xi;if(v.nodes.length===0)return(0,X.jsx)(K,{children:a.empty??O(`nothingYet`)});let b=a.select,x=b!==void 0&&c?{chosen:c.given[b],linkTo:e=>c.linkTo({[b]:e})}:void 0;return(0,X.jsxs)(`div`,{className:M(`flex flex-col gap-4 lg:flex-row`,i),children:[(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsx)(Y.Suspense,{fallback:Xi,children:(0,X.jsx)(Yi,{shape:v,nodes:l,edges:u,fields:g,props:a,...x&&{select:x},...a.node!==void 0&&{content:n.node}})})}),r.length>0&&x?.chosen!==void 0&&(0,X.jsx)(`div`,{className:`min-w-0 lg:w-80 lg:shrink-0`,children:(0,X.jsx)(Ji,{node:e,children:r})})]})},Q=ne(`app/conversation`),Qi=({resource:e,field:t,values:n,placeholder:r})=>{let{resources:i}=R(),a=Nt(),o=mn(),s=je(e),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)();return!i[e]||!h(s,`create`)?null:(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[u!==void 0&&(0,X.jsx)(W,{title:Q(`notSent`),error:u}),(0,X.jsx)(vn,{onSend:async r=>{l(!0),d(void 0);let i=await a.create(e,{...n,[t]:r}).then(()=>!0,e=>(d(e),!1));return l(!1),i&&o(e),i},busy:c,placeholder:r})]})},$i=({node:e})=>{let{resource:t,field:n,values:r,placeholder:i}=U(e);return(0,X.jsx)(Qi,{resource:t,field:n,values:r,placeholder:i})},ea=({node:e,children:t,className:n})=>{let{open:r}=U(e);return(0,X.jsx)(`details`,{open:r,className:M(`[&[open]>summary]:mb-2`,n),children:t})},ta=({children:e,className:t})=>(0,X.jsx)(`summary`,{className:M(`cursor-pointer font-medium`,t),children:e}),na=({node:e,className:t})=>{let{source:n,emptyText:r}=U(e),i=Bt(n);if(i.state===`missing`)return null;if(i.state===`loading`)return(0,X.jsx)(L,{className:M(`h-24 w-full`,t)});if(i.value===null||i.value===void 0||i.value===``)return r?(0,X.jsx)(`p`,{className:M(`text-sm text-muted-foreground`,t),children:r}):null;let a=String(i.value),o=Et(a);return o?(0,X.jsx)(`div`,{className:M(`flex flex-col gap-3`,t),children:o.map((e,t)=>(0,X.jsx)(st,{source:e.lines,path:e.path,split:!0,className:`rounded-md border border-border`},`${t}-${e.path}`))}):(0,X.jsx)(`pre`,{className:M(`overflow-x-auto whitespace-pre-wrap break-words rounded-md border border-border bg-background p-3 font-mono text-[0.6875rem] leading-[18px]`,t),children:a})},ra=e=>e==null?``:typeof e==`object`?JSON.stringify(e):String(e),ia=(e,t)=>{if(t)return t;let n=e.split(`.`).map(e=>vt(e).toLowerCase()).join(` `);return n[0].toUpperCase()+n.slice(1)},aa=({node:e,className:t})=>{let{source:n,label:r,format:i}=U(e),{views:a}=R(),o=Bt(n);if(o.state===`missing`)return null;let s=o.state===`loading`?(0,X.jsx)(L,{className:`h-4 w-24`}):o.state===`plain`?ra(o.value):(0,X.jsx)(Sn,{model:o.model,field:o.field,value:o.value,format:i});if(r===!1)return(0,X.jsx)(`div`,{className:t,children:s});let c=r??ia(n,o.state===`ready`?a[o.model.name]?.fields[o.field.name]?.label:void 0);return(0,X.jsxs)(`div`,{className:M(`min-w-0`,t),children:[(0,X.jsx)(`div`,{className:`text-body text-muted-foreground`,children:c}),(0,X.jsx)(`div`,{className:`mt-0.5 truncate`,children:s})]})},oa={1:``,2:`md:grid-cols-2`,3:`md:grid-cols-2 xl:grid-cols-3`,4:`sm:grid-cols-2 xl:grid-cols-4`},sa={1:``,2:`grid-cols-2`,3:`grid-cols-2 xl:grid-cols-3`,4:`grid-cols-2 xl:grid-cols-4`},ca={1:``,2:`md:col-span-2`,3:`md:col-span-2 xl:col-span-3`,4:`sm:col-span-2 md:col-span-2 xl:col-span-4`},la=e=>typeof e==`object`&&!e.custom&&e.type===`Stat`,ua=({node:e,children:t,className:n})=>{let{columns:r=2}=U(e),i=e.children,a=i.length>0&&i.every(la);return(0,X.jsx)(`div`,{className:M(`grid grid-cols-1 gap-4`,a?sa[r]:oa[r],n),children:t.map((e,t)=>{let n=i[t],r=typeof n==`object`?n.props.span:void 0;return(0,X.jsx)(`div`,{className:M(`min-w-0`,r&&ca[r]),children:e},t)})})},da=({src:e,alt:t,width:n,height:r,className:i})=>(0,X.jsx)(`img`,{src:e,alt:t??``,width:n,height:r,className:i??`max-w-full`}),fa=({width:e,height:t,space:n,theme:r})=>{let i=e??Math.ceil(n/100)*100;if(i!==0)return{width:String(i),...t!==void 0&&{height:String(t)},theme:r}},pa=e=>({staleTime:1/0,refetchOnWindowFocus:!1,...e!==void 0&&{refetchInterval:e*1e3}}),ma=e=>e instanceof Blob&&e.type.startsWith(`image/`),ha=e=>{let[t,n]=(0,Y.useState)();return(0,Y.useEffect)(()=>{if(!e)return n(void 0);let t=URL.createObjectURL(e);return n(t),()=>URL.revokeObjectURL(t)},[e]),t},ga=e=>{let[t,n]=(0,Y.useState)();return[t!==void 0&&t===e,()=>n(e)]},_a=({name:e,alt:t,width:n,height:r,refresh:i,className:a})=>{let o=Nt(),{theme:s}=_e(),[c,l]=lt(),u=fa({width:n,height:r,space:l,theme:s}),d=En({queryKey:Ge.image(e,u??{}),enabled:u!==void 0,placeholderData:Tn,...pa(i),queryFn:async()=>{let t=await o.invoke(e,{query:u,cache:`no-store`});if(!ma(t))throw Error(`The function "${e}" answered no picture`);return t}}),f=ha(d.data),[p,m]=ga(f),h={...n!==void 0&&{width:n},...r!==void 0&&{height:r}};return(0,X.jsx)(`div`,{ref:c,className:M(`min-w-0`,a),children:d.isError||p?t&&(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:t}):f?(0,X.jsx)(`img`,{src:f,alt:t??``,onError:m,style:h,className:n===void 0?`w-full max-w-full object-contain`:`max-w-full object-contain`}):(0,X.jsx)(L,{className:`w-full max-w-full`,style:{height:r??160,...n!==void 0&&{width:n}}})})},va=({node:e,className:t})=>{let n=U(e);return n.src===void 0?(0,X.jsx)(_a,{name:n.function,alt:n.alt,width:n.width,height:n.height,refresh:n.refresh,className:t}):(0,X.jsx)(da,{src:n.src,alt:n.alt,width:n.width,height:n.height,className:t})},ya=e=>function({node:t,className:n}){let r=U(t),{views:i}=R(),a=Bt(r.source);return a.state===`missing`?null:a.state===`loading`?(0,X.jsx)(L,{className:`inline-block h-3 w-16 align-middle`}):Ur(t.type,a.value)?r.emptyText?(0,X.jsx)(`span`,{className:n,children:r.emptyText}):null:a.state===`plain`?(0,X.jsx)(`span`,{className:n,children:e({value:a.value,field:void 0,hints:void 0,props:r})}):(0,X.jsx)(`span`,{className:n,children:e({value:a.value,field:a.field,hints:i[a.model.name]?.fields[a.field.name],props:r})})},ba=({value:e,field:t,hints:n})=>t?.type===`enum`&&typeof e==`string`?r(e,n?.valueLabels):Wr(e),xa=ya(ba),Sa=ya(({value:e,props:t})=>(0,X.jsx)(`span`,{className:`tabular-nums`,children:Gr(e,t,E())})),Ca=ya(({value:e,props:t})=>{let n=Kr(e,t,{locale:E(),now:Date.now(),relative:ct});return(0,X.jsx)(`time`,{dateTime:String(e),children:n})}),wa=ya(({value:e,props:t})=>{let n=qr(e,t,{yes:Rt(`yes`),no:Rt(`no`)});return e?(0,X.jsx)(Ve,{label:n,className:`align-middle`}):(0,X.jsx)(`span`,{className:`text-faint-foreground`,children:n})}),Ta=ya(({value:e,props:t})=>{let n=String(e),r=t.content??n,i=Yr(n);return i===void 0?r:(0,X.jsx)(`a`,{href:i,className:`font-medium text-primary-text hover:underline`,.../^https?:/i.test(i)&&{target:`_blank`,rel:`noreferrer`},children:r})}),Ea=ya(e=>(0,X.jsx)(_n,{value:e.value,hints:e.hints,children:ba(e)})),Da=`font-medium text-primary-text hover:underline`,Oa=({node:e,children:t,className:n})=>{let r=U(e),i={...B(q()),params:Ae()},a=r.variant?M(_t({variant:r.variant}),n):n??Da,o=e.children.some(e=>typeof e!=`string`||e.trim()!==``)?t:void 0;if(r.to){let e=gn(r.to,ot(i));return(0,X.jsx)(de,{to:e,className:a,children:o??Je(e)})}let s=r.href??``;return(0,X.jsx)(`a`,{href:s,className:a,...s.startsWith(`http`)&&{target:`_blank`,rel:`noreferrer`},children:o??s})},ka=(e,t,n)=>Object.fromEntries(t.map(t=>{let r=e.fields[t];if(r.type===`file`)return[t,n?.[t]??null];if(n)return[t,r.type===`boolean`?!!n[t]:v(n[t])];let i=r.default&&`value`in r.default?r.default.value:void 0;return[t,r.type===`boolean`?!!i:v(i)]})),Aa=(e,t,n)=>Object.fromEntries(Object.entries(t).flatMap(([t,r])=>{let i=e.fields[t];return $t(r)?r.key===v(n[t])?[]:[[t,i.type===`integer`?Number(r.key):r.key]]:m(i,r,n[t])?[[t,It(i,r)]]:[]})),ja=({model:e,record:t,mode:n,label:r,title:i,fields:a,values:s,onClose:c})=>{let{resources:l,views:u}=R(),d=Nt(),f=pe(),p=mn(),m=u[e.name],[h,g]=(0,Y.useState)(()=>ka(e,a,t?.record)),[_,v]=(0,Y.useState)({}),[y,b]=(0,Y.useState)(0),x=rt(y),[S,C]=(0,Y.useState)(),[w,T]=(0,Y.useState)(!1),[E,D]=(0,Y.useState)(!1);Xe(E||w,`input-lost`);let ee=async()=>{T(!0),C(void 0),await(n===`create`?d.create(e.name,{...At(e,l,h),...s}):d.update(e.name,t.key,Aa(e,h,t.record),t.etag??`*`)).then(async()=>{await p(e.name),f.show({state:`success`,title:O(`saved`,{label:i??r})}),c()},e=>{let t=un(e);v(t),Object.keys(t).length>0&&b(e=>e+1),C(e)}),T(!1)};return(0,X.jsx)(z,{title:i??r,onClose:c,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{onClick:c,children:O(`cancel`)}),(0,X.jsx)(o,{variant:`primary`,loading:w,onClick:()=>void ee(),children:O(n===`create`?`create`:`save`)})]}),children:(0,X.jsxs)(`form`,{ref:x,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),ee()},children:[S!==void 0&&Object.keys(_).length===0&&(0,X.jsx)(W,{title:O(`notSaved`),error:S}),a.map(n=>{let r=e.fields[n],i=h[n],a=r.relation?l[r.relation.resource]:void 0,o=m?.fields[n]?.label??vt(n),s=_[n];return(0,X.jsx)(Me,{name:n,label:o,help:m?.fields[n]?.help,error:s&&bn(r,o,s),children:(0,X.jsx)(ut,{field:r,hints:m?.fields[n],value:$t(i)?i.key:i,stored:t?.record[n],relationLabel:$t(i)?i.label:void 0,relationPicker:a?{target:a,view:u[a.name]}:void 0,invalid:!!_[n],resource:e.name,onChange:e=>{v(({[n]:e,...t})=>t),D(!0),g(t=>({...t,[n]:e}))}})},n)})]})})},Ma=({model:e,recordKey:t,children:n})=>{let r=wt(e,{key:t});return(0,X.jsx)(X.Fragment,{children:n(r.data??void 0)})},Na=({node:e})=>{let t=U(e),n=Jt(),{resources:r}=R(),i=r[t.resource??n?.model.name??``],a=je(i?.name??``),[s,c]=(0,Y.useState)(!1);if(!i||!(t.mode===`create`?h(a,`create`):h(a,`update`)&&n?.permissions?.update!==!1))return null;let l=e=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{size:`sm`,variant:t.variant??`secondary`,disabled:t.mode===`edit`&&!e,onClick:()=>c(!0),children:t.label}),s&&(0,X.jsx)(ja,{...t,model:i,record:t.mode===`edit`?e:void 0,onClose:()=>c(!1)})]});return t.mode===`edit`&&t.recordKey!==void 0?(0,X.jsx)(Ma,{model:i,recordKey:t.recordKey,children:l}):l(t.mode===`edit`?n:void 0)},Pa=({node:e,children:t,slots:n,className:r})=>{let{title:i,description:a,width:o}=U(e);return(0,X.jsx)(`div`,{className:M(`flex-1`,r),children:(0,X.jsxs)(`div`,{className:M(`flex flex-col gap-6 px-4 pb-16 pt-6 md:px-10 md:py-8`,o!==`full`&&`mx-auto max-w-[1200px]`),children:[(0,X.jsx)(pr,{title:i,subtitle:a,actions:n.actions}),t]})})},Fa=(e,t)=>{let n=q(),r=typeof e==`string`?Mt(n,e):void 0,i=en(r&&`frame`in r?r.frame:void 0,r&&`path`in r?r.path:``);return typeof e==`number`?e:e===void 0?t:r&&`item`in r?Number(r.item):i.state===`ready`?Number(i.value):i.state===`loading`?void 0:NaN},Ia=({node:e,className:t})=>{let{value:n,max:r,label:i}=U(e),a=Fa(n,0),o=Fa(r,100);if(a===void 0||o===void 0)return(0,X.jsx)(L,{className:`h-6 w-full`});if(!Number.isFinite(a)||!Number.isFinite(o))return null;let s=o>0?Math.min(1,Math.max(0,a/o)):0;return(0,X.jsxs)(`div`,{className:M(`min-w-0`,t),children:[(0,X.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-body`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:i}),(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[a.toLocaleString(E()),` / `,o.toLocaleString(E())]})]}),(0,X.jsx)(`div`,{role:`progressbar`,"aria-label":i,"aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":o,className:`mt-1.5 h-2 overflow-hidden rounded-full bg-muted`,children:(0,X.jsx)(`div`,{className:s>=.9?`h-full rounded-full bg-warning`:`h-full rounded-full bg-primary`,style:{width:`${s*100}%`}})})]})},La=({model:e,at:t,filter:n,sort:r,recordKey:i,title:a,description:o,empty:s,actions:c,children:l,className:u})=>{let d=an(t),f=wt(e,{filter:n,sort:r,key:i,enabled:!d}),p=d?Yt(e,d):f,m=e=>p.data?(0,X.jsx)(Wt,{value:p.data,children:e}):void 0,h=p.isPending?(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(L,{className:`h-4 w-1/2`}),(0,X.jsx)(L,{className:`h-4 w-1/3`})]}):p.error?(0,X.jsx)(W,{title:O(`couldNotLoad`),error:p.error}):p.data?m((0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:l})):(0,X.jsx)(K,{children:s??O(`nothingYet`)});return(0,X.jsx)(H,{title:a,description:o,actions:c?m(c):void 0,className:M(`h-full`,u),children:h})},Ra=({node:e,at:t,children:n,slots:r,className:i})=>{let{resource:a,filter:o,sort:s,recordKey:c,title:l,description:u,empty:d}=U(e),f=R().resources[a];return f?(0,X.jsx)(La,{model:f,...t!==void 0&&{at:t},filter:o,sort:s,recordKey:c,title:l,description:u,empty:d,actions:r.actions,className:i,children:n}):null},za=ne(`app/related-cards`),Ba=({children:e})=>{let t=(0,Y.useRef)(null),[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(!1);return(0,Y.useLayoutEffect)(()=>{let e=t.current;if(!e)return;let n=()=>a(e.scrollHeight>e.parentElement.clientHeight+1);n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[n]),(0,X.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,X.jsx)(`div`,{className:M(`w-full min-w-0`,!n&&`max-h-40 overflow-hidden`),children:(0,X.jsx)(`div`,{ref:t,children:e})}),(i||n)&&(0,X.jsx)(o,{size:`sm`,variant:`ghost`,className:`-ml-2`,"aria-expanded":n,onClick:()=>r(!n),children:za(n?`showLess`:`showMore`)})]})},Va=e=>e==null||e===``,Ha=({scope:e,path:t,labelled:n=!0,clamped:r=!1})=>{let{views:i}=R(),a=en(e,t);if(a.state===`missing`||a.state===`ready`&&Va(a.value))return null;let o=a.state===`loading`?(0,X.jsx)(L,{className:`h-4 w-24`}):(0,X.jsx)(Sn,{model:a.model,field:a.field,value:a.value}),s=r?(0,X.jsx)(Ba,{children:o}):o;if(!n)return(0,X.jsx)(`div`,{className:`min-w-0`,children:s});let c=ia(t,a.state===`ready`?i[a.model.name]?.fields[a.field.name]?.label:void 0);return(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`dt`,{className:`text-body text-muted-foreground`,children:c}),(0,X.jsx)(`dd`,{className:`mt-0.5`,children:s})]})},Ua=({scope:e,view:t,fields:n,time:r,tone:i,actions:a,button:o,onActed:s})=>{let c=f(),{resources:l}=R(),u=c(e.model,t,e.record,e.key),d=a.length>0||o!==void 0;return(0,X.jsxs)(`li`,{"data-card":e.key,className:M(`relative grid min-w-0 items-center gap-x-4 gap-y-1 rounded-lg border border-border bg-surface px-4 py-2.5`,d?`grid-cols-[minmax(0,1fr)_auto]`:`grid-cols-[minmax(0,1fr)]`),children:[i&&(0,X.jsx)(ce,{view:t,field:i,record:e.record}),(0,X.jsxs)(`div`,{className:M(`flex min-w-0 items-baseline gap-2`,d&&`col-span-2 sm:col-span-1`),children:[(0,X.jsx)(de,{to:{kind:`record`,resource:e.model.name,key:k(e.model,e.record)},className:`line-clamp-2 min-w-0 font-medium [overflow-wrap:anywhere] text-primary-text hover:underline`,children:u}),r&&(0,X.jsx)(`div`,{className:`ml-auto shrink-0 text-body whitespace-nowrap text-muted-foreground empty:hidden`,children:(0,X.jsx)(Ha,{scope:e,path:r,labelled:!1})})]}),n.length>0&&(0,X.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-y-0.5 text-body text-muted-foreground`,children:n.map(t=>(0,X.jsx)(`div`,{className:`flex max-w-full min-w-0 items-center whitespace-nowrap empty:hidden [&>div]:truncate [:not(:empty)~&]:before:mx-2 [:not(:empty)~&]:before:content-['·'_/_'']`,children:(0,X.jsx)(Ha,{scope:e,path:t,labelled:!1})},t))}),d&&(0,X.jsx)(Wt,{value:e,children:(0,X.jsxs)(`div`,{className:`col-start-2 flex flex-wrap items-center justify-end gap-2 sm:row-span-2 sm:row-start-1`,children:[o&&(0,X.jsx)(or,{button:o,model:e.model,view:t,record:e.record,models:l}),a.map(e=>(0,X.jsx)(ti,{name:e,about:u,onRun:e=>s?.(e,u)},e))]})})]})},Wa=({scope:e,view:t,fields:n,tone:r,actions:i,button:a,onActed:o})=>{let s=f(),{resources:c}=R(),l=s(e.model,t,e.record,e.key);return(0,X.jsxs)(`li`,{"data-card":e.key,className:`relative flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-surface p-4`,children:[r&&(0,X.jsx)(ce,{view:t,field:r,record:e.record}),(0,X.jsx)(de,{to:{kind:`record`,resource:e.model.name,key:k(e.model,e.record)},className:`self-start font-medium text-primary-text hover:underline`,children:l}),n.length>0&&(0,X.jsx)(`dl`,{className:`flex flex-col gap-3`,children:n.map(t=>(0,X.jsx)(Ha,{scope:e,path:t,clamped:!0},t))}),(i.length>0||a)&&(0,X.jsx)(Wt,{value:e,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a&&(0,X.jsx)(or,{button:a,model:e.model,view:t,record:e.record,models:c}),i.map(e=>(0,X.jsx)(ti,{name:e,about:l,onRun:e=>o?.(e,l)},e))]})})]})},Ga=e=>!e.disabled&&e.getAttribute(`aria-disabled`)!==`true`,Ka=e=>[...e.querySelectorAll(`button`)].find(Ga)??e.querySelector(`a`),qa=(e,t,n)=>{let r=e.indexOf(n),i=e=>t.includes(e);return e.slice(r+1).find(i)??e.slice(0,Math.max(r,0)).findLast(i)},Ja=e=>{let t=e.closest(`section`)?.querySelector(`h2`);return t&&!t.hasAttribute(`tabindex`)&&(t.tabIndex=-1),t},Ya=e=>{let t=(0,Y.useRef)(null),n=(0,Y.useRef)({current:e,previous:e}),r=(0,Y.useRef)(void 0),[i,a]=(0,Y.useState)(``),o=(e,n,i)=>{if(r.current=void 0,i.includes(e.key)||!t.current||(a(za(`left`,{action:e.action,title:e.title})),document.activeElement&&document.activeElement!==document.body))return;let o=qa(n,i,e.key),s=o===void 0?void 0:t.current.querySelector(`[data-card="${CSS.escape(o)}"]`);(s?Ka(s):Ja(t.current))?.focus()};return(0,Y.useEffect)(()=>{let t=n.current.current;n.current={current:e,previous:t},r.current&&o(r.current,t,e)},[e]),{root:t,acted:(e,t,i)=>{let{current:a,previous:s}=n.current;if(a.includes(e)){r.current={key:e,action:t,title:i};return}o({key:e,action:t,title:i},s,a)},announcement:i}},Xa=({compact:e,limit:t})=>(0,X.jsx)(`div`,{className:e?`flex flex-col gap-2`:`flex flex-col gap-3`,children:Array.from({length:e?Math.min(t,3):2},(t,n)=>(0,X.jsx)(L,{className:e?`h-17.5 w-full max-sm:h-24`:`h-24 w-full`},n))}),Za=({model:e,view:t,filter:n,sort:r,fields:i,actions:a,button:o,limit:s,display:l,empty:u,carousel:d,compact:f,tone:p,planned:m})=>{let h=w(),g=sr(),_=t?.names?.plural??vt(e.name),v=r||c(e,t),y=at(e,{filter:n,sort:v,pageSize:s,enabled:!m}),b=Ot(e,n,!m),x=m?m.rows:{isPending:y.isPending,error:y.error},S=m?m.rows.rows:y.data?.items,C=m?{data:m.total&&!m.total.isPending&&!m.total.error?er(m.total):void 0}:b,T=(0,Y.useMemo)(()=>(S??[]).map(t=>Ht(e,t)),[e,S]),E=Ya((0,Y.useMemo)(()=>T.map(e=>e.key),[T]));return(0,X.jsxs)(`div`,{ref:E.root,children:[(()=>{if(x.isPending)return(0,X.jsx)(Xa,{compact:!!f,limit:s});if(x.error)return(0,X.jsx)(W,{title:za(`couldNotLoad`),error:x.error});if(T.length===0)return(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:u??za(`nothingYet`)});let r=T.map(e=>{let n=(t,n)=>E.acted(e.key,t,n);return f?(0,X.jsx)(Ua,{scope:e,view:t,fields:i,time:f.time,tone:p,actions:a,button:o,onActed:n},e.key):(0,X.jsx)(Wa,{scope:e,view:t,fields:i,tone:p,actions:a,button:o,onActed:n},e.key)}),c=C.data===void 0?void 0:Un(T.length,C.data,!1);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[d===void 0?(0,X.jsx)(`ul`,{className:f?`flex flex-col gap-2`:`flex flex-col gap-3`,children:r}):(0,X.jsx)(Wn,{scroll:g,label:_,share:d,children:r}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c}),(0,X.jsxs)(de,{to:nr(e,t,h,{filter:n,orderBy:v,display:rr(t,h,{preferred:l})}),className:`flex items-center gap-1 font-medium text-primary-text hover:underline`,children:[Zn(`viewAll`),` `,(0,X.jsx)(`span`,{className:`sr-only`,children:_.toLowerCase()}),(0,X.jsx)(Mn,{className:`size-3.5`,"aria-hidden":!0})]})]})]})})(),(0,X.jsx)(`p`,{role:`status`,className:`sr-only`,children:E.announcement})]})},Qa={"1/4":1/4,"1/3":1/3,"1/2":1/2,"2/3":2/3},$a=({node:e,at:t,slots:n,className:r})=>{let i=U(e),{resource:a,filter:o=``,sort:s=``,fields:c,cardActions:l=[],limit:u=10,display:d,title:f,description:p,empty:m}=i,{layout:h,cardWidth:g}=Xr(i),{resources:_,views:v}=R(),[y,b]=Ut([t,t===void 0?void 0:`${t}#total`]),x=(0,Y.useMemo)(()=>y&&{rows:y,total:b},[y,b]),C=_[a];if(!C)return null;let w=v[C.name];return(0,X.jsx)(`section`,{className:M(`min-w-0`,r),"aria-label":f,children:(0,X.jsx)(S,{title:f,help:p,actions:n.actions,children:(0,X.jsx)(Za,{model:C,view:w,filter:o,sort:s,fields:c??Qe(C,w),actions:l,limit:u,display:d,empty:m,carousel:h===`carousel`?Qa[g]:void 0,...x&&{planned:x}})})})},eo=({model:e,view:t,empty:n,...r})=>{let{resources:i,views:a}=R(),o=qe(i,a,e.name),s=Nn(e.name,t.listOf,!0),c=(t.names?.plural??vt(e.name)).toLowerCase();if(!o.listOf)return null;if(s.error)return(0,X.jsx)(W,{title:On(`couldNotLoadYour`,{plural:c}),error:s.error});if(!s.data)return(0,X.jsx)(L,{className:`h-24`});let l=Jn(o.model,s.data);return l?(0,X.jsx)(lr,{...r,model:o.model,view:o.view,filter:``,scope:l,list:e.name,empty:n}):(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:n??On(`noneYet`,{plural:c})})},to=({model:e,view:t,target:n,targetView:r,row:i})=>{let a=jt(k(e,i)),{name:o,chips:s,title:c,body:l}=dr({model:e,of:t.searchesOf,target:n,targetView:r,row:i,recordKey:a});return(0,X.jsxs)(`section`,{"aria-label":c,className:`flex flex-col gap-3 py-4 first:pt-0 last:pb-0`,children:[(0,X.jsx)(`h3`,{className:`text-[0.9375rem] font-semibold`,children:(0,X.jsx)(de,{to:{kind:`record`,resource:e.name,key:a},className:`hover:underline`,children:o??(0,X.jsx)(Rn,{chips:s})})}),(0,X.jsx)(lr,{...l})]})},no=({model:e,view:t,empty:n})=>{let{resources:r,views:i}=R(),a=t.searchesOf,o=r[a.resource],s=Hn(e.name,!0),c=(t.names?.plural??vt(e.name)).toLowerCase();return o?s.error?(0,X.jsx)(W,{title:zn(`couldNotLoadYour`,{plural:c}),error:s.error}):s.data?s.data.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:n??zn(`noneYet`,{plural:c})}):(0,X.jsx)(`div`,{className:`flex flex-col divide-y`,children:s.data.map(n=>(0,X.jsx)(to,{model:e,view:t,target:o,targetView:i[a.resource],row:n},jt(k(e,n))))}):(0,X.jsx)(L,{className:`h-40`}):null},ro=({node:e,slots:t,className:n})=>{let{resource:r,filter:i=``,sort:a,limit:o,display:s,title:c,description:l,empty:u}=U(e),{resources:d,views:f}=R(),p=d[r];if(!p)return null;let m=f[p.name];return(0,X.jsx)(H,{title:c,description:l,actions:t.actions,className:n,children:m?.searchesOf?(0,X.jsx)(no,{model:p,view:m,empty:u}):m?.listOf===void 0?(0,X.jsx)(lr,{model:p,view:m,filter:i,sort:a,limit:o,display:s,empty:u}):(0,X.jsx)(eo,{model:p,view:m,limit:o,display:s,empty:u})})},io=e=>e.type===`boolean`||e.type===`enum`,ao=({model:e,fields:t,title:n,description:r,stored:i,className:a})=>{let{resources:s,views:c}=R(),l=je(e.name),u=Nt(),d=pe(),f=mn(),p=c[e.name],[g,_]=(0,Y.useState)(i),[v,y]=(0,Y.useState)(()=>ka(e,t,i?.record)),[b,x]=(0,Y.useState)({}),[S,C]=(0,Y.useState)(),[w,T]=(0,Y.useState)(!1),E=(0,Y.useRef)(Promise.resolve()),D=(0,Y.useRef)(i),ee=ka(e,t,void 0),te=g?h(l,`update`)&&g.permissions?.update!==!1:h(l,`create`),ne=t.filter(t=>!io(e.fields[t])),k=ne.some(t=>g?m(e.fields[t],v[t],g.record[t]):v[t]!==ee[t]),re=async t=>{let n=D.current;if(n){let r=await u.update(e.name,n.key,Aa(e,t,n.record),n.etag??`*`);return{...Ht(e,r.record),etag:r.etag,permissions:r.permissions??n.permissions}}let r=await u.create(e.name,At(e,s,{...ee,...t}));return{...Ht(e,r.record),etag:r.etag}},ie=t=>{let r=E.current.then(async()=>{T(!0),C(void 0),await re(t).then(async r=>{D.current=r,_(r),x(e=>Object.fromEntries(Object.entries(e).filter(([e])=>!Object.hasOwn(t,e)))),await f(e.name),d.show({state:`success`,title:O(`saved`,{label:n??O(`settings`)})})},e=>{x(t=>({...t,...un(e)})),C(e)}),T(!1)});E.current=r},ae=(t,n)=>{y(e=>({...e,[t]:n})),io(e.fields[t])&&ie({[t]:n})};return(0,X.jsx)(H,{title:n,description:r,className:M(`h-full`,a),children:(0,X.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),k&&ie(Object.fromEntries(ne.map(e=>[e,v[e]])))},children:[S!==void 0&&Object.keys(b).length===0&&(0,X.jsx)(W,{title:O(`notSaved`),error:S}),t.map(t=>{let n=e.fields[t],r=p?.fields[t]?.label??vt(t),i=b[t];return(0,X.jsx)(Me,{name:t,label:r,help:p?.fields[t]?.help,error:i&&bn(n,r,i),children:(0,X.jsx)(ut,{field:n,hints:p?.fields[t],value:v[t],stored:g?.record[t]??ee[t],invalid:!!i,locked:!te||n.readOnly,resource:e.name,onChange:e=>ae(t,e)})},t)}),te&&k&&(0,X.jsx)(`div`,{children:(0,X.jsx)(o,{type:`submit`,variant:`primary`,size:`sm`,loading:w,children:O(`save`)})})]})})},oo=e=>{let t=wt(e.model,{});return t.isPending?(0,X.jsx)(H,{title:e.title,description:e.description,className:e.className,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(L,{className:`h-4 w-1/2`}),(0,X.jsx)(L,{className:`h-4 w-1/3`})]})}):t.error?(0,X.jsx)(H,{title:e.title,description:e.description,className:e.className,children:(0,X.jsx)(W,{title:O(`couldNotLoad`),error:t.error})}):(0,X.jsx)(ao,{...e,stored:t.data??void 0})},so=({node:e,className:t})=>{let{resource:n,fields:r=[],className:i,...a}=U(e),o=R().resources[n];return o?(0,X.jsx)(oo,{...a,model:o,fields:r.filter(e=>Object.hasOwn(o.fields,e)),stored:void 0,className:t}):null},co=(e,t)=>lo(e,t?[t]:[]),lo=(e,t)=>{let{resources:n}=R(),r=Nt(),i=JSON.stringify(e),a=(0,Y.useMemo)(()=>JSON.parse(i).map(Se),[i]),o=e=>t.some(t=>`item`in t?typeof t.item==`object`&&t.item!==null&&Object.hasOwn(t.item,e):Object.hasOwn(t.model.fields,e)),s=[...new Set(a.flatMap(e=>e.ok?e.paths:[]))],c=new Map(s.flatMap(e=>{let t=x(e,o);return t===void 0?[]:[[e,t]]})),l=s.filter(e=>!c.has(e)),u=[...new Set(c.values())].flatMap(e=>n[e]?[n[e]]:[]),d=l.map(e=>Mt(t,e)),f=mt(l.map((e,t)=>{let n=d[t];return n&&`frame`in n?{scope:n.frame,path:n.path}:{scope:void 0,path:e}})),p=Dn({queries:u.map(e=>cn(r,e))});return a.map(e=>{if(!e.ok)return!1;let t={};for(let n of e.paths){let e=c.get(n);if(e===void 0){let e=l.indexOf(n),r=d[e];if(r&&`item`in r){t[n]=r.item;continue}let i=f[e];if(i.state===`loading`)return;i.state===`ready`&&(t[n]=i.value);continue}let r=u.findIndex(t=>t.name===e);if(r===-1)t[n]=0;else if(p[r].isPending)return;else t[n]=p[r].data??0}return y(e,t)})},uo=(e,t)=>typeof e.props.fallback==`string`?e.props.fallback:t.fallback,fo=({node:e,children:t,slots:n,className:r})=>{let{when:i}=U(e),[a]=lo([i],q());if(a===void 0)return null;let o=a?t:uo(e,n);return o==null?null:r===void 0?(0,X.jsx)(X.Fragment,{children:o}):(0,X.jsx)(`div`,{className:r,children:o})},po=(e,t)=>e.flatMap(e=>typeof e==`string`?[]:[String(Tt(e,B(t)).props.when)]),mo=({node:e,children:t,slots:n,className:r})=>{let i=q(),a=lo(po(e.children,i),i),o=a.findIndex(e=>e!==!1);if(o!==-1&&a[o]===void 0)return null;let s=o===-1?uo(e,n):t[o];return s==null?null:r===void 0?(0,X.jsx)(X.Fragment,{children:s}):(0,X.jsx)(`div`,{className:r,children:s})},ho=({children:e})=>(0,X.jsx)(X.Fragment,{children:e}),go=`text-2xl font-semibold tracking-tight tabular-nums`,_o=({model:e,at:t,filter:n})=>{let{views:r}=R(),i=an(t),a=Ot(e,n,!i),o=i??a;if(o.isPending)return(0,X.jsx)(L,{className:`h-8 w-16`});if(o.error)return(0,X.jsx)(`span`,{className:`text-danger-text`,children:O(`couldNotCount`)});let s=i?er(i):a.data;return(0,X.jsx)(de,{to:Qn(r[e.name],e.name,n),className:`${go} hover:text-primary-text after:absolute after:inset-0 after:content-['']`,children:s.toLocaleString(E())})},vo=({field:e,format:t})=>{let n=Bt(e);return n.state===`loading`?(0,X.jsx)(L,{className:`h-8 w-16`}):n.state===`missing`?null:n.state===`plain`?(0,X.jsx)(`span`,{className:go,children:ra(n.value)}):(0,X.jsx)(`span`,{className:go,children:(0,X.jsx)(Sn,{model:n.model,field:n.field,value:n.value,format:t})})},yo=({node:e,at:t,className:n})=>{let{label:r,value:i,resource:a,filter:o,field:s,format:c,description:l}=U(e),{resources:u}=R(),d=a===void 0?void 0:u[a];return(0,X.jsxs)(H,{className:M(`relative h-full`,n),bodyClassName:`flex flex-col`,children:[(0,X.jsx)(`p`,{className:`text-muted-foreground break-words`,children:r}),(0,X.jsxs)(`div`,{className:`mt-auto pt-1`,children:[i!==void 0&&(0,X.jsx)(`span`,{className:go,children:i}),d&&(0,X.jsx)(_o,{model:d,...t!==void 0&&{at:t},filter:o}),s!==void 0&&(0,X.jsx)(vo,{field:s,format:c})]}),l&&(0,X.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:l})]})},bo=(e,t,n)=>{let r=w(),i=qn(t),[a,o]=(0,Y.useState)(()=>Vn(localStorage,i)),s=(0,Y.useCallback)(e=>{o(e),ir(localStorage,i,e)},[i]);return[rr(e,r,{picked:a,preferred:n}),s]},xo=({model:e,items:t,columns:n,button:r,title:i,description:a,empty:o,actions:s,className:c})=>{let{resources:l,views:u}=R(),d=u[e.name],{fields:f}=Lt(),p=h(je(e.name),`update`),{go:m,href:g}=Fe(),_=w(),v=!we(),y=(0,Y.useMemo)(()=>n?.map(yn)??Qe(e,d),[n,e,d]),b=(0,Y.useMemo)(()=>qt(e,d,y,{resources:l,views:u,fieldTypes:f}),[e,d,y,l,u,f]),x=(0,Y.useMemo)(()=>_?Qt(n)(b):b,[_,n,b]),S=(0,Y.useMemo)(()=>r?Xn(x,e,d,r,l,v):x,[x,e,d,r,l,v]),C=(0,Y.useMemo)(()=>t.map(t=>({...t,id:Ke(e,t)})),[t,e]),T=(0,Y.useMemo)(()=>({total:C.length,rowAt:e=>C[e]}),[C]),E=tr({model:e,view:d,opens:void 0,resources:l,views:u,canUpdate:p}),D=e=>({href:g(e),onFollow:()=>m(e)});return(0,X.jsx)(H,{title:i,description:a,actions:s,className:c,children:C.length===0?(0,X.jsx)(K,{children:o??O(`nothingYet`)}):(0,X.jsx)(Fn,{fit:!0,columns:S,source:T,latencyMs:0,onOpenRow:e=>m(E.address(e)),rowLink:e=>D(E.address(e)),rowActions:E.actions(D),rowNumbers:!1,selectable:!1})})},So=e=>{let t=gt();return t?.model?(0,X.jsx)(xo,{...e,model:t.model,items:t.items}):null},Co=({model:e,view:t,filter:n=``,sort:r=``,columns:i,button:a,bulk:o,limit:s=10,display:c,title:l,description:u,empty:d,actions:f,className:p,chosen:m,planned:h})=>{let[g,_]=bo(t,`page:${e.name}:${l??``}:${n}`,c),v=m?it:g,y=(0,Y.useMemo)(()=>i?.map(yn),[i]),b=(0,Y.useMemo)(()=>Qt(i),[i]);return(0,X.jsxs)(H,{title:l,description:u,actions:(0,X.jsxs)(X.Fragment,{children:[!m&&(0,X.jsx)(ar,{view:t,value:v,onChange:_}),f]}),className:M(`h-full`,p),children:[(0,X.jsx)($n,{model:e,view:t,filter:n,sort:r,columns:y,button:a,bulk:o,limit:s,display:v,empty:d,phoneColumns:b,...m&&{rowTo:m.rowTo,chosenKey:m.key},...h&&{planned:h}}),m?.details]})},wo=({node:e,at:t,slots:n,children:r,className:i})=>{let{className:a,resource:o,select:s,children:c,...l}=U(e),{resources:u,views:d}=R(),[f,p]=Ut([t,t===void 0?void 0:`${t}#total`]),m=(0,Y.useMemo)(()=>f&&{rows:f,total:p},[f,p]);if(o===void 0)return(0,X.jsx)(So,{...l,actions:n.actions,className:i});let h=u[o];return h?s===void 0?(0,X.jsx)(Co,{...l,model:h,view:d[h.name],actions:n.actions,className:i,...m&&{planned:m}}):(0,X.jsx)(To,{...l,model:h,view:d[h.name],actions:n.actions,className:i,select:s,...m&&{planned:m},children:r}):null},To=({select:e,children:t,...n})=>{let{given:r,linkTo:i}=a(),o=t=>i({[e]:t}),s=r[e],c=s===void 0?null:(0,X.jsx)(le,{name:e,children:(0,X.jsx)(li,{model:n.model,query:{key:s},children:t},s)});return(0,X.jsx)(Co,{...n,chosen:{rowTo:o,key:s,details:c}})},Eo=({node:e,children:t,className:n})=>{let{tab:r,pathOf:i}=dt(),{navigate:a}=ee(),o=xn(e),s=dn(o,r),c=e=>i(e===o[0]?.name?void 0:e);return(0,X.jsxs)(`div`,{className:M(`flex flex-col gap-6`,n),children:[(0,X.jsxs)(`select`,{"aria-label":O(`tabs`),value:s?.name??``,onChange:e=>a(c(e.target.value)),className:`h-9 rounded-md border border-border-strong bg-background px-2 font-medium md:hidden`,children:[!s&&(0,X.jsx)(`option`,{value:``,disabled:!0}),o.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.label},e.name))]}),(0,X.jsx)(`nav`,{"aria-label":O(`tabs`),className:`hidden border-b md:block`,children:(0,X.jsx)(`ul`,{className:`flex gap-1`,children:o.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(He,{to:c(e.name),"aria-current":e===s?`page`:void 0,className:M(`-mb-px inline-flex h-9 items-center whitespace-nowrap border-b-2 px-3 font-medium transition-colors`,e===s?`border-foreground text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:e.label})},e.name))})}),s?(0,X.jsx)(Y.Fragment,{children:t[o.indexOf(s)]},s.name):(0,X.jsx)(Be,{children:O(`noTab`,{name:r??``})})]})},Do=({children:e})=>(0,X.jsx)(`div`,{className:`flex flex-col gap-6`,children:e}),Oo=e=>e===void 0?1/0:Date.parse(e),ko=(e,t)=>{let n=e=>e.more&&e.items.length>0?Oo(e.items.at(-1).time):-1/0,r=Math.max(n(e),n(t)),i=[],a=0,o=0;for(;a<e.items.length||o<t.items.length;){let n=o>=t.items.length||a<e.items.length&&Oo(e.items[a].time)>=Oo(t.items[o].time)?e.items[a++]:t.items[o++];if(Oo(n.time)<r)break;i.push(n)}return i},Ao=({value:e,hints:t,mark:n})=>{let i=r(e,t?.valueLabels);return n===`done`?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,X.jsx)(xe,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-success-text`}),i]}):n===`running`?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,X.jsx)(rn,{hidden:!0,className:`size-3.5 shrink-0`}),i]}):n!==`error`&&ft(t?.valueColors,e)!==`red`?i:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-danger-text`,children:[(0,X.jsx)(fr,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),i]})},jo=({value:e})=>{let t=typeof e==`string`?Ce(e):e;return t===C?(0,X.jsx)(ue,{children:String(e)}):(0,X.jsx)(ie,{value:t})},Mo=({label:e,children:t})=>(0,X.jsxs)(`div`,{className:`grid gap-1`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]}),No=({call:e,statusHints:t})=>{let[n,r]=(0,Y.useState)(!1),i=(0,Y.useId)(),a=e.status!==void 0&&(0,X.jsx)(Ao,{value:e.status,hints:t,mark:e.state}),s=(0,X.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:e.name}),c=e.input!==void 0||e.result!==void 0||e.error!==void 0;return(0,X.jsxs)(`div`,{"data-tool-call":!0,className:`flex min-w-0 flex-col gap-1 pl-11 text-xs text-muted-foreground`,children:[c?(0,X.jsxs)(o,{size:`sm`,variant:`ghost`,className:`-ml-2.5 self-start`,"aria-expanded":n,"aria-controls":i,onClick:()=>r(!n),children:[(0,X.jsx)(Re,{"aria-hidden":!0,className:M(`size-3.5 transition-transform`,n&&`rotate-90`)}),s,a]}):(0,X.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[s,a]}),n&&(0,X.jsxs)(`div`,{id:i,className:`grid gap-2`,children:[e.input!==void 0&&(0,X.jsx)(Mo,{label:Q(`callInput`),children:(0,X.jsx)(jo,{value:e.input})}),e.result!==void 0&&(0,X.jsx)(Mo,{label:Q(`callResult`),children:(0,X.jsx)(jo,{value:e.result})}),e.error!==void 0&&(0,X.jsx)(Mo,{label:Q(`callError`),children:(0,X.jsx)(ue,{children:e.error})})]})]})},Po=(e,t)=>e.map(e=>({kind:`message`,row:e,time:typeof e[t]==`string`?e[t]:void 0})),Fo=e=>{if(typeof e==`object`&&e&&`id`in e){let{id:t,name:n}=e;return{id:String(t),...typeof n==`string`&&{name:n}}}return{id:String(e??``),...typeof e==`string`&&{name:e}}},Io=(e,{key:t,sender:n,text:r,status:i},a=Date.now())=>{let o=[],s;for(let c of[...e].reverse()){let e=c.time,l=s?.time!==void 0&&e!==void 0&&De(s.time,e);if(e!==void 0&&!l&&o.push({kind:`day`,key:`day:${c.kind===`call`?c.key:t(c.row)}`,label:be(e,a)}),c.kind===`call`){o.push(c),s={author:void 0,time:e};continue}let{row:u}=c,d=n===void 0?void 0:Fo(u[n]),f=d?.id??``,p=i===void 0||u[i]==null||u[i]===``?void 0:String(u[i]);o.push({kind:`message`,key:t(u),...d&&{author:d},time:e,text:u[r]==null?``:String(u[r]),...p!==void 0&&{status:p},continued:l&&s?.author===f}),s={author:f,time:e}}return o},Lo=e=>zr.includes(e??``)?e:void 0,Ro=e=>e==null||e===``?void 0:String(e),zo=e=>`call:${JSON.stringify(e)}`,Bo=(e,t,n)=>{let r=Ro(e[n.status]),i=Lo(r),a=n.input===void 0?void 0:e[n.input],o=n.result===void 0?void 0:e[n.result],s=n.error===void 0?void 0:Ro(e[n.error]);return{kind:`call`,key:t,name:String(e[n.name]??``),time:typeof e[n.time]==`string`?e[n.time]:void 0,...r!==void 0&&{status:r},...i!==void 0&&{state:i},...a!=null&&{input:a},...o!=null&&{result:o},...s!==void 0&&{error:s}}},Vo=({planned:e,limit:t,expanded:n,expand:r,own:i})=>{if(!e)return i;let a=n&&!i.error&&i.pages<2&&(i.pages===0||i.hasNextPage),o={items:e.rows,labels:e.labels??{},hasNextPage:e.rows.length>=t,isFetchingNextPage:a,isFetchNextPageError:!1,isLoading:e.isPending};return n&&i.error&&i.pages===0?{...o,error:i.error,fetchNextPage:i.refetch,refetch:i.refetch}:n&&!a?i:{...o,error:e.error,fetchNextPage:r,refetch:r}},Ho=(e,{pageSize:t=50,enabled:n=!0,...r},i)=>{let[a,o]=(0,Y.useState)(!1),s=Te(e,{...r,pageSize:t,enabled:n&&(!i||a)}),c=s.data?.pages.length??0,{hasNextPage:l,isFetchingNextPage:u,fetchNextPage:d,error:f}=s;return(0,Y.useEffect)(()=>{i&&a&&!f&&c===1&&l&&!u&&d()},[i,a,f,c,l,u,d]),Vo({planned:i,limit:t,expanded:a,expand:()=>o(!0),own:{...s,pages:c}})},Uo=(e,t,n)=>{let{views:r}=R(),i=e?.model.name??``,a=Ho(i,{filter:e?.filter,orderBy:e&&he(e.fields.time),pageSize:t,enabled:e!==void 0},n);return e?{calls:a.items.map(t=>Bo(t,zo(k(e.model,t)),e.fields)),hasNextPage:a.hasNextPage,isFetchingNextPage:a.isFetchingNextPage,list:a,statusHints:r[i]?.fields[e.fields.status]}:{calls:[],hasNextPage:!1,isFetchingNextPage:!1,list:a,statusHints:void 0}},Wo=e=>e.items.length>0?`messages`:e.error?`error`:e.isLoading?`loading`:`messages`,Go=(e,t)=>e.isLoading?t.loading:t.empty,Ko=e=>e.items.length>0&&!!e.error,qo=e=>e.isFetchNextPageError?()=>void e.fetchNextPage():()=>void e.refetch(),Jo=e=>{for(let t of e)t.hasNextPage&&t.fetchNextPage()},Yo=({model:e,filter:t,sender:n,time:r,text:i,status:a,limit:o=50,empty:s,working:c,calls:l,planned:d})=>{let{resources:f,views:p}=R(),m=St(),h=m?.state.kind===`signed-in`?m.state.user.id:void 0,_=n===void 0?[]:[n],v=oe(f,p,e,_),y=Ho(e.name,{filter:t,orderBy:he(r),pageSize:o,labels:v},d?.messages),b=Uo(l,o,d?.calls),x=Wo(y);if(x===`error`)return(0,X.jsx)(W,{title:Q(`couldNotLoad`),error:y.error,onRetry:qo(y)});if(x===`loading`)return(0,X.jsx)(`div`,{className:`p-4`,children:(0,X.jsx)(K,{children:Q(`loadingMessages`)})});let S=$e(f,e,_,y.items,y.labels),C=ko({items:b.calls,more:b.hasNextPage},{items:Po(S,r),more:y.hasNextPage}),w=Io(C,{key:t=>String(k(e,t)),sender:n,time:r,text:i,status:a}),T=a===void 0?void 0:p[e.name]?.fields[a],E=e.fields[i]!==void 0&&Ie(e.fields[i],p[e.name]?.fields[i]),D=w.findLast(e=>e.kind===`message`&&e.author!==void 0&&e.author.id===h);return(0,X.jsxs)(X.Fragment,{children:[Ko(y)&&(0,X.jsx)(`div`,{className:`shrink-0 p-2`,children:(0,X.jsx)(W,{title:Q(`couldNotLoad`),error:y.error,onRetry:qo(y)})}),l&&b.list.error&&(0,X.jsx)(`div`,{className:`shrink-0 p-2`,children:(0,X.jsx)(W,{title:Q(`couldNotLoadCalls`),error:b.list.error,onRetry:qo(b.list)})}),(0,X.jsx)(u,{length:C.length,followKey:D?.key,working:c,empty:Go(b.list,{loading:Q(`loadingMessages`),empty:s??Q(`noMessages`)}),onLoadEarlier:y.hasNextPage||b.hasNextPage?()=>Jo([y,b.list]):void 0,loadingEarlier:y.isFetchingNextPage||b.isFetchingNextPage,children:w.map(e=>e.kind===`day`?(0,X.jsx)(ge,{label:e.label},e.key):e.kind===`call`?(0,X.jsx)(No,{call:e,statusHints:b.statusHints},e.key):(0,X.jsx)(Ft,{...e.author?{author:e.author}:{alone:!0},time:e.time,continued:e.continued,footer:e.status!==void 0&&(0,X.jsx)(Ao,{value:e.status,hints:T}),children:E&&e.text!==``?(0,X.jsx)(g,{source:e.text,className:`whitespace-normal`}):e.text},e.key))})]})},Xo=({children:e})=>(0,X.jsx)(`div`,{className:`flex h-[min(36rem,65dvh)] flex-col rounded-lg border border-border bg-background`,children:e}),Zo=({node:e,at:t,slots:n,className:r})=>{let{title:i,description:a,resource:o,filter:s,sender:c,time:l,text:u,status:d,working:f,calls:p,limit:m,empty:h}=U(e),{resources:g}=R(),[_]=lo(f===void 0?[]:[f],q()),[v,y]=Ut([t,t===void 0?void 0:`${t}#calls`]),b=g[o];if(!b)return null;let x=p&&g[p.resource];return(0,X.jsx)(`section`,{className:M(`flex min-w-0 flex-col`,r),"aria-label":i,children:(0,X.jsx)(S,{title:i,help:a,actions:n.actions,children:(0,X.jsx)(Xo,{children:(0,X.jsx)(Yo,{model:b,filter:s,sender:c,time:l,text:u,status:d,calls:p&&x&&{model:x,filter:p.filter,fields:p},limit:m,empty:h,working:f===void 0?void 0:_===!0,...(v||y)&&{planned:{messages:v,calls:y}}})})})})},Qo=({children:e,className:t})=>(0,X.jsx)(`div`,{className:t,children:e}),$o=({children:e,className:t})=>(0,X.jsx)(`div`,{className:M(`flex`,t),children:e}),es=({children:e,className:t})=>(0,X.jsx)(`div`,{className:M(`flex flex-col`,t),children:e}),ts=({node:e,children:t,className:n})=>{let{as:r=`p`}=U(e);return(0,X.jsx)(r,{className:n,children:t})},ns=({node:e,children:t})=>{let{source:n}=U(e),r=hn(B(q()),n),i=(0,Y.useMemo)(()=>({items:Array.isArray(r)?r:[]}),[r]);return(0,X.jsx)(Vt,{value:i,children:t})},rs=({node:e,className:t})=>{let{source:n,choices:r,label:i=n,defaultValue:o}=U(e),{values:s,linkTo:c}=a(),l=s[n];return(0,X.jsxs)(`div`,{className:M(`flex flex-wrap items-center gap-2`,t),children:[(0,X.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:i}),r?(0,X.jsx)(d,{label:i,value:l??``,options:r.map(e=>({value:String(e.id),label:e.name})),link:e=>c({[n]:o!==void 0&&e===String(o)?void 0:e})}):(0,X.jsx)(`span`,{children:l})]})},is=({model:e,filter:t,perPage:n,more:r,planned:i,expanded:a,expand:o,own:s})=>{if(t===void 0)return{read:{isPending:!1,error:null},list:{model:e,items:[]}};if(i&&!a){let t=i.rows.slice(0,n),a=r&&t.length===n?o:void 0;return{read:i,list:{model:e,items:t,planned:!0,...a&&{loadMore:a}}}}if(i&&!s.error&&s.pages<2&&(s.pages===0||s.hasNextPage))return{read:i,list:{model:e,items:i.rows.slice(0,n),planned:!0,loadMore:()=>{},loadingMore:!0}};let c=r&&s.hasNextPage?()=>void s.fetchNextPage():void 0;return{read:{isPending:s.isPending,error:s.error},list:{model:e,items:s.items,...c&&{loadMore:c,loadingMore:s.isFetchingNextPage}}}},as=({model:e,filter:t,sort:n,perPage:r,more:i,planned:a})=>{let[o,s]=(0,Y.useState)(!1),c=Te(e.name,{filter:t,orderBy:n,pageSize:r,enabled:t!==void 0&&(!a||o)}),l=c.data?.pages.length??0,{hasNextPage:u,isFetchingNextPage:d,fetchNextPage:f,error:p}=c;return(0,Y.useEffect)(()=>{a&&o&&!p&&l===1&&u&&!d&&f()},[a,o,p,l,u,d,f]),is({model:e,filter:t,perPage:r,more:i,planned:a,expanded:o,expand:()=>s(!0),own:{pages:l,items:c.items,hasNextPage:u,isFetchingNextPage:d,isPending:c.isPending,error:p,fetchNextPage:f}})},os=({node:e,at:t,children:n})=>{let r=U(e),i=R().resources[r.reference],a=ot(B(q())),o=an(t);return i?(0,X.jsx)(ss,{model:i,..._(r,i.primaryKey[0],a),more:r.pagination===`more`,empty:r.empty,...o&&{planned:o},children:n}):null},ss=({empty:e,children:t,...n})=>{let{read:r,list:i}=as(n);return(0,X.jsx)(ln,{read:r,list:i,empty:e,children:t})},cs=({node:e,at:t,children:n})=>{let r=U(e),i=R().resources[r.reference],a=ot(B(q())),o=an(t);return i?(0,X.jsx)(ss,{model:i,...Le(r,i.primaryKey[0],a),more:!1,empty:r.empty,...o&&{planned:o},children:n}):null},ls=({model:e,at:t,recordKey:n,link:r=`edit`,children:i,className:a})=>{let{views:o}=R(),s=an(t),c=wt(e,{key:n,enabled:!s}),l=s?Yt(e,s):c;if(l.isPending)return(0,X.jsx)(L,{className:`h-4 w-24`});if(l.error)return(0,X.jsx)(W,{title:O(`couldNotLoad`),error:l.error});if(!l.data)return null;let u=i.length>0?(0,X.jsx)(Wt,{value:l.data,children:i}):nt(e,o[e.name],l.data.record,n);return r===!1?(0,X.jsx)(`span`,{className:a,children:u}):(0,X.jsx)(de,{to:{kind:`record`,resource:e.name,key:n},className:a??`font-medium text-primary-text hover:underline`,children:u})},us=({node:e,at:t,children:n,className:r})=>{let{reference:i,source:a,link:o,empty:s}=U(e),c=R().resources[i],l=hn(B(q()),a);return c?l==null||l===``?s===void 0?null:(0,X.jsx)(`span`,{className:r,children:s}):(0,X.jsx)(ls,{model:c,...t!==void 0&&{at:t},recordKey:String(l),link:o,className:r,children:n}):null},ds=(e,t)=>t.map(t=>ae(e,t)).join(`, `),$=ne(`users`),fs=({roles:e})=>{let{session:t}=V(),[n,r]=(0,Y.useState)([]),[i,a]=(0,Y.useState)([]),o=(0,Y.useCallback)(()=>void t.users.invitations().then(a,()=>a([])),[t]);return(0,Y.useEffect)(o,[o]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(mr,{title:$(`inviteSomeone`),description:$(`inviteDescription`),onInvite:async e=>{let i=await t.users.invite({email:e,roles:n});return r([]),o(),i},incomplete:n.length===0,children:(0,X.jsx)(gr,{roles:e,selected:n,grantable:new Set(e.map(e=>e.name)),onChange:r})}),(0,X.jsx)(P,{title:$(`notAcceptedYet`),description:i.length>0?$(`sendingAgain`):$(`nobodyWaiting`),children:i.length>0&&(0,X.jsx)(`ul`,{className:`divide-y rounded-md border`,children:i.map(n=>(0,X.jsx)(hr,{email:n.email,gives:ds(e,n.roles),expiresAt:n.expiresAt,onResend:async()=>{let e=await t.users.invite({email:n.email,roles:n.roles});return o(),e},onRevoke:async()=>{await t.users.revoke(n.id),o()}},n.id))})})]})},ps=({roles:e,onCreated:t})=>{let{session:n}=V(),[r,i]=(0,Y.useState)(``),[a,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)([]),{busy:f,error:p,run:m}=Ye(),h=()=>m(async()=>{await n.users.create({email:r.trim(),name:a.trim(),roles:u,...c&&{password:c}}),i(``),s(``),l(``),d([]),t()}),g=!r.trim()||!a.trim()||u.length===0||c!==``&&c.length<12;return(0,X.jsxs)(P,{title:$(`addAnAccount`),description:$(`addDescription`),children:[(0,X.jsx)(I,{message:p}),(0,X.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,X.jsx)(N,{"aria-label":$(`email`),type:`email`,placeholder:`name@example.com`,value:r,onChange:e=>i(e.target.value),wrapperClassName:`flex-1`}),(0,X.jsx)(N,{"aria-label":$(`name`),placeholder:$(`name`),autoComplete:`off`,value:a,onChange:e=>s(e.target.value),wrapperClassName:`flex-1`})]}),(0,X.jsx)(N,{"aria-label":$(`password`),type:`password`,autoComplete:`new-password`,placeholder:$(`passwordOptional`,{length:12}),value:c,onChange:e=>l(e.target.value)}),(0,X.jsx)(gr,{roles:e,selected:u,grantable:new Set(e.map(e=>e.name)),onChange:d}),(0,X.jsx)(`div`,{children:(0,X.jsx)(o,{type:`submit`,variant:`primary`,loading:f,disabled:g,children:$(`addAccount`)})})]})]})},ms=({user:e,roles:t,self:n})=>{let{session:r}=V(),[i,a]=(0,Y.useState)(e),{busy:s,error:c,run:l,setError:u}=Ye(),d=e=>{if(e.length===0)return u($(`keepOneRole`));l(async()=>{await r.users.setRoles(i.id,e),a({...i,roles:e})})},f=e=>void l(async()=>{await(e?r.users.block(i.id):r.users.unblock(i.id)),a({...i,blocked:e})});return(0,X.jsx)(_r,{name:i.name,email:i.email,self:n,error:c,actions:(0,X.jsxs)(X.Fragment,{children:[i.blocked&&(0,X.jsx)(j,{tone:`red`,children:$(`blocked`)}),!n&&(i.blocked?(0,X.jsx)(o,{size:`sm`,loading:s,onClick:()=>f(!1),children:$(`unblock`)}):(0,X.jsx)(o,{size:`sm`,variant:`danger`,loading:s,onClick:()=>f(!0),children:$(`block`)}))]}),children:(0,X.jsx)(gr,{roles:t,selected:i.roles,grantable:new Set(t.map(e=>e.name)),disabled:s,onChange:d})})},hs=({roles:e,version:t})=>{let{session:n,state:r}=V(),[i,a]=(0,Y.useState)(``),o=(0,Y.useCallback)((e,t)=>n.users.search(e,t).then(e=>({items:e.users,total:e.total})),[n,t]),s=yr(o,i),c=r.kind===`signed-in`?r.user.id:void 0;return(0,X.jsx)(vr,{title:$(`people`),description:$(`peopleDescription`),searchLabel:$(`findSomeone`),placeholder:$(`emailAddress`),query:i,onQuery:a,list:s,renderRow:n=>(0,X.jsx)(ms,{user:n,roles:e,self:n.id===c},`${t}/${n.id}`)})},gs=()=>{let{session:e}=V(),[t,n]=(0,Y.useState)([]),[r,i]=(0,Y.useState)();return(0,Y.useEffect)(()=>{e.users.roles().then(n,e=>i(e instanceof G?A(e):$(`couldNotReadRoles`)))},[e]),{roles:t,error:r}},_s=()=>{let{roles:e,error:t}=gs(),[n,r]=(0,Y.useState)(0);return(0,X.jsxs)(`div`,{className:`flex max-w-3xl flex-col gap-4`,children:[(0,X.jsx)(I,{message:t}),(0,X.jsx)(hs,{roles:e,version:n}),(0,X.jsx)(fs,{roles:e}),(0,X.jsx)(ps,{roles:e,onCreated:()=>r(e=>e+1)})]})},vs=({sender:e,busy:t,error:n,onSave:r,onClose:i})=>{let[a,s]=(0,Y.useState)(e?.address??``),[c,l]=(0,Y.useState)(e?.name??``),[u,d]=(0,Y.useState)(e?.signature??``),[f,p]=(0,Y.useState)(e?.isDefault??!1);return(0,X.jsxs)(z,{title:e?e.address:J(`addFromAddress`),description:J(e?`changeFromAddressDescription`:`addFromAddressDescription`),onClose:i,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{onClick:i,children:J(`cancel`)}),(0,X.jsx)(o,{variant:`primary`,loading:t,disabled:!a.trim(),onClick:()=>r({address:a.trim(),name:c.trim(),signature:u,isDefault:f}),children:J(e?`save`:`addAddress`)})]}),children:[!e&&(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[J(`fromAddress`),(0,X.jsx)(N,{autoFocus:!0,type:`email`,value:a,maxLength:254,placeholder:J(`fromAddressPlaceholder`),onChange:e=>s(e.target.value)})]}),(0,X.jsxs)(`label`,{className:`mt-3 flex flex-col gap-1.5 font-medium`,children:[J(`fromName`),(0,X.jsx)(N,{value:c,maxLength:100,placeholder:J(`fromNamePlaceholder`),onChange:e=>l(e.target.value)})]}),(0,X.jsxs)(`label`,{className:`mt-3 flex cursor-pointer items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{children:J(`defaultFromAddress`)}),(0,X.jsx)(fe,{checked:f,onChange:p,label:J(`defaultFromAddress`)})]}),(0,X.jsxs)(`label`,{className:`mt-3 flex flex-col gap-1.5 font-medium`,children:[J(`signature`),(0,X.jsx)(Ne,{value:u,maxLength:2e3,placeholder:J(`signaturePlaceholder`),onChange:e=>d(e.target.value)})]}),(0,X.jsx)(I,{message:n})]})},ys=e=>e.signature?J(`ownSignature`):J(`genericSignature`),bs=({senders:{address:e,senders:t},onAdd:n,onUpdate:r,onRemove:i})=>{let[a,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(),[u,d]=(0,Y.useState)(),f=(0,Y.useRef)(!1),p=t.find(e=>e.isDefault),m=()=>{d(void 0),l(void 0)},h=async e=>{if(!f.current){f.current=!0,s(!0),l(void 0);try{await e(),d(void 0)}catch(e){if(e instanceof TypeError)return l(J(`noAnswerFromServer`));if(!(e instanceof G))throw e;l(A(e))}finally{f.current=!1,s(!1)}}},g=e=>h(async()=>{let t=e.name||null,i=e.signature.trim()?e.signature:null;if(u?.kind===`change`)return r(u.sender.id,{name:t,signature:i,isDefault:e.isDefault});let a=await n({address:e.address,...t&&{name:t},...i&&{signature:i}});e.isDefault&&await r(a.id,{isDefault:!0})});return(0,X.jsxs)(`div`,{className:`mt-5 border-t pt-4`,children:[(0,X.jsx)(`h3`,{className:`font-semibold`,children:J(`fromAddresses`)}),(0,X.jsx)(`p`,{className:`mt-1 mb-3 text-muted-foreground`,children:J(`fromAddressesDescription`)}),(0,X.jsx)(I,{message:u?void 0:c}),(e||t.length>0)&&(0,X.jsxs)(`ul`,{className:`mb-3 divide-y rounded-md border`,children:[e&&(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,X.jsx)(wr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`bdi`,{className:`block truncate font-medium`,children:e}),(0,X.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:J(`mailboxOwnAddress`)})]}),p?(0,X.jsx)(o,{size:`sm`,variant:`ghost`,loading:a,onClick:()=>void h(()=>r(p.id,{isDefault:!1})),children:J(`makeDefault`)}):(0,X.jsx)(j,{tone:`blue`,children:J(`default`)})]}),t.map(e=>(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,X.jsx)(wr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`bdi`,{className:`block truncate font-medium`,children:e.address}),e.name&&(0,X.jsx)(`bdi`,{className:`block truncate`,children:e.name}),(0,X.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:ys(e)})]}),e.isDefault&&(0,X.jsx)(j,{tone:`blue`,children:J(`default`)}),(0,X.jsx)(o,{size:`sm`,variant:`ghost`,onClick:()=>d({kind:`change`,sender:e}),children:J(`edit`)}),(0,X.jsx)(o,{size:`sm`,variant:`ghost`,onClick:()=>d({kind:`remove`,sender:e}),children:J(`remove`)})]},e.id))]}),(0,X.jsxs)(o,{onClick:()=>d({kind:`add`}),children:[(0,X.jsx)(ht,{className:`size-3.5`}),J(`addFromAddress`)]}),u?.kind===`add`&&(0,X.jsx)(vs,{busy:a,error:c,onSave:e=>void g(e),onClose:m}),u?.kind===`change`&&(0,X.jsx)(vs,{sender:u.sender,busy:a,error:c,onSave:e=>void g(e),onClose:m},u.sender.id),u?.kind===`remove`&&(0,X.jsx)(z,{title:J(`removeFromAddress`,{address:u.sender.address}),description:J(`removeFromAddressDescription`),onClose:m,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{onClick:m,children:J(`cancel`)}),(0,X.jsx)(o,{variant:`danger`,loading:a,onClick:()=>void h(()=>i(u.sender.id)),children:J(`remove`)})]}),children:(0,X.jsx)(I,{message:c})})]})},xs=(e,t,n)=>Object.fromEntries(Pn(e,t,{code:`not_linked`}).filter(e=>e.signInOnly).map(({link:e})=>[e.id,Yn(`signInOnly`,{provider:n(e.provider),name:e.name})])),Ss=({links:e})=>{let{session:t,linkPersonalMail:n,signInProviders:r}=V(),{account:i}=t,[a]=(0,Y.useState)(Cn),o=(0,Y.useCallback)(async()=>{let[t,n,r]=await Promise.all([i.linkedPersonalMail(e),i.linkedProviders(),i.mailSenders()]);return{mail:t,providers:n,senders:r}},[i,e]),{data:s,error:c,reload:l}=p(o,J(`couldNotReadMethods`));return s?(0,X.jsx)(re,{title:J(`mailbox`),description:J(`mailboxDescription`),providers:e.map(({id:e,name:t})=>({id:e,name:t})),linked:s.mail,notes:xs(e,s,e=>r.find(t=>t.id===e)?.name??Xt(e)),reconnect:!0,onConnect:t=>n(e.find(e=>e.id===t)),error:a&&et(a,e.length===1?e[0].name:J(`theProvider`)),children:(0,X.jsx)(bs,{senders:s.senders,onAdd:async e=>{let t=await i.addMailSender(e);return await l(),t},onUpdate:async(e,t)=>{await i.updateMailSender(e,t),await l()},onRemove:async e=>{await i.removeMailSender(e),await l()}})}):(0,X.jsx)(F,{error:c})},Cs=()=>{let{personalMail:e}=V();return e.length>0?(0,X.jsx)(Ss,{links:e}):null},ws=e=>br(e.name)??`An unnamed app`,Ts=e=>e.access.map(({role:e,organization:t})=>`as ${e||`no role`}${t?` in ${t}`:``}`).join(`, `),Es=({apps:e,onDisconnect:t})=>{let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(),[s,c]=(0,Y.useState)(),l=async e=>{r(!0),a(void 0);try{await t(e.clientId),c(void 0)}catch(e){if(!(e instanceof G))throw e;a(A(e))}r(!1)};return(0,X.jsxs)(P,{title:`Connected apps`,description:`AI assistants and other apps you allowed to act as you here. Disconnecting one stops it within 15 minutes; it has to ask you again to come back.`,children:[(0,X.jsx)(I,{message:s?void 0:i}),e.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`No apps are connected. Add this app's MCP address to an AI assistant to connect one.`}):(0,X.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.map(e=>{let t=xr(e.clientId);return(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,X.jsx)(Er,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`bdi`,{className:`block truncate font-medium`,children:ws(e)}),(0,X.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[t&&`Published by ${t} · `,`Allowed `,ke(Date.parse(e.allowedAt)),` · `,Ts(e)]})]}),(0,X.jsx)(o,{size:`sm`,variant:`ghost`,onClick:()=>c(e),children:`Disconnect`})]},e.clientId)})}),s&&(0,X.jsx)(z,{title:`Disconnect ${ws(s)}?`,description:`It can no longer read or change anything as you. What it already started may keep working for up to 15 minutes.`,onClose:()=>c(void 0),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{onClick:()=>c(void 0),children:`Cancel`}),(0,X.jsx)(o,{variant:`danger`,loading:n,onClick:()=>void l(s),children:`Disconnect`})]}),children:i&&(0,X.jsx)(I,{message:i})})]})},Ds=(e,t)=>{let n=new URL(`https://claude.ai/customize/connectors`);return n.searchParams.set(`modal`,`add-custom-connector`),t&&n.searchParams.set(`connectorName`,t),n.searchParams.set(`connectorUrl`,e),n.href},Os=({url:e,appName:t})=>(0,X.jsx)(P,{title:J(`mcpAddress`),description:J(`mcpAddressDescription`),children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(Sr,{value:e,copyLabel:J(`copyMcpAddress`)}),(0,X.jsxs)(`a`,{href:Ds(e,t),target:`_blank`,rel:`noreferrer`,className:_t(),children:[(0,X.jsx)(fn,{className:`size-3.5`}),J(`addToClaude`)]})]})}),ks=()=>{let{account:e}=V().session,{data:t,error:n,reload:r}=p((0,Y.useCallback)(()=>e.connectedApps(),[e]),J(`couldNotReadMethods`));return t?(0,X.jsx)(Es,{apps:t,onDisconnect:t=>e.disconnectApp(t).then(r)}):(0,X.jsx)(F,{error:n})},As=({url:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Os,{url:e,appName:R().appName}),(0,X.jsx)(ks,{})]}),js=()=>{let{mcp:e}=V();return e?(0,X.jsx)(As,{url:e.url}):null},Ms={30:30,90:90,365:365,never:void 0},Ns={30:`expiresIn30Days`,90:`expiresIn90Days`,365:`expiresInAYear`,never:`neverExpires`},Ps=e=>ke(Date.parse(e)),Fs=e=>e?J(Date.parse(e)<=Date.now()?`expiredOn`:`expiresOn`,{date:Ps(e)}):J(`neverExpires`),Is=e=>[J(`createdOn`,{date:Ps(e.createdAt)}),Fs(e.expiresAt),e.lastUsedAt?J(`lastUsedOn`,{date:Ps(e.lastUsedAt)}):J(`notUsedYet`),e.organization?J(`actsAsIn`,{role:e.role,organization:e.organization}):J(`actsAs`,{role:e.role})].join(` · `),Ls=({tokens:e,onCreate:t,onRevoke:n})=>{let[r,i]=(0,Y.useState)(!1),[a,s]=(0,Y.useState)(),[c,l]=(0,Y.useState)(),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(`90`),[m,h]=(0,Y.useState)(),g=()=>{l(void 0),s(void 0),h(void 0)},_=(0,Y.useRef)(!1),v=async e=>{if(!_.current){_.current=!0,i(!0),s(void 0);try{l(await e()),h(void 0)}catch(e){if(e instanceof TypeError)return s(J(`noAnswerFromServer`));if(!(e instanceof G))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?h(`asked`):s(A(e))}finally{_.current=!1,i(!1)}}},y=()=>v(async()=>{let e=Ms[f];return{kind:`created`,created:await t({name:u.trim(),...e!==void 0&&{expiresInDays:e}})}});return(0,X.jsxs)(P,{title:J(`accessTokens`),description:J(`accessTokensDescription`),children:[(0,X.jsx)(I,{message:c?void 0:a}),e.length===0?(0,X.jsx)(`p`,{className:`mb-3 text-muted-foreground`,children:J(`noAccessTokens`)}):(0,X.jsx)(`ul`,{className:`mb-3 divide-y rounded-md border`,children:e.map(e=>(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,X.jsx)(Or,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`bdi`,{className:`block truncate font-medium`,children:e.name}),(0,X.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:Is(e)})]}),(0,X.jsx)(o,{size:`sm`,variant:`ghost`,onClick:()=>l({kind:`revoke`,token:e}),children:J(`revoke`)})]},e.id))}),(0,X.jsxs)(o,{onClick:()=>{d(``),p(`90`),l({kind:`create`})},children:[(0,X.jsx)(ht,{className:`size-3.5`}),J(`newAccessToken`)]}),c?.kind===`create`&&(0,X.jsxs)(z,{title:J(`newAccessToken`),description:J(`newAccessTokenDescription`),onClose:g,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{onClick:g,children:J(`cancel`)}),(0,X.jsx)(o,{variant:`primary`,loading:r,disabled:!u.trim(),onClick:()=>void y(),children:J(`createAccessToken`)})]}),children:[(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[J(`name`),(0,X.jsx)(N,{autoFocus:!0,value:u,maxLength:100,placeholder:J(`accessTokenNamePlaceholder`),onChange:e=>d(e.target.value)})]}),(0,X.jsxs)(`label`,{className:`mt-3 flex flex-col gap-1.5 font-medium`,children:[J(`accessTokenExpiry`),(0,X.jsx)(Ue,{value:f,onChange:e=>p(e.target.value),children:Object.keys(Ms).map(e=>(0,X.jsx)(`option`,{value:e,children:J(Ns[e])},e))})]}),m===`asked`&&(0,X.jsx)(yt,{purpose:`change`,minutes:15,onConfirmed:()=>h(`done`)}),m===`done`&&(0,X.jsx)(`p`,{className:`mt-2 text-muted-foreground`,children:J(`confirmedCreateAccessToken`)}),(0,X.jsx)(I,{message:a})]}),c?.kind===`created`&&(0,X.jsx)(z,{title:J(`accessTokenCreated`,{name:c.created.personalAccessToken.name}),description:J(`accessTokenCreatedDescription`),onClose:g,actions:(0,X.jsx)(o,{variant:`primary`,onClick:g,children:J(`done`)}),children:(0,X.jsx)(Sr,{value:c.created.token,copyLabel:J(`copyAccessToken`)})}),c?.kind===`revoke`&&(0,X.jsx)(z,{title:J(`revokeAccessToken`,{name:c.token.name}),description:J(`revokeAccessTokenDescription`),onClose:g,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{onClick:g,children:J(`cancel`)}),(0,X.jsx)(o,{variant:`danger`,loading:r,onClick:()=>void v(async()=>(await n(c.token.id),void 0)),children:J(`revoke`)})]}),children:(0,X.jsx)(I,{message:a})})]})},Rs=()=>{let{account:e}=V().session,{data:t,error:n,reload:r}=p((0,Y.useCallback)(()=>e.personalAccessTokens(),[e]),J(`couldNotReadAccessTokens`));return t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(I,{message:n}),(0,X.jsx)(Ls,{tokens:t,onCreate:t=>e.createPersonalAccessToken(t).then(e=>(r(),e),async e=>{throw await r(),e}),onRevoke:t=>e.revokePersonalAccessToken(t).finally(r)})]}):(0,X.jsx)(F,{error:n})},zs=()=>V().personalAccessTokens?(0,X.jsx)(Rs,{}):null,Bs={revoked:`disconnectedRevoked`,queued:`disconnectedQueued`,not_revoked:`disconnectedNotRevoked`},Vs=e=>e.provider===`google`,Hs=({connections:e,onConnect:t,onDisconnect:n,error:r})=>{let[i,a]=(0,Y.useState)(),[s,c]=(0,Y.useState)(r),[l,u]=(0,Y.useState)(),[d,f]=(0,Y.useState)(),p=async(e,t)=>{a(e),c(void 0),f(void 0);try{await t(),u(void 0)}catch(e){if(!(e instanceof G))throw e;c(A(e))}finally{a(void 0)}};return(0,X.jsxs)(P,{title:J(`connections`),description:J(`connectionsDescription`),children:[(0,X.jsx)(I,{message:l?void 0:s}),(0,X.jsx)(D,{message:d}),(0,X.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.map(e=>(0,X.jsxs)(`li`,{className:`flex flex-col gap-2 px-3 py-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(Mr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.label}),(0,X.jsx)(o,{size:`sm`,loading:i===e.key,disabled:i!==void 0,onClick:()=>void p(e.key,()=>t(e)),children:e.accounts.length>0?J(`connectAgain`,{name:e.label}):J(`connect`,{name:e.label})})]}),e.accounts.map(t=>(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 pl-7 text-sm`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 text-muted-foreground`,children:[J(`connectedOn`,{date:ke(Date.parse(t.created_at))}),` · `,(0,X.jsx)(`code`,{className:`text-xs`,children:t.id})]}),t.needs_sign_in?(0,X.jsx)(j,{tone:`amber`,children:J(`connectionNeedsSignIn`)}):(0,X.jsx)(j,{tone:`green`,children:J(`connected`)}),(0,X.jsx)(o,{size:`sm`,variant:`ghost`,onClick:()=>u({connection:e,accountId:t.id}),children:J(`disconnect`)})]}),t.used_by.length>0&&(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 pl-7 text-sm`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:J(`connectionUsedBy`)}),t.used_by.map(e=>(0,X.jsx)(te,{resource:`workflows`,recordKey:e.id,className:`font-medium text-primary-text hover:underline`,children:e.name},e.id))]})]},t.id))]},e.key))}),l&&(0,X.jsx)(z,{title:J(`disconnectTitle`,{name:l.connection.label}),description:Vs(l.connection)?`${J(`disconnectDescription`)} ${J(`disconnectWholeGrant`)}`:J(`disconnectDescription`),onClose:()=>u(void 0),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{onClick:()=>u(void 0),children:J(`cancel`)}),(0,X.jsx)(o,{variant:`danger`,loading:i===l.accountId,onClick:()=>void p(l.accountId,async()=>f(J(Bs[await n(l.accountId)]))),children:J(`disconnect`)})]}),children:s&&(0,X.jsx)(I,{message:s})})]})},Us=()=>{let{session:e,connectAccount:t}=V(),{account:n}=e,[r]=(0,Y.useState)(Cn),{data:i,error:a,reload:o}=p((0,Y.useCallback)(()=>n.workflowConnections(),[n]),J(`couldNotReadMethods`));return i?i.length===0?null:(0,X.jsx)(Hs,{connections:i,onConnect:t,onDisconnect:e=>n.disconnectAccount(e).finally(o),error:r&&et(r,J(`theProvider`))}):(0,X.jsx)(F,{error:a})},Ws=e=>e.code===`LAST_ADMIN`?J(`deleteAccountLastAdmin`):e.code===`ACCOUNT_LOCKED`?J(`deleteAccountLocked`):A(e),Gs=({hasPassword:e,onDelete:t,onClose:n})=>{let[r,i]=(0,Y.useState)(``),[a,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(),[u,d]=(0,Y.useState)(!1),f=(0,Y.useId)(),p=async()=>{s(!0),l(void 0),d(!1);try{await t(e?r:void 0)}catch(e){if(!(e instanceof G))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?d(!0):l(Ws(e)),s(!1)}};return(0,X.jsxs)(z,{title:J(`deleteAccountQuestion`),description:J(`deleteAccountWarning`),onClose:n,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{onClick:n,children:J(`cancel`)}),(0,X.jsx)(o,{variant:`danger`,type:`submit`,form:f,loading:a,disabled:e&&!r,children:J(`deleteAccountConfirm`)})]}),children:[(0,X.jsxs)(`form`,{id:f,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),p()},children:[e&&(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[J(`deleteAccountPassword`),(0,X.jsx)(N,{type:`password`,name:`current-password`,autoComplete:`current-password`,autoFocus:!0,value:r,invalid:!!c,onChange:e=>i(e.target.value)})]}),(0,X.jsx)(I,{message:c})]}),u&&(0,X.jsx)(yt,{purpose:`change`,minutes:15,onConfirmed:()=>void p()})]})},Ks=({hasPassword:e,staff:t,onDelete:n})=>{let[r,i]=(0,Y.useState)(!1);return(0,X.jsxs)(P,{title:J(`deleteAccount`),description:J(t?`deleteAccountStaff`:`deleteAccountDescription`),children:[!t&&(0,X.jsx)(o,{variant:`danger`,onClick:()=>i(!0),children:J(`deleteAccount`)}),r&&(0,X.jsx)(Gs,{hasPassword:e,onDelete:n,onClose:()=>i(!1)})]})},qs=()=>{let{session:e,state:t,deleteAccount:n}=V(),{account:r}=e,{data:i,error:a}=p((0,Y.useCallback)(()=>r.signInMethods(),[r]),J(`couldNotReadMethods`));return i?(0,X.jsx)(Ks,{hasPassword:i.account.password,staff:t.kind===`signed-in`&&!!t.staff,onDelete:n}):(0,X.jsx)(F,{error:a})},Js=[[/Edg(e|A|iOS)?\//,`Edge`],[/OPR\/|Opera/,`Opera`],[/SamsungBrowser\//,`Samsung Internet`],[/Firefox\/|FxiOS\//,`Firefox`],[/Chrome\/|CriOS\//,`Chrome`],[/Safari\//,`Safari`]],Ys=[[/iPhone/,`iPhone`],[/iPad/,`iPad`],[/Android/,`Android`],[/CrOS/,`ChromeOS`],[/Windows/,`Windows`],[/Mac OS X|Macintosh/,`macOS`],[/Linux/,`Linux`]],Xs=(e,t)=>e.find(([e])=>e.test(t))?.[1],Zs=e=>e?{browser:Xs(Js,e),system:Xs(Ys,e)}:{},Qs=e=>e.device?J(`deviceThrough`,{device:e.device,provider:e.name}):e.name,$s=(e,t)=>{if(e.staff)return t?J(`staffOf`,{operator:t}):J(`staff`);let{browser:n,system:r}=Zs(e.userAgent);return n&&r?J(`browserOn`,{browser:n,system:r}):r?J(`aBrowserOn`,{system:r}):n??J(`unknownDevice`)},ec=e=>{if(e.staff)return Pr;let{system:t}=Zs(e.userAgent);return t===`iPhone`||t===`Android`?Ir:t===`iPad`?Rr:Ar},tc=e=>[...e].sort((e,t)=>Number(t.current)-Number(e.current)||t.createdAt.localeCompare(e.createdAt)),nc=(e,t)=>e.kind===`one`?J(`signOutDevice`,{name:$s(e.session,t)}):e.kind===`link`?J(`signOutDevice`,{name:Qs(e.link)}):J(`signOutOthersTitle`),rc=e=>J(e.kind===`one`?`signOutDeviceDescription`:e.kind===`link`?`signOutLinkedDeviceDescription`:`signOutOthersDescription`),ic=({sessions:e,operator:t,links:n=[],onSignOut:r,onSignOutOthers:a,onSignOutLink:s})=>{let[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(),[f,p]=(0,Y.useState)(),m=e.filter(e=>!n.some(t=>t.sessions.includes(e.token))),h=e.filter(e=>!e.current),g=e=>e.kind===`one`?r(e.session.token):e.kind===`link`?s(e.link.id):a(),_=async e=>{l(!0),d(void 0);try{await g(e),p(void 0)}catch(e){if(!(e instanceof G))throw e;d(A(e))}l(!1)},v=e=>{d(void 0),p(e)};return(0,X.jsxs)(P,{title:J(`devices`),description:J(`devicesDescription`),children:[m.length===0&&n.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:J(`noDevices`)}):(0,X.jsxs)(`ul`,{className:`divide-y rounded-md border`,children:[tc(m).map(e=>{let n=ec(e);return(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,X.jsx)(n,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`bdi`,{className:`truncate font-medium`,children:$s(e,t)}),e.current&&(0,X.jsx)(j,{tone:`green`,children:J(`thisDevice`)})]}),(0,X.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[J(`signedInFromUntil`,{from:i(Date.parse(e.createdAt)),until:i(Date.parse(e.expiresAt))}),!e.staff&&e.ipAddress&&` · ${e.ipAddress}`]})]}),!e.current&&(0,X.jsx)(o,{size:`sm`,variant:`ghost`,onClick:()=>v({kind:`one`,session:e}),children:J(`signOut`)})]},e.token)}),n.map(t=>{let n=e.some(e=>e.current&&t.sessions.includes(e.token));return(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,X.jsx)(Ir,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`bdi`,{className:`truncate font-medium`,children:Qs(t)}),n&&(0,X.jsx)(j,{tone:`green`,children:J(`thisDevice`)})]}),(0,X.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:J(`linkedOn`,{date:i(Date.parse(t.linkedAt))})})]}),!n&&s&&(0,X.jsx)(o,{size:`sm`,variant:`ghost`,onClick:()=>v({kind:`link`,link:t}),children:J(`signOut`)})]},t.id)})]}),h.length>0&&(0,X.jsx)(o,{className:`mt-3`,onClick:()=>v({kind:`others`}),children:J(`signOutOthers`)}),f&&(0,X.jsx)(z,{title:nc(f,t),description:rc(f),onClose:()=>p(void 0),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{onClick:()=>p(void 0),children:J(`cancel`)}),(0,X.jsx)(o,{variant:`danger`,loading:c,onClick:()=>void _(f),children:J(`signOut`)})]}),children:(0,X.jsx)(I,{message:u})})]})},ac=()=>{let{session:e,staffSignIn:t,deviceLinks:n}=V(),{account:r}=e,i=(0,Y.useCallback)(async()=>{let[e,t]=await Promise.all([r.sessions(),n?r.deviceLinks():[]]);return{sessions:e,links:t}},[r,n]),{data:a,error:o,reload:s}=p(i,J(`couldNotReadDevices`));return a?(0,X.jsx)(ic,{sessions:a.sessions,links:a.links,operator:t,onSignOut:e=>r.revokeSession(e).then(s),onSignOutOthers:()=>r.revokeOtherSessions().then(s),onSignOutLink:e=>r.signOutDeviceLink(e).then(s)}):(0,X.jsx)(F,{error:o})},oc={allowed:`passkeysAllowed`,required:`passkeysRequired`,forbidden:`passkeysForbidden`},sc=({rule:e,passkeys:t,onAdd:n,onRename:r,onRemove:i})=>{let[a,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(),[u,d]=(0,Y.useState)(),[f,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(),g=e===`required`&&t.length<=1,_=async e=>{s(!0),l(void 0),h(void 0);try{await e(),d(void 0)}catch(e){if(!(e instanceof G))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?h(`asked`):l(A(e))}s(!1)};return(0,X.jsxs)(P,{title:J(`passkeys`),status:e===`required`&&(0,X.jsx)(j,{tone:`blue`,children:J(`required`)}),description:J(oc[e]),children:[(0,X.jsx)(I,{message:u?void 0:c}),t.length>0&&(0,X.jsx)(`ul`,{className:`mb-3 divide-y rounded-md border`,children:t.map(e=>(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,X.jsx)(Dt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block truncate font-medium`,children:e.name??J(`passkey`)}),(0,X.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[e.createdAt?J(`addedOn`,{date:ke(Date.parse(e.createdAt))}):J(`addedEarlier`),` · `,e.backedUp?J(`synced`):J(`oneDevice`)]})]}),(0,X.jsxs)(`span`,{className:`flex gap-1`,children:[(0,X.jsx)(o,{size:`sm`,variant:`ghost`,onClick:()=>{p(e.name??``),d({kind:`rename`,passkey:e})},children:J(`rename`)}),(0,X.jsx)(o,{size:`sm`,variant:`ghost`,disabled:g,title:g?J(`keepLastPasskey`):void 0,onClick:()=>d({kind:`remove`,passkey:e}),children:J(`remove`)})]})]},e.id))}),e!==`forbidden`&&(0,X.jsxs)(o,{loading:a&&!u,onClick:()=>void _(n),children:[(0,X.jsx)(ht,{className:`size-3.5`}),J(`addPasskey`)]}),m===`asked`&&(0,X.jsx)(yt,{purpose:`change`,withPassword:!0,minutes:15,onConfirmed:()=>h(`done`)}),m===`done`&&(0,X.jsx)(`p`,{className:`mt-2 text-muted-foreground`,children:J(`confirmedAddPasskey`)}),u?.kind===`rename`&&(0,X.jsxs)(z,{title:J(`renamePasskey`),description:J(`renamePasskeyDescription`),onClose:()=>d(void 0),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{onClick:()=>d(void 0),children:J(`cancel`)}),(0,X.jsx)(o,{variant:`primary`,loading:a,disabled:!f.trim(),onClick:()=>void _(()=>r(u.passkey.id,f.trim())),children:J(`save`)})]}),children:[(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[J(`name`),(0,X.jsx)(N,{autoFocus:!0,value:f,maxLength:60,onChange:e=>p(e.target.value)})]}),(0,X.jsx)(I,{message:c})]}),u?.kind===`remove`&&(0,X.jsx)(z,{title:J(`removePasskey`),description:J(`removePasskeyDescription`,{name:u.passkey.name??J(`thisPasskey`)}),onClose:()=>d(void 0),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{onClick:()=>d(void 0),children:J(`cancel`)}),(0,X.jsx)(o,{variant:`danger`,loading:a,onClick:()=>void _(()=>i(u.passkey.id)),children:J(`remove`)})]}),children:c&&(0,X.jsx)(I,{message:c})})]})},cc=()=>{let{account:e}=V().session,t=(0,Y.useCallback)(()=>Promise.all([e.signInMethods(),e.passkeys()]),[e]),{data:n,error:r,reload:i}=p(t,J(`couldNotReadMethods`));if(!n)return(0,X.jsx)(F,{error:r});let[a,o]=n;return(0,X.jsx)(sc,{rule:a.policy.passkey,passkeys:o,onAdd:()=>e.addPasskey().then(i),onRename:(t,n)=>e.renamePasskey(t,n).then(i),onRemove:t=>e.removePasskey(t).then(i)})},lc=e=>e.code===`PASSWORD_TOO_SHORT`?J(`useAtLeast`,{length:12}):e.code===`PASSWORD_TOO_LONG`?J(`passwordTooLong`):A(e),uc=(e,t)=>{if(e.length<12)return J(`useAtLeast`,{length:12});if(e!==t)return J(`passwordsDiffer`)},dc=({hasPassword:e,onSave:t,onClose:n})=>{let[r,i]=(0,Y.useState)(``),[a,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(),m=(0,Y.useId)(),h=(!e||r)&&a&&c,g=async()=>{let e=uc(a,c);if(p(e),!e){d(!0);try{await t({current:r,next:a})}catch(e){if(!(e instanceof G))throw e;p(lc(e)),d(!1)}}};return(0,X.jsx)(z,{title:J(e?`changePassword`:`setPassword`),description:J(`atLeast`,{length:12}),onClose:n,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{onClick:n,children:J(`cancel`)}),(0,X.jsx)(o,{variant:`primary`,type:`submit`,form:m,loading:u,disabled:!h,children:J(`save`)})]}),children:(0,X.jsxs)(`form`,{id:m,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),g()},children:[e&&(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[J(`currentPassword`),(0,X.jsx)(N,{type:`password`,name:`current-password`,autoComplete:`current-password`,autoFocus:!0,value:r,onChange:e=>i(e.target.value)})]}),(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[J(`newPassword`),(0,X.jsx)(N,{type:`password`,name:`new-password`,autoComplete:`new-password`,autoFocus:!e,value:a,invalid:!!f,onChange:e=>s(e.target.value)})]}),(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[J(`repeatPassword`),(0,X.jsx)(N,{type:`password`,name:`repeat-password`,autoComplete:`new-password`,value:c,invalid:!!f,onChange:e=>l(e.target.value)})]}),e&&(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:J(`changeSignsOutOthers`)}),(0,X.jsx)(I,{message:f})]})})},fc=({rule:e,hasPassword:t,staff:n})=>J(n?`passwordStaff`:e===`forbidden`?`passwordForbidden`:t?`passwordIsSet`:`passwordNotSet`),pc=({rule:e,hasPassword:t,staff:n,onChange:r,onSet:i})=>{let[a,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(!1),u=!n&&e===`allowed`;return(0,X.jsxs)(P,{title:J(`password`),description:fc({rule:e,hasPassword:t,staff:n}),children:[(0,X.jsx)(D,{message:c?J(`passwordSaved`):void 0}),u&&(0,X.jsx)(o,{onClick:()=>{l(!1),s(!0)},children:J(t?`changePassword`:`setPassword`)}),a&&(0,X.jsx)(dc,{hasPassword:t,onClose:()=>s(!1),onSave:async({current:e,next:n})=>{await(t?r(e,n):i(n)),s(!1),l(!0)}})]})},mc=()=>{let{session:e,state:t}=V(),{account:n}=e,{data:r,error:i,reload:a}=p((0,Y.useCallback)(()=>n.signInMethods(),[n]),J(`couldNotReadMethods`));return r?(0,X.jsx)(pc,{rule:r.policy.password,hasPassword:r.account.password,staff:t.kind===`signed-in`&&!!t.staff,onChange:(e,t)=>n.changePassword(e,t).then(a),onSet:e=>n.setPassword(e).then(a)}):(0,X.jsx)(F,{error:i})},hc=({email:e,change:t,onDone:n,onClose:r})=>{let[i,a]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(),h=async e=>{f(!0),m(void 0);try{await e()}catch(e){if(!(e instanceof G))throw e;m(A(e))}f(!1)},g=i.trim(),_=()=>h(async()=>{await t.request(g),u(``),c(g)}),v=e=>h(async()=>{await t.confirm(s,e),n()});return s?(0,X.jsxs)(z,{title:J(`changeEmail`),description:J(`codeSentTo`,{email:s,minutes:10}),onClose:r,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{variant:`ghost`,onClick:()=>{c(void 0),m(void 0)},children:J(`otherAddress`)}),(0,X.jsx)(o,{variant:`primary`,loading:d,disabled:l.length<6,onClick:()=>void v(l),children:J(`changeEmail`)})]}),children:[(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[J(`code`),(0,X.jsx)(tn,{name:`code`,required:!0,autoFocus:!0,value:l,invalid:!!p,onChange:u,onComplete:e=>!d&&void v(e)})]}),(0,X.jsx)(I,{message:p})]}):(0,X.jsxs)(z,{title:J(`changeEmail`),description:J(`changeEmailDescription`),onClose:r,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{onClick:r,children:J(`cancel`)}),(0,X.jsx)(o,{variant:`primary`,loading:d,disabled:!g||g.toLowerCase()===e.toLowerCase(),onClick:()=>void _(),children:J(`sendCode`)})]}),children:[(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[J(`newEmail`),(0,X.jsx)(N,{type:`email`,autoComplete:`email`,autoFocus:!0,value:i,onChange:e=>a(e.target.value)})]}),(0,X.jsx)(I,{message:p})]})},gc=({name:e,email:t,onRename:n,emailChange:r,onEmailChanged:i})=>{let[a,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(),g=async()=>{p(!0),h(void 0);try{await n(u.trim()),s(!1)}catch(e){if(!(e instanceof G))throw e;h(A(e))}p(!1)};return(0,X.jsxs)(P,{title:J(`profile`),description:J(`profileDescription`),children:[(0,X.jsxs)(`dl`,{className:`mb-3 grid grid-cols-[auto_1fr] gap-x-6 gap-y-1.5`,children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:J(`name`)}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate font-medium`,children:e}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:J(`email`)}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate font-medium`,children:t})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(o,{onClick:()=>{d(e),h(void 0),s(!0)},children:J(`changeName`)}),r&&(0,X.jsx)(o,{onClick:()=>l(!0),children:J(`changeEmail`)})]}),a&&(0,X.jsxs)(z,{title:J(`changeName`),description:J(`changeNameDescription`),onClose:()=>s(!1),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{onClick:()=>s(!1),children:J(`cancel`)}),(0,X.jsx)(o,{variant:`primary`,loading:f,disabled:!u.trim()||u.trim()===e,onClick:()=>void g(),children:J(`save`)})]}),children:[(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[J(`name`),(0,X.jsx)(N,{autoFocus:!0,value:u,maxLength:100,onChange:e=>d(e.target.value)})]}),(0,X.jsx)(I,{message:m})]}),c&&r&&(0,X.jsx)(hc,{email:t,change:r,onClose:()=>l(!1),onDone:()=>{l(!1),i?.()}})]})},_c=()=>{let{session:e,changeEmail:t}=V(),{data:n,loaded:r,error:i,reload:a}=p((0,Y.useCallback)(()=>e.session(),[e]),J(`couldNotReadProfile`));if(!r)return(0,X.jsx)(F,{error:i});if(!n)return null;let o=t?{request:e.account.requestEmailChange,confirm:e.account.changeEmail}:void 0;return(0,X.jsx)(gc,{name:n.name,email:n.email,onRename:t=>e.account.updateName(t).then(a),emailChange:o,onEmailChanged:a})},vc=({title:e,description:t,confirmLabel:n,danger:r,needsPassword:i,onConfirm:a,onClose:s})=>{let[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(),[m,h]=(0,Y.useState)(!1),g=async()=>{d(!0),p(void 0),h(!1);try{await a(i?c:void 0)}catch(e){if(!(e instanceof G))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?h(!0):p(A(e)),d(!1)}};return(0,X.jsxs)(z,{title:e,description:t,onClose:s,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{onClick:s,children:J(`cancel`)}),(0,X.jsx)(o,{variant:r?`danger`:`primary`,loading:u,disabled:i&&!c,onClick:()=>void g(),children:n})]}),children:[i&&(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[J(`yourPassword`),(0,X.jsx)(N,{type:`password`,autoComplete:`current-password`,autoFocus:!0,value:c,invalid:!!f,onChange:e=>l(e.target.value),onKeyDown:e=>e.key===`Enter`&&c&&void g()})]}),f&&(0,X.jsx)(`p`,{role:`alert`,className:`mt-2 text-body font-medium text-danger-text`,children:f}),m&&(0,X.jsx)(yt,{purpose:`change`,minutes:15,onConfirmed:()=>void g()})]})},yc={allowed:`twoFactorAllowed`,required:`twoFactorRequired`,forbidden:`twoFactorForbidden`},bc=e=>{let{rule:t,enabled:n,authenticatorApp:r,mail:i,needsPassword:a,onTurnOff:s,onNewBackupCodes:c,onChanged:l}=e,[u,d]=(0,Y.useState)(),f=()=>d(void 0),p=n?(0,X.jsx)(j,{tone:`green`,children:J(`on`)}):t===`required`?(0,X.jsx)(j,{tone:`amber`,children:J(`required`)}):(0,X.jsx)(j,{children:J(`off`)}),m=J(n?r?i?`twoFactorOnWithAppOrMail`:`twoFactorOnWithApp`:`twoFactorOnWithMail`:yc[t]);return u?.kind===`setup`?(0,X.jsx)(P,{title:J(`twoFactor`),status:p,description:m,children:(0,X.jsx)(`div`,{className:`max-w-sm`,children:(0,X.jsx)(tt,{offerEmailedCodes:i&&!u.appOnly,needsPassword:a,onStartApp:e.onStartApp,onConfirmApp:e.onConfirmApp,onEmailedCodes:e.onEmailedCodes,onCancel:f,onDone:()=>{f(),l()}})})}):(0,X.jsxs)(P,{title:J(`twoFactor`),status:p,description:m,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[!n&&t!==`forbidden`&&(0,X.jsx)(o,{variant:`primary`,onClick:()=>d({kind:`setup`,appOnly:!1}),children:J(`turnOn`)}),n&&!r&&t!==`forbidden`&&(0,X.jsx)(o,{onClick:()=>d({kind:`setup`,appOnly:!0}),children:J(`addAuthenticator`)}),n&&r&&(0,X.jsx)(o,{onClick:()=>d({kind:`new-codes`}),children:J(`newBackupCodes`)}),n&&(0,X.jsx)(o,{variant:`danger`,disabled:t===`required`,title:t===`required`?J(`twoFactorIsRequired`):void 0,onClick:()=>d({kind:`turn-off`}),children:J(`turnOff`)})]}),u?.kind===`turn-off`&&(0,X.jsx)(vc,{title:J(`turnOffTitle`),description:J(`turnOffDescription`),confirmLabel:J(`turnOff`),danger:!0,needsPassword:a,onClose:f,onConfirm:async e=>{await s(e),f(),l()}}),u?.kind===`new-codes`&&(0,X.jsx)(vc,{title:J(`newCodesTitle`),description:J(`newCodesDescription`),confirmLabel:J(`makeNewCodes`),needsPassword:a,onClose:f,onConfirm:async e=>d({kind:`codes`,codes:await c(e)})}),u?.kind===`codes`&&(0,X.jsx)(z,{title:J(`yourNewCodes`),description:J(`keepCodesSafe`),onClose:f,actions:(0,X.jsx)(o,{variant:`primary`,onClick:f,children:J(`savedCodes`)}),children:(0,X.jsx)(Oe,{codes:u.codes})})]})},xc=()=>{let{account:e}=V().session,{data:t,error:n,reload:r}=p((0,Y.useCallback)(()=>e.signInMethods(),[e]),J(`couldNotReadMethods`));return t?(0,X.jsx)(bc,{rule:t.policy.twoFactor,enabled:t.account.twoFactor,authenticatorApp:t.account.authenticatorApp,mail:t.mail,needsPassword:t.account.password,onStartApp:t=>e.startAuthenticatorApp(t),onConfirmApp:t=>e.confirmAuthenticatorApp(t),onEmailedCodes:t=>e.turnOnEmailedCodes(t),onTurnOff:t=>e.turnOffTwoFactor(t),onNewBackupCodes:t=>e.newBackupCodes(t),onChanged:r}):(0,X.jsx)(F,{error:n})},Sc=({problem:e,fallback:t})=>t===void 0?(0,X.jsx)(Be,{children:e}):(0,X.jsxs)(X.Fragment,{children:[!1,t]}),Cc=({name:e,registered:t,fallback:n,children:r})=>t?(0,X.jsx)(We,{name:e,fallback:n===void 0?void 0:(0,X.jsx)(Sc,{problem:O.rich(`couldNotDraw`,{name:e}),fallback:n}),children:r}):(0,X.jsx)(Sc,{problem:O.rich(`noComponent`,{component:e}),fallback:n}),wc={Page:Pa,Grid:ua,Card:ri,Stat:yo,RecordCard:Ra,Field:aa,Diff:na,Table:wo,CardRow:si,RecordRow:ro,RecordCards:$a,Chart:ci,Timeline:qi,Graph:Zi,Progress:Ia,Image:va,ModalForm:Na,Thread:Zo,Composer:$i,Action:ni,Show:fo,Switch:mo,Match:ho,Link:Oa,Settings:so,Tabs:Eo,Tab:Do,Users:_s,Profile:_c,Password:mc,Passkeys:cc,TwoFactor:xc,ConnectedAccounts:Pe,PersonalMail:Cs,Connections:Us,Devices:ac,ConnectedApps:js,PersonalAccessTokens:zs,DeleteAccount:qs,Box:Qo,Row:$o,Column:es,Text:ts,ReferenceManyField:os,ReferenceArrayField:cs,ArrayField:ns,RecordsIterator:ai,ReferenceField:us,SelectInput:rs,Details:ea,Summary:ta,TextField:xa,NumberField:Sa,DateField:Ca,BooleanField:wa,UrlField:Ta,ChipField:Ea},Tc=new Set(`Page.Grid.Card.Stat.RecordCard.Field.Diff.Table.CardRow.RecordRow.RecordCards.Chart.Timeline.Graph.Progress.Image.Thread.Link.Tabs.Settings.Show.Switch.Action.Box.Row.Column.Text.ReferenceField.SelectInput.Details.Summary.TextField.NumberField.DateField.BooleanField.UrlField.ChipField`.split(`.`)),Ec=(e,t,...n)=>e.map((e,r)=>({child:e,...t!==void 0&&{at:pt(t,...n,r)}})),Dc=({text:e})=>{let t=q(),n=Ae(),r={...B(t),params:n};return(0,X.jsx)(X.Fragment,{children:ze(e,e=>me(hn(r,e)))})},Oc=(e,t)=>e.includes(`{{`)?(0,X.jsx)(Dc,{text:e},t):(0,X.jsx)(Y.Fragment,{children:e},t),kc=e=>e.map(({child:e,at:t},n)=>typeof e==`string`?Oc(e,n):(0,X.jsx)(Ic,{node:e,at:t},n)),Ac=e=>{let t=[];for(let n of e){let e=t.at(-1);Hr(n.child)&&e&&Hr(e[0].child)?e.push(n):t.push([n])}return t.map((e,t)=>{let[n]=e;return Hr(n.child)?(0,X.jsx)(`p`,{className:`leading-6`,children:kc(e)},t):(0,X.jsx)(Ic,{node:n.child,at:n.at},t)})},jc=e=>T(e)||Array.isArray(e)&&e.length>0&&e.every(T),Mc=(e,t)=>Object.fromEntries(Object.entries(e.props).flatMap(([e,n])=>jc(n)?[[e,(0,X.jsx)(X.Fragment,{children:Ac(Nc(n,t,e))})]]:[])),Nc=(e,t,n)=>Array.isArray(e)?Ec(e,t,`props`,n):[{child:e,...t!==void 0&&{at:pt(t,`props`,n)}}],Pc=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Fc=(e,t)=>{let n=Pc(e.props.components)?e.props.components:{},r=Object.fromEntries(Object.entries(n).flatMap(([e,t])=>T(t)?[[e,e=>({...t,children:[...t.children,...e]})]]:[])),i=kt(t,String(e.props.i18nKey),Pc(e.props.values)?e.props.values:{},r);return Array.isArray(i)?i.map(e=>typeof e==`string`||T(e)?e:String(e)):[i]},Ic=({node:e,at:t})=>{let{components:n}=Lt(),r=q(),i=Ae(),a=bt(),o=(0,Y.useMemo)(()=>sn(Tt(e,{...B(r),params:i}),a),[e,r,i,a]);if(o.type===`Trans`&&!o.custom)return(0,X.jsx)(X.Fragment,{children:kc(Fc(o,a).map(e=>({child:e})))});if(o.custom){let e=n?.[o.type],r=o.children.length>0?(0,X.jsx)(Ji,{node:o,children:Ac(Ec(o.children,t,`children`))}):void 0;return(0,X.jsx)(Cc,{name:o.type,registered:!!e,fallback:o.fallback&&(0,X.jsx)(X.Fragment,{children:Ac(Ec(o.fallback,t,`fallback`))}),children:e&&(0,X.jsx)(Ze,{node:o,...t!==void 0&&{at:t},children:(0,X.jsx)(e,{...pn(o.props),children:r})})})}let s=wc[o.type];if(!s)return(0,X.jsx)(Be,{children:O.rich(`unknownBlock`,{type:o.type})});let c=typeof o.props.className==`string`?o.props.className:void 0,l=Ec(o.children,t,`children`),u=(0,X.jsx)(s,{node:o,at:t,slots:Mc(o,t),className:c,children:o.type===`Text`||o.type===`Link`||o.type===`Summary`?kc(l):Ac(o.type===`Switch`?l.filter(({child:e})=>typeof e!=`string`):l)}),d=c===void 0||Tc.has(o.type)?u:(0,X.jsx)(`div`,{className:c,children:u});return o.fallback?(0,X.jsx)(We,{name:o.type,resetKey:o,fallback:(0,X.jsx)(X.Fragment,{children:Ac(Ec(o.fallback,t,`fallback`))}),children:d}):d};export{bo as a,Ha as c,Yo as i,za as l,Cc as n,co as o,Xo as r,Za as s,Ic as t,Qi as u};
3
+ //# debugId=c4781a19-f62e-497f-b6a9-e1eaf452bbe9
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$s as r,Hc as i,Hi as a,Il as o,Jn as s,Kr as c,Ls as l,Ma as u,Nc as d,Oc as f,Pl as p,Qr as m,Rr as h,Rs as g,Ua as _,Vc as v,Vi as y,Xs as b,Yn as x,Zc as S,Zo as C,Zs as w,el as T,gi as E,il as D,is as O,ka as k,mr as A,on as j,vn as M}from"./app-B48LQpC1.js";import{h as N,o as P}from"./vendor-t7Q7QbPu.js";import{Q as F}from"./embedded-list-CdFZ5TIe.js";import{n as I}from"./lib-dnd-kit-sortable-CNDSKqCD.js";import{a as L,i as R,n as z,o as B,r as ee,s as V,t as H}from"./messages-lXPHUGLV.js";var U={name:`arrow-up-down`,size:24,node:[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]};U.node;var W=d(U),G={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};G.node;var K=d(G),q=e(t(),1),J=i(`app/delete`),Y=p(),X=({blockingPlural:e,noun:t})=>J(`stillPointAt`,{plural:e,noun:t}),Z=({blockedBy:e,resources:t,views:n,noun:r,key:i})=>{let{resource:a,field:s}=e;if(!t[a])return;let c=n[a]?.names?.plural??T(a),l=X({blockingPlural:c,noun:r});if(!s||i===void 0)return{text:l};let u={kind:`list`,resource:a,filter:o(Y.eq(s,i))};return{text:l,link:{label:J(`show`,{plural:c}),to:u}}},Q=e(n(),1),te=({title:e,noun:t,busy:n,onConfirm:i,onCancel:a})=>(0,Q.jsx)(w,{title:J(`confirmTitle`,{title:e}),description:J(`confirmDescription`,{noun:t,title:e}),onClose:a,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(r,{onClick:a,children:J(`cancel`)}),(0,Q.jsx)(r,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,loading:n,onClick:i,children:J(`delete`)})]})}),ne=({title:e,changes:t,busy:n,onReview:i,onDeleteAnyway:a,onCancel:o})=>(0,Q.jsx)(w,{title:J(`changedTitle`,{title:e}),description:J(`changedDescription`),onClose:o,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(r,{onClick:i,children:J(`reviewChanges`)}),(0,Q.jsx)(r,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,loading:n,onClick:a,children:J(`deleteAnyway`)})]}),children:t.length===0?(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:J(`noVisibleChanges`)}):(0,Q.jsx)(`ul`,{className:`divide-y rounded-md border`,children:t.map(e=>(0,Q.jsxs)(`li`,{className:`grid grid-cols-[96px_1fr] gap-3 px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e.label}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground line-through`,children:e.before}),` `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e.after})]})]},e.field))})}),$=e=>{if(e.stage===`confirm`)return(0,Q.jsx)(w,{title:J(`bulkConfirmTitle`,{count:e.count,noun:e.noun,plural:e.plural}),description:J(`bulkConfirmDescription`),onClose:e.onCancel,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(r,{onClick:e.onCancel,children:J(`cancel`)}),(0,Q.jsx)(r,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,onClick:e.onConfirm,children:J(`deleteCount`,{count:e.count})})]})});if(e.stage===`running`)return(0,Q.jsx)(w,{title:J(`deleting`),description:J(`progress`,{done:e.done,total:e.total}),onClose:()=>void 0,actions:(0,Q.jsx)(r,{loading:!0,disabled:!0,children:J(`working`)})});let t=e.total-e.failures.length;return(0,Q.jsx)(w,{title:e.failures.length===0?J(`deleted`,{count:t}):J(`deletedOf`,{count:t,total:e.total}),description:e.failures.length===0?void 0:J(`kept`,{count:e.failures.length}),onClose:e.onClose,actions:(0,Q.jsx)(r,{variant:`primary`,onClick:e.onClose,children:J(`done`)}),children:e.failures.length>0&&(0,Q.jsx)(`ul`,{className:`max-h-48 divide-y overflow-y-auto rounded-md border`,children:e.failures.map(e=>(0,Q.jsxs)(`li`,{className:`px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.title}),(0,Q.jsx)(`span`,{className:`block text-xs text-danger-text`,children:e.message})]},e.title))})})},re=new Set([`updated_at`,`updatedAt`]),ie=(e,t,n,r)=>Object.values(e.fields).flatMap(e=>{if(re.has(e.name)||JSON.stringify(n[e.name]??null)===JSON.stringify(r[e.name]??null))return[];let i=t?.fields[e.name];return[{field:e.name,label:i?.label??T(e.name),before:E(e,n[e.name],i),after:E(e,r[e.name],i)}]}),ae=4,oe=({model:e,view:t,onDeleted:n,onReview:r,restore:i})=>{let a=O(),o=N(),s=u(),[c,d]=(0,q.useState)(),[f,p]=(0,q.useState)(!1),m=t?.names?.singular??T(e.name),_=t?.names?.plural??T(e.name),{resources:v,views:y}=C(),{href:b,open:x}=h(),S=(t,n)=>t.blockedBy&&Z({blockedBy:t.blockedBy,resources:v,views:y,noun:m,...e.primaryKey.length===1&&{key:n.key}}),w=()=>{for(let t of[`page`,`list`,`first-page`,`map`])o.invalidateQueries({queryKey:[t,e.name]});for(let t of[`facets`,`series`,`aggregate`,`histogram`,`count`])o.invalidateQueries({queryKey:[t,e.name]})},E=async(t,n)=>{let r=n??(await a.get(e.name,t.key)).etag;try{await a.remove(e.name,t.key,{etag:r})}catch(e){if(!(e instanceof l))throw e;return e}},D=t=>{w(),d(void 0),n?.(t),s.show({state:`success`,title:J(`deletedToast`,{title:t.title}),...e.softDelete&&i&&{action:{label:J(`undo`),onClick:()=>{i(t).then(()=>{w(),s.show({state:`success`,title:J(`restored`,{title:t.title})})},e=>{if(!g(e))throw e;w(),s.show({state:e.status===409?`success`:`error`,title:e.status===409?J(`alreadyBack`,{title:t.title}):J(`couldNotRestore`,{title:t.title}),description:e.status===409?void 0:e.message})})}}}})},k=async(n,r)=>{p(!0);try{if(!await E(n,r))return D(n);let i=(await a.get(e.name,n.key)).record;d({kind:`conflict`,target:n,fresh:i,changes:ie(e,t,n.snapshot,i)})}catch(e){if(!g(e))throw e;d(void 0);let t=S(e,n);s.show({state:`error`,title:J(`couldNotDelete`,{title:n.title}),description:t?.text??e.message,...t?.link&&{action:{label:t.link.label,href:b(t.link.to),onNavigate:x}}})}finally{p(!1)}},A=async e=>{try{return await E(e,e.etag)?{title:e.title,message:J(`changedSinceLoaded`)}:void 0}catch(t){if(!g(t))throw t;return{title:e.title,message:S(t,e)?.text??t.message}}},j=async e=>{let t=[],n=[],r=0;d({kind:`bulk-running`,done:r,total:e.length});let i=[...e];return await Promise.all(Array.from({length:Math.min(ae,e.length)},async()=>{for(let a=i.shift();a;a=i.shift()){let i=await A(a);i&&(t.push(i),n.push(a)),r+=1,d({kind:`bulk-running`,done:r,total:e.length})}})),w(),d({kind:`bulk-done`,total:e.length,failures:t}),n},M=()=>d(void 0);return{dialogs:c&&(0,Q.jsxs)(Q.Fragment,{children:[c.kind===`confirm`&&(0,Q.jsx)(te,{title:c.target.title,noun:m,busy:f,onCancel:M,onConfirm:()=>void k(c.target,c.target.etag)}),c.kind===`conflict`&&(0,Q.jsx)(ne,{title:c.target.title,changes:c.changes,busy:f,onCancel:M,onReview:()=>{M(),r?.(c.target,c.fresh)},onDeleteAnyway:()=>void k(c.target,`*`)}),c.kind===`bulk-confirm`&&(0,Q.jsx)($,{stage:`confirm`,count:c.targets.length,noun:m,plural:_,onCancel:()=>{M(),c.settle(c.targets)},onConfirm:()=>c.settle(j(c.targets))}),c.kind===`bulk-running`&&(0,Q.jsx)($,{stage:`running`,done:c.done,total:c.total}),c.kind===`bulk-done`&&(0,Q.jsx)($,{stage:`done`,total:c.total,failures:c.failures,onClose:M})]}),start:t=>e.softDelete?k(t,t.etag):d({kind:`confirm`,target:t}),startBulk:e=>new Promise(t=>d({kind:`bulk-confirm`,targets:e,settle:t}))}},se=e=>{let t=O();return e.softDelete?async n=>void await t.undelete(e.name,n.key):void 0},ce=(e,t,n)=>({order:r,index:i})=>{let o=t=>r.findIndex(n=>D(a(e,n))===t),s=t.after.find(e=>o(e.key)>i);if(s)return H(`dependsOn`,{record:n,other:s.title});let c=t.before.find(e=>o(e.key)!==-1&&o(e.key)<i);return c?H(`dependsOn`,{record:c.title,other:n}):void 0},le=(e,t,n,r)=>{let i=e[t],a;for(let o=n;o<e.length;o++){let n=r({record:i,order:I(e,t,o),index:o});if(n===void 0)return{to:o,...a!==void 0&&{reason:a}};a??=n}return{to:t,reason:a}},ue=({model:e,view:t,field:n,filter:r,fields:i,rule:a})=>{let o=O(),l=u(),d=M(),{resources:f,views:p}=C(),m=`${n} asc`,h=P({queryKey:[...v.list(e.name,r,m,500,`hand-order`),i.join(`,`)],queryFn:async()=>{let t=s(f,p,e,i),n=[],a=``;do{let s=await o.search(e.name,{filter:r||void 0,orderBy:m,pageSize:500,labels:t,...a&&{pageToken:a}});n.push(...x(f,e,i,s.items,s.labels).map((t,n)=>({...t,id:y(e,s.items[n])}))),a=s.nextPageToken}while(a);return n}}),[g,_]=(0,q.useState)(),b=(0,q.useRef)(void 0),w=(0,q.useRef)([]),T=(0,q.useRef)(void 0),E=(0,q.useRef)(Promise.resolve()),D=(0,q.useRef)(0),k=(0,q.useRef)(void 0),A=async()=>{let t=b.current,r=w.current;if(w.current=[],!t||r.length===0)return;let i=await o.batchWrite(r),a=new Map(i.results.flatMap(e=>e.op===`move`?e.records:[]).map(t=>[y(e,t.record),t])),s=z(i.results,t=>y(e,t)),c=L(e,[...a].map(([e,t])=>({...t,before:{[n]:s.get(e)}})),[n]);k.current!==void 0&&l.dismiss(k.current),k.current=l.show({state:`success`,title:V(`orderChanged`),action:{label:V(`undo`),onClick:()=>W(c)}}),b.current&&=b.current.map(e=>{let t=a.get(e.id);return t?{...e,[n]:t.record[n],etag:t.etag}:e})},j=(e,t)=>n=>{b.current=void 0,w.current=[],_(void 0),l.show(B(n,e,{place:`list`,title:t?T.current:void 0}))},N=async()=>{--D.current,!(D.current>0)&&(await d(e.name),!(D.current>0)&&(b.current=void 0,_(void 0)))},F=(n,r)=>{let i=b.current??h.data;if(!i||n===r)return;if(!e.position?.after)return H(i,n,r,a);let s=c(e,i[n]).record,l=i[n].id;R(o,e,t,s).then(n=>{let i=b.current??h.data,o=ce(e,n,S(e,t,s,l));H(i,i.findIndex(e=>e.id===l),r,e=>o(e)??a?.(e))},j(V(`couldNotChange`),!1))},H=(i,a,o,s)=>{if(a===-1||a===o)return;let l=s?U(i,a,o,s):o;a!==l&&(b.current=I(i,a,l),w.current=[...w.current,ee(e,n,r,b.current,l)],_(b.current),D.current+=1,T.current=S(e,t,c(e,i[a]).record,i[a].id),E.current=E.current.then(A).catch(j(V(`couldNotChange`),!0)).then(N))},U=(t,n,r,i)=>{let a=le(t.map(t=>c(e,t).record),n,r,i);return a.reason!==void 0&&l.show({state:`warning`,title:a.to===n?V(`notMoved`):V(`movedToPlace`,{place:a.to+1}),description:a.reason}),a.to},W=e=>{k.current!==void 0&&l.dismiss(k.current),k.current=void 0,D.current+=1,E.current=E.current.then(async()=>{await o.batchWrite(e),b.current=void 0,w.current=[],_(void 0)}).catch(j(V(`couldNotUndo`),!1)).then(N)};return{rows:g??h.data,loading:h.isPending,error:h.error,move:F}},de=({model:e,view:t,field:n,filter:r,columns:i,sort:o})=>{let{resources:s,views:c}=C(),{fields:l,dropRules:u}=k(),{go:d,href:f}=h(),p=o!==void 0,g=(0,q.useMemo)(()=>j(e,t,i,{resources:s,views:c,fieldTypes:l}).map(e=>p?e:{...e,sortable:!1}),[e,t,i.join(`,`),s,c,l,p]),v=(0,q.useMemo)(()=>m(e,t,g.map(e=>e.id)),[e,t,g]),y=t?.list?.drag?.rule,x=y===void 0?void 0:u?.[y],w=ue({model:e,view:t,field:n,filter:r,fields:v,...x&&{rule:x}}),T=w.rows,E=(0,q.useMemo)(()=>T&&{total:T.length,rowAt:e=>T[e]},[T]);if(y!==void 0&&!x)return(0,Q.jsx)(_,{children:V.rich(`noRule`,{rule:y})});if(w.loading)return(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from({length:3},(e,t)=>(0,Q.jsx)(b,{className:`h-4 w-full`},t))});if(w.error)return(0,Q.jsx)(A,{title:V(`couldNotLoad`),error:w.error});if(!E||E.total===0)return(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:V(`nothingYet`)});let D=t=>d({kind:`record`,resource:e.name,key:a(e,t)});return(0,Q.jsx)(F,{fit:!0,scroll:`parent`,columns:g,source:E,latencyMs:0,onOpenRow:D,rowLink:t=>({href:f({kind:`record`,resource:e.name,key:a(e,t)}),onFollow:()=>D(t)}),...o&&{sort:o.value,onSortChange:o.onChange},rowNumbers:!1,reorder:{label:n=>S(e,t,n,n.id),onMove:w.move}})},fe=({sorting:e,onChange:t,size:n,iconOnly:i=!1})=>{let a=V(e?`done`:`reorder`);return(0,Q.jsxs)(r,{size:n,variant:e?`primary`:`secondary`,onClick:()=>t(!e),...i&&{"aria-label":a,title:a},children:[e?(0,Q.jsx)(f,{className:`size-3.5`}):(0,Q.jsx)(W,{className:`size-3.5`}),!i&&a]})};export{K as a,oe as i,de as n,se as r,fe as t};
2
+ //# debugId=5ab940ce-36f5-4117-92b3-ebc8c0f46df5
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Ys as r,mr as i}from"./app-1j5nx8lw.js";import{t as a}from"./workflow-canvas-BgC2BoRd.js";import{a as o,i as s,n as c}from"./step-panel-DDSMdJhn.js";import{t as l}from"./use-run-trace-CNqw_HuX.js";import{t as u}from"./use-workflow-types-CxeOmx1U.js";import{n as d,t as f}from"./graph-frame-PVfWqgbJ.js";var p=e(t(),1),m=e(n(),1),h=new Map,g=({trace:e,types:t,notice:n,idle:l})=>{let{definition:u,steps:g,going:_,place:v}=e,y=(0,p.useMemo)(()=>v&&o(g,{inProgress:_,...v}),[v,g,_]),[b,x]=(0,p.useState)();if(e.error)return(0,m.jsx)(i,{error:e.error,title:s(`loadFailed`)});if(!e.run||!e.id||!u||!y)return(0,m.jsx)(r,{className:`h-[28rem] w-full max-sm:h-[22rem]`});let S=[...y].filter(([,e])=>e.status===`failed`).map(([e])=>e).sort((e,t)=>t.split(`/`).length-e.split(`/`).length)[0],C=b===void 0?S:b??void 0,w={...e.run,id:e.id,created_at:String(e.run.created_at)};return(0,m.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[!_&&g.length===0&&(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`noTrace`)}),(0,m.jsx)(f,{canvas:(0,m.jsx)(a,{definition:u,problems:h,selected:C,onSelect:e=>x(e??null),traces:y,...t&&{types:t}}),panel:(0,m.jsxs)(m.Fragment,{children:[n,C===void 0?l??(0,m.jsx)(d,{children:s(`pickNode`)}):(0,m.jsx)(c,{definition:u,run:w,selected:C,...t&&{types:t}})]})})]})},_=({runId:e})=>{let t=l(e),n=u().data;return(0,m.jsx)(g,{trace:t,...n&&{types:n}})};export{_ as RunTrace};
2
- //# debugId=b6300c47-9bc3-4871-a93a-868202613623
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Xs as r,mr as i}from"./app-B48LQpC1.js";import{t as a}from"./workflow-canvas-DtTiaGIh.js";import{a as o,i as s,n as c}from"./step-panel-BNu4CT-a.js";import{t as l}from"./use-run-trace-D0jDOrL8.js";import{t as u}from"./use-workflow-types-8ZRuZVuJ.js";import{n as d,t as f}from"./graph-frame-PVfWqgbJ.js";var p=e(t(),1),m=e(n(),1),h=new Map,g=({trace:e,types:t,notice:n,idle:l})=>{let{definition:u,steps:g,going:_,place:v}=e,y=(0,p.useMemo)(()=>v&&o(g,{inProgress:_,...v}),[v,g,_]),[b,x]=(0,p.useState)();if(e.error)return(0,m.jsx)(i,{error:e.error,title:s(`loadFailed`)});if(!e.run||!e.id||!u||!y)return(0,m.jsx)(r,{className:`h-[28rem] w-full max-sm:h-[22rem]`});let S=[...y].filter(([,e])=>e.status===`failed`).map(([e])=>e).sort((e,t)=>t.split(`/`).length-e.split(`/`).length)[0],C=b===void 0?S:b??void 0,w={...e.run,id:e.id,created_at:String(e.run.created_at)};return(0,m.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[!_&&g.length===0&&(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`noTrace`)}),(0,m.jsx)(f,{canvas:(0,m.jsx)(a,{definition:u,problems:h,selected:C,onSelect:e=>x(e??null),traces:y,...t&&{types:t}}),panel:(0,m.jsxs)(m.Fragment,{children:[n,C===void 0?l??(0,m.jsx)(d,{children:s(`pickNode`)}):(0,m.jsx)(c,{definition:u,run:w,selected:C,...t&&{types:t}})]})})]})},_=({runId:e})=>{let t=l(e),n=u().data;return(0,m.jsx)(g,{trace:t,...n&&{types:n}})};export{_ as RunTrace};
2
+ //# debugId=bb15adf5-605d-4d36-8b85-3fd1b2fd51c5
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Fs as r,Qi as i,Qs as a,Vc as o,qc as s,rs as c}from"./app-1j5nx8lw.js";import{t as l}from"./copy-field-DJZYMDoO.js";var u=e(t(),1),d=o(`app/field-types/runner-install`),f=e(n(),1),p=e=>e instanceof r?e.slug===`runner-registered`?d(`registered`):e.slug===`runner-revoked`?d(`revoked`):e.status===404?d(`notYours`):d(`failed`):d(`failed`),m=({value:e})=>{let t=c(),[n,r]=(0,u.useState)(),[o,s]=(0,u.useState)(!1),[m,h]=(0,u.useState)();if(e===null)return null;let g=async()=>{s(!0),h(void 0),await t.runnerRegistration(e).then(r,e=>h(p(e))),s(!1)};return(0,f.jsxs)(`div`,{className:`grid gap-2`,children:[n&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l,{value:n.command,copyLabel:d(`copy`)}),(0,f.jsx)(`p`,{className:`text-body text-muted-foreground`,children:d(`shownOnce`,{until:i(Date.parse(n.expires_at))})})]}),m&&(0,f.jsx)(`p`,{role:`alert`,className:`text-body text-danger-text`,children:m}),(0,f.jsx)(a,{size:`sm`,variant:n?`secondary`:`primary`,className:`justify-self-start`,loading:o,onClick:()=>void g(),children:d(n?`again`:`issue`)})]})},h={of:[...s.runner_install],display:m,cell:()=>null};export{h as runnerInstallField};
2
- //# debugId=58cd6937-61e8-4b60-bbce-4013fcd3371f
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$i as r,$s as i,Hc as a,Is as o,Jc as s,is as c}from"./app-B48LQpC1.js";import{t as l}from"./copy-field-9SzlccPw.js";var u=e(t(),1),d=a(`app/field-types/runner-install`),f=e(n(),1),p=e=>e instanceof o?e.slug===`runner-registered`?d(`registered`):e.slug===`runner-revoked`?d(`revoked`):e.status===404?d(`notYours`):d(`failed`):d(`failed`),m=({value:e})=>{let t=c(),[n,a]=(0,u.useState)(),[o,s]=(0,u.useState)(!1),[m,h]=(0,u.useState)();if(e===null)return null;let g=async()=>{s(!0),h(void 0),await t.runnerRegistration(e).then(a,e=>h(p(e))),s(!1)};return(0,f.jsxs)(`div`,{className:`grid gap-2`,children:[n&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l,{value:n.command,copyLabel:d(`copy`)}),(0,f.jsx)(`p`,{className:`text-body text-muted-foreground`,children:d(`shownOnce`,{until:r(Date.parse(n.expires_at))})})]}),m&&(0,f.jsx)(`p`,{role:`alert`,className:`text-body text-danger-text`,children:m}),(0,f.jsx)(i,{size:`sm`,variant:n?`secondary`:`primary`,className:`justify-self-start`,loading:o,onClick:()=>void g(),children:d(n?`again`:`issue`)})]})},h={of:[...s.runner_install],display:m,cell:()=>null};export{h as runnerInstallField};
2
+ //# debugId=698fa706-6f43-40b0-bb21-1cea3886fb9b
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Fs as r,Ls as i,Mc as a,Qi as o,Qs as s,Ra as c,Rs as l,Vc as u,Xi as d,Xs as f,da as p,ec as m}from"./app-1j5nx8lw.js";var h={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};h.node;var g=a(h),_=e=>typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null&&`code`in e.error&&`message`in e.error,v=async e=>{let t=e.headers.get(`content-type`)?.includes(`json`)??!1?await e.clone().json():void 0;return _(t)?new r({type:`urn:protobase:problem:${t.error.code}`,title:e.statusText||`Request failed`,status:e.status,detail:t.error.message}):l(e)},y=e=>{let t=e.url.replace(/\/+$/,``),n=e.fetch??((e,t)=>fetch(e,t)),r=async(r,i)=>{let a=await e.token(),o=await n(`${t}${r}`,{method:i,headers:{accept:`application/json`,...a&&{authorization:`Bearer ${a}`}}});if(!o.ok)throw await v(o);return await o.json()};return{status:()=>r(``,`GET`),update:()=>r(`/update`,`POST`)}},b=e(t(),1),x=u(`app/runtime`),S=e=>!!(e?.updateAvailable&&e.indicator),C=e=>e?5e3:18e5,w=(e,t)=>{if(!e.updateStage)return x(`updatingNow`);let n=x(e.updateStage);if(!e.updateStartedAt)return n;let r=Math.max(0,Math.floor((t-Date.parse(e.updateStartedAt))/1e3));return x(`started`,{stage:n,ago:d(r)})},T=(e,t=Date.now(),n=p())=>e.updating?w(e,t):e.nextUpdateAt?x(`nextOn`,{policy:x(e.policy),when:o(Date.parse(e.nextUpdateAt),n)}):x(e.policy),E=(e,t=p())=>{let n=o(Date.parse(e.finishedAt),t),r=x(e.outcome,{version:e.toVersion,when:n});return e.message?`${r}: ${e.message}`:`${r}.`},D=e=>i(e)&&e.status<500&&e.problem.detail?e.problem.detail:i(e)&&e.status===409?x(`alreadyLatest`):i(e)&&e.status===403?x(`onlyAdmin`):x(`couldNotStart`),O=e(n(),1),k=({label:e,value:t})=>(0,O.jsxs)(`div`,{className:`flex justify-between gap-4 py-1`,children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,O.jsx)(`span`,{className:`font-medium tabular-nums`,children:t})]}),A=({status:e,requesting:t,error:n,checkError:r,onUpdate:i,onClose:a})=>{let o=e.updating?void 0:e.lastUpdate;return(0,O.jsxs)(f,{title:x(`runtimeUpdate`),description:e.updating?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,O.jsx)(m,{className:`size-3.5`}),T(e)]}):T(e),onClose:a,actions:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(s,{onClick:a,children:x(`close`)}),(0,O.jsx)(s,{variant:`primary`,loading:t,disabled:e.updating||!e.updateAvailable,onClick:i,children:e.updating?x(`updating`):x(`updateNow`)})]}),children:[(0,O.jsx)(k,{label:x(`currentVersion`),value:e.version}),(0,O.jsx)(k,{label:x(`latestVersion`),value:e.latest}),o&&(0,O.jsx)(`p`,{className:o.outcome===`failed`?`mt-3 text-danger-text`:`mt-3 text-muted-foreground`,children:E(o)}),n!==void 0&&(0,O.jsx)(`p`,{role:`alert`,className:`mt-3 text-danger-text`,children:D(n)}),r!==void 0&&(0,O.jsx)(`p`,{className:`mt-3 text-muted-foreground`,children:x(`checkFailed`)})]})},j=e=>{let t=c(),n=(0,b.useRef)(t);n.current=t;let r=t!==void 0;return(0,b.useMemo)(()=>r?y({url:e,token:()=>n.current}):void 0,[e,r])},M=e=>{let[t,n]=(0,b.useState)(),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),l=t?.updating??!1;return(0,b.useEffect)(()=>{if(!e)return;let t=!0,r=()=>e.status().then(e=>{t&&(n(e),c(void 0))},e=>t&&c(e));r();let i=setInterval(()=>void r(),C(l));return()=>{t=!1,clearInterval(i)}},[e,l]),{status:t,update:(0,b.useCallback)(async()=>{e&&(i(!0),o(void 0),await e.update().then(n,o),i(!1))},[e]),requesting:r,error:a,checkError:s}},N=({client:e})=>{let{status:t,update:n,requesting:r,error:i,checkError:a}=M(e),[o,c]=(0,b.useState)(!1);return!t||!o&&!S(t)?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(s,{size:`sm`,variant:`ghost`,"aria-label":x(`updateAvailable`),title:x(`updateAvailable`),onClick:()=>c(!0),className:`max-md:size-9 max-md:p-0`,children:[(0,O.jsx)(g,{className:`size-3.5 text-primary`}),(0,O.jsx)(`span`,{className:`max-md:sr-only`,children:x(`update`)})]}),o&&(0,O.jsx)(A,{status:t,requesting:r,error:i,checkError:a,onUpdate:()=>void n(),onClose:()=>c(!1)})]})},P=({url:e})=>(0,O.jsx)(N,{client:j(e)}),F=({url:e,client:t})=>t?(0,O.jsx)(N,{client:t}):(0,O.jsx)(P,{url:e});export{F as RuntimeUpdateButton};
2
- //# debugId=95340208-208e-414e-a8ff-53e88b6b4216
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$i as r,$s as i,Hc as a,Is as o,Nc as s,Rs as c,Zi as l,Zs as u,fa as d,tc as f,za as p,zs as m}from"./app-B48LQpC1.js";var h={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};h.node;var g=s(h),_=e=>typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null&&`code`in e.error&&`message`in e.error,v=async e=>{let t=e.headers.get(`content-type`)?.includes(`json`)??!1?await e.clone().json():void 0;return _(t)?new o({type:`urn:protobase:problem:${t.error.code}`,title:e.statusText||`Request failed`,status:e.status,detail:t.error.message}):m(e)},y=e=>{let t=e.url.replace(/\/+$/,``),n=e.fetch??((e,t)=>fetch(e,t)),r=async(r,i)=>{let a=await e.token(),o=await n(`${t}${r}`,{method:i,headers:{accept:`application/json`,...a&&{authorization:`Bearer ${a}`}}});if(!o.ok)throw await v(o);return await o.json()};return{status:()=>r(``,`GET`),update:()=>r(`/update`,`POST`)}},b=e(t(),1),x=a(`app/runtime`),S=e=>!!(e?.updateAvailable&&e.indicator),C=e=>e?5e3:18e5,w=(e,t)=>{if(!e.updateStage)return x(`updatingNow`);let n=x(e.updateStage);if(!e.updateStartedAt)return n;let r=Math.max(0,Math.floor((t-Date.parse(e.updateStartedAt))/1e3));return x(`started`,{stage:n,ago:l(r)})},T=(e,t=Date.now(),n=d())=>e.updating?w(e,t):e.nextUpdateAt?x(`nextOn`,{policy:x(e.policy),when:r(Date.parse(e.nextUpdateAt),n)}):x(e.policy),E=(e,t=d())=>{let n=r(Date.parse(e.finishedAt),t),i=x(e.outcome,{version:e.toVersion,when:n});return e.message?`${i}: ${e.message}`:`${i}.`},D=e=>c(e)&&e.status<500&&e.problem.detail?e.problem.detail:c(e)&&e.status===409?x(`alreadyLatest`):c(e)&&e.status===403?x(`onlyAdmin`):x(`couldNotStart`),O=e(n(),1),k=({label:e,value:t})=>(0,O.jsxs)(`div`,{className:`flex justify-between gap-4 py-1`,children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,O.jsx)(`span`,{className:`font-medium tabular-nums`,children:t})]}),A=({status:e,requesting:t,error:n,checkError:r,onUpdate:a,onClose:o})=>{let s=e.updating?void 0:e.lastUpdate;return(0,O.jsxs)(u,{title:x(`runtimeUpdate`),description:e.updating?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,O.jsx)(f,{className:`size-3.5`}),T(e)]}):T(e),onClose:o,actions:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i,{onClick:o,children:x(`close`)}),(0,O.jsx)(i,{variant:`primary`,loading:t,disabled:e.updating||!e.updateAvailable,onClick:a,children:e.updating?x(`updating`):x(`updateNow`)})]}),children:[(0,O.jsx)(k,{label:x(`currentVersion`),value:e.version}),(0,O.jsx)(k,{label:x(`latestVersion`),value:e.latest}),s&&(0,O.jsx)(`p`,{className:s.outcome===`failed`?`mt-3 text-danger-text`:`mt-3 text-muted-foreground`,children:E(s)}),n!==void 0&&(0,O.jsx)(`p`,{role:`alert`,className:`mt-3 text-danger-text`,children:D(n)}),r!==void 0&&(0,O.jsx)(`p`,{className:`mt-3 text-muted-foreground`,children:x(`checkFailed`)})]})},j=e=>{let t=p(),n=(0,b.useRef)(t);n.current=t;let r=t!==void 0;return(0,b.useMemo)(()=>r?y({url:e,token:()=>n.current}):void 0,[e,r])},M=e=>{let[t,n]=(0,b.useState)(),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),l=t?.updating??!1;return(0,b.useEffect)(()=>{if(!e)return;let t=!0,r=()=>e.status().then(e=>{t&&(n(e),c(void 0))},e=>t&&c(e));r();let i=setInterval(()=>void r(),C(l));return()=>{t=!1,clearInterval(i)}},[e,l]),{status:t,update:(0,b.useCallback)(async()=>{e&&(i(!0),o(void 0),await e.update().then(n,o),i(!1))},[e]),requesting:r,error:a,checkError:s}},N=({client:e})=>{let{status:t,update:n,requesting:r,error:a,checkError:o}=M(e),[s,c]=(0,b.useState)(!1);return!t||!s&&!S(t)?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(i,{size:`sm`,variant:`ghost`,"aria-label":x(`updateAvailable`),title:x(`updateAvailable`),onClick:()=>c(!0),className:`max-md:size-9 max-md:p-0`,children:[(0,O.jsx)(g,{className:`size-3.5 text-primary`}),(0,O.jsx)(`span`,{className:`max-md:sr-only`,children:x(`update`)})]}),s&&(0,O.jsx)(A,{status:t,requesting:r,error:a,checkError:o,onUpdate:()=>void n(),onClose:()=>c(!1)})]})},P=({url:e})=>(0,O.jsx)(N,{client:j(e)}),F=({url:e,client:t})=>t?(0,O.jsx)(N,{client:t}):(0,O.jsx)(P,{url:e});export{F as RuntimeUpdateButton};
2
+ //# debugId=99df57d1-60cd-4303-91be-eaa7958016d0
@@ -0,0 +1 @@
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{$ as e,$s as t,Ar as n,At as r,B as ee,Bc as te,Bt as i,Cn as a,Ct as o,Da as s,Do as c,Dt as l,Eo as u,Et as d,Fc as f,Fr as p,Ft as m,G as h,Gi as g,Gt as _,H as v,Ht as y,Ia as b,Ic as x,Ir as S,Ji as C,Js as w,Jt as T,K as E,Ki as D,Lc as O,Lr as k,Mt as A,N as j,No as M,Nt as N,Oa as P,Ot as F,P as I,Pr as L,Pt as R,Q as z,Qt as B,R as V,Ra as H,Rc as U,Rn as W,Rr as G,Rt as K,So as q,Sr as J,St as Y,To as X,Tr as Z,Tt as Q,U as ne,Uc as re,Ui as ie,V as ae,Vt as oe,W as se,Wi as ce,X as le,Xi as ue,Yi as $,Yt as de,Zs as fe,Zt as pe,_r as me,_t as he,as as ge,br as _e,bt as ve,co as ye,do as be,dt as xe,ec as Se,et as Ce,ft as we,gr as Te,gt as Ee,ha as De,ho as Oe,hr as ke,ht as Ae,is as je,it as Me,ja as Ne,jr as Pe,jt as Fe,kr as Ie,mt as Le,n as Re,no as ze,ns as Be,nt as Ve,or as He,ot as Ue,po as We,pt as Ge,qi as Ke,qt as qe,r as Je,ro as Ye,rs as Xe,rt as Ze,so as Qe,t as $e,tc as et,to as tt,tt as nt,uo as rt,ut as it,vt as at,wo as ot,wr as st,wt as ct,xr as lt,xt as ut,yr as dt,yt as ft,z as pt,za as mt,zc as ht,zt as gt}from"./app-B48LQpC1.js";import{h as _t,o as vt}from"./vendor-t7Q7QbPu.js";export{Y as ActionCard,J as ActionInputError,Xe as ApiProvider,p as App,k as AppLink,u as AppMark,we as AssistantDock,Ye as AuthLayout,rt as AvailabilityMark,t as Button,K as CallMark,y as CallView,E as Carousel,A as ChatDivider,Fe as ChatMessage,r as ChatThread,pt as Choices,tt as CodeForm,ve as CompactTable,ct as Composer,fe as Dialog,he as DiffView,V as Field,de as FieldBadge,ut as FieldList,Te as FileReadError,e as FocusActions,Ce as FocusNotice,Me as FocusPage,nt as FocusPanel,Ve as FocusSlot,j as Form,_e as HtmlFrame,Re as InPlaceForm,q as Input,c as LogoMark,a as Markdown,d as MentionBox,Q as MentionedText,ee as MenuSelect,We as MenuSurface,Qe as OtpInput,Le as PartView,i as RecordCall,_ as RecordLink,$e as RecordPicker,ze as ResendCodeButton,Ke as ResponsiveDialog,w as RouteLink,le as SearchPicker,I as Section,Oe as Segmented,ae as Select,o as SidePanel,m as SignInPrompt,et as Spinner,be as StatusMark,Ae as StepList,W as Textarea,T as ToneEdge,v as allowDelayMs,Se as buttonClass,N as chatDayLabel,M as closeSidebarEvent,s as definePlugin,P as defineUi,at as diffStats,l as emptyDraft,lt as fileNamed,st as isConflict,ne as isFramed,X as logoTapEvent,F as mentionedIds,O as mergeUi,ft as parseDiff,Ee as parsePatch,ht as pluginApi,f as pluginsChangedEvent,te as protobaseVersion,R as sameChatDay,re as showTextsIn,dt as siblingPage,ye as signedOutEvent,ce as statusRefreshMs,U as uiFromModule,S as uiReadyEvent,mt as useApiToken,G as useAppAddress,se as useArmedAfterFocus,xe as useAssistant,it as useAssistantClient,Ge as useBackendData,je as useClient,pe as useComponentReads,B as useComponentSelect,Je as useCreateForm,Ie as useFacets,ot as useFieldControl,me as useFileText,Ue as useFocusPage,z as useFocusRecord,Ze as useFocusZoneFilled,h as useGuardedPress,n as useHistogram,C as useInbox,He as useLayoutRecord,L as useList,qe as useListDisplay,$ as useMarkNotificationsRead,ie as useMembers,Be as useMeta,g as useOwnStatus,x as usePlugin,Ne as usePresence,De as usePushNotifications,vt as useQuery,_t as useQueryClient,b as useRecord,oe as useRecordCallAddress,gt as useRecordCalls,ge as useResourceClient,Pe as useSeries,ke as useSiblingPage,H as useSignedInUser,D as useStatuses,ue as useUnreadNotifications,Z as useUpdateRecord};
@@ -1,3 +1,3 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$c as r,Fl as i,Ls as a,Mc as o,Nc as s,Nl as c,Qa as l,Qc as u,Qs as d,Uc as f,Wc as p,ec as m,hi as h,j as g,mr as _,yc as v}from"./app-1j5nx8lw.js";import{c as y,d as b,l as ee,o as x,u as S}from"./list-page-BXVd_Eq3.js";var C={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};C.node;var te=o(C),w=e(t(),1),T=e(n(),1),ne=e=>/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,re=(e,t)=>{let n=[...t].sort((e,t)=>e.line-t.line).map(t=>[...e.map((e,n)=>x(t.cells[n]??null)),String(t.line),t.problems.join(`; `)]);return`${[[...e,b(`line`),b(`problems`)],...n].map(e=>e.map(ne).join(`,`)).join(`\r
2
- `)}\r\n`},E=({label:e,counts:t})=>(0,T.jsx)(`dl`,{"aria-label":e,className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:t.map(([e,t])=>(0,T.jsxs)(`div`,{className:`rounded-lg border px-3 py-2`,children:[(0,T.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,T.jsx)(`dd`,{className:`text-lg font-semibold tabular-nums`,children:t.toLocaleString(p())})]},e))}),D=(e,t)=>e?.fields[t]?.label??r(t),ie=new Set([`text`,`integer`,`bigint`,`decimal`,`boolean`,`date`,`timestamp`,`uuid`,`enum`,`relation`,`currency`,`country`]),O=(e,t)=>{let n=e.relation?t[e.relation.resource]:void 0;return n?.primaryKey.length===1?n:void 0},ae=(e,t,{json:n=!1}={})=>Object.values(e.fields).filter(r=>r.readOnly||r.name===e.tenant?!1:r.type===`json`?n:ie.has(r.type)?r.type!==`relation`||O(r,t)!==void 0:!1),oe=new Set([`text`,`integer`,`bigint`,`uuid`,`date`,`currency`,`country`,`enum`]),se=e=>{let t=e.primaryKey.length===1?[e.fields[e.primaryKey[0]]]:[],n=Object.values(e.fields).filter(t=>t.filterable&&!t.sensitive&&oe.has(t.type)&&!e.primaryKey.includes(t.name));return[...t,...n]},k=(e,t)=>O(e,t),A=e=>!e.nullable&&!e.default,j=e=>e.toLowerCase().replace(/[\s_-]+/g,``),ce=(e,t,n)=>{let r=new Set;return e.flatMap((e,i)=>{let a=j(e);if(a===``)return[];let o=t.find(e=>!r.has(e.name)&&(j(D(n,e.name))===a||j(e.name)===a));return o?(r.add(o.name),[{column:i,field:o.name}]):[]})},le=(e,t,n)=>{if(e===`update`)return[];let r=new Set(n.map(e=>e.field));return t.filter(e=>A(e)&&!r.has(e.name))},M=e=>({ok:!0,value:e}),N=e=>({ok:!1,problem:e}),P=e=>`“${x(e)}”`,F=(e,t)=>{if(typeof e==`number`)return String(e);if(typeof e==`string`)return g(e,t.decimal)},ue=(e,t,n)=>{let r=F(t,n);if(r===void 0)return N(b(`notNumber`,{cell:P(t)}));let[i,a=``]=r.split(`.`);if(/[1-9]/.test(a)||/e/i.test(r))return N(b(`notWholeNumber`,{cell:P(t)}));if(e.type===`bigint`)return M(String(BigInt(i)));let o=Number(i);return Number.isSafeInteger(o)?M(o):N(b(`tooLarge`,{cell:P(t)}))},de=(e,t)=>{let n=F(e,t);return n===void 0?N(b(`notNumber`,{cell:P(e)})):M(n)},fe=new Set([`true`,`yes`,`1`]),pe=new Set([`false`,`no`,`0`]),me=e=>{if(typeof e==`boolean`)return M(e);let t=typeof e==`string`||typeof e==`number`?String(e).trim().toLowerCase():``;return fe.has(t)?M(!0):pe.has(t)?M(!1):N(b(`notBoolean`,{cell:P(e)}))},I=e=>String(e).padStart(2,`0`),he=(e,t,n)=>{let r=new Date(Date.UTC(e,t-1,n));if(r.getUTCFullYear()===e&&r.getUTCMonth()===t-1&&r.getUTCDate()===n)return`${e}-${I(t)}-${I(n)}`},L=`(\\d{1,2}):(\\d{2})(?::(\\d{2})(?:\\.\\d+)?)?`,ge=(e,t)=>{let n=RegExp(`^(\\d{4})[-/](\\d{1,2})[-/](\\d{1,2})(?:[T ]${L}(Z|[+-]\\d{2}:?\\d{2})?)?$`).exec(e.trim()),r=RegExp(`^(\\d{1,2})[./-](\\d{1,2})[./-](\\d{4})(?: ${L})?$`).exec(e.trim());if(!n&&!r)return;let[i,a,o]=n?[n[1],n[2],n[3]].map(Number):t===`dmy`?[r[3],r[2],r[1]].map(Number):[r[3],r[1],r[2]].map(Number),s=he(i,a,o);if(!s)return;let[c,l,u=`0`]=n?n.slice(4,7):r.slice(4,7);if(c===void 0)return{date:s};if(!(Number(c)>23||Number(l)>59||Number(u)>59))return{date:s,time:`${I(Number(c))}:${l}:${I(Number(u))}`,zone:n?.[7]}},R=(e,t)=>{if(ee(e)){let[t,n]=e.date.split(`T`);return{date:t,time:n}}return typeof e==`string`?ge(e,t.dateOrder):void 0},z=(e,t)=>N(b(`notDate`,{cell:P(e),dayFirst:t.dateOrder===`dmy`})),_e=(e,t)=>{let n=R(e,t);return n?n.time&&n.time!==`00:00:00`?N(b(`hasTime`,{cell:P(e)})):M(n.date):z(e,t)},ve=(e,t)=>{let n=R(e,t);if(!n)return z(e,t);if(n.zone)return M(new Date(`${n.date}T${n.time}${n.zone===`Z`?`Z`:n.zone.replace(/^([+-]\d{2})(\d{2})$/,`$1:$2`)}`).toISOString());let[r,i,a]=n.date.split(`-`).map(Number),[o,s,c]=(n.time??`00:00:00`).split(`:`).map(Number);return M(new Date(r,i-1,a,o,s,c).toISOString())},B=e=>e.trim().toLowerCase().replace(/\s+/g,` `),ye=(e,t,n)=>{let r=e.enumValues??[],i=B(x(n)),a=r.filter(e=>B(e)===i||B(u(e,t?.valueLabels))===i);return a.length===1?M(a[0]):a.length>1?N(b(`severalValues`,{cell:P(n),values:a.map(e=>u(e,t?.valueLabels)).join(`, `)})):N(b(`notOneOf`,{cell:P(n),values:r.map(e=>u(e,t?.valueLabels)).join(`, `)}))},be=(e,t)=>typeof e==`boolean`&&!t.booleanText?N(b(`notText`,{cell:P(e)})):M(x(e)),xe=e=>S(e)?M(e.json):M(e),V=(e,t,n,r)=>{if(y(n))return e.nullable?M(null):N(b(`emptyRequired`));if(e.type===`json`)return xe(n);if(S(n))return N(b(`nestedValue`,{cell:P(n)}));switch(e.type){case`integer`:case`bigint`:return ue(e,n,r);case`decimal`:return de(n,r);case`boolean`:return me(n);case`date`:return _e(n,r);case`timestamp`:return ve(n,r);case`enum`:return ye(e,t,n);case`text`:case`uuid`:case`currency`:case`country`:return be(n,r);default:throw Error(`Not implemented: importing ${e.type} fields, which importableFields leaves out`)}},Se=(e,t)=>e[t]?.names?.singular??r(t),Ce=(e,t)=>e[t]?.names?.plural??r(t),we=(e,t,n)=>{let{model:r,resources:i,views:a}=n,o=a[r.name],s={},c={},l=[],u=[];for(let{column:n,field:d,matchBy:f}of t.columns){let p=r.fields[d],m=e.cells[n]??null,h=D(o,d),g=k(p,i);if(g&&!y(m)){let e=f??g.primaryKey[0],n=V(g.fields[e],a[g.name]?.fields[e],m,t.options);n.ok?u.push({field:d,finding:{model:g,field:e,value:n.value}}):l.push(`${h}: ${n.problem}`),s[d]=x(m);continue}let _=V(p,o?.fields[d],m,t.options);_.ok?c[d]=s[d]=_.value:l.push(`${h}: ${_.problem}`)}let d;if(t.match&&t.mode!==`create`){let n=r.fields[t.match.field],i=V({...n,nullable:!1},o?.fields[n.name],e.cells[t.match.column]??null,t.options);i.ok?d={model:r,field:n.name,value:i.value}:l.push(`${D(o,n.name)}: ${i.problem}`)}return{values:s,data:c,problems:l,relations:u,match:d}},H=(e,t)=>{let n=e.lookups.keysOf(t.model.name,t.field,t.value),r=`${D(e.views[t.model.name],t.field).toLowerCase()} “${String(t.value)}”`;return n.length===1?{key:n[0]}:n.length===0?{none:b(`noneHas`,{singular:Se(e.views,t.model.name),named:r})}:{several:b(`severalHave`,{count:n.length,plural:Ce(e.views,t.model.name),named:r})}},Te=e=>e.cells.every(y),U=async(e,t,n)=>{let{model:r,views:i}=n,a=e.filter(e=>!Te(e)).map(e=>({row:e,...we(e,t,n)})),o=new Map;for(let e of a.flatMap(e=>[...e.relations.map(e=>e.finding),...e.match?[e.match]:[]])){let t=`${e.model.name}.${e.field}`;o.has(t)||o.set(t,{model:e.model,field:e.field,values:[]}),o.get(t).values.push(e.value)}for(let{model:e,field:t,values:r}of o.values())await n.lookups.load(e,t,r);return a.map(({row:e,values:a,data:o,problems:s,relations:c,match:l})=>{let u={...o};for(let{field:e,finding:t}of c){let a=H(n,t);`key`in a?u[e]=a.key:s.push(`${D(i[r.name],e)}: ${a.none??a.several}`)}let d=l&&H(n,l);d?.several&&s.push(b(`notOneRecord`,{found:d.several})),d?.none&&t.mode===`update`&&s.push(b(`nothingToUpdate`,{found:d.none}));let f={line:e.line,cells:e.cells,values:a,problems:s};return s.length>0?f:d&&`key`in d?{...f,op:{op:`update`,resource:r.name,key:d.key,etag:`*`,data:u}}:{...f,op:{op:`create`,resource:r.name,data:u}}})},Ee=5,De=5,Oe=async(e,t)=>{let n=e.rows(t),{value:r=[]}=await n.next();await n.return(void 0);let[i,...a]=r;return{headers:(i?.cells??[]).map(x),sample:a.slice(0,Ee)}};async function*W(e,t){let n=!0;for await(let r of e.rows(t))yield n?r.slice(1):r,n=!1}var ke=async(e,t,n,r,i,a)=>{let o={rows:0,creates:0,updates:0,problems:[],preview:[]};for await(let s of W(e,t)){a?.throwIfAborted();for(let e of await U(s,n,r))o.rows++,o.preview.length<De&&o.preview.push(e),e.op?.op===`create`?o.creates++:e.op?.op===`update`?o.updates++:o.problems.push({line:e.line,cells:e.cells,problems:e.problems});i(o.rows)}return o},Ae=(e,t)=>{if(!a(e))return[e.message];let n=e.errors.filter(e=>e.field);return n.length===0?[e.message]:n.map(e=>`${D(t.views[t.model.name],e.field)}: ${e.message}`)},je=async(e,t,n,r,{client:i,onProgress:o,cancelled:s})=>{let c={created:0,updated:0,skipped:0,failed:0,notWritten:[]},l=async e=>{let t=[...e];for(;t.length>0;){let e=t.map(e=>e.op);try{let{results:t}=await i.batchWrite(e);for(let e of t)e.op===`create`?c.created++:e.op===`update`&&c.updated++;return}catch(e){let n=a(e)?e.operation:void 0;if(n===void 0||!t[n])throw e;let[i]=t.splice(n,1);c.failed++,c.notWritten.push({line:i.line,cells:i.cells,problems:Ae(e,r)})}}},u=[],d=async e=>{for(;u.length>=100||e&&u.length>0;){if(s())return!1;await l(u.splice(0,100)),o({...c})}return!0};for await(let i of W(e,t)){for(let e of await U(i,n,r))e.op?u.push(e):(c.skipped++,c.notWritten.push({line:e.line,cells:e.cells,problems:e.problems}));if(!await d(!1))return{...c,cancelled:!0}}return await d(!0)?{...c,cancelled:!1}:{...c,cancelled:!0}},G=50,K=(e,t,n)=>l(re(t,n),b(`notImportedFile`,{name:(e??`import`).replace(/\.[^.]+$/,``)}),`text/csv`),q=({rows:e})=>(0,T.jsxs)(`ul`,{"aria-label":b(`rowsNotImported`),className:`flex flex-col gap-1 text-body`,children:[e.slice(0,G).map(e=>(0,T.jsxs)(`li`,{children:[(0,T.jsx)(`span`,{className:`font-medium`,children:b(`rowProblems`,{line:e.line})}),` `,e.problems.join(`; `)]},e.line)),e.length>G&&(0,T.jsx)(`li`,{className:`text-muted-foreground`,children:b(`andMore`,{count:(e.length-G).toLocaleString(p())})})]}),Me=({rows:e})=>(0,T.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,T.jsx)(m,{className:`size-3.5`}),b(`checkingRows`,{count:e.toLocaleString(p())})]}),Ne=({check:e,model:t,resources:n,views:r,columns:i,headers:a,fileName:o})=>{let s=r[t.name],c=i.map(e=>t.fields[e.field]);return(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsx)(E,{label:b(`check`),counts:[[b(`rows`),e.rows],[b(`toCreate`),e.creates],[b(`toUpdate`),e.updates],[b(`withProblems`),e.problems.length]]}),e.preview.length>0&&(0,T.jsx)(`div`,{className:`overflow-x-auto rounded-lg border`,children:(0,T.jsxs)(`table`,{"aria-label":b(`firstRows`),className:`w-full text-left text-body`,children:[(0,T.jsx)(`thead`,{className:`bg-muted text-muted-foreground`,children:(0,T.jsxs)(`tr`,{children:[(0,T.jsx)(`th`,{className:`px-2 py-1.5 font-medium`,children:b(`row`)}),c.map(e=>(0,T.jsx)(`th`,{className:`whitespace-nowrap px-2 py-1.5 font-medium`,children:D(s,e.name)},e.name))]})}),(0,T.jsx)(`tbody`,{className:`divide-y`,children:e.preview.map(e=>(0,T.jsxs)(`tr`,{className:e.problems.length>0?`bg-danger-soft`:void 0,children:[(0,T.jsx)(`td`,{className:`px-2 py-1.5 tabular-nums text-muted-foreground`,children:e.line}),c.map(t=>(0,T.jsx)(`td`,{className:`max-w-48 truncate px-2 py-1.5`,children:k(t,n)?String(e.values[t.name]??`—`):t.name in e.values?h(t,e.values[t.name],s?.fields[t.name]):``},t.name))]},e.line))})]})}),e.problems.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsx)(`h3`,{className:`font-medium`,children:b(`problemRows`)}),(0,T.jsxs)(d,{size:`sm`,onClick:()=>K(o,a,e.problems),children:[(0,T.jsx)(v,{className:`size-3.5`}),b(`download`)]})]}),(0,T.jsx)(q,{rows:e.problems})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`batches`,{size:100})})]})},Pe=[`.xlsx`,`.csv`,`.json`],Fe=[`text/csv`,`application/json`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],Ie=[`text/comma-separated-values`,`application/csv`,`text/x-csv`,`application/vnd.ms-excel`,`text/plain`,`application/octet-stream`],Le=e=>/\bAndroid\b/.test(e),Re=e=>[...Pe,...Fe,...Le(e)?Ie:[]].join(`,`),J=({label:e,name:t,value:n,options:r,onChange:i,help:a,className:o})=>{let c=(0,w.useId)();return(0,T.jsxs)(`div`,{className:s(`flex min-w-0 flex-col gap-1.5`,o),children:[(0,T.jsx)(`label`,{htmlFor:c,className:`font-medium`,children:e}),(0,T.jsx)(`select`,{id:c,"aria-label":t,value:n,onChange:e=>i(e.target.value),className:`h-8 w-full min-w-0 rounded-md border border-border-strong bg-background px-2 shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20 max-sm:min-h-11`,children:r.map(e=>(0,T.jsx)(`option`,{value:e.value,children:e.label},e.value))}),a&&(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a})]})},Y=({file:e,sheets:t,sheet:n,reading:r,onChoose:i,onSheet:a})=>{let o=(0,w.useId)();return(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsx)(`label`,{htmlFor:o,className:`font-medium`,children:b(`file`)}),(0,T.jsx)(`input`,{id:o,type:`file`,accept:Re(globalThis.navigator?.userAgent??``),disabled:r,onChange:e=>{let t=e.target.files?.[0];t&&i(t)},className:`file:mr-3 file:h-8 file:rounded-md file:border file:border-border-strong file:bg-background file:px-3 file:font-medium file:text-foreground max-sm:file:min-h-11`}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`fileHint`)})]}),r&&(0,T.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,T.jsx)(m,{className:`size-3.5`}),b(`reading`,{name:e?.name??b(`theFile`)})]}),!r&&t.length>1&&(0,T.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,T.jsx)(te,{className:`mb-2 size-4 shrink-0 text-muted-foreground`}),(0,T.jsx)(J,{className:`flex-1`,label:b(`sheet`),value:n??``,options:t.map(e=>({value:e,label:e})),onChange:a})]})]})},X=e=>e.toLocaleString(p()),ze=({progress:e,total:t,cancelling:n})=>{let r=e.created+e.updated+e.failed;return(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:b(n?`stopping`:`saving`)}),(0,T.jsxs)(`span`,{className:`tabular-nums`,children:[X(r),` / `,X(t)]})]}),(0,T.jsx)(`div`,{role:`progressbar`,"aria-label":b(`rowsSaved`),"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":t,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width]`,style:{width:`${t>0?Math.min(100,r/t*100):0}%`}})})]})},Be=({result:e,stopped:t,headers:n,fileName:r})=>(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t!==void 0&&(0,T.jsx)(_,{title:b(`stopped`),error:t}),e.cancelled&&(0,T.jsx)(`p`,{role:`status`,children:b(`cancelled`)}),(0,T.jsx)(E,{label:b(`summary`),counts:[[b(`created`),e.created],[b(`updated`),e.updated],[b(`skipped`),e.skipped],[b(`failed`),e.failed]]}),e.notWritten.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsx)(`h3`,{className:`font-medium`,children:b(`rowsNotImported`)}),(0,T.jsxs)(d,{size:`sm`,onClick:()=>K(r,n,e.notWritten),children:[(0,T.jsx)(v,{className:`size-3.5`}),b(`download`)]})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`notWrittenHint`)}),(0,T.jsx)(q,{rows:[...e.notWritten].sort((e,t)=>e.line-t.line)})]})]}),Ve=c(),Z=100,Q=e=>String(e),He=e=>{let t=new Map,n=(e,n)=>{let r=`${e}.${n}`;return t.has(r)||t.set(r,new Map),t.get(r)};return{load:async(t,r,a)=>{let o=n(t.name,r),s=[...new Map(a.filter(e=>!o.has(Q(e))).map(e=>[Q(e),e])).values()],c=t.primaryKey[0];for(let n=0;n<s.length;n+=Z){let a=s.slice(n,n+Z);for(let e of a)o.set(Q(e),[]);let l=i(Ve.in(r,a)),u;do{let n=await e(t.name).list(t.name,{filter:l,fields:[...new Set([c,r])],pageSize:1e3,pageToken:u});for(let e of n.items)o.get(Q(e[r]))?.push(e[c]);u=n.nextPageToken||void 0}while(u)}},keysOf:(e,t,r)=>n(e,t).get(Q(r))??[]}},Ue=500,$=()=>{let e=new Worker(new URL(`/assets/parse-worker-DI-FeZWV.js`,``+import.meta.url),{type:`module`}),t=[],n;return e.onmessage=e=>{if(n){let t=n;n=void 0,t(e.data)}else t.push(e.data)},e.onerror=e=>{e.preventDefault();let r={type:`error`,message:b(`unreadable`)};n?n(r):t.push(r)},{send:t=>e.postMessage(t),receive:()=>t.length>0?Promise.resolve(t.shift()):new Promise(e=>n=e),stop:()=>e.terminate()}},We=e=>({sheets:async()=>{let t=$();try{t.send({type:`sheets`,file:e,locale:f()});let n=await t.receive();if(n.type===`error`)throw Error(n.message);if(n.type!==`sheets`)throw Error(`The parse worker answered ${n.type} to a request for sheets`);return n.sheets}finally{t.stop()}},rows:async function*(t){let n=$();try{for(n.send({type:`read`,file:e,sheet:t,chunk:Ue,locale:f()});;){let e=await n.receive();if(e.type===`error`)throw Error(e.message);if(e.type===`end`)return;if(e.type!==`rows`)throw Error(`The parse worker answered ${e.type} to a read`);yield e.rows,n.send({type:`next`})}}finally{n.stop()}}});export{A as _,Y as a,Me as c,je as d,ce as f,k as g,se as h,Be as i,ke as l,ae as m,He as n,J as o,D as p,ze as r,Ne as s,We as t,Oe as u,le as v};
3
- //# debugId=4d7e4373-34e7-4fc0-a677-6a39e50d504b
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$a as r,$c as i,$s as a,Gc as o,Il as s,Nc as c,Pc as l,Pl as u,Rs as d,Wc as f,bc as p,el as m,gi as h,j as g,mr as _,tc as v}from"./app-B48LQpC1.js";import{c as y,d as b,l as ee,o as x,u as S}from"./list-page-C7h-_WJY.js";var C={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};C.node;var te=c(C),w=e(t(),1),T=e(n(),1),ne=e=>/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,re=(e,t)=>{let n=[...t].sort((e,t)=>e.line-t.line).map(t=>[...e.map((e,n)=>x(t.cells[n]??null)),String(t.line),t.problems.join(`; `)]);return`${[[...e,b(`line`),b(`problems`)],...n].map(e=>e.map(ne).join(`,`)).join(`\r
2
+ `)}\r\n`},E=({label:e,counts:t})=>(0,T.jsx)(`dl`,{"aria-label":e,className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:t.map(([e,t])=>(0,T.jsxs)(`div`,{className:`rounded-lg border px-3 py-2`,children:[(0,T.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,T.jsx)(`dd`,{className:`text-lg font-semibold tabular-nums`,children:t.toLocaleString(o())})]},e))}),D=(e,t)=>e?.fields[t]?.label??m(t),ie=new Set([`text`,`integer`,`bigint`,`decimal`,`boolean`,`date`,`timestamp`,`uuid`,`enum`,`relation`,`currency`,`country`]),O=(e,t)=>{let n=e.relation?t[e.relation.resource]:void 0;return n?.primaryKey.length===1?n:void 0},ae=(e,t,{json:n=!1}={})=>Object.values(e.fields).filter(r=>r.readOnly||r.name===e.tenant?!1:r.type===`json`?n:ie.has(r.type)?r.type!==`relation`||O(r,t)!==void 0:!1),oe=new Set([`text`,`integer`,`bigint`,`uuid`,`date`,`currency`,`country`,`enum`]),se=e=>{let t=e.primaryKey.length===1?[e.fields[e.primaryKey[0]]]:[],n=Object.values(e.fields).filter(t=>t.filterable&&!t.sensitive&&oe.has(t.type)&&!e.primaryKey.includes(t.name));return[...t,...n]},k=(e,t)=>O(e,t),A=e=>!e.nullable&&!e.default,j=e=>e.toLowerCase().replace(/[\s_-]+/g,``),ce=(e,t,n)=>{let r=new Set;return e.flatMap((e,i)=>{let a=j(e);if(a===``)return[];let o=t.find(e=>!r.has(e.name)&&(j(D(n,e.name))===a||j(e.name)===a));return o?(r.add(o.name),[{column:i,field:o.name}]):[]})},le=(e,t,n)=>{if(e===`update`)return[];let r=new Set(n.map(e=>e.field));return t.filter(e=>A(e)&&!r.has(e.name))},M=e=>({ok:!0,value:e}),N=e=>({ok:!1,problem:e}),P=e=>`“${x(e)}”`,F=(e,t)=>{if(typeof e==`number`)return String(e);if(typeof e==`string`)return g(e,t.decimal)},ue=(e,t,n)=>{let r=F(t,n);if(r===void 0)return N(b(`notNumber`,{cell:P(t)}));let[i,a=``]=r.split(`.`);if(/[1-9]/.test(a)||/e/i.test(r))return N(b(`notWholeNumber`,{cell:P(t)}));if(e.type===`bigint`)return M(String(BigInt(i)));let o=Number(i);return Number.isSafeInteger(o)?M(o):N(b(`tooLarge`,{cell:P(t)}))},de=(e,t)=>{let n=F(e,t);return n===void 0?N(b(`notNumber`,{cell:P(e)})):M(n)},fe=new Set([`true`,`yes`,`1`]),pe=new Set([`false`,`no`,`0`]),me=e=>{if(typeof e==`boolean`)return M(e);let t=typeof e==`string`||typeof e==`number`?String(e).trim().toLowerCase():``;return fe.has(t)?M(!0):pe.has(t)?M(!1):N(b(`notBoolean`,{cell:P(e)}))},I=e=>String(e).padStart(2,`0`),he=(e,t,n)=>{let r=new Date(Date.UTC(e,t-1,n));if(r.getUTCFullYear()===e&&r.getUTCMonth()===t-1&&r.getUTCDate()===n)return`${e}-${I(t)}-${I(n)}`},L=`(\\d{1,2}):(\\d{2})(?::(\\d{2})(?:\\.\\d+)?)?`,ge=(e,t)=>{let n=RegExp(`^(\\d{4})[-/](\\d{1,2})[-/](\\d{1,2})(?:[T ]${L}(Z|[+-]\\d{2}:?\\d{2})?)?$`).exec(e.trim()),r=RegExp(`^(\\d{1,2})[./-](\\d{1,2})[./-](\\d{4})(?: ${L})?$`).exec(e.trim());if(!n&&!r)return;let[i,a,o]=n?[n[1],n[2],n[3]].map(Number):t===`dmy`?[r[3],r[2],r[1]].map(Number):[r[3],r[1],r[2]].map(Number),s=he(i,a,o);if(!s)return;let[c,l,u=`0`]=n?n.slice(4,7):r.slice(4,7);if(c===void 0)return{date:s};if(!(Number(c)>23||Number(l)>59||Number(u)>59))return{date:s,time:`${I(Number(c))}:${l}:${I(Number(u))}`,zone:n?.[7]}},R=(e,t)=>{if(ee(e)){let[t,n]=e.date.split(`T`);return{date:t,time:n}}return typeof e==`string`?ge(e,t.dateOrder):void 0},z=(e,t)=>N(b(`notDate`,{cell:P(e),dayFirst:t.dateOrder===`dmy`})),_e=(e,t)=>{let n=R(e,t);return n?n.time&&n.time!==`00:00:00`?N(b(`hasTime`,{cell:P(e)})):M(n.date):z(e,t)},ve=(e,t)=>{let n=R(e,t);if(!n)return z(e,t);if(n.zone)return M(new Date(`${n.date}T${n.time}${n.zone===`Z`?`Z`:n.zone.replace(/^([+-]\d{2})(\d{2})$/,`$1:$2`)}`).toISOString());let[r,i,a]=n.date.split(`-`).map(Number),[o,s,c]=(n.time??`00:00:00`).split(`:`).map(Number);return M(new Date(r,i-1,a,o,s,c).toISOString())},B=e=>e.trim().toLowerCase().replace(/\s+/g,` `),ye=(e,t,n)=>{let r=e.enumValues??[],a=B(x(n)),o=r.filter(e=>B(e)===a||B(i(e,t?.valueLabels))===a);return o.length===1?M(o[0]):o.length>1?N(b(`severalValues`,{cell:P(n),values:o.map(e=>i(e,t?.valueLabels)).join(`, `)})):N(b(`notOneOf`,{cell:P(n),values:r.map(e=>i(e,t?.valueLabels)).join(`, `)}))},be=(e,t)=>typeof e==`boolean`&&!t.booleanText?N(b(`notText`,{cell:P(e)})):M(x(e)),xe=e=>S(e)?M(e.json):M(e),V=(e,t,n,r)=>{if(y(n))return e.nullable?M(null):N(b(`emptyRequired`));if(e.type===`json`)return xe(n);if(S(n))return N(b(`nestedValue`,{cell:P(n)}));switch(e.type){case`integer`:case`bigint`:return ue(e,n,r);case`decimal`:return de(n,r);case`boolean`:return me(n);case`date`:return _e(n,r);case`timestamp`:return ve(n,r);case`enum`:return ye(e,t,n);case`text`:case`uuid`:case`currency`:case`country`:return be(n,r);default:throw Error(`Not implemented: importing ${e.type} fields, which importableFields leaves out`)}},Se=(e,t)=>e[t]?.names?.singular??m(t),Ce=(e,t)=>e[t]?.names?.plural??m(t),we=(e,t,n)=>{let{model:r,resources:i,views:a}=n,o=a[r.name],s={},c={},l=[],u=[];for(let{column:n,field:d,matchBy:f}of t.columns){let p=r.fields[d],m=e.cells[n]??null,h=D(o,d),g=k(p,i);if(g&&!y(m)){let e=f??g.primaryKey[0],n=V(g.fields[e],a[g.name]?.fields[e],m,t.options);n.ok?u.push({field:d,finding:{model:g,field:e,value:n.value}}):l.push(`${h}: ${n.problem}`),s[d]=x(m);continue}let _=V(p,o?.fields[d],m,t.options);_.ok?c[d]=s[d]=_.value:l.push(`${h}: ${_.problem}`)}let d;if(t.match&&t.mode!==`create`){let n=r.fields[t.match.field],i=V({...n,nullable:!1},o?.fields[n.name],e.cells[t.match.column]??null,t.options);i.ok?d={model:r,field:n.name,value:i.value}:l.push(`${D(o,n.name)}: ${i.problem}`)}return{values:s,data:c,problems:l,relations:u,match:d}},H=(e,t)=>{let n=e.lookups.keysOf(t.model.name,t.field,t.value),r=`${D(e.views[t.model.name],t.field).toLowerCase()} “${String(t.value)}”`;return n.length===1?{key:n[0]}:n.length===0?{none:b(`noneHas`,{singular:Se(e.views,t.model.name),named:r})}:{several:b(`severalHave`,{count:n.length,plural:Ce(e.views,t.model.name),named:r})}},Te=e=>e.cells.every(y),U=async(e,t,n)=>{let{model:r,views:i}=n,a=e.filter(e=>!Te(e)).map(e=>({row:e,...we(e,t,n)})),o=new Map;for(let e of a.flatMap(e=>[...e.relations.map(e=>e.finding),...e.match?[e.match]:[]])){let t=`${e.model.name}.${e.field}`;o.has(t)||o.set(t,{model:e.model,field:e.field,values:[]}),o.get(t).values.push(e.value)}for(let{model:e,field:t,values:r}of o.values())await n.lookups.load(e,t,r);return a.map(({row:e,values:a,data:o,problems:s,relations:c,match:l})=>{let u={...o};for(let{field:e,finding:t}of c){let a=H(n,t);`key`in a?u[e]=a.key:s.push(`${D(i[r.name],e)}: ${a.none??a.several}`)}let d=l&&H(n,l);d?.several&&s.push(b(`notOneRecord`,{found:d.several})),d?.none&&t.mode===`update`&&s.push(b(`nothingToUpdate`,{found:d.none}));let f={line:e.line,cells:e.cells,values:a,problems:s};return s.length>0?f:d&&`key`in d?{...f,op:{op:`update`,resource:r.name,key:d.key,etag:`*`,data:u}}:{...f,op:{op:`create`,resource:r.name,data:u}}})},Ee=5,De=5,Oe=async(e,t)=>{let n=e.rows(t),{value:r=[]}=await n.next();await n.return(void 0);let[i,...a]=r;return{headers:(i?.cells??[]).map(x),sample:a.slice(0,Ee)}};async function*W(e,t){let n=!0;for await(let r of e.rows(t))yield n?r.slice(1):r,n=!1}var ke=async(e,t,n,r,i,a)=>{let o={rows:0,creates:0,updates:0,problems:[],preview:[]};for await(let s of W(e,t)){a?.throwIfAborted();for(let e of await U(s,n,r))o.rows++,o.preview.length<De&&o.preview.push(e),e.op?.op===`create`?o.creates++:e.op?.op===`update`?o.updates++:o.problems.push({line:e.line,cells:e.cells,problems:e.problems});i(o.rows)}return o},Ae=(e,t)=>{if(!d(e))return[e.message];let n=e.errors.filter(e=>e.field);return n.length===0?[e.message]:n.map(e=>`${D(t.views[t.model.name],e.field)}: ${e.message}`)},je=async(e,t,n,r,{client:i,onProgress:a,cancelled:o})=>{let s={created:0,updated:0,skipped:0,failed:0,notWritten:[]},c=async e=>{let t=[...e];for(;t.length>0;){let e=t.map(e=>e.op);try{let{results:t}=await i.batchWrite(e);for(let e of t)e.op===`create`?s.created++:e.op===`update`&&s.updated++;return}catch(e){let n=d(e)?e.operation:void 0;if(n===void 0||!t[n])throw e;let[i]=t.splice(n,1);s.failed++,s.notWritten.push({line:i.line,cells:i.cells,problems:Ae(e,r)})}}},l=[],u=async e=>{for(;l.length>=100||e&&l.length>0;){if(o())return!1;await c(l.splice(0,100)),a({...s})}return!0};for await(let i of W(e,t)){for(let e of await U(i,n,r))e.op?l.push(e):(s.skipped++,s.notWritten.push({line:e.line,cells:e.cells,problems:e.problems}));if(!await u(!1))return{...s,cancelled:!0}}return await u(!0)?{...s,cancelled:!1}:{...s,cancelled:!0}},G=50,K=(e,t,n)=>r(re(t,n),b(`notImportedFile`,{name:(e??`import`).replace(/\.[^.]+$/,``)}),`text/csv`),q=({rows:e})=>(0,T.jsxs)(`ul`,{"aria-label":b(`rowsNotImported`),className:`flex flex-col gap-1 text-body`,children:[e.slice(0,G).map(e=>(0,T.jsxs)(`li`,{children:[(0,T.jsx)(`span`,{className:`font-medium`,children:b(`rowProblems`,{line:e.line})}),` `,e.problems.join(`; `)]},e.line)),e.length>G&&(0,T.jsx)(`li`,{className:`text-muted-foreground`,children:b(`andMore`,{count:(e.length-G).toLocaleString(o())})})]}),Me=({rows:e})=>(0,T.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,T.jsx)(v,{className:`size-3.5`}),b(`checkingRows`,{count:e.toLocaleString(o())})]}),Ne=({check:e,model:t,resources:n,views:r,columns:i,headers:o,fileName:s})=>{let c=r[t.name],l=i.map(e=>t.fields[e.field]);return(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsx)(E,{label:b(`check`),counts:[[b(`rows`),e.rows],[b(`toCreate`),e.creates],[b(`toUpdate`),e.updates],[b(`withProblems`),e.problems.length]]}),e.preview.length>0&&(0,T.jsx)(`div`,{className:`overflow-x-auto rounded-lg border`,children:(0,T.jsxs)(`table`,{"aria-label":b(`firstRows`),className:`w-full text-left text-body`,children:[(0,T.jsx)(`thead`,{className:`bg-muted text-muted-foreground`,children:(0,T.jsxs)(`tr`,{children:[(0,T.jsx)(`th`,{className:`px-2 py-1.5 font-medium`,children:b(`row`)}),l.map(e=>(0,T.jsx)(`th`,{className:`whitespace-nowrap px-2 py-1.5 font-medium`,children:D(c,e.name)},e.name))]})}),(0,T.jsx)(`tbody`,{className:`divide-y`,children:e.preview.map(e=>(0,T.jsxs)(`tr`,{className:e.problems.length>0?`bg-danger-soft`:void 0,children:[(0,T.jsx)(`td`,{className:`px-2 py-1.5 tabular-nums text-muted-foreground`,children:e.line}),l.map(t=>(0,T.jsx)(`td`,{className:`max-w-48 truncate px-2 py-1.5`,children:k(t,n)?String(e.values[t.name]??`—`):t.name in e.values?h(t,e.values[t.name],c?.fields[t.name]):``},t.name))]},e.line))})]})}),e.problems.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsx)(`h3`,{className:`font-medium`,children:b(`problemRows`)}),(0,T.jsxs)(a,{size:`sm`,onClick:()=>K(s,o,e.problems),children:[(0,T.jsx)(p,{className:`size-3.5`}),b(`download`)]})]}),(0,T.jsx)(q,{rows:e.problems})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`batches`,{size:100})})]})},Pe=[`.xlsx`,`.csv`,`.json`],Fe=[`text/csv`,`application/json`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],Ie=[`text/comma-separated-values`,`application/csv`,`text/x-csv`,`application/vnd.ms-excel`,`text/plain`,`application/octet-stream`],Le=e=>/\bAndroid\b/.test(e),Re=e=>[...Pe,...Fe,...Le(e)?Ie:[]].join(`,`),J=({label:e,name:t,value:n,options:r,onChange:i,help:a,className:o})=>{let s=(0,w.useId)();return(0,T.jsxs)(`div`,{className:l(`flex min-w-0 flex-col gap-1.5`,o),children:[(0,T.jsx)(`label`,{htmlFor:s,className:`font-medium`,children:e}),(0,T.jsx)(`select`,{id:s,"aria-label":t,value:n,onChange:e=>i(e.target.value),className:`h-8 w-full min-w-0 rounded-md border border-border-strong bg-background px-2 shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20 max-sm:min-h-11`,children:r.map(e=>(0,T.jsx)(`option`,{value:e.value,children:e.label},e.value))}),a&&(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a})]})},Y=({file:e,sheets:t,sheet:n,reading:r,onChoose:i,onSheet:a})=>{let o=(0,w.useId)();return(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsx)(`label`,{htmlFor:o,className:`font-medium`,children:b(`file`)}),(0,T.jsx)(`input`,{id:o,type:`file`,accept:Re(globalThis.navigator?.userAgent??``),disabled:r,onChange:e=>{let t=e.target.files?.[0];t&&i(t)},className:`file:mr-3 file:h-8 file:rounded-md file:border file:border-border-strong file:bg-background file:px-3 file:font-medium file:text-foreground max-sm:file:min-h-11`}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`fileHint`)})]}),r&&(0,T.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,T.jsx)(v,{className:`size-3.5`}),b(`reading`,{name:e?.name??b(`theFile`)})]}),!r&&t.length>1&&(0,T.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,T.jsx)(te,{className:`mb-2 size-4 shrink-0 text-muted-foreground`}),(0,T.jsx)(J,{className:`flex-1`,label:b(`sheet`),value:n??``,options:t.map(e=>({value:e,label:e})),onChange:a})]})]})},X=e=>e.toLocaleString(o()),ze=({progress:e,total:t,cancelling:n})=>{let r=e.created+e.updated+e.failed;return(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:b(n?`stopping`:`saving`)}),(0,T.jsxs)(`span`,{className:`tabular-nums`,children:[X(r),` / `,X(t)]})]}),(0,T.jsx)(`div`,{role:`progressbar`,"aria-label":b(`rowsSaved`),"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":t,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width]`,style:{width:`${t>0?Math.min(100,r/t*100):0}%`}})})]})},Be=({result:e,stopped:t,headers:n,fileName:r})=>(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t!==void 0&&(0,T.jsx)(_,{title:b(`stopped`),error:t}),e.cancelled&&(0,T.jsx)(`p`,{role:`status`,children:b(`cancelled`)}),(0,T.jsx)(E,{label:b(`summary`),counts:[[b(`created`),e.created],[b(`updated`),e.updated],[b(`skipped`),e.skipped],[b(`failed`),e.failed]]}),e.notWritten.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsx)(`h3`,{className:`font-medium`,children:b(`rowsNotImported`)}),(0,T.jsxs)(a,{size:`sm`,onClick:()=>K(r,n,e.notWritten),children:[(0,T.jsx)(p,{className:`size-3.5`}),b(`download`)]})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`notWrittenHint`)}),(0,T.jsx)(q,{rows:[...e.notWritten].sort((e,t)=>e.line-t.line)})]})]}),Ve=u(),Z=100,Q=e=>String(e),He=e=>{let t=new Map,n=(e,n)=>{let r=`${e}.${n}`;return t.has(r)||t.set(r,new Map),t.get(r)};return{load:async(t,r,i)=>{let a=n(t.name,r),o=[...new Map(i.filter(e=>!a.has(Q(e))).map(e=>[Q(e),e])).values()],c=t.primaryKey[0];for(let n=0;n<o.length;n+=Z){let i=o.slice(n,n+Z);for(let e of i)a.set(Q(e),[]);let l=s(Ve.in(r,i)),u;do{let n=await e(t.name).list(t.name,{filter:l,fields:[...new Set([c,r])],pageSize:1e3,pageToken:u});for(let e of n.items)a.get(Q(e[r]))?.push(e[c]);u=n.nextPageToken||void 0}while(u)}},keysOf:(e,t,r)=>n(e,t).get(Q(r))??[]}},Ue=500,$=()=>{let e=new Worker(new URL(`/assets/parse-worker-BN8cVWIa.js`,``+import.meta.url),{type:`module`}),t=[],n;return e.onmessage=e=>{if(n){let t=n;n=void 0,t(e.data)}else t.push(e.data)},e.onerror=e=>{e.preventDefault();let r={type:`error`,message:b(`unreadable`)};n?n(r):t.push(r)},{send:t=>e.postMessage(t),receive:()=>t.length>0?Promise.resolve(t.shift()):new Promise(e=>n=e),stop:()=>e.terminate()}},We=e=>({sheets:async()=>{let t=$();try{t.send({type:`sheets`,file:e,locale:f()});let n=await t.receive();if(n.type===`error`)throw Error(n.message);if(n.type!==`sheets`)throw Error(`The parse worker answered ${n.type} to a request for sheets`);return n.sheets}finally{t.stop()}},rows:async function*(t){let n=$();try{for(n.send({type:`read`,file:e,sheet:t,chunk:Ue,locale:f()});;){let e=await n.receive();if(e.type===`error`)throw Error(e.message);if(e.type===`end`)return;if(e.type!==`rows`)throw Error(`The parse worker answered ${e.type} to a read`);yield e.rows,n.send({type:`next`})}}finally{n.stop()}}});export{A as _,Y as a,Me as c,je as d,ce as f,k as g,se as h,Be as i,ke as l,ae as m,He as n,J as o,D as p,ze as r,Ne as s,We as t,Oe as u,le as v};
3
+ //# debugId=a940151f-32e4-4c3e-9ce7-f2c9ba852e90
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$i as r,$s as i,Gc as a,Jo as o,Ko as s,Pc as c,Uo as l,Wo as u,ds as d,ms as f,tc as p,us as m}from"./app-B48LQpC1.js";import{t as h}from"./page-header-Ddz2r5ic.js";var g=e(t(),1),_=()=>[{value:`allowed`,label:m(`on`)},{value:`forbidden`,label:m(`off`)}],v=()=>[{value:`allowed`,label:m(`optional`)},{value:`required`,label:m(`required`)},{value:`forbidden`,label:m(`off`)}],y=()=>[{method:`password`,label:m(`password`),description:m(`passwordDescription`),rules:_()},{method:`emailCode`,label:m(`emailedSignInCode`),description:m(`emailedSignInCodeDescription`),rules:_()},{method:`passkey`,label:m(`passkeys`),description:m(`passkeysPolicyDescription`),rules:v()},{method:`twoFactor`,label:m(`twoFactor`),description:m(`twoFactorPolicyDescription`),rules:v()},{method:`staffAccess`,label:m(`staffAccess`),description:m(`staffAccessDescription`),rules:[{value:`allowed`,label:m(`on`)},{value:`notify`,label:m(`emailThePerson`)},{value:`forbidden`,label:m(`off`)}]},{method:`platformSignIn`,label:m(`platformSignIn`),description:m(`platformSignInDescription`),rules:_()}],b=(e,t)=>{let n=y().find(t=>t.method===e)?.rules.find(e=>e.value===t)?.label;if(n===void 0)throw Error(`No label for the ${t} rule of ${e}`);return n},x=e(n(),1),S=({row:e,value:t,onChange:n})=>(0,x.jsx)(`span`,{role:`radiogroup`,"aria-label":e.label,className:`inline-flex h-8 shrink-0 rounded-md bg-muted p-0.5`,children:e.rules.map(e=>(0,x.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e.value===t,onClick:()=>n(e.value),className:c(`rounded px-3 text-body font-medium transition-colors`,e.value===t?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:e.label},e.value))}),C=({method:e},t,{mail:n,effective:r,policy:i})=>{if(e===`emailCode`&&!n)return m(`codeNeedsMail`);if(e===`password`&&!n&&t.password===`forbidden`)return m(`passwordStaysOn`);if(e===`staffAccess`&&!n&&t.staffAccess===`notify`)return m(`staffNeedsMail`);if(e===`platformSignIn`&&t.platformSignIn===`allowed`&&t.passkey===`required`)return m(`platformOff`);if(t[e]===i[e]&&r[e]!==i[e])return m(`appliesAs`,{rule:b(e,r[e])})},w=({operator:e,platformProviders:t=[]})=>y().flatMap(n=>n.method===`staffAccess`&&!e?[]:n.method===`platformSignIn`?t.length>0?[{...n,label:m(`platformSignInWith`,{provider:new Intl.ListFormat(a(),{type:`conjunction`}).format(t)})}]:[]:[n]),T=({state:e,onSave:t,busy:n,error:a,notice:o})=>{let[s,c]=(0,g.useState)(e.policy),l=w(e),u=l.some(({method:t})=>s[t]!==e.policy[t]);return(0,x.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),t(s)},children:[(0,x.jsx)(`ul`,{className:`divide-y rounded-lg border bg-background`,children:l.map(t=>{let n=C(t,s,e);return(0,x.jsxs)(`li`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`h2`,{className:`font-semibold`,children:t.label}),(0,x.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:t.description}),n&&(0,x.jsx)(`p`,{className:`mt-1.5 text-xs font-medium text-warning-text`,children:n})]}),(0,x.jsx)(S,{row:t,value:s[t.method],onChange:e=>c({...s,[t.method]:e})})]},t.method)})}),a&&(0,x.jsx)(`p`,{role:`alert`,className:`rounded-md bg-danger-soft px-3 py-2 text-body font-medium text-danger-text`,children:a}),o&&!u&&(0,x.jsx)(`p`,{role:`status`,className:`rounded-md bg-success-soft px-3 py-2 text-body font-medium text-success-text`,children:o}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.savedAt?e.savedBy?m(`lastSavedBy`,{name:e.savedBy,time:r(Date.parse(e.savedAt))}):m(`lastSaved`,{time:r(Date.parse(e.savedAt))}):m(`neverChanged`)}),(0,x.jsxs)(`div`,{className:`flex gap-2`,children:[u&&(0,x.jsx)(i,{onClick:()=>c(e.policy),children:m(`reset`)}),(0,x.jsx)(i,{variant:`primary`,type:`submit`,loading:n,disabled:!u,children:m(`save`)})]})]})]})},E=(e,t)=>e.endedAt?(0,x.jsx)(s,{tone:`neutral`,children:m(`stopped`,{time:r(Date.parse(e.endedAt))})}):Date.parse(e.expiresAt)<=t?(0,x.jsx)(s,{tone:`neutral`,children:m(`ended`,{time:r(Date.parse(e.expiresAt))})}):(0,x.jsx)(s,{tone:`amber`,children:m(`signedInUntil`,{time:r(Date.parse(e.expiresAt))})}),D=({signIns:e,operator:t,error:n,now:i=Date.now()})=>(0,x.jsxs)(l,{title:m(`staffSignIns`),description:m(`staffSignInsDescription`,{operator:t}),children:[(0,x.jsx)(u,{message:n}),e&&e.length===0&&(0,x.jsx)(`p`,{className:`text-muted-foreground`,children:m(`noStaffSignIns`)}),e&&e.length>0&&(0,x.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.map(e=>(0,x.jsxs)(`li`,{className:`flex flex-col gap-1.5 p-3`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,x.jsx)(`span`,{className:`font-medium break-all`,children:e.staffName?`${e.staffName} (${e.staff})`:e.staff}),(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:m(`as`)}),(0,x.jsx)(`span`,{className:`font-medium break-all`,children:e.user})]}),(0,x.jsx)(`p`,{className:`break-words`,children:e.reason}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,x.jsx)(`span`,{children:r(Date.parse(e.startedAt))}),E(e,i)]})]},e.id))})]}),O=({operator:e})=>{let{session:t}=d(),[n,r]=(0,g.useState)(),[i,a]=(0,g.useState)();return(0,g.useEffect)(()=>{t.staff.log().then(r,e=>a(e instanceof f?o(e):m(`couldNotReadStaffSignIns`)))},[t]),(0,x.jsx)(D,{operator:e,signIns:n,error:i})},k=()=>{let{session:e}=d(),[t,n]=(0,g.useState)(),[r,i]=(0,g.useState)(!1),[a,s]=(0,g.useState)(),[c,l]=(0,g.useState)();(0,g.useEffect)(()=>{e.signInPolicy.read().then(n,e=>s(e instanceof f?o(e):m(`couldNotReadPolicy`)))},[e]);let u=async t=>{i(!0),s(void 0),l(void 0);try{n(await e.signInPolicy.save(t)),l(m(`policySaved`))}catch(e){if(!(e instanceof f))throw e;s(o(e))}i(!1)};return(0,x.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6`,children:[(0,x.jsx)(h,{title:m(`signInPolicy`),subtitle:m(`policySubtitle`)}),t?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{state:t,busy:r,error:a,notice:c,onSave:e=>void u(e)},t.savedAt??`default`),t.operator&&(0,x.jsx)(O,{operator:t.operator})]}):a?(0,x.jsx)(`p`,{role:`alert`,className:`text-danger-text`,children:a}):(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,x.jsx)(p,{}),` `,m(`loading`)]})]})};export{k as SignInPolicyPage};
2
+ //# debugId=6e98bd59-3cad-48a4-af8c-38689bdb221d
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t}from"./react-CuiNlnus.js";import{Ai as n,Er as r,Fo as i,Jn as a,Ms as o,Nr as s,Qn as c,Zo as l,an as u,ar as d,dn as f,er as p,fn as m,gs as h,in as g,is as _,ka as v,rn as y,sr as b,un as x,xs as S,ys as C}from"./app-B48LQpC1.js";import{h as w}from"./vendor-t7Q7QbPu.js";import{S as T,ht as E,r as D}from"./embedded-list-CdFZ5TIe.js";import{n as O}from"./record-preview-DYLddBgR.js";var k=e(t(),1),A=e=>({queryKey:e.queryKey,start:t=>t.prefetchQuery(e)}),j=e=>({queryKey:e.queryKey,start:t=>t.prefetchInfiniteQuery(e)}),M={Table:(e,t,r)=>{let{resource:i,filter:a=``,sort:o=``,columns:s,button:c,bulk:l=!1,limit:d=10,select:p}=g(e),m=i===void 0?void 0:r.resources[i];if(!m)return[];if(t.part===`chosen`){let e=p===void 0?void 0:r.given[p];return e?[A(f(r.client,m,{key:e}))]:[]}let h=r.views[m.name],{fields:_,read:v}=u({...r,model:m,view:h,columns:s?.map(S),button:c,bulk:l,phoneColumns:y(s)});return[A(D(r,{model:m,filter:a,orderBy:o||n(m,h),limit:d,fields:_,read:v}))]},Chart:(e,t,{client:n,resources:i,views:a})=>{let{resource:o,groupBy:s,splitBy:c,sum:l,average:u,filter:d,granularity:f,range:p,limit:m}=g(e),h=i[o],_=h&&E({model:h,groupBy:s,splitBy:c,sum:l,average:u,filter:d,granularity:f,range:p,limit:m},i,a);return h&&_?[A(r(n,h.name,_))]:[]},RecordCards:(e,t,{client:r,resources:i,views:a})=>{let{resource:o,filter:s=``,sort:c=``,limit:l=10}=g(e),u=i[o];if(!u)return[];let d=c||n(u,a[u.name]);return[A(m(r,u,{filter:s,sort:d,pageSize:l})),A(x(r,u,s))]},RecordRow:(e,t,{client:n,queryClient:r,resources:i,views:a})=>{let{resource:o,filter:s=``,sort:c=``}=g(e),l=i[o];if(!l)return[];let u=a[l.name];return u?.searchesOf||u?.listOf!==void 0?[]:[A(O({queryClient:r,client:n,resources:i,views:a,model:l,...T(l,u,{filter:s,sort:c})}))]},Thread:(e,t,{client:n,resources:r,views:i})=>{let{resource:c,filter:l,sender:u,time:d,calls:f,limit:p=50}=g(e);if(t.part===`calls`){let e=f&&r[f.resource];return e?[j(s(n,e.name,{filter:f.filter,orderBy:o(f.time),pageSize:p}))]:[]}let m=r[c];if(!m)return[];let h=a(r,i,m,u===void 0?[]:[u]);return[j(s(n,m.name,{filter:l,orderBy:o(d),pageSize:p,labels:h}))]}},N=(e,t,{client:n,resources:r})=>{let i=r[t.resource];return i?[A(x(n,i))]:[]},P=(e,t,n)=>(n?.reads??[]).flatMap(n=>{let r=C(t,n.block);if(!r||r.custom)return[];if(n.part===`condition`)return N(r,n,e);if(n.split)return[];let i=M[r.type];return i?i(h(r,{stack:[],params:e.params,...e.root&&{root:e.root}}),n,e):[]}),F=({tree:e,plan:t})=>{let n=_(),r=w(),{resources:a,views:o}=l(),s=v().fields,u=i(),f=c(),m=p(),h=d(b()),g=(0,k.useMemo)(()=>P({client:n,queryClient:r,resources:a,views:o,fieldTypes:s,xs:u,params:f,given:m,...h&&{root:h}},e,t),[n,r,a,o,s,u,f,m,h,e,t]);return(0,k.useEffect)(()=>{for(let e of g)e.start(r)},[g,r]),null};export{F as t};
2
+ //# debugId=d813cdee-f4cb-49fc-b7b1-a837dc932253