@protobase/ui 0.120.0 → 0.121.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 (223) hide show
  1. package/dist/account/messages.d.ts +2 -2
  2. package/dist/app/charts/messages.d.ts +2 -2
  3. package/dist/app/comments/messages.d.ts +2 -2
  4. package/dist/app/conversation/thread-state.d.ts +1 -1
  5. package/dist/app/create/messages.d.ts +2 -2
  6. package/dist/app/custom-section.d.ts +1 -1
  7. package/dist/app/delete/messages.d.ts +2 -2
  8. package/dist/app/displays/list-cards.d.ts +1 -1
  9. package/dist/app/displays/messages.d.ts +2 -2
  10. package/dist/app/embedded-list/messages.d.ts +2 -2
  11. package/dist/app/export/messages.d.ts +2 -2
  12. package/dist/app/field-types/runner-install/messages.d.ts +2 -2
  13. package/dist/app/field-types/widget-part.d.ts +1 -1
  14. package/dist/app/field-types/workflow/cache-field.js +1 -1
  15. package/dist/app/field-types/workflow/definition.d.ts +1 -1
  16. package/dist/app/field-types/workflow/flow-elements.js +2 -2
  17. package/dist/app/field-types/workflow/flow-nodes.js +2 -2
  18. package/dist/app/field-types/workflow/messages.d.ts +2 -2
  19. package/dist/app/field-types/workflow/node-panel.js +2 -2
  20. package/dist/app/field-types/workflow/pins/data-edits.js +1 -1
  21. package/dist/app/field-types/workflow/pins/pin-text.js +1 -1
  22. package/dist/app/field-types/workflow/task-fields.js +2 -2
  23. package/dist/app/field-types/workflow/trigger-fields.js +1 -1
  24. package/dist/app/field-types/workflow/workflow-canvas.js +3 -3
  25. package/dist/app/field-types/workflow/workflow-field.js +1 -1
  26. package/dist/app/field-types/workflow/workflow-graph-editor.js +3 -3
  27. package/dist/app/field-types/workflow-page/insert-value-view.js +3 -3
  28. package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
  29. package/dist/app/field-types/workflow-page/publish-panel.js +2 -2
  30. package/dist/app/field-types/workflow-page/rerun-panel.js +1 -1
  31. package/dist/app/field-types/workflow-page/run-notice.js +1 -1
  32. package/dist/app/field-types/workflow-page/runs-panel.js +1 -1
  33. package/dist/app/field-types/workflow-page/test-run-panel.js +2 -2
  34. package/dist/app/field-types/workflow-page/use-workflow-page.js +2 -2
  35. package/dist/app/field-types/workflow-page/workbench-bar.js +1 -1
  36. package/dist/app/field-types/workflow-page/workflow-workbench.js +12 -12
  37. package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
  38. package/dist/app/field-types/workflow-run/run-trace-view.js +4 -4
  39. package/dist/app/field-types/workflow-run/step-card.js +1 -1
  40. package/dist/app/field-types/workflow-run/step-panel.js +1 -1
  41. package/dist/app/file-viewers/messages.d.ts +2 -2
  42. package/dist/app/focus/messages.d.ts +2 -2
  43. package/dist/app/gallery/messages.d.ts +2 -2
  44. package/dist/app/hand-order/messages.d.ts +2 -2
  45. package/dist/app/history/messages.d.ts +2 -2
  46. package/dist/app/import/messages.d.ts +2 -2
  47. package/dist/app/list-edit/messages.d.ts +2 -2
  48. package/dist/app/list-messages.d.ts +2 -2
  49. package/dist/app/messages.d.ts +2 -2
  50. package/dist/app/pages/custom-boundary.d.ts +1 -1
  51. package/dist/app/pages/custom-chosen.d.ts +1 -1
  52. package/dist/app/pages/messages.d.ts +2 -2
  53. package/dist/app/record-messages.d.ts +2 -2
  54. package/dist/app/record-mode/shown-layout.d.ts +1 -1
  55. package/dist/app/record-row/messages.d.ts +2 -2
  56. package/dist/app/related-cards/messages.d.ts +2 -2
  57. package/dist/app/saved/messages.d.ts +2 -2
  58. package/dist/app/saved/saved-list.d.ts +1 -1
  59. package/dist/app/searches/messages.d.ts +2 -2
  60. package/dist/app-shell/messages.d.ts +2 -2
  61. package/dist/auth/messages.d.ts +2 -2
  62. package/dist/calls/messages.d.ts +2 -2
  63. package/dist/filter-panel/messages.d.ts +2 -2
  64. package/dist/forms/messages.d.ts +2 -2
  65. package/dist/inline-child-table/messages.d.ts +2 -2
  66. package/dist/invitations/messages.d.ts +2 -2
  67. package/dist/locale/texts-gate.d.ts +1 -1
  68. package/dist/mailbox/messages.d.ts +2 -2
  69. package/dist/mocks/customers.d.ts +1 -1
  70. package/dist/mocks/invoices.d.ts +2 -2
  71. package/dist/mocks/orders.d.ts +2 -2
  72. package/dist/organizations/messages.d.ts +2 -2
  73. package/dist/package.js +1 -1
  74. package/dist/plugins/before-sign-in.d.ts +1 -1
  75. package/dist/plugins/messages.d.ts +2 -2
  76. package/dist/shell/assets/{account-page-D0LQgPBu.js → account-page-DIIa49Sf.js} +2 -2
  77. package/dist/shell/assets/{app-CK_M0TgA.js → app-B8KcM2Z-.js} +5 -5
  78. package/dist/shell/assets/{assistant-shell-t6EYCEG6.js → assistant-shell-CLGyb2ss.js} +2 -2
  79. package/dist/shell/assets/{board-display-BF6sraBq.js → board-display-DJJD_jjY.js} +2 -2
  80. package/dist/shell/assets/{calendar-display-DdgRC4MC.js → calendar-display-7R7Vz5Vm.js} +2 -2
  81. package/dist/shell/assets/{call-rings-C5ud3oUx.js → call-rings-AviIOqM7.js} +2 -2
  82. package/dist/shell/assets/{calls-5vjQEKRi.js → calls-C2CUgWkn.js} +2 -2
  83. package/dist/shell/assets/{circle-alert-D4sTiwNu.js → circle-alert-DOaXkZQv.js} +2 -2
  84. package/dist/shell/assets/{composed-page-BWauYpuf.js → composed-page-DjGZy9C7.js} +2 -2
  85. package/dist/shell/assets/{composer-section-Dp-xM9-b.js → composer-section-BLqTkqi8.js} +2 -2
  86. package/dist/shell/assets/{connect-route-DkjLawxM.js → connect-route-41MPQMtp.js} +2 -2
  87. package/dist/shell/assets/{copy-field-B14w71cy.js → copy-field-Ct-6xn8T.js} +2 -2
  88. package/dist/shell/assets/{create-route-DGBe6c9T.js → create-route-CRZSYoTi.js} +2 -2
  89. package/dist/shell/assets/{custom-step-container-field-CXzhDKB8.js → custom-step-container-field-C0uZrHjV.js} +2 -2
  90. package/dist/shell/assets/{embedded-list-COr7SEcU.js → embedded-list-C3nd1V5o.js} +3 -3
  91. package/dist/shell/assets/{export-dialog-CCnbhHYq.js → export-dialog-BerhgfFO.js} +2 -2
  92. package/dist/shell/assets/{first-organization-page-NFqF-XyH.js → first-organization-page-CKYevHep.js} +2 -2
  93. package/dist/shell/assets/{graph-view-CnMNqiV4.js → graph-view-CoLu3Uhs.js} +2 -2
  94. package/dist/shell/assets/{group-donut-BbP0DJKg.js → group-donut-B8v2SWzP.js} +2 -2
  95. package/dist/shell/assets/{guest-call-page-R7GFfBV-.js → guest-call-page-DqQMPCVU.js} +3 -3
  96. package/dist/shell/assets/{html-viewer-DoOxyTcM.js → html-viewer-BntGWVRA.js} +2 -2
  97. package/dist/shell/assets/{import-dialog-_5Szg-jU.js → import-dialog-DThTUXFS.js} +2 -2
  98. package/dist/shell/assets/{import-table-dialog-njI8BoS4.js → import-table-dialog-C-XIx1Dd.js} +2 -2
  99. package/dist/shell/assets/{index-BbZazL12.js → index-CI7L8s0t.js} +1 -1
  100. package/dist/shell/assets/{invitations-page-EV-UUQ6b.js → invitations-page-COFjv2AV.js} +2 -2
  101. package/dist/shell/assets/{layout-grid-B0-CJOlT.js → layout-grid-CvCNKDtn.js} +2 -2
  102. package/dist/shell/assets/{legend-item-DlKFFY7e.js → legend-item-9nkaAII6.js} +2 -2
  103. package/dist/shell/assets/{list-page-aYSJ3PHa.js → list-page-D3nIEwGf.js} +4 -4
  104. package/dist/shell/assets/{maplibre-B6nwN1UZ.js → maplibre-5GcVztUc.js} +2 -2
  105. package/dist/shell/assets/{markdown-content-C8sLopWJ.js → markdown-content-DVmg_kx3.js} +2 -2
  106. package/dist/shell/assets/{members-page-CgBOboZQ.js → members-page-DoRl-b9K.js} +2 -2
  107. package/dist/shell/assets/{message-content-BkvkBtPr.js → message-content-BpfTrsWh.js} +2 -2
  108. package/dist/shell/assets/{messages-CqYTV98f.js → messages-CZQvPUZQ.js} +2 -2
  109. package/dist/shell/assets/{organization-page-CUBsrNzR.js → organization-page-DeaQlPop.js} +2 -2
  110. package/dist/shell/assets/{organizations-page-D_imfTUa.js → organizations-page-Dlosll2b.js} +2 -2
  111. package/dist/shell/assets/{pending-invitation-row-D4gFapdv.js → pending-invitation-row-t63yAwI8.js} +2 -2
  112. package/dist/shell/assets/{period-chart-ChFHNTEE.js → period-chart-BVv9kC_E.js} +2 -2
  113. package/dist/shell/assets/{person-row-YwRtkzbb.js → person-row-CgvcHRmL.js} +2 -2
  114. package/dist/shell/assets/{public-form-page-oyX-a-KA.js → public-form-page-CruNnqqc.js} +2 -2
  115. package/dist/shell/assets/{record-lines-D1wftBQA.js → record-lines-Dts68Cfq.js} +2 -2
  116. package/dist/shell/assets/{record-map-BEOxTNu4.js → record-map-BO9rZaxg.js} +2 -2
  117. package/dist/shell/assets/{record-opens-C9579izg.js → record-opens-Ds9nDyw1.js} +2 -2
  118. package/dist/shell/assets/{record-page-Dhb9gzfJ.js → record-page-DJgscks5.js} +3 -3
  119. package/dist/shell/assets/{record-preview-eCoWviA9.js → record-preview-CwySCCRj.js} +2 -2
  120. package/dist/shell/assets/{records-map-DVETi1eC.js → records-map-Bq_dBgiT.js} +2 -2
  121. package/dist/shell/assets/{render-node-CSjGRPb0.js → render-node-zjMYynnA.js} +3 -3
  122. package/dist/shell/assets/{reorder-button-1ikk6wTV.js → reorder-button-BGgoLDx3.js} +2 -2
  123. package/dist/shell/assets/{run-trace-view-DC8UUfeb.js → run-trace-view-BtyPPUyt.js} +2 -2
  124. package/dist/shell/assets/{runner-install-field-BmVLaBtB.js → runner-install-field-DvuPCX28.js} +2 -2
  125. package/dist/shell/assets/{runtime-update-CTsM8FBn.js → runtime-update-e56Spv--.js} +2 -2
  126. package/dist/shell/assets/{shared-protobase-ui-DkBQh22L.js → shared-protobase-ui-QP42FY24.js} +1 -1
  127. package/dist/shell/assets/{sheet-source-BbBLftOM.js → sheet-source-Cenf8A74.js} +2 -2
  128. package/dist/shell/assets/{sign-in-policy-page-BrVvhdS0.js → sign-in-policy-page-CUiU8ZIN.js} +2 -2
  129. package/dist/shell/assets/{start-block-queries-B1m-VmpK.js → start-block-queries-DUvYFyeX.js} +2 -2
  130. package/dist/shell/assets/{step-catalog-DXkb5LNi.js → step-catalog-CKmRa3SA.js} +2 -2
  131. package/dist/shell/assets/{step-panel-CEluX3Jl.js → step-panel-DD821ue5.js} +2 -2
  132. package/dist/shell/assets/{timeline-display-C1OXwJcu.js → timeline-display-ChPHZfO_.js} +2 -2
  133. package/dist/shell/assets/{trash-Ba3Y5_30.js → trash-Ch2JFURM.js} +2 -2
  134. package/dist/shell/assets/{update-set-D2mI0J7M.js → update-set-Zch9kB-u.js} +2 -2
  135. package/dist/shell/assets/{use-calendar-move-BENhrEOz.js → use-calendar-move-Cl14_xWL.js} +2 -2
  136. package/dist/shell/assets/{use-display-rows-DIoyxucI.js → use-display-rows-s-zuk4Lc.js} +2 -2
  137. package/dist/shell/assets/{use-my-invitations-B4h6GyJO.js → use-my-invitations-APXH_Xf1.js} +2 -2
  138. package/dist/shell/assets/{use-paged-search-DjnlXbQ5.js → use-paged-search-CxaSlMkh.js} +2 -2
  139. package/dist/shell/assets/{use-run-trace-2fQX9FeC.js → use-run-trace-CRG2_uVq.js} +2 -2
  140. package/dist/shell/assets/{use-workflow-page-D8Vn1I90.js → use-workflow-page-BPZWN9Iv.js} +2 -2
  141. package/dist/shell/assets/{use-workflow-types-DpNGPeuE.js → use-workflow-types-Dk4FOVoz.js} +2 -2
  142. package/dist/shell/assets/{workflow-canvas-CZ6QjuM6.js → workflow-canvas-DBlvFI_n.js} +2 -2
  143. package/dist/shell/assets/{workflow-field-CLeslVkB.js → workflow-field-DXiYYH5X.js} +3 -3
  144. package/dist/shell/assets/{workflow-graph-editor-CirmaYcy.js → workflow-graph-editor-BtNoPI_a.js} +2 -2
  145. package/dist/shell/assets/{workflow-run-field-DgVAi0nl.js → workflow-run-field-CztPPLbi.js} +3 -3
  146. package/dist/shell/assets/{workflow-status-field-CD4Npg78.js → workflow-status-field-K3DE4tPj.js} +2 -2
  147. package/dist/shell/assets/{workflow-workbench-Dy2EmMb7.js → workflow-workbench-CAz04v9t.js} +2 -2
  148. package/dist/shell/index.html +3 -3
  149. package/dist/shell/protobase.shell.json +2 -2
  150. package/dist/shell/protobase.sw.js +2 -2
  151. package/dist/shell-source-maps/assets/{account-page-D0LQgPBu.js.map → account-page-DIIa49Sf.js.map} +1 -1
  152. package/dist/shell-source-maps/assets/{app-CK_M0TgA.js.map → app-B8KcM2Z-.js.map} +1 -1
  153. package/dist/shell-source-maps/assets/{assistant-shell-t6EYCEG6.js.map → assistant-shell-CLGyb2ss.js.map} +1 -1
  154. package/dist/shell-source-maps/assets/{board-display-BF6sraBq.js.map → board-display-DJJD_jjY.js.map} +1 -1
  155. package/dist/shell-source-maps/assets/{calendar-display-DdgRC4MC.js.map → calendar-display-7R7Vz5Vm.js.map} +1 -1
  156. package/dist/shell-source-maps/assets/{call-rings-C5ud3oUx.js.map → call-rings-AviIOqM7.js.map} +1 -1
  157. package/dist/shell-source-maps/assets/{calls-5vjQEKRi.js.map → calls-C2CUgWkn.js.map} +1 -1
  158. package/dist/shell-source-maps/assets/{circle-alert-D4sTiwNu.js.map → circle-alert-DOaXkZQv.js.map} +1 -1
  159. package/dist/shell-source-maps/assets/{composed-page-BWauYpuf.js.map → composed-page-DjGZy9C7.js.map} +1 -1
  160. package/dist/shell-source-maps/assets/{composer-section-Dp-xM9-b.js.map → composer-section-BLqTkqi8.js.map} +1 -1
  161. package/dist/shell-source-maps/assets/{connect-route-DkjLawxM.js.map → connect-route-41MPQMtp.js.map} +1 -1
  162. package/dist/shell-source-maps/assets/{copy-field-B14w71cy.js.map → copy-field-Ct-6xn8T.js.map} +1 -1
  163. package/dist/shell-source-maps/assets/{create-route-DGBe6c9T.js.map → create-route-CRZSYoTi.js.map} +1 -1
  164. package/dist/shell-source-maps/assets/{custom-step-container-field-CXzhDKB8.js.map → custom-step-container-field-C0uZrHjV.js.map} +1 -1
  165. package/dist/shell-source-maps/assets/{embedded-list-COr7SEcU.js.map → embedded-list-C3nd1V5o.js.map} +1 -1
  166. package/dist/shell-source-maps/assets/{export-dialog-CCnbhHYq.js.map → export-dialog-BerhgfFO.js.map} +1 -1
  167. package/dist/shell-source-maps/assets/{first-organization-page-NFqF-XyH.js.map → first-organization-page-CKYevHep.js.map} +1 -1
  168. package/dist/shell-source-maps/assets/{graph-view-CnMNqiV4.js.map → graph-view-CoLu3Uhs.js.map} +1 -1
  169. package/dist/shell-source-maps/assets/{group-donut-BbP0DJKg.js.map → group-donut-B8v2SWzP.js.map} +1 -1
  170. package/dist/shell-source-maps/assets/{guest-call-page-R7GFfBV-.js.map → guest-call-page-DqQMPCVU.js.map} +1 -1
  171. package/dist/shell-source-maps/assets/{html-viewer-DoOxyTcM.js.map → html-viewer-BntGWVRA.js.map} +1 -1
  172. package/dist/shell-source-maps/assets/{import-dialog-_5Szg-jU.js.map → import-dialog-DThTUXFS.js.map} +1 -1
  173. package/dist/shell-source-maps/assets/{import-table-dialog-njI8BoS4.js.map → import-table-dialog-C-XIx1Dd.js.map} +1 -1
  174. package/dist/shell-source-maps/assets/{invitations-page-EV-UUQ6b.js.map → invitations-page-COFjv2AV.js.map} +1 -1
  175. package/dist/shell-source-maps/assets/{layout-grid-B0-CJOlT.js.map → layout-grid-CvCNKDtn.js.map} +1 -1
  176. package/dist/shell-source-maps/assets/{legend-item-DlKFFY7e.js.map → legend-item-9nkaAII6.js.map} +1 -1
  177. package/dist/shell-source-maps/assets/{list-page-aYSJ3PHa.js.map → list-page-D3nIEwGf.js.map} +1 -1
  178. package/dist/shell-source-maps/assets/{maplibre-B6nwN1UZ.js.map → maplibre-5GcVztUc.js.map} +1 -1
  179. package/dist/shell-source-maps/assets/{markdown-content-C8sLopWJ.js.map → markdown-content-DVmg_kx3.js.map} +1 -1
  180. package/dist/shell-source-maps/assets/{members-page-CgBOboZQ.js.map → members-page-DoRl-b9K.js.map} +1 -1
  181. package/dist/shell-source-maps/assets/{message-content-BkvkBtPr.js.map → message-content-BpfTrsWh.js.map} +1 -1
  182. package/dist/shell-source-maps/assets/{messages-CqYTV98f.js.map → messages-CZQvPUZQ.js.map} +1 -1
  183. package/dist/shell-source-maps/assets/{organization-page-CUBsrNzR.js.map → organization-page-DeaQlPop.js.map} +1 -1
  184. package/dist/shell-source-maps/assets/{organizations-page-D_imfTUa.js.map → organizations-page-Dlosll2b.js.map} +1 -1
  185. package/dist/shell-source-maps/assets/{pending-invitation-row-D4gFapdv.js.map → pending-invitation-row-t63yAwI8.js.map} +1 -1
  186. package/dist/shell-source-maps/assets/{period-chart-ChFHNTEE.js.map → period-chart-BVv9kC_E.js.map} +1 -1
  187. package/dist/shell-source-maps/assets/{person-row-YwRtkzbb.js.map → person-row-CgvcHRmL.js.map} +1 -1
  188. package/dist/shell-source-maps/assets/{public-form-page-oyX-a-KA.js.map → public-form-page-CruNnqqc.js.map} +1 -1
  189. package/dist/shell-source-maps/assets/{record-lines-D1wftBQA.js.map → record-lines-Dts68Cfq.js.map} +1 -1
  190. package/dist/shell-source-maps/assets/{record-map-BEOxTNu4.js.map → record-map-BO9rZaxg.js.map} +1 -1
  191. package/dist/shell-source-maps/assets/{record-opens-C9579izg.js.map → record-opens-Ds9nDyw1.js.map} +1 -1
  192. package/dist/shell-source-maps/assets/{record-page-Dhb9gzfJ.js.map → record-page-DJgscks5.js.map} +1 -1
  193. package/dist/shell-source-maps/assets/{record-preview-eCoWviA9.js.map → record-preview-CwySCCRj.js.map} +1 -1
  194. package/dist/shell-source-maps/assets/{records-map-DVETi1eC.js.map → records-map-Bq_dBgiT.js.map} +1 -1
  195. package/dist/shell-source-maps/assets/{render-node-CSjGRPb0.js.map → render-node-zjMYynnA.js.map} +1 -1
  196. package/dist/shell-source-maps/assets/{reorder-button-1ikk6wTV.js.map → reorder-button-BGgoLDx3.js.map} +1 -1
  197. package/dist/shell-source-maps/assets/{run-trace-view-DC8UUfeb.js.map → run-trace-view-BtyPPUyt.js.map} +1 -1
  198. package/dist/shell-source-maps/assets/{runner-install-field-BmVLaBtB.js.map → runner-install-field-DvuPCX28.js.map} +1 -1
  199. package/dist/shell-source-maps/assets/{runtime-update-CTsM8FBn.js.map → runtime-update-e56Spv--.js.map} +1 -1
  200. package/dist/shell-source-maps/assets/{sheet-source-BbBLftOM.js.map → sheet-source-Cenf8A74.js.map} +1 -1
  201. package/dist/shell-source-maps/assets/{sign-in-policy-page-BrVvhdS0.js.map → sign-in-policy-page-CUiU8ZIN.js.map} +1 -1
  202. package/dist/shell-source-maps/assets/{start-block-queries-B1m-VmpK.js.map → start-block-queries-DUvYFyeX.js.map} +1 -1
  203. package/dist/shell-source-maps/assets/{step-catalog-DXkb5LNi.js.map → step-catalog-CKmRa3SA.js.map} +1 -1
  204. package/dist/shell-source-maps/assets/{step-panel-CEluX3Jl.js.map → step-panel-DD821ue5.js.map} +1 -1
  205. package/dist/shell-source-maps/assets/{timeline-display-C1OXwJcu.js.map → timeline-display-ChPHZfO_.js.map} +1 -1
  206. package/dist/shell-source-maps/assets/{trash-Ba3Y5_30.js.map → trash-Ch2JFURM.js.map} +1 -1
  207. package/dist/shell-source-maps/assets/{update-set-D2mI0J7M.js.map → update-set-Zch9kB-u.js.map} +1 -1
  208. package/dist/shell-source-maps/assets/{use-calendar-move-BENhrEOz.js.map → use-calendar-move-Cl14_xWL.js.map} +1 -1
  209. package/dist/shell-source-maps/assets/{use-display-rows-DIoyxucI.js.map → use-display-rows-s-zuk4Lc.js.map} +1 -1
  210. package/dist/shell-source-maps/assets/{use-my-invitations-B4h6GyJO.js.map → use-my-invitations-APXH_Xf1.js.map} +1 -1
  211. package/dist/shell-source-maps/assets/{use-paged-search-DjnlXbQ5.js.map → use-paged-search-CxaSlMkh.js.map} +1 -1
  212. package/dist/shell-source-maps/assets/{use-run-trace-2fQX9FeC.js.map → use-run-trace-CRG2_uVq.js.map} +1 -1
  213. package/dist/shell-source-maps/assets/{use-workflow-page-D8Vn1I90.js.map → use-workflow-page-BPZWN9Iv.js.map} +1 -1
  214. package/dist/shell-source-maps/assets/{use-workflow-types-DpNGPeuE.js.map → use-workflow-types-Dk4FOVoz.js.map} +1 -1
  215. package/dist/shell-source-maps/assets/{workflow-canvas-CZ6QjuM6.js.map → workflow-canvas-DBlvFI_n.js.map} +1 -1
  216. package/dist/shell-source-maps/assets/{workflow-field-CLeslVkB.js.map → workflow-field-DXiYYH5X.js.map} +1 -1
  217. package/dist/shell-source-maps/assets/{workflow-graph-editor-CirmaYcy.js.map → workflow-graph-editor-BtNoPI_a.js.map} +1 -1
  218. package/dist/shell-source-maps/assets/{workflow-run-field-DgVAi0nl.js.map → workflow-run-field-CztPPLbi.js.map} +1 -1
  219. package/dist/shell-source-maps/assets/{workflow-status-field-CD4Npg78.js.map → workflow-status-field-K3DE4tPj.js.map} +1 -1
  220. package/dist/shell-source-maps/assets/{workflow-workbench-Dy2EmMb7.js.map → workflow-workbench-CAz04v9t.js.map} +1 -1
  221. package/dist/status/messages.d.ts +2 -2
  222. package/dist/users/messages.d.ts +2 -2
  223. package/package.json +5 -5
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/import-dialog-_5Szg-jU.js","assets/rolldown-runtime-DFwUHQ4A.js","assets/react-CuiNlnus.js","assets/app-CK_M0TgA.js","assets/vendor-t7Q7QbPu.js","assets/app-DLkpxjgP.css","assets/sheet-source-BbBLftOM.js","assets/import-table-dialog-njI8BoS4.js","assets/export-dialog-CCnbhHYq.js","assets/embedded-list-COr7SEcU.js","assets/update-set-D2mI0J7M.js","assets/layout-grid-B0-CJOlT.js","assets/lib-tanstack-react-table-uAPG3Sdi.js","assets/lib-tanstack-store-KbP08Dw1.js","assets/lib-tanstack-react-store-BKI8EKbh.js","assets/lib-use-sync-external-store-D4s7MiFL.js","assets/lib-tanstack-table-core-2MHQ7o_e.js","assets/record-preview-eCoWviA9.js","assets/lib-dnd-kit-core-xi-7xL_N.js","assets/lib-dnd-kit-utilities-Bvr0fWXF.js","assets/lib-dnd-kit-accessibility-AUTLnqh4.js","assets/lib-dnd-kit-sortable-CNDSKqCD.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,$r as i,Ao as a,Bi as o,Bo as s,Br as c,C as l,Co as u,Da as d,Di as f,Dn as p,Do as m,Ea as h,Eo as g,Fn as _,Gc as v,Ho as y,Jr as b,Ki as x,Kn as S,La as C,Li as w,Lt as T,M as E,Ni as D,Nr as O,O as k,Pa as ee,Pr as te,Ql as ne,Rc as re,S as ie,Sa as ae,Sc as oe,So as se,Ss as ce,T as le,Ta as ue,Uo as de,Ur as fe,Vc as A,Wc as j,Xl as pe,Xn as M,Yn as N,Ys as P,ai as me,as as he,b as F,ba as ge,bn as _e,cl as I,da as ve,dc as ye,dl as be,ei as xe,el as Se,fi as L,fl as R,fn as Ce,fs as z,gi as we,gl as Te,gr as Ee,hc as De,ic as B,io as Oe,is as V,iu as ke,jc as Ae,jn as je,jt as Me,k as H,ka as Ne,ko as Pe,li as Fe,lt as Ie,mc as U,nc as Le,nl as Re,nu as ze,os as Be,qn as Ve,sc as W,sl as He,uc as G,ul as Ue,vc as K,wa as We,wl as Ge,xa as Ke,zc as qe,zi as Je,zr as Ye}from"./app-CK_M0TgA.js";import{C as Xe,f as Ze,h as Qe,i as $e,o as et,s as tt}from"./vendor-t7Q7QbPu.js";import{n as nt}from"./view-chart-ChBtewKd.js";import{$ as rt,A as it,B as at,D as ot,E as st,F as ct,G as lt,H as ut,I as dt,J as q,K as ft,L as pt,M as mt,N as ht,O as gt,P as _t,Q as vt,R as yt,T as bt,U as xt,V as St,W as Ct,X as wt,Y as Tt,Z as J,b as Et,d as Dt,et as Ot,f as kt,ft as At,h as jt,i as Mt,j as Nt,k as Pt,m as Ft,n as It,p as Lt,pt as Rt,q as zt,u as Bt,v as Vt,w as Ht,x as Ut,xt as Y,y as Wt,z as Gt}from"./embedded-list-COr7SEcU.js";import{a as Kt,i as qt,n as Jt,r as Yt,t as Xt}from"./reorder-button-1ikk6wTV.js";import{t as Zt}from"./trash-Ba3Y5_30.js";import{t as Qt}from"./page-header-Ddz2r5ic.js";import{i as $t,r as en,t as tn}from"./record-preview-eCoWviA9.js";import{c as nn,l as rn}from"./messages-CqYTV98f.js";import{t as an}from"./use-display-rows-DIoyxucI.js";var on=new Set(`all.analyse.analyze.and.any.array.as.asc.asymmetric.both.case.cast.check.collate.column.constraint.create.current_catalog.current_date.current_role.current_time.current_timestamp.current_user.default.deferrable.desc.distinct.do.else.end.except.false.fetch.for.foreign.from.grant.group.having.in.initially.intersect.into.lateral.leading.limit.localtime.localtimestamp.not.null.offset.on.only.or.order.placing.primary.references.returning.select.session_user.some.symmetric.system_user.table.then.to.trailing.true.union.unique.user.using.variadic.when.where.window.with`.split(`.`)),sn=/^[a-z][a-z0-9_]*$/,cn=[`id`,`etag`,`organization_id`],ln=e=>sn.test(e)&&new TextEncoder().encode(e).length<=63,un=(e,t,n=63)=>{if(typeof e!=`string`||!ln(e)||new TextEncoder().encode(e).length>n)return`form`;if(on.has(e))return`reserved_word`;if(t===`field`&&cn.includes(e))return`reserved_field`},dn={name:`bookmark-check`,size:24,node:[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}],[`path`,{d:`m9 10 2 2 4-4`,key:`1gnqz4`}]]};dn.node;var fn=j(dn),pn={name:`bookmark-plus`,size:24,node:[[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M15 10H9`,key:`o6yqo3`}],[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]};pn.node;var mn=j(pn),hn={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};hn.node;var gn=j(hn),_n={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};_n.node;var vn=j(_n),yn={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};yn.node;var bn=j(yn),xn=e=>e.normalize(`NFKD`).replace(/[̀-ͯ]/g,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``),Sn=(e,t,n)=>(/^[a-z]/.test(e)?e:`${t}_${e}`).slice(0,n).replace(/_+$/,``),Cn=(e,t,n)=>{let r=e;for(let i=2;t.has(r)||on.has(r);i++){let t=`_${i}`;r=`${e.slice(0,n-t.length).replace(/_+$/,``)}${t}`}return r},wn=e=>e<26?String.fromCharCode(97+e):wn(Math.floor(e/26)-1)+wn(e%26),Tn=e=>{let t=new Set(cn);return e.map((e,n)=>{let r=xn(e),i=Cn(r===``?`column_${wn(n)}`:Sn(r,`column`,63),t,63);return t.add(i),i})},En=(e,t=[],n=63)=>{let r=xn(e.replace(/\.(csv|tsv|txt|xlsx|json)$/i,``));if(r!==``)return Cn(Sn(r,`table`,n),new Set(t),n)},X=e(n(),1),Dn=`inline-flex h-6 items-center gap-1 rounded-full border border-primary-border bg-primary-soft pl-2.5 pr-1.5 text-xs font-medium text-primary-text`,On=({chips:e,lockedLabels:t=[],onRemove:n,onClear:r,scroll:i})=>e.length===0&&t.length===0?null:(0,X.jsxs)(`div`,{className:i?`flex flex-nowrap items-center gap-1.5 overflow-x-auto pb-1 [&>*]:shrink-0`:`flex flex-wrap items-center gap-1.5`,children:[t.map(e=>(0,X.jsxs)(`span`,{className:`inline-flex h-6 items-center gap-1.5 rounded-full border border-border-strong bg-muted px-2.5 text-xs font-medium text-foreground`,children:[(0,X.jsx)(gn,{className:`size-3 text-muted-foreground`}),e]},e)),e.map(e=>(0,X.jsxs)(`span`,{className:Dn,children:[e.label,(0,X.jsx)(`button`,{type:`button`,"aria-label":q(`remove`,{label:e.label}),onClick:()=>n(e.key),className:`rounded-full p-0.5 hover:bg-primary-border/60`,children:(0,X.jsx)(U,{className:`size-3`})})]},e.key)),e.length>0&&(0,X.jsx)(`button`,{type:`button`,onClick:r,className:`ml-1 text-xs font-medium text-muted-foreground hover:text-foreground`,children:q(`clearAll`)})]}),kn=({value:e,presets:t=zt,onChange:n})=>(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(t=>{let r=ft(t);return(0,X.jsx)(`button`,{type:`button`,disabled:!r,title:r?void 0:q(`unknownPreset`,{id:t}),onClick:()=>n(e===t?void 0:t),className:v(`h-7 rounded-md border px-2.5 text-body font-medium transition-colors`,!r&&`border-dashed text-danger-text`,e===t?`border-primary-border bg-primary-soft text-primary-text`:`border-border-strong bg-background text-muted-foreground hover:bg-muted`),children:r??q(`unsupported`,{id:t})},t)})}),An=(e,t)=>e.onSearch?e.options:e.options.filter(e=>St(e.label,t)),jn=(e,t,n)=>t===0?-1:n===`ArrowDown`?e<0?0:(e+1)%t:e<0?t-1:(e-1+t)%t,Z=e(t(),1),Mn=({config:e,selected:t,onToggle:n,inline:r=!1})=>{let i=(0,Z.useId)(),a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(-1),f=r||c,p=An(e,o),m=(0,Z.useRef)(e.onSearch);m.current=e.onSearch,(0,Z.useEffect)(()=>()=>m.current?.(``),[]);let h=t=>{s(t),d(-1),e.onSearch?.(t)};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`div`,{className:`flex min-h-8 cursor-text flex-wrap items-center gap-1 rounded-md border border-border-strong bg-background px-2 py-1 shadow-sm focus-within:border-primary focus-within:ring-2 focus-within:ring-primary/20`,onClick:()=>a.current?.focus(),children:[(0,X.jsx)(K,{className:`size-3.5 shrink-0 text-muted-foreground`}),t.map(t=>(0,X.jsx)(_,{label:at(e,t),onRemove:()=>n(t)},t)),(0,X.jsx)(`input`,{ref:a,autoFocus:r,role:`combobox`,"aria-label":e.label,"aria-expanded":f,"aria-controls":`${i}-options`,"aria-autocomplete":`list`,"aria-activedescendant":p[u]?`${i}-${u}`:void 0,placeholder:t.length>0?``:q(`searchIn`,{label:e.label}),className:`h-6 min-w-16 flex-1 bg-transparent text-foreground outline-none placeholder:text-faint-foreground`,value:o,onChange:e=>h(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),d(jn(u,p.length,e.key));return}if(e.key===`Enter`&&p[u]){e.preventDefault(),n(p[u].value);return}if(e.key===`Backspace`&&o===``&&t.length>0){n(t[t.length-1]);return}e.key===`Escape`&&o!==``&&(e.stopPropagation(),h(``))},onFocus:()=>l(!0),onBlur:()=>{l(!1),d(-1),!r&&o!==``&&h(``)}})]}),f&&(0,X.jsxs)(`ul`,{id:`${i}-options`,role:`listbox`,"aria-label":e.label,"aria-multiselectable":!0,className:v(`flex max-h-60 flex-col gap-px overflow-y-auto`,!r&&`rounded-md border bg-background p-1 shadow-sm`),children:[p.map((e,r)=>{let a=t.includes(e.value);return(0,X.jsxs)(`li`,{id:`${i}-${r}`,role:`option`,"aria-selected":a,tabIndex:-1,className:v(`flex cursor-pointer items-center gap-2 rounded px-1.5 py-1 hover:bg-muted`,r===u&&`bg-muted`),onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.value),children:[(0,X.jsx)(`span`,{className:v(`inline-flex size-4 shrink-0 items-center justify-center rounded border`,a?`border-primary bg-primary text-primary-foreground`:`border-border-strong bg-background`),children:a&&(0,X.jsx)(qe,{className:`size-3`,strokeWidth:3})}),(0,X.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.count!==void 0&&(0,X.jsx)(`span`,{className:`text-xs tabular-nums text-faint-foreground`,children:D(e.count)})]},e.value)}),e.failed&&(0,X.jsx)(`li`,{className:`px-1.5 py-1 text-xs text-danger-text`,children:q(`couldNotLoadCounts`)}),!e.failed&&p.length===0&&(0,X.jsx)(`li`,{className:`px-1.5 py-1 text-xs text-faint-foreground`,children:q(`noMatches`)})]})]})},Nn=({config:e,selected:t,onToggle:n})=>{let[r,i]=(0,Z.useState)(``),o=e.options.filter(e=>St(e.label,r));return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.searchable&&(0,X.jsx)(a,{wrapperClassName:`mb-1 h-7`,leading:(0,X.jsx)(K,{className:`size-3.5`}),placeholder:q(`searchIn`,{label:e.label}),value:r,onChange:e=>i(e.target.value)}),o.map(e=>(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-1 py-1 hover:bg-muted`,children:[(0,X.jsx)(Oe,{checked:t.includes(e.value),onChange:()=>n(e.value),label:e.label}),(0,X.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.count!==void 0&&(0,X.jsx)(`span`,{className:`text-xs tabular-nums text-faint-foreground`,children:D(e.count)})]},e.value)),e.failed&&(0,X.jsx)(`span`,{className:`px-1 py-1 text-xs text-danger-text`,children:q(`couldNotLoadCounts`)}),!e.failed&&o.length===0&&(0,X.jsx)(`span`,{className:`px-1 py-1 text-xs text-faint-foreground`,children:q(`noMatches`)})]})},Pn=({label:e,activeCount:t,width:n=240,defaultOpen:r=!1,children:i})=>{let[a,o]=(0,Z.useState)(r),[s,c]=(0,Z.useState)({width:n}),l=(0,Z.useRef)(null),u=(0,Z.useRef)(null);(0,Z.useLayoutEffect)(()=>{if(!a||!l.current)return;let e=l.current.getBoundingClientRect(),t=document.documentElement.clientWidth,r=Math.min(n,g(t));c({width:r,right:e.left+r>t?e.right-m(e.right,r,t):void 0})},[a,n]);let d=Pe(a,l,u,s);return(0,Z.useEffect)(()=>{if(!a)return;let e=e=>{e.target instanceof Node&&!l.current?.contains(e.target)&&o(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[a]),(0,X.jsxs)(`div`,{ref:l,className:`relative`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":a,onClick:()=>o(!a),className:v(`inline-flex h-8 items-center gap-1.5 rounded-md border bg-background px-2.5 font-medium shadow-sm transition-colors hover:bg-muted`,t>0?`border-primary-border text-primary-text`:`border-border-strong text-foreground`),children:[e,t>0&&(0,X.jsx)(`span`,{className:`rounded-full bg-primary px-1.5 text-[0.6875rem] leading-4 text-primary-foreground`,children:t}),(0,X.jsx)(re,{className:`size-3.5 text-muted-foreground`})]}),a&&(0,X.jsx)(`div`,{ref:u,className:v(`absolute top-full z-30 mt-1.5 rounded-lg border bg-background p-3 shadow-pop`,s.right===void 0&&`left-0`),style:{...s,...d},children:typeof i==`function`?i(()=>o(!1)):i})]})},Fn=({title:e,children:t})=>(0,X.jsxs)(`section`,{className:`flex flex-col gap-2 border-b py-3 last:border-b-0`,children:[(0,X.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),t]}),In=({items:e,onPick:t,close:n})=>{let r=(0,Z.useRef)([]);return(0,Z.useEffect)(()=>r.current[0]?.focus(),[]),(0,X.jsx)(`ul`,{role:`menu`,"aria-label":q(`moreFilters`),onKeyDown:t=>{if(t.key===`Escape`)return n();let i=Me(t.key,r.current.indexOf(document.activeElement),e.length);i!==void 0&&(t.preventDefault(),r.current[i]?.focus())},className:`-mx-3 -my-3`,children:e.map((e,i)=>(0,X.jsx)(`li`,{role:`none`,children:(0,X.jsx)(`button`,{ref:e=>{r.current[i]=e},type:`button`,role:`menuitem`,className:Ie,onClick:()=>{n(),t(e.key)},children:e.label})},e.key))})},Ln=({items:e,onPick:t})=>e.length===0?null:(0,X.jsx)(Pn,{label:q(`moreFilters`),activeCount:0,children:n=>(0,X.jsx)(In,{items:e,onPick:t,close:n})}),Rn=(e,t,n,r,i)=>{let a=n+(r-n)*e/t;return n+(r-n)*(e+1)/t>i[0]&&a<i[1]},zn=(e,t,n)=>n===t?0:(e-t)/(n-t),Bn=(e,t,n)=>t===0?[Math.min(n,e[1]),e[1]]:[e[0],Math.max(n,e[0])],Vn=1e3,Hn=({config:e,value:t,onChange:n})=>{let{min:r,max:i,step:a,histogram:o,format:s}=e,[c,l]=(0,Z.useState)(),u=c??t??[r,i],d=Math.max(...o),f=()=>{c&&(l(void 0),n(c[0]===r&&c[1]===i?void 0:c))},p=Je(c,Vn);return(0,Z.useEffect)(()=>{p&&f()},[p]),e.failed?(0,X.jsx)(`p`,{className:`text-xs text-danger-text`,children:q(`couldNotLoadCounts`)}):(0,X.jsxs)(`div`,{className:`w-full`,children:[(0,X.jsxs)(`div`,{className:`px-[7px]`,children:[o.length>0&&(0,X.jsx)(`div`,{className:`mb-1 flex h-12 items-end gap-0.5`,children:o.map((e,t)=>(0,X.jsx)(`span`,{className:v(`flex-1 rounded-t-sm`,Rn(t,o.length,r,i,u)?`bg-primary/70`:`bg-border`),style:{height:`${Math.max(6,e/d*100)}%`}},t))}),(0,X.jsxs)(`div`,{className:`relative h-4`,children:[(0,X.jsx)(`span`,{className:`absolute inset-x-0 top-1/2 h-1 -translate-y-1/2 rounded-full bg-border`}),(0,X.jsx)(`span`,{className:`absolute top-1/2 h-1 -translate-y-1/2 rounded-full bg-primary`,style:{left:`${zn(u[0],r,i)*100}%`,right:`${100-zn(u[1],r,i)*100}%`}})]})]}),(0,X.jsx)(`div`,{className:`relative -mt-4 h-4`,children:[0,1].map(t=>(0,X.jsx)(`input`,{type:`range`,className:`pb-range`,"aria-label":q(t===0?`minimum`:`maximum`,{label:e.label}),min:r,max:i,step:a,value:u[t],onChange:e=>l(Bn(u,t,Number(e.target.value))),onPointerUp:f,onTouchEnd:f,onBlur:f},t))}),(0,X.jsxs)(`div`,{className:`mt-2 flex justify-between text-xs tabular-nums text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:s(u[0])}),(0,X.jsx)(`span`,{children:s(u[1])})]})]})},Un=e=>[...new Set(e.map(e=>e.key.split(`:`).slice(0,2).join(`:`)))],Wn=(e,t)=>{let n=t.filter(t=>!e.includes(t));return n.length===0?e:[...e,...n]},Gn=(e,t)=>{let n=[...e.facets.map(e=>({key:`facet:${e.id}`,label:e.label,secondary:e.secondary})),...(e.ranges??[]).map(e=>({key:`range:${e.id}`,label:e.label,secondary:e.secondary})),...e.datePresets?[{key:`date`,label:q(`date`),secondary:e.dateSecondary}]:[],...(e.toggles??[]).map(e=>({key:`toggle:${e.id}`,label:e.label,secondary:e.secondary}))],r=new Set,i=[];for(let e of n)!e.secondary||t.includes(e.key)?r.add(e.key):i.push({key:e.key,label:e.label});return{shown:r,more:i}},Kn=({label:e,checked:t,onChange:n})=>(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-between gap-3 py-1`,children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(E,{checked:t,onChange:n,label:e})]}),qn=(e,t)=>e.some(e=>e.length>0)||!!t,Jn=({groups:e,trailing:t})=>{if(!qn(e,t))return null;let n=e.filter(e=>e.length>0);return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n.map((e,t)=>(0,X.jsxs)(Z.Fragment,{children:[t>0&&(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`}),e]},t)),t&&(0,X.jsx)(`div`,{className:`flex min-w-32 flex-1 justify-end`,children:t})]})},Yn=(e,t,n)=>{let[r,i]=(0,Z.useState)(t??Gt);return[e??r,e=>{i(e),n?.(e)}]},Xn=({config:e,layout:t,value:n,defaultValue:r,onChange:i,lockedLabels:a,defaultOpenMenu:o,fullWidth:s,leading:c,trailing:l})=>{let[u,d]=Yn(n,r,i),f=yt(e,u),p=Un(f),[m,h]=(0,Z.useState)(()=>p),[g,_]=(0,Z.useState)();(0,Z.useEffect)(()=>h(e=>Wn(e,p)),[p.join(`,`)]);let v=(0,X.jsx)(On,{chips:f,lockedLabels:a,onRemove:e=>d(ut(u,e)),onClear:()=>d(Gt)}),y=(e,t=!1)=>{let n=u.facets[e.id]??[],r=t=>d(Ct(u,e.id,t));return e.combobox?(0,X.jsx)(Mn,{config:e,selected:n,onToggle:r,inline:t}):(0,X.jsx)(Nn,{config:e,selected:n,onToggle:r})},b=e.ranges??[],x=e=>(0,X.jsx)(Hn,{config:e,value:u.ranges?.[e.id],onChange:t=>d(xt(u,e.id,t))}),S=e.datePresets&&(0,X.jsx)(kn,{value:u.date,presets:Array.isArray(e.datePresets)?e.datePresets:void 0,onChange:e=>d({...u,date:e})}),C=(e.toggles??[]).map(e=>(0,X.jsx)(Kn,{label:e.label,checked:u.toggles.includes(e.id),onChange:()=>d(lt(u,e.id))},e.id));if(t===`panel`)return(0,X.jsxs)(`aside`,{className:s?`flex w-full flex-col gap-1`:`flex w-64 shrink-0 flex-col gap-1 overflow-y-auto rounded-lg border bg-background px-4 py-3`,children:[(0,X.jsx)(`div`,{className:`flex items-center justify-between pb-1`,children:(0,X.jsx)(`h2`,{className:`font-semibold`,children:q(`filters`)})}),(f.length>0||(a?.length??0)>0)&&(0,X.jsx)(`div`,{className:`border-b pb-3`,children:v}),c,e.facets.map(e=>(0,X.jsx)(Fn,{title:e.label,children:y(e)},e.id)),b.map(e=>(0,X.jsx)(Fn,{title:e.label,children:x(e)},e.id)),S&&(0,X.jsx)(Fn,{title:q(`date`),children:S}),C.length>0&&(0,X.jsx)(Fn,{title:q(`showOnly`),children:C})]});let{shown:w,more:T}=Gn(e,m),E=e=>{h(t=>Wn(t,[e])),_(e)},D=[...e.facets.filter(e=>w.has(`facet:${e.id}`)).map(e=>(0,X.jsx)(Pn,{label:e.label,activeCount:(u.facets[e.id]??[]).length,width:e.combobox?280:void 0,defaultOpen:o===e.id||g===`facet:${e.id}`,children:y(e,!0)},e.id)),...b.filter(e=>w.has(`range:${e.id}`)).map(e=>(0,X.jsx)(Pn,{label:e.label,activeCount:+!!u.ranges?.[e.id],width:280,defaultOpen:o===e.id||g===`range:${e.id}`,children:x(e)},`range:${e.id}`)),...S&&w.has(`date`)?[(0,X.jsx)(Z.Fragment,{children:S},`date`)]:[]],O=(e.toggles??[]).filter(e=>w.has(`toggle:${e.id}`)).map(e=>(0,X.jsx)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:(0,X.jsx)(Kn,{label:e.label,checked:u.toggles.includes(e.id),onChange:()=>d(lt(u,e.id))})},e.id)),k=[c?[(0,X.jsx)(Z.Fragment,{children:c},`leading`)]:[],D,O,T.length>0?[(0,X.jsx)(Ln,{items:T,onPick:E},`more`)]:[]];return!qn(k,l)&&f.length===0&&!a?.length?null:(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(Jn,{groups:k,trailing:l}),v]})},Q=Se(`app/export`),Zn=()=>new DOMException(Q(`cancelled`),`AbortError`),Qn=async({client:e,resource:t,filters:n,orderBy:r,plan:i,labels:a,limit:o,port:s,sink:c,signal:l,onProgress:u})=>{let d=i.columns.map(e=>e.name),f=0;try{await c.write(await s.send({kind:`start`,plan:i,locale:Re()}));for(let[i,p]of n.entries()){let m=``;do{let h=await e.search(t,{filter:p,orderBy:r,pageSize:500,pageToken:m,fields:d,labels:a});if(l.aborted)throw Zn();let g=h.items.slice(0,o-f);if(await c.write(await s.send({kind:`page`,records:g,labels:h.labels??{}})),f+=g.length,u(f),m=h.nextPageToken,f>=o)return await $n(s,c),{rows:f,truncated:g.length<h.items.length||m!==``||i+1<n.length}}while(m!==``)}return await $n(s,c),{rows:f,truncated:!1}}catch(e){throw await c.abort(),e}finally{s.close()}},$n=async(e,t)=>{await t.write(await e.send({kind:`finish`})),await t.close()},er=1048575,tr=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
3
- `,nr=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,rr=`http://schemas.openxmlformats.org/package/2006/relationships`;`${tr}`,`${tr}${rr}${nr}`,`${tr}${rr}${nr}${nr}`,new TextEncoder;var ir=pe(),ar=e=>e?.export!==!1,or=e=>Object.values(e.fields).flatMap(e=>e.sensitive?[]:[e.name]),sr=(e,t)=>{let n=new Set(or(e));return He(e,t).filter(e=>n.has(e))},cr=(e,t,n)=>Object.fromEntries(we(e,t,[],n).map(e=>[e.id,e.header])),lr=(e,t,n)=>{let r=cr(e,t,n);return n.flatMap(n=>{let i=e.fields[n];return i?[{name:n,header:r[n],field:i,hints:t?.fields[n]??{}}]:[]})},ur=(e,t)=>{let n=e?.export?e.export.maxRows??1/0:1/0;return Math.min(n,t===`xlsx`?er:1/0)},dr=e=>e.primaryKey.length===1,fr=(e,t)=>{let[n]=e.primaryKey;if(!n||e.primaryKey.length!==1)throw Error(`Not implemented: selected rows are exported by a single-field key`);let r=[];for(let e=0;e<t.length;e+=500)r.push(ne(ir.in(n,t.slice(e,e+500))));return r},pr=e=>{if(e.kind!==`counting`)return e.kind===`exact`?e.rows:Math.max(e.rows,10001)},mr=Se(`app/import`),hr=e=>typeof e==`object`&&!!e&&`date`in e,gr=e=>typeof e==`object`&&!!e&&`json`in e,_r=e=>e===null||typeof e==`string`&&e.trim()===``,vr=e=>e===null?``:hr(e)?e.date.replace(`T`,` `):gr(e)?JSON.stringify(e.json):typeof e==`boolean`?e?`TRUE`:`FALSE`:String(e),yr=e=>e<26?String.fromCharCode(65+e):yr(Math.floor(e/26)-1)+yr(e%26),br=(e,t)=>e[t]?.trim()?e[t]:mr(`column`,{letters:yr(t)}),xr=(e,t,n,r)=>{let i=Tn(t.headers),a=t.headers.map((e,n)=>({column:n,include:!0,name:i[n],label:br(t.headers,n).trim(),type:t.types[n].type,inferred:t.types[n],decimal:t.decimals[n]}));return{name:En(e,n,r)??``,pluralLabel:e.replace(/\.[^.]+$/,``).trim(),singularLabel:``,titleField:a.find(e=>e.type===`text`)?.name,fields:a}},Sr=e=>e.fields.filter(e=>e.include),Cr=(e,t,n)=>{let r=e.fields.find(e=>e.column===t),i=e.fields.map(e=>e.column===t?{...e,...n}:e),a=i.find(e=>e.column===t),o=r?.name===e.titleField,s=a.include&&a.type===`text`;return o?{...e,fields:i,titleField:s?a.name:void 0}:{...e,fields:i}},wr=`user_table_fields`,Tr=`table`,Er=(e,t)=>{let n=Sr(t).map((e,t)=>({op:`create`,resource:wr,data:{table_id:{$ref:Tr},name:e.name,label:e.label.trim(),type:e.type,position:t+1,...e.type===`decimal`&&{precision:e.decimal.precision,scale:e.decimal.scale}}})),r=t.titleField?[{op:`update`,resource:e,key:{$ref:Tr},etag:`*`,data:{title_field:t.titleField}}]:[];return[{op:`create`,resource:e,ref:Tr,data:{name:t.name,singular_label:t.singularLabel.trim(),plural_label:t.pluralLabel.trim()}},...n,...r]},Dr=(e,t)=>{let n=new Map(t.map(e=>[e.value,e.count]));return e.map(([e,t])=>({value:e,label:t,...n.get(e)!==void 0&&{count:n.get(e)}}))},Or=(e,t)=>[...new Set(t.filter(t=>!e.includes(t)))],kr=pe(),Ar=(e,t,n)=>{let r=z(),[i,a]=(0,Z.useState)({}),o=e=>!!e?.search?.length&&e.primaryKey.length===1,s=e=>{let n=t[e.name];return[e.primaryKey[0],...n?.titleFrom?n.titleFrom.fields:[I(e,n)]]},c=(e,r)=>{let i=t[e.name],a=String(r[e.primaryKey[0]]);return[a,i?.titleFrom?n(e,i,r,a):String(r[I(e,i)])]},l=tt({queries:e.map(({id:e,target:t})=>{let n=(i[e]??``).trim();return{queryKey:[`reference-search`,e,t?.name??``,n],enabled:o(t)&&n!==``,placeholderData:Ze,queryFn:async()=>(await r.list(t.name,{filter:ne(kr.search(n)),fields:s(t),pageSize:20})).items}})});return e.map(({id:e,target:t},n)=>{if(!o(t))return{};let r=t=>a(n=>({...n,[e]:t}));return(i[e]??``).trim()===``?{onSearch:r}:{onSearch:r,matches:(l[n]?.data??[]).map(e=>c(t,e))}})},jr=24,Mr=({model:e,resources:t,views:n,view:i,state:a,extras:o,titleOf:s})=>{let c=z(),l=te(c),u=Qe(),d=ct(i,e),f=e=>i?.fields[e]?.label??R(e),p=n=>{let r=e.fields[n];return r?.type===`relation`&&r.relation?t[r.relation.resource]:void 0},m=e=>!!(e&&n[e.name]?.titleFrom),h=d.facets.flatMap(e=>(e.flags?e.options.map(e=>e.value):[e.id]).map(t=>({group:e.id,field:t}))),g=tt({queries:h.map(({group:t,field:i})=>{let s=dt(d,{...a,facets:{...a.facets,[t]:[]}},o),c=p(i),u=c?.primaryKey.length===1&&!m(c)?I(c,n[c.name]):void 0;return{queryKey:r.facets(e.name,i,s),queryFn:()=>l.facets(e.name,i,{filter:s,limit:50,...u&&{label:u}})}})}),_=(e,t)=>g[h.findIndex(n=>n.group===e&&n.field===t)],v=(e,t)=>_(e,t)?.data,y=e=>(v(e,e)??[]).flatMap(e=>e.value===null?[]:[String(e.value)]),b=tt({queries:d.facets.map(t=>{let i=p(t.id),o=Or(y(t.id),a.facets[t.id]??[]);return{queryKey:r.labels(`facet:${e.name}.${t.id}`,o.join(`,`)),enabled:!!i&&!m(i)&&o.length>0,queryFn:async()=>[...await N(u,c,i,o,n[i.name])]}})}),x=tt({queries:d.facets.map(t=>{let i=p(t.id),o=i&&m(i)?S(i,n[i.name]):void 0,s=[...new Set([...y(t.id),...a.facets[t.id]??[]])];return{queryKey:r.labels(`facet-title:${e.name}.${t.id}`,s.join(`,`)),enabled:o!==void 0&&s.length>0,queryFn:async()=>[...await Ve(c,i,o,s)]}})}),C=(e,t)=>{let r=p(e);return(x[t]?.data??[]).map(([e,t])=>[e,s(r,n[r.name],t,e)])},w=Ar(d.facets.map(e=>({id:e.id,target:e.combobox?p(e.id):void 0})),n,s),T=d.ranges??[],E=tt({queries:T.map(t=>{let n=dt(d,xt(a,t.id,void 0),o),s=_t(i,t.id)?jr:1;return{queryKey:r.histogram(e.name,t.id,s,n),queryFn:()=>l.histogram(e.name,t.id,{filter:n,buckets:s})}})});return{facets:d.facets.map((t,n)=>{if(t.flags){let e=e=>{let n=v(t.id,e);return n&&{count:n.find(e=>String(e.value)===`true`)?.count??0}},n=t.options.map(({value:t})=>({value:t,label:f(t),...e(t)})),r=t.options.some(({value:e})=>_(t.id,e)?.isError);return{...t,options:n,...r&&{failed:r}}}let r=e.fields[t.id],a=(v(t.id,t.id)??[]).flatMap(e=>e.label===void 0?[]:[[String(e.value),e.label]]),o=r?.type===`enum`?(r.enumValues??[]).map(e=>[e,be(e,i?.fields[t.id]?.valueLabels)]):[],s=new Map([...o,...a,...b[n]?.data??[],...C(t.id,n)]),c=(v(t.id,t.id)??[]).flatMap(e=>e.value===null?[]:[{value:String(e.value),label:s.get(String(e.value))??String(e.value),count:e.count}]),l=w[n],u=_(t.id,t.id)?.isError;return{...t,label:f(t.id),...u&&{failed:u},options:l.matches?Dr(l.matches,c):c,...s.size>0&&{labels:Object.fromEntries(s)},...l.onSearch&&{onSearch:l.onSearch}}}),ranges:T.flatMap((e,t)=>{let n=E[t];if(n?.isError)return[{...e,label:f(e.id),min:0,max:0,step:1,histogram:[],format:ht(i,e.id),failed:!0}];let r=n?.data;return!r||r.min===null||r.max===null?[]:[{...e,label:f(e.id),min:Math.floor(r.min),max:Math.ceil(r.max),step:Math.max(1,Math.round((r.max-r.min)/100)),histogram:_t(i,e.id)?r.buckets.map(e=>e.count):[],format:ht(i,e.id)}]}),...d.dateField&&{datePresets:d.datePresets??!0,dateField:d.dateField,dateKind:d.dateKind,...d.dateSecondary&&{dateSecondary:!0}},toggles:d.toggles?.map(e=>({...e,label:f(e.id)}))}},Nr=w(()=>Xe(()=>import(`./import-dialog-_5Szg-jU.js`).then(e=>e.ImportDialog),__vite__mapDeps([0,1,2,3,4,5,6]))),Pr=w(()=>Xe(()=>import(`./import-table-dialog-njI8BoS4.js`).then(e=>e.ImportTableDialog),__vite__mapDeps([7,1,2,3,4,5,6]))),Fr=({model:e})=>{let{resources:t,views:n}=he(),r=Be(e.name),i=Be(wr),[a,o]=(0,Z.useState)(!1),s=n[e.name]?.import;return s===!1||!d(r,`create`)||s===`table`&&!d(i,`create`)?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(G,{onClick:()=>o(!0),"aria-haspopup":`dialog`,children:[(0,X.jsx)(De,{className:`size-3.5`}),mr(s===`table`?`fromFile`:`import`)]}),a&&s===`table`&&(0,X.jsx)(Pr,{tables:e,resources:t,views:n,onClose:()=>o(!1)}),a&&s!==`table`&&(0,X.jsx)(Nr,{model:e,resources:t,views:n,canUpdate:d(r,`update`),onClose:()=>o(!1)})]})},Ir=()=>{let e=new Worker(new URL(`/assets/export-worker-CNhkzttC.js`,``+import.meta.url),{type:`module`,name:`protobase-export`}),t=[];return e.onmessage=e=>t.shift()?.resolve(e.data.bytes),e.onerror=e=>{e.preventDefault();let n=Error(Q(`couldNotBuild`,{message:e.message}));for(let e of t.splice(0))e.reject(n)},{send:n=>new Promise((r,i)=>{t.push({resolve:r,reject:i}),e.postMessage(n)}),close:()=>e.terminate()}},Lr={xlsx:{mime:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,extension:`.xlsx`,description:`workbook`},csv:{mime:`text/csv`,extension:`.csv`,description:`csvFile`}},Rr=/[\\/:*?"<>|\u0000-\u001f]/g,zr=(e,t,n=new Date)=>{let r=[n.getFullYear(),String(n.getMonth()+1).padStart(2,`0`),String(n.getDate()).padStart(2,`0`)].join(`-`);return`${e.replace(Rr,` `).trim()} ${r}${Lr[t].extension}`},Br=8e6,Vr=(e,t)=>{let n=new Blob([],{type:Lr[t].mime}),r=[],i=0,a=()=>{n=new Blob([n,...r],{type:Lr[t].mime}),r=[],i=0};return{write:async e=>{e.length!==0&&(r.push(e),i+=e.length,i>=Br&&a())},close:async()=>{a();let t=URL.createObjectURL(n),r=document.createElement(`a`);r.href=t,r.download=e,r.click(),setTimeout(()=>URL.revokeObjectURL(t),6e4)},abort:async()=>{r=[],n=new Blob([])}}},Hr=()=>globalThis.showSaveFilePicker,Ur=()=>typeof Hr()==`function`,Wr=async(e,t)=>{let n=Hr();if(!n)throw Error(`This browser cannot save a file as it is built`);let r=Lr[t],i;try{i=await n({suggestedName:e,types:[{description:Q(r.description),accept:{[r.mime]:[r.extension]}}]})}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;throw e}let a=await i.createWritable();return{write:async e=>{e.length>0&&await a.write(e)},close:()=>a.close(),abort:()=>a.abort()}},Gr=w(()=>Xe(()=>import(`./export-dialog-CCnbhHYq.js`).then(e=>e.ExportDialog),__vite__mapDeps([8,1,2,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21]))),Kr=w(()=>Xe(()=>import(`./export-dialog-CCnbhHYq.js`).then(e=>e.ExportProgressDialog),__vite__mapDeps([8,1,2,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21]))),qr=(e,t)=>Ur()?Wr(e,t):Promise.resolve(Vr(e,t)),Jr=(e,t)=>{let n=t[e.primaryKey[0]];return typeof n==`object`&&n&&`id`in n?n.id:n},Yr=({model:e,view:t,resources:n,views:i,plural:a,filter:o,orderBy:s,createPort:c=Ir,createSink:l=qr})=>{let u=z(),d=C(),[f,p]=(0,Z.useState)({kind:`closed`}),m=(0,Z.useRef)(void 0),h=(0,Z.useRef)(void 0),g=et({queryKey:r.exportCount(e.name,o),enabled:f.kind===`settings`,queryFn:async()=>{let t=await u.list(e.name,{filter:o||void 0,pageSize:1,count:`exact`,fields:e.primaryKey});return t.totalSize===void 0?{kind:`estimate`,rows:t.totalSizeEstimate}:{kind:`exact`,rows:t.totalSize}}}).data??{kind:`counting`},_=(e,t=h.current)=>{let n=h.current;n&&n===t&&(h.current=void 0,n.settle(e?[]:n.rows))},v=(t=[])=>(_(!1),p({kind:`settings`,selected:dr(e)?t.map(t=>Jr(e,t)):[]}),new Promise(e=>{h.current={rows:t,settle:e}})),y=()=>{p({kind:`closed`}),_(!1)},b=async(r,f)=>{let v=zr(a,r.format),y=await l(v,r.format);if(!y)return;let b=h.current,x=ur(t,r.format),S=r.scope===`selected`?f.length:pr(g),C=S===void 0?void 0:Math.min(S,x),w=new AbortController;m.current=w,p({kind:`running`,done:0,total:C});try{let l=await Qn({client:u,resource:e.name,filters:r.scope===`selected`?fr(e,f):[o],orderBy:s,plan:{format:r.format,mode:r.mode,name:a,columns:lr(e,t,r.columns)},labels:r.mode===`shown`?M(n,i,e,r.columns):{},limit:x,port:c(),sink:y,signal:w.signal,onProgress:e=>w.signal.aborted||p({kind:`running`,done:e,total:C})});d.show({state:`success`,title:Q(`exported`,{count:D(l.rows),plural:a}),description:l.truncated?Q(`truncated`,{name:v,count:D(l.rows)}):v}),_(!0,b)}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;if(!P(e))throw e;d.show({state:`error`,title:Q(`couldNotExport`,{plural:a}),description:e.message})}finally{m.current=void 0,p(e=>e.kind===`running`?{kind:`closed`}:e),_(!1,b)}},x=()=>{m.current?.abort(),y()},S=or(e),w=cr(e,t,S);return{open:v,dialogs:f.kind===`settings`?(0,X.jsx)(Gr,{plural:a,view:t,fields:S.map(e=>({name:e,label:w[e]})),initialColumns:sr(e,t),count:g,selected:f.selected.length>0?f.selected.length:void 0,open:!0,onExport:e=>void b(e,f.selected),onClose:y}):f.kind===`running`?(0,X.jsx)(Kr,{plural:a,done:f.done,total:f.total,onCancel:x}):null}},Xr=({state:e,onClearSearch:t,onClearFilters:n,create:r})=>(0,X.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-8 text-center text-muted-foreground`,children:[(0,X.jsx)(`p`,{children:e.message}),(e.clearSearch||e.clearFilters||e.create&&r)&&(0,X.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[e.clearSearch&&(0,X.jsx)(G,{onClick:t,children:Y(`clearSearch`)}),e.clearFilters&&(0,X.jsx)(G,{onClick:n,children:Y(`clearFilters`)}),e.create&&r]})]}),Zr=({plural:e,search:t,filtered:n,scoped:r,canCreate:i})=>t?{message:Y(`noMatchSearch`,{plural:e,search:t}),clearSearch:!0,clearFilters:n,create:!1}:n?{message:Y(`noMatchFilters`,{plural:e}),clearSearch:!1,clearFilters:!0,create:!1}:r?{message:Y(`noMatch`,{plural:e}),clearSearch:!1,clearFilters:!1,create:!1}:{message:Y(`noneYet`,{plural:e}),clearSearch:!1,clearFilters:!1,create:i},Qr=(e,t)=>{},$r=({windowMs:e=1e3,comebacks:t=2,onHold:n=Qr}={})=>{let r,i=[],a;return(o,s)=>{if(a?.among.has(o))return a.value;if(a&&(a=void 0,i=[]),o===r||(r=o,i=i.filter(t=>s-t.at<=e),i.push({value:o,at:s,comeback:i.some(e=>e.value===o)}),i.filter(e=>e.comeback).length<t))return o;let c=new Set(i.slice(-2*t).map(e=>e.value));return a={value:Math.min(...c),among:c},n(a.value,[...c]),a.value}},ei=e=>Math.max(1,Math.floor((e+12)/252)),ti=(e,t)=>Math.max(0,(e-(t-1)*12)/t),ni=(e,t,n,r)=>({start:e*n,end:Math.max(0,Math.min(r,(t+1)*n)-1)}),ri=(e,t,n)=>{let r=e/t.rowHeight;return t.columns===n.columns?r*n.rowHeight:Math.floor(Math.floor(r)*t.columns/n.columns)*n.rowHeight},ii=(e,t)=>{let n=e/t.rowHeight;return Math.floor(n)*t.columns+n%1},ai=(e,t)=>Math.floor(Math.floor(e)/t)+e%1,oi=8,si=(e,t,n)=>{let r=e.get(t);if(r!==void 0&&r>=n)return e;let i=new Map(e);i.delete(t),i.set(t,n);for(let e of i.keys()){if(i.size<=oi)break;i.delete(e)}return i},ci=({source:e,label:t,initialIndex:n,onScrollIndex:r,minHeight:i,children:a})=>{let{total:o}=e,[s]=(0,Z.useState)(n),[c,l]=(0,Z.useState)(0),u=ei(c),d=ti(c,u),[f,p]=(0,Z.useState)(()=>new Map),m=Math.ceil(Math.max(i(d),f.get(d)??0)),h=m+12,g={columns:u,rowHeight:h},_=(0,Z.useRef)({layout:g,top:0}),v=_.current.top>0&&(_.current.layout.columns!==u||_.current.layout.rowHeight!==h),y=e=>v?ri(_.current.top,_.current.layout,g):e,b=d>0&&f.has(d),x=rt({total:Math.ceil(o/u),rowHeight:h,initialIndex:ai(s,u),settle:y,ready:b,onScroll:e=>r(ii(e,g))});(0,Z.useLayoutEffect)(()=>{v&&x.scrollTo(x.top),_.current={layout:g,top:x.started()?x.top:0}});let S=ni(x.first,x.last,u,o),C=$t({total:o,rowAt:e.rowAt,loadRows:e.loadRows,cachedRows:e.cachedRows,revision:e.revision,latencyMs:0},S.start,S.end),[w]=(0,Z.useState)(()=>$r());(0,Z.useLayoutEffect)(()=>{let e=x.ref.current;if(!e)return;let t=()=>l(w(e.clientWidth,performance.now())),n=new ResizeObserver(t);return n.observe(e),t(),()=>n.disconnect()},[w]);let T=(0,Z.useRef)(d);T.current=d;let[E]=(0,Z.useState)(()=>new ResizeObserver(e=>{let t=Math.max(...e.map(e=>e.borderBoxSize[0]?.blockSize??e.contentRect.height)),n=T.current;p(e=>si(e,n,t))}));(0,Z.useLayoutEffect)(()=>()=>E.disconnect(),[E]),(0,Z.useLayoutEffect)(()=>{let e=x.ref.current;if(b||d===0||!e)return;let t=[...e.querySelectorAll(`:scope > li[aria-posinset]`)];if(t.length===0)return;let n=Math.max(...t.map(e=>e.getBoundingClientRect().height));p(e=>si(e,d,n))});let D=(0,Z.useCallback)(e=>{if(e)return E.observe(e),()=>E.unobserve(e)},[E]);return(0,X.jsx)(`ul`,{ref:x.ref,className:`relative min-w-0 flex-auto`,"aria-label":t,style:{height:x.geometry.contentHeight},children:x.rows.flatMap(({index:e,offset:t})=>Array.from({length:u},(n,r)=>{let i=e*u+r;if(i>=o)return[];let s=C(i),c={top:t,left:r*(d+12),width:d,minHeight:m};return s?(0,X.jsx)(`li`,{ref:D,"aria-posinset":i+1,"aria-setsize":o,className:`absolute grid grid-cols-[minmax(0,1fr)]`,style:c,children:a(s)},s.id):(0,X.jsx)(`li`,{"aria-hidden":!0,className:`absolute grid grid-cols-[minmax(0,1fr)]`,style:c,children:(0,X.jsx)(W,{className:`h-full rounded-lg`})},`skeleton-${i}`)}))})},li=`grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-3`,ui=e=>e*.75,di=44,fi=({model:e,view:t,display:n,list:r,empty:i})=>{let a=t?.names?.plural??R(e.name),o=n.card===void 0&&(n.image!==void 0||n.photos!==void 0);return r.isLoading?(0,X.jsx)(`div`,{"aria-busy":!0,className:`min-h-0 flex-1 overflow-hidden ${li}`,children:Array.from({length:6},(e,t)=>(0,X.jsx)(W,{className:`h-24`},t))}):r.error?(0,X.jsx)(Ee,{title:L(`couldNotLoadRows`),error:r.error}):!r.source||r.source.total===0?i??(0,X.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:L(`noneMatch`,{plural:a.toLowerCase()})}):(0,X.jsx)(ci,{source:r.source,label:a,initialIndex:r.initialIndex,onScrollIndex:r.onScrollIndex,minHeight:e=>(o?ui(e):0)+di,children:r=>(0,X.jsx)(Ht,{model:e,view:t,display:n,row:b(e,r)})})},pi=`protobase:list-places`,mi=50,hi=(e,t)=>`${e} ${t}`,gi=e=>{if(typeof e!=`object`||!e)return!1;let{entry:t,url:n,place:r}=e;return typeof t==`string`&&typeof n==`string`&&typeof r==`number`&&Number.isFinite(r)&&r>=0},_i=e=>ke(()=>{let t=e.getItem(pi);if(t===null)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(gi):[]},[]),vi=e=>{let t=new Map(_i(e).map(e=>[hi(e.entry,e.url),e]));return{placeOf:(e,n)=>{let r=t.get(hi(e,n));return r?r.place:[...t.values()].findLast(e=>e.url===n)?.place??0},save:(e,n,r)=>{let i=hi(e,n);t.delete(i),t.set(i,{entry:e,url:n,place:r});for(let e of[...t.keys()].slice(0,Math.max(0,t.size-mi)))t.delete(e)},persist:()=>ke(()=>e.setItem(pi,JSON.stringify([...t.values()])),void 0)}},yi={getItem:()=>null,setItem:()=>{}},bi,xi=()=>bi??=vi(ke(()=>window.sessionStorage,void 0)??yi),Si=()=>{let{entry:e,path:t,params:n}=Le(),r=`${t}?${n.toString()}`,i=xi();(0,Z.useEffect)(()=>{let e=()=>i.persist(),t=()=>document.visibilityState===`hidden`&&i.persist();return window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,t),i.persist()}},[i]);let a=(0,Z.useCallback)(t=>i.save(e,r,t),[i,e,r]);return{initialIndex:i.placeOf(e,r),remember:a}},Ci=e=>e.reduce((e,t)=>e+t.count,0),wi=e=>{let t=Math.floor(e.length/2),n=Ci(e.slice(0,t)),r=Ci(e.slice(e.length-t));return n===0?0:(r-n)/n*100},Ti=Se(`activity-chart`),Ei=({title:e,defaultGranularity:t=`day`,data:n,granularity:r,onGranularityChange:i,periodLabel:a,state:o,className:s})=>{let[c,l]=(0,Z.useState)(t),d=r??c,f=i??l,p=wi(n),m=n.map(({at:e,count:t})=>({at:e,value:t,count:t}));return(0,X.jsxs)(`section`,{className:v(`rounded-lg border bg-background px-4 pb-2 pt-3`,s),children:[(0,X.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,X.jsx)(`h2`,{className:`font-semibold`,children:e}),o===void 0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`font-semibold tabular-nums`,children:D(Ci(n))}),(0,X.jsxs)(`span`,{className:v(`text-xs font-medium tabular-nums`,p>=0?`text-success-text`:`text-danger-text`),children:[p>=0?`+`:`−`,Math.abs(p).toFixed(1),`%`]})]}),(0,X.jsx)(`span`,{className:`hidden text-xs text-muted-foreground sm:inline`,children:a??`last ${d===`day`?`30 days`:`12 weeks`}`})]}),(0,X.jsx)(u,{value:d,onChange:f,options:[{value:`day`,label:Ti(`day`)},{value:`week`,label:Ti(`week`)}]})]}),(0,X.jsxs)(`div`,{className:`mt-2`,children:[o===`failed`&&(0,X.jsx)(`p`,{className:`py-6 text-danger-text`,children:Ti(`couldNotLoad`)}),o===`loading`&&(0,X.jsx)(W,{className:`h-24 w-full`}),o===void 0&&(0,X.jsx)(Rt,{points:m,measure:{kind:`count`},bucket:d,type:`bar`,compact:!0})]})]})},Di={"7d":`last 7 days`,"30d":`last 30 days`,"90d":`last 90 days`,"1y":`last year`,all:`all time`},Oi=({resource:e,chart:t,title:n,filter:r})=>{let[i,a]=(0,Z.useState)(t.granularity===`week`?`week`:`day`),o=i===`week`?`90d`:t.range,s=O(e,{field:t.field,range:o,granularity:i,filter:r,timeZone:ve()}),c=s.data?.points.map(e=>({at:Date.parse(`${e.bucket}Z`),count:e.count}))??[];return(0,X.jsx)(Ei,{title:n,data:c,granularity:i,onGranularityChange:a,periodLabel:i===`week`?`last 12 weeks`:Di[o],state:s.isError?`failed`:s.isPending?`loading`:void 0})},ki=(e,t,n)=>{let r=e.sum??e.average;if(r===void 0)return n;let i=t?.fields[r]?.label??R(r);return e.sum===void 0?B(`average`,{label:i}):`${i}`},Ai=({model:e,view:t,chart:n,plural:r,filter:i})=>{let a=t?.fields[n.groupBy]?.label??R(n.groupBy);return(0,X.jsxs)(`section`,{className:`rounded-lg border bg-background px-4 pb-3 pt-3`,"aria-label":`${ki(n,t,r)} by ${a.toLowerCase()}`,children:[(0,X.jsxs)(`h2`,{className:`mb-2 font-semibold`,children:[ki(n,t,r),` by `,a.toLowerCase()]}),(0,X.jsx)(At,{model:e,view:t,groupBy:n.groupBy,type:n.type,sum:n.sum,average:n.average,limit:n.limit,filter:i})]})},ji=({value:e,onCommit:t,placeholder:n,className:r})=>{let[i,o]=(0,Z.useState)(e);return(0,Z.useEffect)(()=>o(e),[e]),(0,Z.useEffect)(()=>{if(i===e)return;let n=setTimeout(()=>t(i),350);return()=>clearTimeout(n)},[i,e,t]),(0,X.jsx)(a,{wrapperClassName:v(`min-w-0 flex-1 sm:w-72 sm:flex-initial`,r),leading:(0,X.jsx)(K,{className:`size-4`}),placeholder:n,"aria-label":Y(`search`),value:i,onChange:e=>o(e.target.value),onKeyDown:e=>e.key===`Enter`&&t(i)})},Mi=(e,t,n,r,i)=>{let a=n?.list?.relatedColumns??[];if(a.length===0)return e;let o=new Map(e.map(e=>[e.id,e]));return He(t,n).flatMap(e=>{let t=o.get(e);if(t)return[t];let n=a.find(t=>t.name===e),s=n&&r[n.resource];if(!n||!s)return[];let c=n.label??R(n.name);return[{id:n.name,header:c,kind:`text`,width:160,minWidth:f(c,!1),sortable:!1,render:e=>(0,X.jsx)(bt,{column:n,records:e[n.name]??[],target:s,view:i[s.name],Card:Ht})}]})},Ni=({model:e,view:t,target:n,children:r})=>{let i=gt(e.name,t.listOf,!0),a=t.names?.plural??R(e.name),o=e=>(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[(0,X.jsx)(Qt,{title:a,subtitle:t.help}),e]});if(i.error)return o((0,X.jsx)(Ee,{title:ot(`couldNotLoadYour`,{plural:a.toLowerCase()}),error:i.error}));if(!i.data)return o((0,X.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-3`,children:Array.from({length:3},(e,t)=>(0,X.jsx)(W,{className:`h-24`},t))}));let s=Pt(n,i.data);return s?r(s):o((0,X.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:ot(`noneYet`,{plural:a.toLowerCase()})}))},Pi=({title:e,chips:t,label:n,required:r,initial:i=``,busy:o,onSave:s,onClose:c})=>{let l=(0,Z.useId)(),[u,d]=(0,Z.useState)(i),f=`${l}-form`;return(0,X.jsx)(x,{open:!0,title:e,onClose:c,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(G,{onClick:c,children:J(`cancel`)}),(0,X.jsx)(G,{type:`submit`,form:f,variant:`primary`,loading:o,children:J(`save`)})]}),children:(0,X.jsxs)(`form`,{id:f,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),s(u.trim()===``?null:u.trim())},children:[t.length>0&&(0,X.jsx)(Tt,{chips:t}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,X.jsx)(`label`,{htmlFor:l,className:`font-medium`,children:n}),!r&&(0,X.jsx)(`span`,{id:`${l}-hint`,className:`text-xs text-muted-foreground`,children:J(`optional`)})]}),(0,X.jsx)(a,{id:l,value:u,required:r,pattern:r?`.*\\S.*`:void 0,"aria-describedby":r?void 0:`${l}-hint`,autoFocus:!0,autoComplete:`off`,onChange:e=>d(e.target.value)})]})]})})},$=pe(),Fi={start:0,end:0},Ii=(e,t)=>$.and(t,{kind:`present`,field:e.field,span:Fi}),Li=e=>{switch(e.kind){case`and`:case`or`:return{...e,args:e.args.map(Li)};case`not`:return Ri(e.arg);case`search`:case`present`:case`isNull`:case`related`:return e;default:return Ii(e,e)}},Ri=e=>{switch(e.kind){case`and`:return $.or(...e.args.map(Ri));case`or`:return $.and(...e.args.map(Ri));case`not`:return Li(e.arg);case`search`:case`present`:case`isNull`:case`related`:return $.not(e);default:return Ii(e,$.not(e))}},zi=e=>{let t=ze(e);if(!t.ok)throw Error(`The filter cannot be read: ${t.errors.map(e=>e.message).join(`; `)}`);return t.ast},Bi=e=>e.kind===`and`||e.kind===`or`?e.args.some(Bi):e.kind===`not`?Bi(e.arg):e.kind===`related`,Vi=(e,t)=>![zi(e),zi(t)].some(e=>e&&Bi(e)),Hi=(e,t)=>{let n=zi(e);if(!n)return null;let r=zi(t),i=$.not(Li(n));return ne(r?$.and(r,i):i)},Ui=(e,t)=>Hi(t,e),Wi=e=>e.key.startsWith(`extra:`)?`extra:${e.label}`:e.key,Gi=(e,t)=>{let n=new Map(e.map(e=>[Wi(e),e])),r=new Map(t.map(e=>[Wi(e),e])),i=e.filter(e=>!r.has(Wi(e))).map(e=>({kind:`removed`,label:e.label})),a=t.flatMap(e=>{let t=n.get(Wi(e));return t&&t.label!==e.label?[{kind:`changed`,label:e.label,before:t.label}]:[]}),o=t.filter(e=>!n.has(Wi(e))).map(e=>({kind:`added`,label:e.label}));return[...i,...a,...o]},Ki=(e,t,n,r)=>{let i=e-t;if(i===0)return J(`asMany`,{plural:r});let a=Math.abs(i)===1?n:r;return i>0?J(`more`,{count:i,noun:a}):J(`fewer`,{count:-i,noun:a})},qi=12,Ji={added:{word:`added`,className:`text-success-text`},removed:{word:`removed`,className:`text-danger-text`},changed:{word:`changed`,className:`text-primary-text`}},Yi=({changes:e})=>(0,X.jsx)(`ul`,{"aria-label":J(`filterChanges`),className:`divide-y rounded-md border`,children:e.map(e=>(0,X.jsxs)(`li`,{className:`grid grid-cols-[72px_1fr] gap-3 px-3 py-2`,children:[(0,X.jsx)(`span`,{className:`font-medium ${Ji[e.kind].className}`,children:J(Ji[e.kind].word)}),e.kind===`changed`?(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`text-muted-foreground line-through`,children:e.before}),` `,(0,X.jsx)(`span`,{className:`font-medium`,children:e.label})]}):(0,X.jsx)(`span`,{className:e.kind===`removed`?`text-muted-foreground line-through`:`font-medium`,children:e.label})]},`${e.kind}:${e.label}`))}),Xi=(e,t)=>{let n=et({...Ce(z(),e,t??``),enabled:t!==null});return t===null?0:n.data},Zi=(e,t,n)=>`${e} ${e===1?t:n}`,Qi=({model:e,view:t,title:n,filter:r,total:i,plural:a})=>{let o=t?.list?.displays?.find(e=>e.kind===`cards`);return(0,X.jsxs)(`section`,{"aria-label":n,className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`h3`,{className:`font-semibold`,children:[n,` `,(0,X.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,i??`…`,`)`]})]}),i!==void 0&&i>qi&&(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:J(`firstOf`,{limit:qi,total:i})}),r===null||i===0?(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:J(`noPlural`,{plural:a})}):(0,X.jsx)(It,{model:e,view:t,filter:r,sort:ge(e,t),limit:qi,display:o?.name??`table`,row:!0,link:!1,empty:`No ${a}.`})]})},$i=({model:e,view:t,before:n,after:r})=>{let i=(0,Z.useMemo)(()=>Hi(n,r),[n,r]),a=(0,Z.useMemo)(()=>Ui(n,r),[n,r]),o=Xi(e,i),s=Xi(e,a),c=(t?.names?.singular??R(e.name)).toLowerCase(),l=(t?.names?.plural??R(e.name)).toLowerCase();return(0,X.jsxs)(X.Fragment,{children:[o!==void 0&&s!==void 0?(0,X.jsxs)(`p`,{children:[(0,X.jsx)(`span`,{className:`font-semibold`,children:Ki(o,s,c,l)}),(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[`: `,J(`addedRemoved`,{added:Zi(o,c,l),removed:s})]})]}):(0,X.jsx)(W,{className:`h-4 w-48`}),(0,X.jsx)(Qi,{model:e,view:t,title:J(`added`),filter:i,total:o,plural:l}),(0,X.jsx)(Qi,{model:e,view:t,title:J(`removed`),filter:a,total:s,plural:l})]})},ea=({model:e,view:t,title:n,before:r,after:i,saveNewLabel:a,updating:o,creating:s,onUpdate:c,onSaveNew:l,onCancel:u})=>{let d=Gi(it(e,r),it(e,i));return(0,X.jsx)(x,{open:!0,wide:!0,title:n,onClose:u,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(G,{onClick:u,children:J(`cancel`)}),(0,X.jsx)(G,{loading:s,disabled:o,onClick:l,children:a}),(0,X.jsx)(G,{variant:`primary`,loading:o,disabled:s,onClick:c,children:J(`update`)})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[d.length>0&&(0,X.jsx)(Yi,{changes:d}),Vi(r,i)?(0,X.jsx)($i,{model:e,view:t,before:r,after:i}):(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:J(`noRecordsDiff`)})]})})},ta=()=>{let{address:e,set:t}=c();return{key:e?.kind===`list`?e.savedSearch:void 0,open:e=>t({savedSearch:e})}},na=e=>e instanceof Error?e.message:J(`somethingWrong`),ra=(e,t)=>{let n=he(),r=z(),i=C(),a=_e(),{href:o,open:s}=c(),l=ta(),{resource:u}=e,f=n.resources[u],p=n.views[u]?.searchesOf,m=n.permissions[u],h=f!==void 0&&p!==void 0&&m!==void 0&&d(m,`create`)&&d(m,`delete`),g=n.signIn?.[u]?.signIn,_=Et(u,h),v=e=>Te(We(f,e)),y=p&&_.data?.find(e=>e[p.filter]===t),b=y||l.key===void 0||!m||!d(m,`update`)?void 0:_.data?.find(e=>v(e)===l.key),x=n.views[u]?.names,S=x?.plural??`saved searches`,w=p?.name===void 0?void 0:f?.fields[p.name],T=$e({mutationFn:e=>r.create(u,{[p.filter]:t,...p.name&&{[p.name]:e}}),onSuccess:e=>{l.open(v(e.record)),i.show({state:`success`,title:J(`searchSaved`),action:{label:J(`openPlural`,{plural:S}),href:o({kind:`list`,resource:u}),onNavigate:s}})},onError:e=>i.show({state:`error`,title:J(`couldNotSave`),description:na(e)}),onSettled:()=>a(u)}),E=$e({mutationFn:e=>r.remove(u,v(e)),onError:e=>i.show({state:`error`,title:J(`couldNotTakeOff`),description:na(e)}),onSettled:()=>a(u)}),D=$e({mutationFn:e=>r.update(u,v(e),{[p.filter]:t},e.etag??`*`),onSuccess:()=>i.show({state:`success`,title:J(`searchUpdated`)}),onError:e=>i.show({state:`error`,title:J(`couldNotUpdate`),description:na(e)}),onSettled:()=>a(u)}),O=T.isPending||E.isPending||D.isPending;return{mode:h?`save`:g?`sign-in`:void 0,prompt:g,saved:y!==void 0,opened:b&&{filter:String(b[p.filter]??``),name:p.name&&typeof b[p.name]==`string`&&b[p.name]!==``?String(b[p.name]):void 0},noun:(x?.singular??R(u)).toLowerCase(),naming:w&&{label:n.views[u]?.fields[w.name]?.label??R(w.name),required:!w.nullable},ready:_.data!==void 0&&!O,updating:D.isPending,creating:T.isPending,remove:()=>y&&E.mutate(y),saveNew:(e,t)=>T.mutate(e,t),update:e=>b&&D.mutate(b,e)}},ia=({model:e,view:t,search:n,filter:r,chips:i,className:a})=>{let o=ra(n,r),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)();if(!o.mode)return null;let p=n.label??J(`saveSearch`);if(o.mode===`sign-in`)return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(G,{className:a,"aria-haspopup":`dialog`,onClick:()=>c(!0),children:[(0,X.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),p]}),(0,X.jsx)(T,{as:`dialog`,prompt:o.prompt,open:s,onClose:()=>c(!1)})]});let m=e=>{u(!1),o.naming?f(e):o.saveNew(null)},h=d!==void 0&&o.naming&&(0,X.jsx)(Pi,{title:d,chips:i,label:o.naming.label,required:o.naming.required,busy:o.creating,onSave:e=>o.saveNew(e,{onSuccess:()=>f(void 0)}),onClose:()=>f(void 0)}),g=o.opened;if(g){let n=J(`saveAsNew`,{noun:o.noun});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(G,{className:a,"aria-haspopup":`dialog`,"aria-disabled":!o.ready,onClick:()=>o.ready&&u(!0),children:[(0,X.jsx)(vn,{className:`size-3.5`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`max-w-60 truncate`,children:J(`updateName`,{name:g.name??o.noun})})]}),(0,X.jsxs)(G,{className:a,"aria-haspopup":o.naming?`dialog`:void 0,"aria-disabled":!o.ready,onClick:()=>o.ready&&m(n),children:[(0,X.jsx)(mn,{className:`size-3.5`,"aria-hidden":!0}),n]}),l&&(0,X.jsx)(ea,{model:e,view:t,title:g.name?J(`updateNameQuestion`,{name:g.name}):J(`updateNounQuestion`,{noun:o.noun}),before:g.filter,after:r,saveNewLabel:n,updating:o.updating,creating:o.creating,onUpdate:()=>o.update({onSuccess:()=>u(!1)}),onSaveNew:()=>m(n),onCancel:()=>u(!1)}),h]})}let _=o.saved?fn:A;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(G,{className:a,"aria-pressed":o.saved,"aria-haspopup":!o.saved&&o.naming?`dialog`:void 0,"aria-disabled":!o.ready,onClick:()=>o.ready&&(o.saved?o.remove():m(p)),children:[(0,X.jsx)(_,{className:o.saved?`size-3.5 text-primary`:`size-3.5`,"aria-hidden":!0}),p]}),h]})},aa=e=>e instanceof Error?e.message:J(`somethingWrong`),oa=({model:e,view:t,name:n,value:r,onChange:i})=>{let a=(0,Z.useId)(),o=e.fields[n],s=t.fields[n],c=s?.label??R(n);if(o?.type===`boolean`)return(0,X.jsx)(E,{checked:r===!0,onChange:i,label:c});if(o?.type!==`enum`)throw Error(`Not implemented: "${n}" is ${o?.type??`unknown`}, and a saved search's controls are enums or booleans`);return(0,X.jsxs)(`label`,{htmlFor:a,className:`flex items-center gap-2 text-muted-foreground`,children:[c,(0,X.jsx)(`select`,{id:a,value:String(r??``),onChange:e=>i(e.target.value),className:`h-8 rounded-md border border-border-strong bg-background px-2 text-foreground shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20`,children:(o.enumValues??[]).map(e=>(0,X.jsx)(`option`,{value:e,children:be(e,s?.valueLabels)},e))})]})},sa=(e,t,n)=>Object.entries(n).map(([n,r])=>`${t.fields[n]?.label??R(n)}: ${e.fields[n]?.type===`boolean`?J(r===!0?`on`:`off`):be(String(r),t.fields[n]?.valueLabels)}`).join(`, `),ca=({model:e,view:t,recordKey:n,title:r,row:i,fields:a})=>{let o=z(),s=C(),c=_e(),l=$e({mutationFn:t=>o.update(e.name,n,t,i.etag??`*`),onSuccess:(n,i)=>s.show({state:`success`,title:J(`saved`,{title:r}),description:sa(e,t,i)}),onError:e=>s.show({state:`error`,title:J(`couldNotChange`),description:aa(e)}),onSettled:()=>c(e.name)});return(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-3`,children:a.map(n=>(0,X.jsx)(oa,{model:e,view:t,name:n,value:l.isPending&&n in(l.variables??{})?l.variables[n]:i[n],onChange:e=>l.mutate({[n]:e})},n))})},la=e=>e instanceof Error?e.message:J(`somethingWrong`),ua=({model:e,view:t,of:n,target:r,targetView:i,row:a,recordKey:o,canRename:s,onDelete:c})=>{let l=z(),u=C(),d=_e(),[f,p]=(0,Z.useState)(!1),{name:m,chips:h,title:g,body:_}=Wt({model:e,of:n,target:r,targetView:i,row:a,recordKey:o}),v=$e({mutationFn:t=>l.update(e.name,o,{[n.name]:t},a.etag??`*`),onSuccess:()=>p(!1),onError:e=>u.show({state:`error`,title:J(`couldNotRename`),description:la(e)}),onSettled:()=>d(e.name)}),y=n.name===void 0?void 0:e.fields[n.name];return(0,X.jsxs)(`section`,{"aria-label":g,className:`flex flex-col gap-3 rounded-lg border bg-surface p-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:(0,X.jsx)(Ye,{to:{kind:`record`,resource:e.name,key:o},className:`hover:underline`,children:m??(0,X.jsx)(wt,{chips:h})})})}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n.controls&&(0,X.jsx)(ca,{model:e,view:t,recordKey:o,title:g,row:a,fields:n.controls}),s&&y&&(0,X.jsx)(G,{variant:`ghost`,"aria-label":J(`renameTitle`,{title:g}),"aria-haspopup":`dialog`,onClick:()=>p(!0),children:(0,X.jsx)(Kt,{className:`size-3.5`,"aria-hidden":!0})}),c&&(0,X.jsx)(G,{variant:`ghost`,"aria-label":J(`deleteTitle`,{title:g}),onClick:()=>c(g),children:(0,X.jsx)(Zt,{className:`size-3.5`,"aria-hidden":!0})})]})]}),f&&y&&(0,X.jsx)(Pi,{title:J(`renameTitle`,{title:g}),chips:h,label:t.fields[y.name]?.label??R(y.name),required:!y.nullable,initial:m,busy:v.isPending,onSave:e=>v.mutate(e),onClose:()=>p(!1)}),(0,X.jsx)(Ut,{..._})]})},da=({model:e,view:t})=>{let{resources:n,views:r}=he(),i=t.searchesOf,a=n[i.resource],o=r[i.resource],s=Et(e.name,!0),c=Be(e.name),l=qt({model:e,view:t}),u=t.names?.plural??R(e.name),f=e=>(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[l.dialogs,(0,X.jsx)(Qt,{title:u,subtitle:t.help}),e]});if(!a)return f((0,X.jsx)(V,{title:J(`notFound`),children:J.rich(`noResource`,{resource:i.resource})}));if(s.error)return f((0,X.jsx)(Ee,{title:J(`couldNotLoadYour`,{plural:u.toLowerCase()}),error:s.error}));if(!s.data)return f((0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:Array.from({length:2},(e,t)=>(0,X.jsx)(W,{className:`h-56`},t))}));if(s.data.length===0){let e=(o?.names?.plural??R(a.name)).toLowerCase();return f((0,X.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:J.rich(`noSavedYet`,{plural:u.toLowerCase(),list:(0,X.jsx)(Ye,{to:{kind:`list`,resource:a.name},className:`font-medium text-primary-text hover:underline`,children:e})})}))}return f((0,X.jsx)(`div`,{className:`flex flex-col gap-4`,children:s.data.map(n=>{let r=Te(We(e,n)),s=d(c,`delete`)?e=>void l.start({key:r,title:e,etag:n.etag,snapshot:n}):void 0;return(0,X.jsx)(ua,{model:e,view:t,of:i,target:a,targetView:o,row:n,recordKey:r,canRename:d(c,`update`),onDelete:s},r)})}))},fa=({field:e,hints:t,resource:n,stored:r,onSave:i,close:a})=>{let[o,s]=(0,Z.useState)(()=>k(e,r)),c=(0,Z.useRef)(null),u=(0,Z.useRef)(!1),d=!t?.widget&&(e.type===`boolean`||e.type===`enum`);(0,Z.useEffect)(()=>{c.current?.querySelector(`input, select, textarea, button, [tabindex]`)?.focus()},[]);let f=(t,n,s=o)=>{u.current||(u.current=!0,t&&l(e,s,r)&&i(H(e,s)),a(n))};return(0,X.jsx)(`div`,{ref:c,className:`w-full min-w-0`,onKeyDown:e=>{ie(e.target)||(e.key===`Enter`?(e.preventDefault(),f(!0)):e.key===`Tab`?(e.preventDefault(),f(!0,e.shiftKey?-1:1)):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),f(!1)))},onBlur:e=>{!c.current?.contains(e.relatedTarget)&&!ie(e.relatedTarget)&&f(!0)},children:(0,X.jsx)(F,{field:e,hints:t,value:o,stored:r,resource:n,onChange:e=>{s(e),d&&f(!0,void 0,e)}})})},pa=Se(`app/list-edit`),ma=e=>{let t=z(),n=Qe(),i=C(),[a,o]=(0,Z.useState)(new Map),s=(0,Z.useRef)(a),c=(0,Z.useRef)(new Map),l=(e,t)=>{s.current=new Map(s.current).set(e,{...s.current.get(e),...t}),o(s.current)},u=async(a,o,c)=>{let u=We(e,a),d=String(s.current.get(a.id)?.etag??a.etag);try{let i=await t.update(e.name,u,{[o]:c},d);l(a.id,{[o]:i.record[o],etag:i.etag}),n.setQueryData(r.record(e.name,Te(u)),i),n.invalidateQueries({queryKey:[`page`,e.name]}),n.invalidateQueries({queryKey:[`list`,e.name]}),n.invalidateQueries({queryKey:[`map`,e.name]}),n.invalidateQueries({queryKey:[`count`,e.name]})}catch(n){if(!P(n))throw l(a.id,{[o]:a[o]}),n;let r=n.status===412,s=r?await t.get(e.name,u):void 0;l(a.id,s?{[o]:s.record[o],etag:s.etag}:{[o]:a[o]});let c=n.errors.find(e=>e.field===o)?.message??n.message;i.show({state:`error`,title:pa(r?`changedBySomeoneElse`:`couldNotSave`),description:c})}};return{patches:a,save:(e,t,n)=>{l(e.id,{[t]:n});let r=(c.current.get(e.id)??Promise.resolve()).then(()=>u(e,t,n));return c.current.set(e.id,r.catch(()=>void 0)),r}}},ha=(e,t,n)=>{let r=ma(e),i=t?.list?.editable??[];return{editor:i.length>0&&d(n,`update`)?{editable:(t,n)=>i.includes(n)&&e.fields[n]!==void 0&&le(e.fields[n])&&Ne(t,`update`),render:(n,i,a)=>(0,X.jsx)(fa,{field:e.fields[i],hints:t?.fields[i],resource:e.name,stored:n[i],onSave:e=>void r.save(n,i,e),close:a})}:void 0,patches:r.patches}},ga=pe(),_a=e=>e.find(e=>e.kind===`search`),va=({address:e})=>{let{resources:t,views:n,signIn:r}=he(),i=t[e.resource],a=r?.[e.resource];if(!i)return a?(0,X.jsx)(T,{as:`page`,prompt:a.signIn}):(0,X.jsx)(V,{title:B(`notFound`),children:B(`noResource`,{name:e.resource})});let o=Ge(n[e.resource],e.list);if(e.list!==void 0&&!o)return(0,X.jsx)(V,{title:B(`notFound`),children:Y(`noList`,{name:e.list})});if(o?.searchesOf)return(0,X.jsx)(da,{model:i,view:o});let s=fe(t,n,e.resource,e.list);if(o&&s.listOf){let t=s.model;return(0,X.jsx)(Ni,{model:i,view:o,target:t,children:n=>(0,X.jsx)(ya,{model:t,address:e,scope:n,heading:{title:o.names?.plural??R(i.name),subtitle:o.help}})})}return(0,X.jsx)(ya,{model:i,address:e})},ya=({model:e,address:t,scope:n,heading:r})=>{let a=he(),{set:l,listTo:u,go:f,href:m}=c(),g=e.name,_=Ge(a.views[g],t.list),v=(0,Z.useMemo)(()=>ct(_,e),[_,e]),{fields:x}=ee(),S=(0,Z.useMemo)(()=>Mi(p(je(we(e,_),e,_,x),e,a.resources,a.views),e,_,a.resources,a.views),[e,_,x,a.resources,a.views]),C=t.filter,w=(0,Z.useMemo)(()=>pt(v,C),[v,C]),T=w.ok?w.state:Gt,E=w.ok?w.extras:[],{orderBy:D,filterLayout:O}=t,k=y(),te=de(),[ne,re]=(0,Z.useState)(!1),ie=n?[...E,n]:E,le=o(),fe=Mr({model:e,resources:a.resources,views:a.views,view:_,state:T,extras:ie,titleOf:le}),A=n?dt(v,T,ie):w.ok?C:``,j=(0,Z.useMemo)(()=>xe(e,_,S.map(e=>e.id)),[e,_,S]),pe=(0,Z.useMemo)(()=>st(_,a.resources,a.views,j),[_,a.resources,a.views,j]),M=en({resources:a.resources,views:a.views,model:e,columns:j,filter:A,orderBy:D,related:pe}),N=me(e,_,t.display),P=Be(g),F=n?void 0:rn(e,P),[ge,_e]=(0,Z.useState)(!1),I=ge&&F!==void 0,ve=!N&&!I&&nn(_,F,D,A),be=I||N?.kind!==`map`;s(be);let Se=an(e,M.page,M.key,N?.kind===`custom`),L=Si(),Ce=Ue(e,_),z=e=>({key:e.id,title:String(typeof e[Ce]==`object`?e[Ce].name:e[Ce]??e.id),etag:typeof e.etag==`string`?e.etag:void 0,snapshot:e}),Te=_?.names?.singular??R(g),De=ha(e,_,P),{state:B}=ce(),Oe=Yt(e),V=qt({model:e,view:_,restore:Oe,onReview:e=>f({kind:`record`,resource:g,key:e.key})}),ke=Mt(e),Me=_?.actions.some(e=>e.run?.kind===`delete`)??!1,H=(e,t=E)=>l({filter:dt(v,e,t)}),Pe=_a(E),Ie=e=>{let t=E.filter(e=>e.kind!==`search`);H(T,e?[...t,ga.search(e)]:t)},U=_?.names?.plural??R(g),Le=N?.kind===`calendar`||N?.kind===`timeline`||N?.kind===`board`&&Fe(e)?void 0:N,Re=Le&&(0,X.jsx)(Dt,{model:e,view:_,display:Le,orderBy:D,onChange:e=>l({orderBy:e})}),ze=e.search?.length?(0,X.jsx)(ji,{value:Pe?.kind===`search`?Pe.text:``,onCommit:Ie,placeholder:Y(`searchPlural`,{plural:U}),className:k?void 0:`min-h-11`}):null,Ve=(0,X.jsx)(Xn,{layout:O,config:fe,value:T,onChange:H,leading:O===`bar`?Re:void 0,trailing:ze}),W=O===`bar`?Ve:(0,X.jsx)(Jn,{groups:[Re?[Re]:[]],trailing:ze}),K=yt(fe,T),qe=(0,X.jsx)(On,{scroll:!0,chips:K,onRemove:e=>H(ut(T,e)),onClear:()=>H(Gt)}),Je=Le&&(0,X.jsx)(Fn,{title:Y(`sort`),children:(0,X.jsx)(Dt,{model:e,view:_,display:Le,orderBy:D,onChange:e=>l({orderBy:e}),className:`min-h-11 w-full`})}),Xe=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(G,{className:`min-h-11`,onClick:()=>re(!0),"aria-haspopup":`dialog`,children:[(0,X.jsx)(bn,{className:`size-3.5`}),K.length>0?Y(`filtersCount`,{count:K.length}):Y(`filters`)]}),ze??(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:qe})]}),ze&&qe,(0,X.jsx)(se,{title:Y(`filters`),open:ne,onClose:()=>re(!1),children:(0,X.jsx)(Xn,{layout:`panel`,fullWidth:!0,config:fe,value:T,onChange:H,leading:Je})})]}),Ze=!n&&h(_,a.pages,P)&&(0,X.jsxs)(Ye,{to:{kind:`create`,resource:g},className:ye({variant:`primary`}),children:[(0,X.jsx)(oe,{className:`size-3.5`}),Y(`newRecord`,{singular:Te})]}),Qe=_?.saveSearch&&!n&&w.ok&&C&&(0,X.jsx)(ia,{model:e,view:_,search:_.saveSearch,filter:C,chips:mt(e,_,C,Nt(fe))}),$e=!n&&(0,X.jsx)(Fr,{model:e}),et=Yr({model:e,view:_,resources:a.resources,views:a.views,plural:U,filter:A,orderBy:D}),tt=ar(_)&&(0,X.jsxs)(G,{onClick:()=>et.open(),...!k&&{"aria-label":Y(`export`),title:Y(`export`)},children:[(0,X.jsx)(Ae,{className:`size-3.5`}),k&&Y(`export`)]}),rt=F&&!ve&&(0,X.jsx)(Xt,{sorting:I,onChange:_e,iconOnly:!k}),it=t=>!I&&(0,X.jsx)(Bt,{view:_,choices:i(e,_,te),value:N?.name??`table`,onChange:e=>l({display:e}),menu:t}),at=tn(e),ot=t=>{at(b(e,t).record),f({kind:`record`,resource:g,key:We(e,t)})},lt=async e=>{let t=e.map(z),n=await V.startBulk(t);return e.filter((e,r)=>n.includes(t[r]))},q=M.source?(0,X.jsx)(vt,{columns:S,source:M.source,sort:Ke(D),onSortChange:e=>l({orderBy:ae(e)}),onOpenRow:ot,rowLink:t=>({href:m({kind:`record`,resource:g,key:We(e,t)}),onFollow:()=>ot(t)}),cellEditor:De.editor,rowPatches:De.patches,initialScrollIndex:L.initialIndex,onScrollIndex:L.remember,rowActions:[{label:Y(`openRecord`,{singular:Te}),onSelect:ot},...ke.rowActions,...d(P,`delete`)&&!Me?[{label:Y(`delete`),destructive:!0,available:e=>Ne(e,`delete`),onSelect:e=>void V.start(z(e))}]:[]],bulkActions:[...ar(_)&&dr(e)?[{label:e=>Y(`exportCount`,{count:e}),onRun:e=>et.open(e)}]:[],...ke.bulkActions,...d(P,`delete`)?[{label:e=>Y(`deleteCount`,{count:e}),destructive:!0,onRun:e=>lt(e)}]:[]],rowNumbers:!1,pinKey:B.kind===`signed-in`?Ot(B.user.id,ue(g,t.list)):void 0,scroll:`parent`,className:`flex-1`}):(0,X.jsx)(`div`,{"aria-busy":!0,className:`flex-1 rounded-lg border bg-surface`}),ft={...M,initialIndex:L.initialIndex,onScrollIndex:L.remember},ht=Zr({plural:U,search:Pe?.kind===`search`?Pe.text:``,filtered:K.length>0,scoped:!!n||E.some(e=>e.kind!==`search`),canCreate:!!Ze}),gt=(0,X.jsx)(Xr,{state:ht,onClearSearch:()=>Ie(``),onClearFilters:()=>H(Gt),create:Ze}),_t=I?(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:Y(`dragToSort`)}),(0,X.jsx)(Jt,{model:e,view:_,field:F,filter:``,columns:He(e,_)})]}):ve?(0,X.jsx)(Jt,{model:e,view:_,field:F,filter:``,columns:He(e,_),sort:{value:Ke(D),onChange:e=>l({orderBy:ae(e)})}}):N?N.kind===`cards`?(0,X.jsx)(fi,{model:e,view:_,display:N,list:ft,empty:gt},M.key.join(` `)):N.kind===`map`?(0,X.jsx)(jt,{model:e,view:_,display:N,filter:A,orderBy:D,fields:j,at:t.map,onMove:e=>l({map:e}),flush:!0}):N.kind===`board`?(0,X.jsx)(kt,{model:e,view:_,display:N,fields:j,filter:A,orderBy:D}):N.kind===`calendar`?(0,X.jsx)(Lt,{model:e,view:_,display:N,fields:j,filter:A,at:t.calendar,linkTo:e=>u({calendar:e})}):N.kind===`timeline`?(0,X.jsx)(Ft,{model:e,view:_,display:N,fields:j,filter:A,at:t.timeline,linkTo:e=>u({timeline:e})}):(0,X.jsx)(Vt,{display:N,list:Se}):M.source?.total===0&&!M.error?gt:q;return(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[V.dialogs,et.dialogs,ke.prompt,(0,X.jsx)(Qt,{title:r?.title??U,subtitle:r?r.subtitle:_?.help,subtitleBelow:!0,actions:(0,X.jsxs)(X.Fragment,{children:[it(!k),rt,Qe,$e,tt,Ze]})}),!w.ok&&(0,X.jsx)(Ee,{title:Y(`unreadableFilter`),error:Error(w.errors.map(e=>e.message).join(`; `))}),M.error&&!N&&!I&&(0,X.jsx)(Ee,{title:Y(`couldNotLoadRows`),error:M.error}),_?.chart&&!I&&(nt(_.chart)?(0,X.jsx)(Ai,{model:e,view:_,chart:_.chart,plural:U,filter:A}):(0,X.jsx)(Oi,{resource:g,chart:_.chart,title:Y(`created`,{plural:U}),filter:A})),!I&&(k?W:Xe),k&&O===`panel`&&!I?(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-4`,children:[(0,X.jsx)(`div`,{className:be?`sticky top-[calc(var(--pb-sticky-top,0px)+1rem)] flex max-h-[calc(100dvh-var(--pb-sticky-top,0px)-var(--pb-sticky-bottom,0px)-2rem)] shrink-0 self-start`:`flex shrink-0`,children:Ve}),_t]}):_t]})};export{va as ListPage,xr as a,_r as c,mr as d,pr as f,un as h,Sr as i,hr as l,Q as m,wr as n,vr as o,ur as p,Cr as r,br as s,Er as t,gr as u};
4
- //# debugId=1a612277-3c76-4fb5-9fbf-a367e91ff0da
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/import-dialog-DThTUXFS.js","assets/rolldown-runtime-DFwUHQ4A.js","assets/react-CuiNlnus.js","assets/app-B8KcM2Z-.js","assets/vendor-t7Q7QbPu.js","assets/app-DLkpxjgP.css","assets/sheet-source-Cenf8A74.js","assets/import-table-dialog-C-XIx1Dd.js","assets/export-dialog-BerhgfFO.js","assets/embedded-list-C3nd1V5o.js","assets/update-set-Zch9kB-u.js","assets/layout-grid-CvCNKDtn.js","assets/lib-tanstack-react-table-uAPG3Sdi.js","assets/lib-tanstack-store-KbP08Dw1.js","assets/lib-tanstack-react-store-BKI8EKbh.js","assets/lib-use-sync-external-store-D4s7MiFL.js","assets/lib-tanstack-table-core-2MHQ7o_e.js","assets/record-preview-CwySCCRj.js","assets/lib-dnd-kit-core-xi-7xL_N.js","assets/lib-dnd-kit-utilities-Bvr0fWXF.js","assets/lib-dnd-kit-accessibility-AUTLnqh4.js","assets/lib-dnd-kit-sortable-CNDSKqCD.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,$r as i,Ao as a,Bi as o,Bo as s,Br as c,C as l,Co as u,Da as d,Di as f,Dn as p,Do as m,Ea as h,Eo as g,Fn as _,Gc as v,Ho as y,Jr as b,Ki as x,Kn as S,La as C,Li as w,Lt as T,M as E,Ni as D,Nr as O,O as k,Pa as ee,Pr as te,Ql as ne,Rc as re,S as ie,Sa as ae,Sc as oe,So as se,Ss as ce,T as le,Ta as ue,Uo as de,Ur as fe,Vc as A,Wc as j,Xl as pe,Xn as M,Yn as N,Ys as P,ai as me,as as he,b as F,ba as ge,bn as _e,cl as I,da as ve,dc as ye,dl as be,ei as xe,el as Se,fi as L,fl as R,fn as Ce,fs as z,gi as we,gl as Te,gr as Ee,hc as De,ic as B,io as Oe,is as V,iu as ke,jc as Ae,jn as je,jt as Me,k as H,ka as Ne,ko as Pe,li as Fe,lt as Ie,mc as U,nc as Le,nl as Re,nu as ze,os as Be,qn as Ve,sc as W,sl as He,uc as G,ul as Ue,vc as K,wa as We,wl as Ge,xa as Ke,zc as qe,zi as Je,zr as Ye}from"./app-B8KcM2Z-.js";import{C as Xe,f as Ze,h as Qe,i as $e,o as et,s as tt}from"./vendor-t7Q7QbPu.js";import{n as nt}from"./view-chart-ChBtewKd.js";import{$ as rt,A as it,B as at,D as ot,E as st,F as ct,G as lt,H as ut,I as dt,J as q,K as ft,L as pt,M as mt,N as ht,O as gt,P as _t,Q as vt,R as yt,T as bt,U as xt,V as St,W as Ct,X as wt,Y as Tt,Z as J,b as Et,d as Dt,et as Ot,f as kt,ft as At,h as jt,i as Mt,j as Nt,k as Pt,m as Ft,n as It,p as Lt,pt as Rt,q as zt,u as Bt,v as Vt,w as Ht,x as Ut,xt as Y,y as Wt,z as Gt}from"./embedded-list-C3nd1V5o.js";import{a as Kt,i as qt,n as Jt,r as Yt,t as Xt}from"./reorder-button-BGgoLDx3.js";import{t as Zt}from"./trash-Ch2JFURM.js";import{t as Qt}from"./page-header-Ddz2r5ic.js";import{i as $t,r as en,t as tn}from"./record-preview-CwySCCRj.js";import{c as nn,l as rn}from"./messages-CZQvPUZQ.js";import{t as an}from"./use-display-rows-s-zuk4Lc.js";var on=new Set(`all.analyse.analyze.and.any.array.as.asc.asymmetric.both.case.cast.check.collate.column.constraint.create.current_catalog.current_date.current_role.current_time.current_timestamp.current_user.default.deferrable.desc.distinct.do.else.end.except.false.fetch.for.foreign.from.grant.group.having.in.initially.intersect.into.lateral.leading.limit.localtime.localtimestamp.not.null.offset.on.only.or.order.placing.primary.references.returning.select.session_user.some.symmetric.system_user.table.then.to.trailing.true.union.unique.user.using.variadic.when.where.window.with`.split(`.`)),sn=/^[a-z][a-z0-9_]*$/,cn=[`id`,`etag`,`organization_id`],ln=e=>sn.test(e)&&new TextEncoder().encode(e).length<=63,un=(e,t,n=63)=>{if(typeof e!=`string`||!ln(e)||new TextEncoder().encode(e).length>n)return`form`;if(on.has(e))return`reserved_word`;if(t===`field`&&cn.includes(e))return`reserved_field`},dn={name:`bookmark-check`,size:24,node:[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}],[`path`,{d:`m9 10 2 2 4-4`,key:`1gnqz4`}]]};dn.node;var fn=j(dn),pn={name:`bookmark-plus`,size:24,node:[[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M15 10H9`,key:`o6yqo3`}],[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]};pn.node;var mn=j(pn),hn={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};hn.node;var gn=j(hn),_n={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};_n.node;var vn=j(_n),yn={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};yn.node;var bn=j(yn),xn=e=>e.normalize(`NFKD`).replace(/[̀-ͯ]/g,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``),Sn=(e,t,n)=>(/^[a-z]/.test(e)?e:`${t}_${e}`).slice(0,n).replace(/_+$/,``),Cn=(e,t,n)=>{let r=e;for(let i=2;t.has(r)||on.has(r);i++){let t=`_${i}`;r=`${e.slice(0,n-t.length).replace(/_+$/,``)}${t}`}return r},wn=e=>e<26?String.fromCharCode(97+e):wn(Math.floor(e/26)-1)+wn(e%26),Tn=e=>{let t=new Set(cn);return e.map((e,n)=>{let r=xn(e),i=Cn(r===``?`column_${wn(n)}`:Sn(r,`column`,63),t,63);return t.add(i),i})},En=(e,t=[],n=63)=>{let r=xn(e.replace(/\.(csv|tsv|txt|xlsx|json)$/i,``));if(r!==``)return Cn(Sn(r,`table`,n),new Set(t),n)},X=e(n(),1),Dn=`inline-flex h-6 items-center gap-1 rounded-full border border-primary-border bg-primary-soft pl-2.5 pr-1.5 text-xs font-medium text-primary-text`,On=({chips:e,lockedLabels:t=[],onRemove:n,onClear:r,scroll:i})=>e.length===0&&t.length===0?null:(0,X.jsxs)(`div`,{className:i?`flex flex-nowrap items-center gap-1.5 overflow-x-auto pb-1 [&>*]:shrink-0`:`flex flex-wrap items-center gap-1.5`,children:[t.map(e=>(0,X.jsxs)(`span`,{className:`inline-flex h-6 items-center gap-1.5 rounded-full border border-border-strong bg-muted px-2.5 text-xs font-medium text-foreground`,children:[(0,X.jsx)(gn,{className:`size-3 text-muted-foreground`}),e]},e)),e.map(e=>(0,X.jsxs)(`span`,{className:Dn,children:[e.label,(0,X.jsx)(`button`,{type:`button`,"aria-label":q(`remove`,{label:e.label}),onClick:()=>n(e.key),className:`rounded-full p-0.5 hover:bg-primary-border/60`,children:(0,X.jsx)(U,{className:`size-3`})})]},e.key)),e.length>0&&(0,X.jsx)(`button`,{type:`button`,onClick:r,className:`ml-1 text-xs font-medium text-muted-foreground hover:text-foreground`,children:q(`clearAll`)})]}),kn=({value:e,presets:t=zt,onChange:n})=>(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(t=>{let r=ft(t);return(0,X.jsx)(`button`,{type:`button`,disabled:!r,title:r?void 0:q(`unknownPreset`,{id:t}),onClick:()=>n(e===t?void 0:t),className:v(`h-7 rounded-md border px-2.5 text-body font-medium transition-colors`,!r&&`border-dashed text-danger-text`,e===t?`border-primary-border bg-primary-soft text-primary-text`:`border-border-strong bg-background text-muted-foreground hover:bg-muted`),children:r??q(`unsupported`,{id:t})},t)})}),An=(e,t)=>e.onSearch?e.options:e.options.filter(e=>St(e.label,t)),jn=(e,t,n)=>t===0?-1:n===`ArrowDown`?e<0?0:(e+1)%t:e<0?t-1:(e-1+t)%t,Z=e(t(),1),Mn=({config:e,selected:t,onToggle:n,inline:r=!1})=>{let i=(0,Z.useId)(),a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(-1),f=r||c,p=An(e,o),m=(0,Z.useRef)(e.onSearch);m.current=e.onSearch,(0,Z.useEffect)(()=>()=>m.current?.(``),[]);let h=t=>{s(t),d(-1),e.onSearch?.(t)};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`div`,{className:`flex min-h-8 cursor-text flex-wrap items-center gap-1 rounded-md border border-border-strong bg-background px-2 py-1 shadow-sm focus-within:border-primary focus-within:ring-2 focus-within:ring-primary/20`,onClick:()=>a.current?.focus(),children:[(0,X.jsx)(K,{className:`size-3.5 shrink-0 text-muted-foreground`}),t.map(t=>(0,X.jsx)(_,{label:at(e,t),onRemove:()=>n(t)},t)),(0,X.jsx)(`input`,{ref:a,autoFocus:r,role:`combobox`,"aria-label":e.label,"aria-expanded":f,"aria-controls":`${i}-options`,"aria-autocomplete":`list`,"aria-activedescendant":p[u]?`${i}-${u}`:void 0,placeholder:t.length>0?``:q(`searchIn`,{label:e.label}),className:`h-6 min-w-16 flex-1 bg-transparent text-foreground outline-none placeholder:text-faint-foreground`,value:o,onChange:e=>h(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),d(jn(u,p.length,e.key));return}if(e.key===`Enter`&&p[u]){e.preventDefault(),n(p[u].value);return}if(e.key===`Backspace`&&o===``&&t.length>0){n(t[t.length-1]);return}e.key===`Escape`&&o!==``&&(e.stopPropagation(),h(``))},onFocus:()=>l(!0),onBlur:()=>{l(!1),d(-1),!r&&o!==``&&h(``)}})]}),f&&(0,X.jsxs)(`ul`,{id:`${i}-options`,role:`listbox`,"aria-label":e.label,"aria-multiselectable":!0,className:v(`flex max-h-60 flex-col gap-px overflow-y-auto`,!r&&`rounded-md border bg-background p-1 shadow-sm`),children:[p.map((e,r)=>{let a=t.includes(e.value);return(0,X.jsxs)(`li`,{id:`${i}-${r}`,role:`option`,"aria-selected":a,tabIndex:-1,className:v(`flex cursor-pointer items-center gap-2 rounded px-1.5 py-1 hover:bg-muted`,r===u&&`bg-muted`),onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.value),children:[(0,X.jsx)(`span`,{className:v(`inline-flex size-4 shrink-0 items-center justify-center rounded border`,a?`border-primary bg-primary text-primary-foreground`:`border-border-strong bg-background`),children:a&&(0,X.jsx)(qe,{className:`size-3`,strokeWidth:3})}),(0,X.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.count!==void 0&&(0,X.jsx)(`span`,{className:`text-xs tabular-nums text-faint-foreground`,children:D(e.count)})]},e.value)}),e.failed&&(0,X.jsx)(`li`,{className:`px-1.5 py-1 text-xs text-danger-text`,children:q(`couldNotLoadCounts`)}),!e.failed&&p.length===0&&(0,X.jsx)(`li`,{className:`px-1.5 py-1 text-xs text-faint-foreground`,children:q(`noMatches`)})]})]})},Nn=({config:e,selected:t,onToggle:n})=>{let[r,i]=(0,Z.useState)(``),o=e.options.filter(e=>St(e.label,r));return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.searchable&&(0,X.jsx)(a,{wrapperClassName:`mb-1 h-7`,leading:(0,X.jsx)(K,{className:`size-3.5`}),placeholder:q(`searchIn`,{label:e.label}),value:r,onChange:e=>i(e.target.value)}),o.map(e=>(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-1 py-1 hover:bg-muted`,children:[(0,X.jsx)(Oe,{checked:t.includes(e.value),onChange:()=>n(e.value),label:e.label}),(0,X.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.count!==void 0&&(0,X.jsx)(`span`,{className:`text-xs tabular-nums text-faint-foreground`,children:D(e.count)})]},e.value)),e.failed&&(0,X.jsx)(`span`,{className:`px-1 py-1 text-xs text-danger-text`,children:q(`couldNotLoadCounts`)}),!e.failed&&o.length===0&&(0,X.jsx)(`span`,{className:`px-1 py-1 text-xs text-faint-foreground`,children:q(`noMatches`)})]})},Pn=({label:e,activeCount:t,width:n=240,defaultOpen:r=!1,children:i})=>{let[a,o]=(0,Z.useState)(r),[s,c]=(0,Z.useState)({width:n}),l=(0,Z.useRef)(null),u=(0,Z.useRef)(null);(0,Z.useLayoutEffect)(()=>{if(!a||!l.current)return;let e=l.current.getBoundingClientRect(),t=document.documentElement.clientWidth,r=Math.min(n,g(t));c({width:r,right:e.left+r>t?e.right-m(e.right,r,t):void 0})},[a,n]);let d=Pe(a,l,u,s);return(0,Z.useEffect)(()=>{if(!a)return;let e=e=>{e.target instanceof Node&&!l.current?.contains(e.target)&&o(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[a]),(0,X.jsxs)(`div`,{ref:l,className:`relative`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":a,onClick:()=>o(!a),className:v(`inline-flex h-8 items-center gap-1.5 rounded-md border bg-background px-2.5 font-medium shadow-sm transition-colors hover:bg-muted`,t>0?`border-primary-border text-primary-text`:`border-border-strong text-foreground`),children:[e,t>0&&(0,X.jsx)(`span`,{className:`rounded-full bg-primary px-1.5 text-[0.6875rem] leading-4 text-primary-foreground`,children:t}),(0,X.jsx)(re,{className:`size-3.5 text-muted-foreground`})]}),a&&(0,X.jsx)(`div`,{ref:u,className:v(`absolute top-full z-30 mt-1.5 rounded-lg border bg-background p-3 shadow-pop`,s.right===void 0&&`left-0`),style:{...s,...d},children:typeof i==`function`?i(()=>o(!1)):i})]})},Fn=({title:e,children:t})=>(0,X.jsxs)(`section`,{className:`flex flex-col gap-2 border-b py-3 last:border-b-0`,children:[(0,X.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),t]}),In=({items:e,onPick:t,close:n})=>{let r=(0,Z.useRef)([]);return(0,Z.useEffect)(()=>r.current[0]?.focus(),[]),(0,X.jsx)(`ul`,{role:`menu`,"aria-label":q(`moreFilters`),onKeyDown:t=>{if(t.key===`Escape`)return n();let i=Me(t.key,r.current.indexOf(document.activeElement),e.length);i!==void 0&&(t.preventDefault(),r.current[i]?.focus())},className:`-mx-3 -my-3`,children:e.map((e,i)=>(0,X.jsx)(`li`,{role:`none`,children:(0,X.jsx)(`button`,{ref:e=>{r.current[i]=e},type:`button`,role:`menuitem`,className:Ie,onClick:()=>{n(),t(e.key)},children:e.label})},e.key))})},Ln=({items:e,onPick:t})=>e.length===0?null:(0,X.jsx)(Pn,{label:q(`moreFilters`),activeCount:0,children:n=>(0,X.jsx)(In,{items:e,onPick:t,close:n})}),Rn=(e,t,n,r,i)=>{let a=n+(r-n)*e/t;return n+(r-n)*(e+1)/t>i[0]&&a<i[1]},zn=(e,t,n)=>n===t?0:(e-t)/(n-t),Bn=(e,t,n)=>t===0?[Math.min(n,e[1]),e[1]]:[e[0],Math.max(n,e[0])],Vn=1e3,Hn=({config:e,value:t,onChange:n})=>{let{min:r,max:i,step:a,histogram:o,format:s}=e,[c,l]=(0,Z.useState)(),u=c??t??[r,i],d=Math.max(...o),f=()=>{c&&(l(void 0),n(c[0]===r&&c[1]===i?void 0:c))},p=Je(c,Vn);return(0,Z.useEffect)(()=>{p&&f()},[p]),e.failed?(0,X.jsx)(`p`,{className:`text-xs text-danger-text`,children:q(`couldNotLoadCounts`)}):(0,X.jsxs)(`div`,{className:`w-full`,children:[(0,X.jsxs)(`div`,{className:`px-[7px]`,children:[o.length>0&&(0,X.jsx)(`div`,{className:`mb-1 flex h-12 items-end gap-0.5`,children:o.map((e,t)=>(0,X.jsx)(`span`,{className:v(`flex-1 rounded-t-sm`,Rn(t,o.length,r,i,u)?`bg-primary/70`:`bg-border`),style:{height:`${Math.max(6,e/d*100)}%`}},t))}),(0,X.jsxs)(`div`,{className:`relative h-4`,children:[(0,X.jsx)(`span`,{className:`absolute inset-x-0 top-1/2 h-1 -translate-y-1/2 rounded-full bg-border`}),(0,X.jsx)(`span`,{className:`absolute top-1/2 h-1 -translate-y-1/2 rounded-full bg-primary`,style:{left:`${zn(u[0],r,i)*100}%`,right:`${100-zn(u[1],r,i)*100}%`}})]})]}),(0,X.jsx)(`div`,{className:`relative -mt-4 h-4`,children:[0,1].map(t=>(0,X.jsx)(`input`,{type:`range`,className:`pb-range`,"aria-label":q(t===0?`minimum`:`maximum`,{label:e.label}),min:r,max:i,step:a,value:u[t],onChange:e=>l(Bn(u,t,Number(e.target.value))),onPointerUp:f,onTouchEnd:f,onBlur:f},t))}),(0,X.jsxs)(`div`,{className:`mt-2 flex justify-between text-xs tabular-nums text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:s(u[0])}),(0,X.jsx)(`span`,{children:s(u[1])})]})]})},Un=e=>[...new Set(e.map(e=>e.key.split(`:`).slice(0,2).join(`:`)))],Wn=(e,t)=>{let n=t.filter(t=>!e.includes(t));return n.length===0?e:[...e,...n]},Gn=(e,t)=>{let n=[...e.facets.map(e=>({key:`facet:${e.id}`,label:e.label,secondary:e.secondary})),...(e.ranges??[]).map(e=>({key:`range:${e.id}`,label:e.label,secondary:e.secondary})),...e.datePresets?[{key:`date`,label:q(`date`),secondary:e.dateSecondary}]:[],...(e.toggles??[]).map(e=>({key:`toggle:${e.id}`,label:e.label,secondary:e.secondary}))],r=new Set,i=[];for(let e of n)!e.secondary||t.includes(e.key)?r.add(e.key):i.push({key:e.key,label:e.label});return{shown:r,more:i}},Kn=({label:e,checked:t,onChange:n})=>(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-between gap-3 py-1`,children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(E,{checked:t,onChange:n,label:e})]}),qn=(e,t)=>e.some(e=>e.length>0)||!!t,Jn=({groups:e,trailing:t})=>{if(!qn(e,t))return null;let n=e.filter(e=>e.length>0);return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n.map((e,t)=>(0,X.jsxs)(Z.Fragment,{children:[t>0&&(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`}),e]},t)),t&&(0,X.jsx)(`div`,{className:`flex min-w-32 flex-1 justify-end`,children:t})]})},Yn=(e,t,n)=>{let[r,i]=(0,Z.useState)(t??Gt);return[e??r,e=>{i(e),n?.(e)}]},Xn=({config:e,layout:t,value:n,defaultValue:r,onChange:i,lockedLabels:a,defaultOpenMenu:o,fullWidth:s,leading:c,trailing:l})=>{let[u,d]=Yn(n,r,i),f=yt(e,u),p=Un(f),[m,h]=(0,Z.useState)(()=>p),[g,_]=(0,Z.useState)();(0,Z.useEffect)(()=>h(e=>Wn(e,p)),[p.join(`,`)]);let v=(0,X.jsx)(On,{chips:f,lockedLabels:a,onRemove:e=>d(ut(u,e)),onClear:()=>d(Gt)}),y=(e,t=!1)=>{let n=u.facets[e.id]??[],r=t=>d(Ct(u,e.id,t));return e.combobox?(0,X.jsx)(Mn,{config:e,selected:n,onToggle:r,inline:t}):(0,X.jsx)(Nn,{config:e,selected:n,onToggle:r})},b=e.ranges??[],x=e=>(0,X.jsx)(Hn,{config:e,value:u.ranges?.[e.id],onChange:t=>d(xt(u,e.id,t))}),S=e.datePresets&&(0,X.jsx)(kn,{value:u.date,presets:Array.isArray(e.datePresets)?e.datePresets:void 0,onChange:e=>d({...u,date:e})}),C=(e.toggles??[]).map(e=>(0,X.jsx)(Kn,{label:e.label,checked:u.toggles.includes(e.id),onChange:()=>d(lt(u,e.id))},e.id));if(t===`panel`)return(0,X.jsxs)(`aside`,{className:s?`flex w-full flex-col gap-1`:`flex w-64 shrink-0 flex-col gap-1 overflow-y-auto rounded-lg border bg-background px-4 py-3`,children:[(0,X.jsx)(`div`,{className:`flex items-center justify-between pb-1`,children:(0,X.jsx)(`h2`,{className:`font-semibold`,children:q(`filters`)})}),(f.length>0||(a?.length??0)>0)&&(0,X.jsx)(`div`,{className:`border-b pb-3`,children:v}),c,e.facets.map(e=>(0,X.jsx)(Fn,{title:e.label,children:y(e)},e.id)),b.map(e=>(0,X.jsx)(Fn,{title:e.label,children:x(e)},e.id)),S&&(0,X.jsx)(Fn,{title:q(`date`),children:S}),C.length>0&&(0,X.jsx)(Fn,{title:q(`showOnly`),children:C})]});let{shown:w,more:T}=Gn(e,m),E=e=>{h(t=>Wn(t,[e])),_(e)},D=[...e.facets.filter(e=>w.has(`facet:${e.id}`)).map(e=>(0,X.jsx)(Pn,{label:e.label,activeCount:(u.facets[e.id]??[]).length,width:e.combobox?280:void 0,defaultOpen:o===e.id||g===`facet:${e.id}`,children:y(e,!0)},e.id)),...b.filter(e=>w.has(`range:${e.id}`)).map(e=>(0,X.jsx)(Pn,{label:e.label,activeCount:+!!u.ranges?.[e.id],width:280,defaultOpen:o===e.id||g===`range:${e.id}`,children:x(e)},`range:${e.id}`)),...S&&w.has(`date`)?[(0,X.jsx)(Z.Fragment,{children:S},`date`)]:[]],O=(e.toggles??[]).filter(e=>w.has(`toggle:${e.id}`)).map(e=>(0,X.jsx)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:(0,X.jsx)(Kn,{label:e.label,checked:u.toggles.includes(e.id),onChange:()=>d(lt(u,e.id))})},e.id)),k=[c?[(0,X.jsx)(Z.Fragment,{children:c},`leading`)]:[],D,O,T.length>0?[(0,X.jsx)(Ln,{items:T,onPick:E},`more`)]:[]];return!qn(k,l)&&f.length===0&&!a?.length?null:(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(Jn,{groups:k,trailing:l}),v]})},Q=Se(`app/export`),Zn=()=>new DOMException(Q(`cancelled`),`AbortError`),Qn=async({client:e,resource:t,filters:n,orderBy:r,plan:i,labels:a,limit:o,port:s,sink:c,signal:l,onProgress:u})=>{let d=i.columns.map(e=>e.name),f=0;try{await c.write(await s.send({kind:`start`,plan:i,locale:Re()}));for(let[i,p]of n.entries()){let m=``;do{let h=await e.search(t,{filter:p,orderBy:r,pageSize:500,pageToken:m,fields:d,labels:a});if(l.aborted)throw Zn();let g=h.items.slice(0,o-f);if(await c.write(await s.send({kind:`page`,records:g,labels:h.labels??{}})),f+=g.length,u(f),m=h.nextPageToken,f>=o)return await $n(s,c),{rows:f,truncated:g.length<h.items.length||m!==``||i+1<n.length}}while(m!==``)}return await $n(s,c),{rows:f,truncated:!1}}catch(e){throw await c.abort(),e}finally{s.close()}},$n=async(e,t)=>{await t.write(await e.send({kind:`finish`})),await t.close()},er=1048575,tr=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
3
+ `,nr=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,rr=`http://schemas.openxmlformats.org/package/2006/relationships`;`${tr}`,`${tr}${rr}${nr}`,`${tr}${rr}${nr}${nr}`,new TextEncoder;var ir=pe(),ar=e=>e?.export!==!1,or=e=>Object.values(e.fields).flatMap(e=>e.sensitive?[]:[e.name]),sr=(e,t)=>{let n=new Set(or(e));return He(e,t).filter(e=>n.has(e))},cr=(e,t,n)=>Object.fromEntries(we(e,t,[],n).map(e=>[e.id,e.header])),lr=(e,t,n)=>{let r=cr(e,t,n);return n.flatMap(n=>{let i=e.fields[n];return i?[{name:n,header:r[n],field:i,hints:t?.fields[n]??{}}]:[]})},ur=(e,t)=>{let n=e?.export?e.export.maxRows??1/0:1/0;return Math.min(n,t===`xlsx`?er:1/0)},dr=e=>e.primaryKey.length===1,fr=(e,t)=>{let[n]=e.primaryKey;if(!n||e.primaryKey.length!==1)throw Error(`Not implemented: selected rows are exported by a single-field key`);let r=[];for(let e=0;e<t.length;e+=500)r.push(ne(ir.in(n,t.slice(e,e+500))));return r},pr=e=>{if(e.kind!==`counting`)return e.kind===`exact`?e.rows:Math.max(e.rows,10001)},mr=Se(`app/import`),hr=e=>typeof e==`object`&&!!e&&`date`in e,gr=e=>typeof e==`object`&&!!e&&`json`in e,_r=e=>e===null||typeof e==`string`&&e.trim()===``,vr=e=>e===null?``:hr(e)?e.date.replace(`T`,` `):gr(e)?JSON.stringify(e.json):typeof e==`boolean`?e?`TRUE`:`FALSE`:String(e),yr=e=>e<26?String.fromCharCode(65+e):yr(Math.floor(e/26)-1)+yr(e%26),br=(e,t)=>e[t]?.trim()?e[t]:mr(`column`,{letters:yr(t)}),xr=(e,t,n,r)=>{let i=Tn(t.headers),a=t.headers.map((e,n)=>({column:n,include:!0,name:i[n],label:br(t.headers,n).trim(),type:t.types[n].type,inferred:t.types[n],decimal:t.decimals[n]}));return{name:En(e,n,r)??``,pluralLabel:e.replace(/\.[^.]+$/,``).trim(),singularLabel:``,titleField:a.find(e=>e.type===`text`)?.name,fields:a}},Sr=e=>e.fields.filter(e=>e.include),Cr=(e,t,n)=>{let r=e.fields.find(e=>e.column===t),i=e.fields.map(e=>e.column===t?{...e,...n}:e),a=i.find(e=>e.column===t),o=r?.name===e.titleField,s=a.include&&a.type===`text`;return o?{...e,fields:i,titleField:s?a.name:void 0}:{...e,fields:i}},wr=`user_table_fields`,Tr=`table`,Er=(e,t)=>{let n=Sr(t).map((e,t)=>({op:`create`,resource:wr,data:{table_id:{$ref:Tr},name:e.name,label:e.label.trim(),type:e.type,position:t+1,...e.type===`decimal`&&{precision:e.decimal.precision,scale:e.decimal.scale}}})),r=t.titleField?[{op:`update`,resource:e,key:{$ref:Tr},etag:`*`,data:{title_field:t.titleField}}]:[];return[{op:`create`,resource:e,ref:Tr,data:{name:t.name,singular_label:t.singularLabel.trim(),plural_label:t.pluralLabel.trim()}},...n,...r]},Dr=(e,t)=>{let n=new Map(t.map(e=>[e.value,e.count]));return e.map(([e,t])=>({value:e,label:t,...n.get(e)!==void 0&&{count:n.get(e)}}))},Or=(e,t)=>[...new Set(t.filter(t=>!e.includes(t)))],kr=pe(),Ar=(e,t,n)=>{let r=z(),[i,a]=(0,Z.useState)({}),o=e=>!!e?.search?.length&&e.primaryKey.length===1,s=e=>{let n=t[e.name];return[e.primaryKey[0],...n?.titleFrom?n.titleFrom.fields:[I(e,n)]]},c=(e,r)=>{let i=t[e.name],a=String(r[e.primaryKey[0]]);return[a,i?.titleFrom?n(e,i,r,a):String(r[I(e,i)])]},l=tt({queries:e.map(({id:e,target:t})=>{let n=(i[e]??``).trim();return{queryKey:[`reference-search`,e,t?.name??``,n],enabled:o(t)&&n!==``,placeholderData:Ze,queryFn:async()=>(await r.list(t.name,{filter:ne(kr.search(n)),fields:s(t),pageSize:20})).items}})});return e.map(({id:e,target:t},n)=>{if(!o(t))return{};let r=t=>a(n=>({...n,[e]:t}));return(i[e]??``).trim()===``?{onSearch:r}:{onSearch:r,matches:(l[n]?.data??[]).map(e=>c(t,e))}})},jr=24,Mr=({model:e,resources:t,views:n,view:i,state:a,extras:o,titleOf:s})=>{let c=z(),l=te(c),u=Qe(),d=ct(i,e),f=e=>i?.fields[e]?.label??R(e),p=n=>{let r=e.fields[n];return r?.type===`relation`&&r.relation?t[r.relation.resource]:void 0},m=e=>!!(e&&n[e.name]?.titleFrom),h=d.facets.flatMap(e=>(e.flags?e.options.map(e=>e.value):[e.id]).map(t=>({group:e.id,field:t}))),g=tt({queries:h.map(({group:t,field:i})=>{let s=dt(d,{...a,facets:{...a.facets,[t]:[]}},o),c=p(i),u=c?.primaryKey.length===1&&!m(c)?I(c,n[c.name]):void 0;return{queryKey:r.facets(e.name,i,s),queryFn:()=>l.facets(e.name,i,{filter:s,limit:50,...u&&{label:u}})}})}),_=(e,t)=>g[h.findIndex(n=>n.group===e&&n.field===t)],v=(e,t)=>_(e,t)?.data,y=e=>(v(e,e)??[]).flatMap(e=>e.value===null?[]:[String(e.value)]),b=tt({queries:d.facets.map(t=>{let i=p(t.id),o=Or(y(t.id),a.facets[t.id]??[]);return{queryKey:r.labels(`facet:${e.name}.${t.id}`,o.join(`,`)),enabled:!!i&&!m(i)&&o.length>0,queryFn:async()=>[...await N(u,c,i,o,n[i.name])]}})}),x=tt({queries:d.facets.map(t=>{let i=p(t.id),o=i&&m(i)?S(i,n[i.name]):void 0,s=[...new Set([...y(t.id),...a.facets[t.id]??[]])];return{queryKey:r.labels(`facet-title:${e.name}.${t.id}`,s.join(`,`)),enabled:o!==void 0&&s.length>0,queryFn:async()=>[...await Ve(c,i,o,s)]}})}),C=(e,t)=>{let r=p(e);return(x[t]?.data??[]).map(([e,t])=>[e,s(r,n[r.name],t,e)])},w=Ar(d.facets.map(e=>({id:e.id,target:e.combobox?p(e.id):void 0})),n,s),T=d.ranges??[],E=tt({queries:T.map(t=>{let n=dt(d,xt(a,t.id,void 0),o),s=_t(i,t.id)?jr:1;return{queryKey:r.histogram(e.name,t.id,s,n),queryFn:()=>l.histogram(e.name,t.id,{filter:n,buckets:s})}})});return{facets:d.facets.map((t,n)=>{if(t.flags){let e=e=>{let n=v(t.id,e);return n&&{count:n.find(e=>String(e.value)===`true`)?.count??0}},n=t.options.map(({value:t})=>({value:t,label:f(t),...e(t)})),r=t.options.some(({value:e})=>_(t.id,e)?.isError);return{...t,options:n,...r&&{failed:r}}}let r=e.fields[t.id],a=(v(t.id,t.id)??[]).flatMap(e=>e.label===void 0?[]:[[String(e.value),e.label]]),o=r?.type===`enum`?(r.enumValues??[]).map(e=>[e,be(e,i?.fields[t.id]?.valueLabels)]):[],s=new Map([...o,...a,...b[n]?.data??[],...C(t.id,n)]),c=(v(t.id,t.id)??[]).flatMap(e=>e.value===null?[]:[{value:String(e.value),label:s.get(String(e.value))??String(e.value),count:e.count}]),l=w[n],u=_(t.id,t.id)?.isError;return{...t,label:f(t.id),...u&&{failed:u},options:l.matches?Dr(l.matches,c):c,...s.size>0&&{labels:Object.fromEntries(s)},...l.onSearch&&{onSearch:l.onSearch}}}),ranges:T.flatMap((e,t)=>{let n=E[t];if(n?.isError)return[{...e,label:f(e.id),min:0,max:0,step:1,histogram:[],format:ht(i,e.id),failed:!0}];let r=n?.data;return!r||r.min===null||r.max===null?[]:[{...e,label:f(e.id),min:Math.floor(r.min),max:Math.ceil(r.max),step:Math.max(1,Math.round((r.max-r.min)/100)),histogram:_t(i,e.id)?r.buckets.map(e=>e.count):[],format:ht(i,e.id)}]}),...d.dateField&&{datePresets:d.datePresets??!0,dateField:d.dateField,dateKind:d.dateKind,...d.dateSecondary&&{dateSecondary:!0}},toggles:d.toggles?.map(e=>({...e,label:f(e.id)}))}},Nr=w(()=>Xe(()=>import(`./import-dialog-DThTUXFS.js`).then(e=>e.ImportDialog),__vite__mapDeps([0,1,2,3,4,5,6]))),Pr=w(()=>Xe(()=>import(`./import-table-dialog-C-XIx1Dd.js`).then(e=>e.ImportTableDialog),__vite__mapDeps([7,1,2,3,4,5,6]))),Fr=({model:e})=>{let{resources:t,views:n}=he(),r=Be(e.name),i=Be(wr),[a,o]=(0,Z.useState)(!1),s=n[e.name]?.import;return s===!1||!d(r,`create`)||s===`table`&&!d(i,`create`)?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(G,{onClick:()=>o(!0),"aria-haspopup":`dialog`,children:[(0,X.jsx)(De,{className:`size-3.5`}),mr(s===`table`?`fromFile`:`import`)]}),a&&s===`table`&&(0,X.jsx)(Pr,{tables:e,resources:t,views:n,onClose:()=>o(!1)}),a&&s!==`table`&&(0,X.jsx)(Nr,{model:e,resources:t,views:n,canUpdate:d(r,`update`),onClose:()=>o(!1)})]})},Ir=()=>{let e=new Worker(new URL(`/assets/export-worker-CNhkzttC.js`,``+import.meta.url),{type:`module`,name:`protobase-export`}),t=[];return e.onmessage=e=>t.shift()?.resolve(e.data.bytes),e.onerror=e=>{e.preventDefault();let n=Error(Q(`couldNotBuild`,{message:e.message}));for(let e of t.splice(0))e.reject(n)},{send:n=>new Promise((r,i)=>{t.push({resolve:r,reject:i}),e.postMessage(n)}),close:()=>e.terminate()}},Lr={xlsx:{mime:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,extension:`.xlsx`,description:`workbook`},csv:{mime:`text/csv`,extension:`.csv`,description:`csvFile`}},Rr=/[\\/:*?"<>|\u0000-\u001f]/g,zr=(e,t,n=new Date)=>{let r=[n.getFullYear(),String(n.getMonth()+1).padStart(2,`0`),String(n.getDate()).padStart(2,`0`)].join(`-`);return`${e.replace(Rr,` `).trim()} ${r}${Lr[t].extension}`},Br=8e6,Vr=(e,t)=>{let n=new Blob([],{type:Lr[t].mime}),r=[],i=0,a=()=>{n=new Blob([n,...r],{type:Lr[t].mime}),r=[],i=0};return{write:async e=>{e.length!==0&&(r.push(e),i+=e.length,i>=Br&&a())},close:async()=>{a();let t=URL.createObjectURL(n),r=document.createElement(`a`);r.href=t,r.download=e,r.click(),setTimeout(()=>URL.revokeObjectURL(t),6e4)},abort:async()=>{r=[],n=new Blob([])}}},Hr=()=>globalThis.showSaveFilePicker,Ur=()=>typeof Hr()==`function`,Wr=async(e,t)=>{let n=Hr();if(!n)throw Error(`This browser cannot save a file as it is built`);let r=Lr[t],i;try{i=await n({suggestedName:e,types:[{description:Q(r.description),accept:{[r.mime]:[r.extension]}}]})}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;throw e}let a=await i.createWritable();return{write:async e=>{e.length>0&&await a.write(e)},close:()=>a.close(),abort:()=>a.abort()}},Gr=w(()=>Xe(()=>import(`./export-dialog-BerhgfFO.js`).then(e=>e.ExportDialog),__vite__mapDeps([8,1,2,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21]))),Kr=w(()=>Xe(()=>import(`./export-dialog-BerhgfFO.js`).then(e=>e.ExportProgressDialog),__vite__mapDeps([8,1,2,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21]))),qr=(e,t)=>Ur()?Wr(e,t):Promise.resolve(Vr(e,t)),Jr=(e,t)=>{let n=t[e.primaryKey[0]];return typeof n==`object`&&n&&`id`in n?n.id:n},Yr=({model:e,view:t,resources:n,views:i,plural:a,filter:o,orderBy:s,createPort:c=Ir,createSink:l=qr})=>{let u=z(),d=C(),[f,p]=(0,Z.useState)({kind:`closed`}),m=(0,Z.useRef)(void 0),h=(0,Z.useRef)(void 0),g=et({queryKey:r.exportCount(e.name,o),enabled:f.kind===`settings`,queryFn:async()=>{let t=await u.list(e.name,{filter:o||void 0,pageSize:1,count:`exact`,fields:e.primaryKey});return t.totalSize===void 0?{kind:`estimate`,rows:t.totalSizeEstimate}:{kind:`exact`,rows:t.totalSize}}}).data??{kind:`counting`},_=(e,t=h.current)=>{let n=h.current;n&&n===t&&(h.current=void 0,n.settle(e?[]:n.rows))},v=(t=[])=>(_(!1),p({kind:`settings`,selected:dr(e)?t.map(t=>Jr(e,t)):[]}),new Promise(e=>{h.current={rows:t,settle:e}})),y=()=>{p({kind:`closed`}),_(!1)},b=async(r,f)=>{let v=zr(a,r.format),y=await l(v,r.format);if(!y)return;let b=h.current,x=ur(t,r.format),S=r.scope===`selected`?f.length:pr(g),C=S===void 0?void 0:Math.min(S,x),w=new AbortController;m.current=w,p({kind:`running`,done:0,total:C});try{let l=await Qn({client:u,resource:e.name,filters:r.scope===`selected`?fr(e,f):[o],orderBy:s,plan:{format:r.format,mode:r.mode,name:a,columns:lr(e,t,r.columns)},labels:r.mode===`shown`?M(n,i,e,r.columns):{},limit:x,port:c(),sink:y,signal:w.signal,onProgress:e=>w.signal.aborted||p({kind:`running`,done:e,total:C})});d.show({state:`success`,title:Q(`exported`,{count:D(l.rows),plural:a}),description:l.truncated?Q(`truncated`,{name:v,count:D(l.rows)}):v}),_(!0,b)}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;if(!P(e))throw e;d.show({state:`error`,title:Q(`couldNotExport`,{plural:a}),description:e.message})}finally{m.current=void 0,p(e=>e.kind===`running`?{kind:`closed`}:e),_(!1,b)}},x=()=>{m.current?.abort(),y()},S=or(e),w=cr(e,t,S);return{open:v,dialogs:f.kind===`settings`?(0,X.jsx)(Gr,{plural:a,view:t,fields:S.map(e=>({name:e,label:w[e]})),initialColumns:sr(e,t),count:g,selected:f.selected.length>0?f.selected.length:void 0,open:!0,onExport:e=>void b(e,f.selected),onClose:y}):f.kind===`running`?(0,X.jsx)(Kr,{plural:a,done:f.done,total:f.total,onCancel:x}):null}},Xr=({state:e,onClearSearch:t,onClearFilters:n,create:r})=>(0,X.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-8 text-center text-muted-foreground`,children:[(0,X.jsx)(`p`,{children:e.message}),(e.clearSearch||e.clearFilters||e.create&&r)&&(0,X.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[e.clearSearch&&(0,X.jsx)(G,{onClick:t,children:Y(`clearSearch`)}),e.clearFilters&&(0,X.jsx)(G,{onClick:n,children:Y(`clearFilters`)}),e.create&&r]})]}),Zr=({plural:e,search:t,filtered:n,scoped:r,canCreate:i})=>t?{message:Y(`noMatchSearch`,{plural:e,search:t}),clearSearch:!0,clearFilters:n,create:!1}:n?{message:Y(`noMatchFilters`,{plural:e}),clearSearch:!1,clearFilters:!0,create:!1}:r?{message:Y(`noMatch`,{plural:e}),clearSearch:!1,clearFilters:!1,create:!1}:{message:Y(`noneYet`,{plural:e}),clearSearch:!1,clearFilters:!1,create:i},Qr=(e,t)=>{},$r=({windowMs:e=1e3,comebacks:t=2,onHold:n=Qr}={})=>{let r,i=[],a;return(o,s)=>{if(a?.among.has(o))return a.value;if(a&&(a=void 0,i=[]),o===r||(r=o,i=i.filter(t=>s-t.at<=e),i.push({value:o,at:s,comeback:i.some(e=>e.value===o)}),i.filter(e=>e.comeback).length<t))return o;let c=new Set(i.slice(-2*t).map(e=>e.value));return a={value:Math.min(...c),among:c},n(a.value,[...c]),a.value}},ei=e=>Math.max(1,Math.floor((e+12)/252)),ti=(e,t)=>Math.max(0,(e-(t-1)*12)/t),ni=(e,t,n,r)=>({start:e*n,end:Math.max(0,Math.min(r,(t+1)*n)-1)}),ri=(e,t,n)=>{let r=e/t.rowHeight;return t.columns===n.columns?r*n.rowHeight:Math.floor(Math.floor(r)*t.columns/n.columns)*n.rowHeight},ii=(e,t)=>{let n=e/t.rowHeight;return Math.floor(n)*t.columns+n%1},ai=(e,t)=>Math.floor(Math.floor(e)/t)+e%1,oi=8,si=(e,t,n)=>{let r=e.get(t);if(r!==void 0&&r>=n)return e;let i=new Map(e);i.delete(t),i.set(t,n);for(let e of i.keys()){if(i.size<=oi)break;i.delete(e)}return i},ci=({source:e,label:t,initialIndex:n,onScrollIndex:r,minHeight:i,children:a})=>{let{total:o}=e,[s]=(0,Z.useState)(n),[c,l]=(0,Z.useState)(0),u=ei(c),d=ti(c,u),[f,p]=(0,Z.useState)(()=>new Map),m=Math.ceil(Math.max(i(d),f.get(d)??0)),h=m+12,g={columns:u,rowHeight:h},_=(0,Z.useRef)({layout:g,top:0}),v=_.current.top>0&&(_.current.layout.columns!==u||_.current.layout.rowHeight!==h),y=e=>v?ri(_.current.top,_.current.layout,g):e,b=d>0&&f.has(d),x=rt({total:Math.ceil(o/u),rowHeight:h,initialIndex:ai(s,u),settle:y,ready:b,onScroll:e=>r(ii(e,g))});(0,Z.useLayoutEffect)(()=>{v&&x.scrollTo(x.top),_.current={layout:g,top:x.started()?x.top:0}});let S=ni(x.first,x.last,u,o),C=$t({total:o,rowAt:e.rowAt,loadRows:e.loadRows,cachedRows:e.cachedRows,revision:e.revision,latencyMs:0},S.start,S.end),[w]=(0,Z.useState)(()=>$r());(0,Z.useLayoutEffect)(()=>{let e=x.ref.current;if(!e)return;let t=()=>l(w(e.clientWidth,performance.now())),n=new ResizeObserver(t);return n.observe(e),t(),()=>n.disconnect()},[w]);let T=(0,Z.useRef)(d);T.current=d;let[E]=(0,Z.useState)(()=>new ResizeObserver(e=>{let t=Math.max(...e.map(e=>e.borderBoxSize[0]?.blockSize??e.contentRect.height)),n=T.current;p(e=>si(e,n,t))}));(0,Z.useLayoutEffect)(()=>()=>E.disconnect(),[E]),(0,Z.useLayoutEffect)(()=>{let e=x.ref.current;if(b||d===0||!e)return;let t=[...e.querySelectorAll(`:scope > li[aria-posinset]`)];if(t.length===0)return;let n=Math.max(...t.map(e=>e.getBoundingClientRect().height));p(e=>si(e,d,n))});let D=(0,Z.useCallback)(e=>{if(e)return E.observe(e),()=>E.unobserve(e)},[E]);return(0,X.jsx)(`ul`,{ref:x.ref,className:`relative min-w-0 flex-auto`,"aria-label":t,style:{height:x.geometry.contentHeight},children:x.rows.flatMap(({index:e,offset:t})=>Array.from({length:u},(n,r)=>{let i=e*u+r;if(i>=o)return[];let s=C(i),c={top:t,left:r*(d+12),width:d,minHeight:m};return s?(0,X.jsx)(`li`,{ref:D,"aria-posinset":i+1,"aria-setsize":o,className:`absolute grid grid-cols-[minmax(0,1fr)]`,style:c,children:a(s)},s.id):(0,X.jsx)(`li`,{"aria-hidden":!0,className:`absolute grid grid-cols-[minmax(0,1fr)]`,style:c,children:(0,X.jsx)(W,{className:`h-full rounded-lg`})},`skeleton-${i}`)}))})},li=`grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-3`,ui=e=>e*.75,di=44,fi=({model:e,view:t,display:n,list:r,empty:i})=>{let a=t?.names?.plural??R(e.name),o=n.card===void 0&&(n.image!==void 0||n.photos!==void 0);return r.isLoading?(0,X.jsx)(`div`,{"aria-busy":!0,className:`min-h-0 flex-1 overflow-hidden ${li}`,children:Array.from({length:6},(e,t)=>(0,X.jsx)(W,{className:`h-24`},t))}):r.error?(0,X.jsx)(Ee,{title:L(`couldNotLoadRows`),error:r.error}):!r.source||r.source.total===0?i??(0,X.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:L(`noneMatch`,{plural:a.toLowerCase()})}):(0,X.jsx)(ci,{source:r.source,label:a,initialIndex:r.initialIndex,onScrollIndex:r.onScrollIndex,minHeight:e=>(o?ui(e):0)+di,children:r=>(0,X.jsx)(Ht,{model:e,view:t,display:n,row:b(e,r)})})},pi=`protobase:list-places`,mi=50,hi=(e,t)=>`${e} ${t}`,gi=e=>{if(typeof e!=`object`||!e)return!1;let{entry:t,url:n,place:r}=e;return typeof t==`string`&&typeof n==`string`&&typeof r==`number`&&Number.isFinite(r)&&r>=0},_i=e=>ke(()=>{let t=e.getItem(pi);if(t===null)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(gi):[]},[]),vi=e=>{let t=new Map(_i(e).map(e=>[hi(e.entry,e.url),e]));return{placeOf:(e,n)=>{let r=t.get(hi(e,n));return r?r.place:[...t.values()].findLast(e=>e.url===n)?.place??0},save:(e,n,r)=>{let i=hi(e,n);t.delete(i),t.set(i,{entry:e,url:n,place:r});for(let e of[...t.keys()].slice(0,Math.max(0,t.size-mi)))t.delete(e)},persist:()=>ke(()=>e.setItem(pi,JSON.stringify([...t.values()])),void 0)}},yi={getItem:()=>null,setItem:()=>{}},bi,xi=()=>bi??=vi(ke(()=>window.sessionStorage,void 0)??yi),Si=()=>{let{entry:e,path:t,params:n}=Le(),r=`${t}?${n.toString()}`,i=xi();(0,Z.useEffect)(()=>{let e=()=>i.persist(),t=()=>document.visibilityState===`hidden`&&i.persist();return window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,t),i.persist()}},[i]);let a=(0,Z.useCallback)(t=>i.save(e,r,t),[i,e,r]);return{initialIndex:i.placeOf(e,r),remember:a}},Ci=e=>e.reduce((e,t)=>e+t.count,0),wi=e=>{let t=Math.floor(e.length/2),n=Ci(e.slice(0,t)),r=Ci(e.slice(e.length-t));return n===0?0:(r-n)/n*100},Ti=Se(`activity-chart`),Ei=({title:e,defaultGranularity:t=`day`,data:n,granularity:r,onGranularityChange:i,periodLabel:a,state:o,className:s})=>{let[c,l]=(0,Z.useState)(t),d=r??c,f=i??l,p=wi(n),m=n.map(({at:e,count:t})=>({at:e,value:t,count:t}));return(0,X.jsxs)(`section`,{className:v(`rounded-lg border bg-background px-4 pb-2 pt-3`,s),children:[(0,X.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,X.jsx)(`h2`,{className:`font-semibold`,children:e}),o===void 0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`font-semibold tabular-nums`,children:D(Ci(n))}),(0,X.jsxs)(`span`,{className:v(`text-xs font-medium tabular-nums`,p>=0?`text-success-text`:`text-danger-text`),children:[p>=0?`+`:`−`,Math.abs(p).toFixed(1),`%`]})]}),(0,X.jsx)(`span`,{className:`hidden text-xs text-muted-foreground sm:inline`,children:a??`last ${d===`day`?`30 days`:`12 weeks`}`})]}),(0,X.jsx)(u,{value:d,onChange:f,options:[{value:`day`,label:Ti(`day`)},{value:`week`,label:Ti(`week`)}]})]}),(0,X.jsxs)(`div`,{className:`mt-2`,children:[o===`failed`&&(0,X.jsx)(`p`,{className:`py-6 text-danger-text`,children:Ti(`couldNotLoad`)}),o===`loading`&&(0,X.jsx)(W,{className:`h-24 w-full`}),o===void 0&&(0,X.jsx)(Rt,{points:m,measure:{kind:`count`},bucket:d,type:`bar`,compact:!0})]})]})},Di={"7d":`last 7 days`,"30d":`last 30 days`,"90d":`last 90 days`,"1y":`last year`,all:`all time`},Oi=({resource:e,chart:t,title:n,filter:r})=>{let[i,a]=(0,Z.useState)(t.granularity===`week`?`week`:`day`),o=i===`week`?`90d`:t.range,s=O(e,{field:t.field,range:o,granularity:i,filter:r,timeZone:ve()}),c=s.data?.points.map(e=>({at:Date.parse(`${e.bucket}Z`),count:e.count}))??[];return(0,X.jsx)(Ei,{title:n,data:c,granularity:i,onGranularityChange:a,periodLabel:i===`week`?`last 12 weeks`:Di[o],state:s.isError?`failed`:s.isPending?`loading`:void 0})},ki=(e,t,n)=>{let r=e.sum??e.average;if(r===void 0)return n;let i=t?.fields[r]?.label??R(r);return e.sum===void 0?B(`average`,{label:i}):`${i}`},Ai=({model:e,view:t,chart:n,plural:r,filter:i})=>{let a=t?.fields[n.groupBy]?.label??R(n.groupBy);return(0,X.jsxs)(`section`,{className:`rounded-lg border bg-background px-4 pb-3 pt-3`,"aria-label":`${ki(n,t,r)} by ${a.toLowerCase()}`,children:[(0,X.jsxs)(`h2`,{className:`mb-2 font-semibold`,children:[ki(n,t,r),` by `,a.toLowerCase()]}),(0,X.jsx)(At,{model:e,view:t,groupBy:n.groupBy,type:n.type,sum:n.sum,average:n.average,limit:n.limit,filter:i})]})},ji=({value:e,onCommit:t,placeholder:n,className:r})=>{let[i,o]=(0,Z.useState)(e);return(0,Z.useEffect)(()=>o(e),[e]),(0,Z.useEffect)(()=>{if(i===e)return;let n=setTimeout(()=>t(i),350);return()=>clearTimeout(n)},[i,e,t]),(0,X.jsx)(a,{wrapperClassName:v(`min-w-0 flex-1 sm:w-72 sm:flex-initial`,r),leading:(0,X.jsx)(K,{className:`size-4`}),placeholder:n,"aria-label":Y(`search`),value:i,onChange:e=>o(e.target.value),onKeyDown:e=>e.key===`Enter`&&t(i)})},Mi=(e,t,n,r,i)=>{let a=n?.list?.relatedColumns??[];if(a.length===0)return e;let o=new Map(e.map(e=>[e.id,e]));return He(t,n).flatMap(e=>{let t=o.get(e);if(t)return[t];let n=a.find(t=>t.name===e),s=n&&r[n.resource];if(!n||!s)return[];let c=n.label??R(n.name);return[{id:n.name,header:c,kind:`text`,width:160,minWidth:f(c,!1),sortable:!1,render:e=>(0,X.jsx)(bt,{column:n,records:e[n.name]??[],target:s,view:i[s.name],Card:Ht})}]})},Ni=({model:e,view:t,target:n,children:r})=>{let i=gt(e.name,t.listOf,!0),a=t.names?.plural??R(e.name),o=e=>(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[(0,X.jsx)(Qt,{title:a,subtitle:t.help}),e]});if(i.error)return o((0,X.jsx)(Ee,{title:ot(`couldNotLoadYour`,{plural:a.toLowerCase()}),error:i.error}));if(!i.data)return o((0,X.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-3`,children:Array.from({length:3},(e,t)=>(0,X.jsx)(W,{className:`h-24`},t))}));let s=Pt(n,i.data);return s?r(s):o((0,X.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:ot(`noneYet`,{plural:a.toLowerCase()})}))},Pi=({title:e,chips:t,label:n,required:r,initial:i=``,busy:o,onSave:s,onClose:c})=>{let l=(0,Z.useId)(),[u,d]=(0,Z.useState)(i),f=`${l}-form`;return(0,X.jsx)(x,{open:!0,title:e,onClose:c,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(G,{onClick:c,children:J(`cancel`)}),(0,X.jsx)(G,{type:`submit`,form:f,variant:`primary`,loading:o,children:J(`save`)})]}),children:(0,X.jsxs)(`form`,{id:f,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),s(u.trim()===``?null:u.trim())},children:[t.length>0&&(0,X.jsx)(Tt,{chips:t}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,X.jsx)(`label`,{htmlFor:l,className:`font-medium`,children:n}),!r&&(0,X.jsx)(`span`,{id:`${l}-hint`,className:`text-xs text-muted-foreground`,children:J(`optional`)})]}),(0,X.jsx)(a,{id:l,value:u,required:r,pattern:r?`.*\\S.*`:void 0,"aria-describedby":r?void 0:`${l}-hint`,autoFocus:!0,autoComplete:`off`,onChange:e=>d(e.target.value)})]})]})})},$=pe(),Fi={start:0,end:0},Ii=(e,t)=>$.and(t,{kind:`present`,field:e.field,span:Fi}),Li=e=>{switch(e.kind){case`and`:case`or`:return{...e,args:e.args.map(Li)};case`not`:return Ri(e.arg);case`search`:case`present`:case`isNull`:case`related`:return e;default:return Ii(e,e)}},Ri=e=>{switch(e.kind){case`and`:return $.or(...e.args.map(Ri));case`or`:return $.and(...e.args.map(Ri));case`not`:return Li(e.arg);case`search`:case`present`:case`isNull`:case`related`:return $.not(e);default:return Ii(e,$.not(e))}},zi=e=>{let t=ze(e);if(!t.ok)throw Error(`The filter cannot be read: ${t.errors.map(e=>e.message).join(`; `)}`);return t.ast},Bi=e=>e.kind===`and`||e.kind===`or`?e.args.some(Bi):e.kind===`not`?Bi(e.arg):e.kind===`related`,Vi=(e,t)=>![zi(e),zi(t)].some(e=>e&&Bi(e)),Hi=(e,t)=>{let n=zi(e);if(!n)return null;let r=zi(t),i=$.not(Li(n));return ne(r?$.and(r,i):i)},Ui=(e,t)=>Hi(t,e),Wi=e=>e.key.startsWith(`extra:`)?`extra:${e.label}`:e.key,Gi=(e,t)=>{let n=new Map(e.map(e=>[Wi(e),e])),r=new Map(t.map(e=>[Wi(e),e])),i=e.filter(e=>!r.has(Wi(e))).map(e=>({kind:`removed`,label:e.label})),a=t.flatMap(e=>{let t=n.get(Wi(e));return t&&t.label!==e.label?[{kind:`changed`,label:e.label,before:t.label}]:[]}),o=t.filter(e=>!n.has(Wi(e))).map(e=>({kind:`added`,label:e.label}));return[...i,...a,...o]},Ki=(e,t,n,r)=>{let i=e-t;if(i===0)return J(`asMany`,{plural:r});let a=Math.abs(i)===1?n:r;return i>0?J(`more`,{count:i,noun:a}):J(`fewer`,{count:-i,noun:a})},qi=12,Ji={added:{word:`added`,className:`text-success-text`},removed:{word:`removed`,className:`text-danger-text`},changed:{word:`changed`,className:`text-primary-text`}},Yi=({changes:e})=>(0,X.jsx)(`ul`,{"aria-label":J(`filterChanges`),className:`divide-y rounded-md border`,children:e.map(e=>(0,X.jsxs)(`li`,{className:`grid grid-cols-[72px_1fr] gap-3 px-3 py-2`,children:[(0,X.jsx)(`span`,{className:`font-medium ${Ji[e.kind].className}`,children:J(Ji[e.kind].word)}),e.kind===`changed`?(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`text-muted-foreground line-through`,children:e.before}),` `,(0,X.jsx)(`span`,{className:`font-medium`,children:e.label})]}):(0,X.jsx)(`span`,{className:e.kind===`removed`?`text-muted-foreground line-through`:`font-medium`,children:e.label})]},`${e.kind}:${e.label}`))}),Xi=(e,t)=>{let n=et({...Ce(z(),e,t??``),enabled:t!==null});return t===null?0:n.data},Zi=(e,t,n)=>`${e} ${e===1?t:n}`,Qi=({model:e,view:t,title:n,filter:r,total:i,plural:a})=>{let o=t?.list?.displays?.find(e=>e.kind===`cards`);return(0,X.jsxs)(`section`,{"aria-label":n,className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`h3`,{className:`font-semibold`,children:[n,` `,(0,X.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,i??`…`,`)`]})]}),i!==void 0&&i>qi&&(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:J(`firstOf`,{limit:qi,total:i})}),r===null||i===0?(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:J(`noPlural`,{plural:a})}):(0,X.jsx)(It,{model:e,view:t,filter:r,sort:ge(e,t),limit:qi,display:o?.name??`table`,row:!0,link:!1,empty:`No ${a}.`})]})},$i=({model:e,view:t,before:n,after:r})=>{let i=(0,Z.useMemo)(()=>Hi(n,r),[n,r]),a=(0,Z.useMemo)(()=>Ui(n,r),[n,r]),o=Xi(e,i),s=Xi(e,a),c=(t?.names?.singular??R(e.name)).toLowerCase(),l=(t?.names?.plural??R(e.name)).toLowerCase();return(0,X.jsxs)(X.Fragment,{children:[o!==void 0&&s!==void 0?(0,X.jsxs)(`p`,{children:[(0,X.jsx)(`span`,{className:`font-semibold`,children:Ki(o,s,c,l)}),(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[`: `,J(`addedRemoved`,{added:Zi(o,c,l),removed:s})]})]}):(0,X.jsx)(W,{className:`h-4 w-48`}),(0,X.jsx)(Qi,{model:e,view:t,title:J(`added`),filter:i,total:o,plural:l}),(0,X.jsx)(Qi,{model:e,view:t,title:J(`removed`),filter:a,total:s,plural:l})]})},ea=({model:e,view:t,title:n,before:r,after:i,saveNewLabel:a,updating:o,creating:s,onUpdate:c,onSaveNew:l,onCancel:u})=>{let d=Gi(it(e,r),it(e,i));return(0,X.jsx)(x,{open:!0,wide:!0,title:n,onClose:u,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(G,{onClick:u,children:J(`cancel`)}),(0,X.jsx)(G,{loading:s,disabled:o,onClick:l,children:a}),(0,X.jsx)(G,{variant:`primary`,loading:o,disabled:s,onClick:c,children:J(`update`)})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[d.length>0&&(0,X.jsx)(Yi,{changes:d}),Vi(r,i)?(0,X.jsx)($i,{model:e,view:t,before:r,after:i}):(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:J(`noRecordsDiff`)})]})})},ta=()=>{let{address:e,set:t}=c();return{key:e?.kind===`list`?e.savedSearch:void 0,open:e=>t({savedSearch:e})}},na=e=>e instanceof Error?e.message:J(`somethingWrong`),ra=(e,t)=>{let n=he(),r=z(),i=C(),a=_e(),{href:o,open:s}=c(),l=ta(),{resource:u}=e,f=n.resources[u],p=n.views[u]?.searchesOf,m=n.permissions[u],h=f!==void 0&&p!==void 0&&m!==void 0&&d(m,`create`)&&d(m,`delete`),g=n.signIn?.[u]?.signIn,_=Et(u,h),v=e=>Te(We(f,e)),y=p&&_.data?.find(e=>e[p.filter]===t),b=y||l.key===void 0||!m||!d(m,`update`)?void 0:_.data?.find(e=>v(e)===l.key),x=n.views[u]?.names,S=x?.plural??`saved searches`,w=p?.name===void 0?void 0:f?.fields[p.name],T=$e({mutationFn:e=>r.create(u,{[p.filter]:t,...p.name&&{[p.name]:e}}),onSuccess:e=>{l.open(v(e.record)),i.show({state:`success`,title:J(`searchSaved`),action:{label:J(`openPlural`,{plural:S}),href:o({kind:`list`,resource:u}),onNavigate:s}})},onError:e=>i.show({state:`error`,title:J(`couldNotSave`),description:na(e)}),onSettled:()=>a(u)}),E=$e({mutationFn:e=>r.remove(u,v(e)),onError:e=>i.show({state:`error`,title:J(`couldNotTakeOff`),description:na(e)}),onSettled:()=>a(u)}),D=$e({mutationFn:e=>r.update(u,v(e),{[p.filter]:t},e.etag??`*`),onSuccess:()=>i.show({state:`success`,title:J(`searchUpdated`)}),onError:e=>i.show({state:`error`,title:J(`couldNotUpdate`),description:na(e)}),onSettled:()=>a(u)}),O=T.isPending||E.isPending||D.isPending;return{mode:h?`save`:g?`sign-in`:void 0,prompt:g,saved:y!==void 0,opened:b&&{filter:String(b[p.filter]??``),name:p.name&&typeof b[p.name]==`string`&&b[p.name]!==``?String(b[p.name]):void 0},noun:(x?.singular??R(u)).toLowerCase(),naming:w&&{label:n.views[u]?.fields[w.name]?.label??R(w.name),required:!w.nullable},ready:_.data!==void 0&&!O,updating:D.isPending,creating:T.isPending,remove:()=>y&&E.mutate(y),saveNew:(e,t)=>T.mutate(e,t),update:e=>b&&D.mutate(b,e)}},ia=({model:e,view:t,search:n,filter:r,chips:i,className:a})=>{let o=ra(n,r),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)();if(!o.mode)return null;let p=n.label??J(`saveSearch`);if(o.mode===`sign-in`)return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(G,{className:a,"aria-haspopup":`dialog`,onClick:()=>c(!0),children:[(0,X.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),p]}),(0,X.jsx)(T,{as:`dialog`,prompt:o.prompt,open:s,onClose:()=>c(!1)})]});let m=e=>{u(!1),o.naming?f(e):o.saveNew(null)},h=d!==void 0&&o.naming&&(0,X.jsx)(Pi,{title:d,chips:i,label:o.naming.label,required:o.naming.required,busy:o.creating,onSave:e=>o.saveNew(e,{onSuccess:()=>f(void 0)}),onClose:()=>f(void 0)}),g=o.opened;if(g){let n=J(`saveAsNew`,{noun:o.noun});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(G,{className:a,"aria-haspopup":`dialog`,"aria-disabled":!o.ready,onClick:()=>o.ready&&u(!0),children:[(0,X.jsx)(vn,{className:`size-3.5`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`max-w-60 truncate`,children:J(`updateName`,{name:g.name??o.noun})})]}),(0,X.jsxs)(G,{className:a,"aria-haspopup":o.naming?`dialog`:void 0,"aria-disabled":!o.ready,onClick:()=>o.ready&&m(n),children:[(0,X.jsx)(mn,{className:`size-3.5`,"aria-hidden":!0}),n]}),l&&(0,X.jsx)(ea,{model:e,view:t,title:g.name?J(`updateNameQuestion`,{name:g.name}):J(`updateNounQuestion`,{noun:o.noun}),before:g.filter,after:r,saveNewLabel:n,updating:o.updating,creating:o.creating,onUpdate:()=>o.update({onSuccess:()=>u(!1)}),onSaveNew:()=>m(n),onCancel:()=>u(!1)}),h]})}let _=o.saved?fn:A;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(G,{className:a,"aria-pressed":o.saved,"aria-haspopup":!o.saved&&o.naming?`dialog`:void 0,"aria-disabled":!o.ready,onClick:()=>o.ready&&(o.saved?o.remove():m(p)),children:[(0,X.jsx)(_,{className:o.saved?`size-3.5 text-primary`:`size-3.5`,"aria-hidden":!0}),p]}),h]})},aa=e=>e instanceof Error?e.message:J(`somethingWrong`),oa=({model:e,view:t,name:n,value:r,onChange:i})=>{let a=(0,Z.useId)(),o=e.fields[n],s=t.fields[n],c=s?.label??R(n);if(o?.type===`boolean`)return(0,X.jsx)(E,{checked:r===!0,onChange:i,label:c});if(o?.type!==`enum`)throw Error(`Not implemented: "${n}" is ${o?.type??`unknown`}, and a saved search's controls are enums or booleans`);return(0,X.jsxs)(`label`,{htmlFor:a,className:`flex items-center gap-2 text-muted-foreground`,children:[c,(0,X.jsx)(`select`,{id:a,value:String(r??``),onChange:e=>i(e.target.value),className:`h-8 rounded-md border border-border-strong bg-background px-2 text-foreground shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20`,children:(o.enumValues??[]).map(e=>(0,X.jsx)(`option`,{value:e,children:be(e,s?.valueLabels)},e))})]})},sa=(e,t,n)=>Object.entries(n).map(([n,r])=>`${t.fields[n]?.label??R(n)}: ${e.fields[n]?.type===`boolean`?J(r===!0?`on`:`off`):be(String(r),t.fields[n]?.valueLabels)}`).join(`, `),ca=({model:e,view:t,recordKey:n,title:r,row:i,fields:a})=>{let o=z(),s=C(),c=_e(),l=$e({mutationFn:t=>o.update(e.name,n,t,i.etag??`*`),onSuccess:(n,i)=>s.show({state:`success`,title:J(`saved`,{title:r}),description:sa(e,t,i)}),onError:e=>s.show({state:`error`,title:J(`couldNotChange`),description:aa(e)}),onSettled:()=>c(e.name)});return(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-3`,children:a.map(n=>(0,X.jsx)(oa,{model:e,view:t,name:n,value:l.isPending&&n in(l.variables??{})?l.variables[n]:i[n],onChange:e=>l.mutate({[n]:e})},n))})},la=e=>e instanceof Error?e.message:J(`somethingWrong`),ua=({model:e,view:t,of:n,target:r,targetView:i,row:a,recordKey:o,canRename:s,onDelete:c})=>{let l=z(),u=C(),d=_e(),[f,p]=(0,Z.useState)(!1),{name:m,chips:h,title:g,body:_}=Wt({model:e,of:n,target:r,targetView:i,row:a,recordKey:o}),v=$e({mutationFn:t=>l.update(e.name,o,{[n.name]:t},a.etag??`*`),onSuccess:()=>p(!1),onError:e=>u.show({state:`error`,title:J(`couldNotRename`),description:la(e)}),onSettled:()=>d(e.name)}),y=n.name===void 0?void 0:e.fields[n.name];return(0,X.jsxs)(`section`,{"aria-label":g,className:`flex flex-col gap-3 rounded-lg border bg-surface p-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:(0,X.jsx)(Ye,{to:{kind:`record`,resource:e.name,key:o},className:`hover:underline`,children:m??(0,X.jsx)(wt,{chips:h})})})}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n.controls&&(0,X.jsx)(ca,{model:e,view:t,recordKey:o,title:g,row:a,fields:n.controls}),s&&y&&(0,X.jsx)(G,{variant:`ghost`,"aria-label":J(`renameTitle`,{title:g}),"aria-haspopup":`dialog`,onClick:()=>p(!0),children:(0,X.jsx)(Kt,{className:`size-3.5`,"aria-hidden":!0})}),c&&(0,X.jsx)(G,{variant:`ghost`,"aria-label":J(`deleteTitle`,{title:g}),onClick:()=>c(g),children:(0,X.jsx)(Zt,{className:`size-3.5`,"aria-hidden":!0})})]})]}),f&&y&&(0,X.jsx)(Pi,{title:J(`renameTitle`,{title:g}),chips:h,label:t.fields[y.name]?.label??R(y.name),required:!y.nullable,initial:m,busy:v.isPending,onSave:e=>v.mutate(e),onClose:()=>p(!1)}),(0,X.jsx)(Ut,{..._})]})},da=({model:e,view:t})=>{let{resources:n,views:r}=he(),i=t.searchesOf,a=n[i.resource],o=r[i.resource],s=Et(e.name,!0),c=Be(e.name),l=qt({model:e,view:t}),u=t.names?.plural??R(e.name),f=e=>(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[l.dialogs,(0,X.jsx)(Qt,{title:u,subtitle:t.help}),e]});if(!a)return f((0,X.jsx)(V,{title:J(`notFound`),children:J.rich(`noResource`,{resource:i.resource})}));if(s.error)return f((0,X.jsx)(Ee,{title:J(`couldNotLoadYour`,{plural:u.toLowerCase()}),error:s.error}));if(!s.data)return f((0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:Array.from({length:2},(e,t)=>(0,X.jsx)(W,{className:`h-56`},t))}));if(s.data.length===0){let e=(o?.names?.plural??R(a.name)).toLowerCase();return f((0,X.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:J.rich(`noSavedYet`,{plural:u.toLowerCase(),list:(0,X.jsx)(Ye,{to:{kind:`list`,resource:a.name},className:`font-medium text-primary-text hover:underline`,children:e})})}))}return f((0,X.jsx)(`div`,{className:`flex flex-col gap-4`,children:s.data.map(n=>{let r=Te(We(e,n)),s=d(c,`delete`)?e=>void l.start({key:r,title:e,etag:n.etag,snapshot:n}):void 0;return(0,X.jsx)(ua,{model:e,view:t,of:i,target:a,targetView:o,row:n,recordKey:r,canRename:d(c,`update`),onDelete:s},r)})}))},fa=({field:e,hints:t,resource:n,stored:r,onSave:i,close:a})=>{let[o,s]=(0,Z.useState)(()=>k(e,r)),c=(0,Z.useRef)(null),u=(0,Z.useRef)(!1),d=!t?.widget&&(e.type===`boolean`||e.type===`enum`);(0,Z.useEffect)(()=>{c.current?.querySelector(`input, select, textarea, button, [tabindex]`)?.focus()},[]);let f=(t,n,s=o)=>{u.current||(u.current=!0,t&&l(e,s,r)&&i(H(e,s)),a(n))};return(0,X.jsx)(`div`,{ref:c,className:`w-full min-w-0`,onKeyDown:e=>{ie(e.target)||(e.key===`Enter`?(e.preventDefault(),f(!0)):e.key===`Tab`?(e.preventDefault(),f(!0,e.shiftKey?-1:1)):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),f(!1)))},onBlur:e=>{!c.current?.contains(e.relatedTarget)&&!ie(e.relatedTarget)&&f(!0)},children:(0,X.jsx)(F,{field:e,hints:t,value:o,stored:r,resource:n,onChange:e=>{s(e),d&&f(!0,void 0,e)}})})},pa=Se(`app/list-edit`),ma=e=>{let t=z(),n=Qe(),i=C(),[a,o]=(0,Z.useState)(new Map),s=(0,Z.useRef)(a),c=(0,Z.useRef)(new Map),l=(e,t)=>{s.current=new Map(s.current).set(e,{...s.current.get(e),...t}),o(s.current)},u=async(a,o,c)=>{let u=We(e,a),d=String(s.current.get(a.id)?.etag??a.etag);try{let i=await t.update(e.name,u,{[o]:c},d);l(a.id,{[o]:i.record[o],etag:i.etag}),n.setQueryData(r.record(e.name,Te(u)),i),n.invalidateQueries({queryKey:[`page`,e.name]}),n.invalidateQueries({queryKey:[`list`,e.name]}),n.invalidateQueries({queryKey:[`map`,e.name]}),n.invalidateQueries({queryKey:[`count`,e.name]})}catch(n){if(!P(n))throw l(a.id,{[o]:a[o]}),n;let r=n.status===412,s=r?await t.get(e.name,u):void 0;l(a.id,s?{[o]:s.record[o],etag:s.etag}:{[o]:a[o]});let c=n.errors.find(e=>e.field===o)?.message??n.message;i.show({state:`error`,title:pa(r?`changedBySomeoneElse`:`couldNotSave`),description:c})}};return{patches:a,save:(e,t,n)=>{l(e.id,{[t]:n});let r=(c.current.get(e.id)??Promise.resolve()).then(()=>u(e,t,n));return c.current.set(e.id,r.catch(()=>void 0)),r}}},ha=(e,t,n)=>{let r=ma(e),i=t?.list?.editable??[];return{editor:i.length>0&&d(n,`update`)?{editable:(t,n)=>i.includes(n)&&e.fields[n]!==void 0&&le(e.fields[n])&&Ne(t,`update`),render:(n,i,a)=>(0,X.jsx)(fa,{field:e.fields[i],hints:t?.fields[i],resource:e.name,stored:n[i],onSave:e=>void r.save(n,i,e),close:a})}:void 0,patches:r.patches}},ga=pe(),_a=e=>e.find(e=>e.kind===`search`),va=({address:e})=>{let{resources:t,views:n,signIn:r}=he(),i=t[e.resource],a=r?.[e.resource];if(!i)return a?(0,X.jsx)(T,{as:`page`,prompt:a.signIn}):(0,X.jsx)(V,{title:B(`notFound`),children:B(`noResource`,{name:e.resource})});let o=Ge(n[e.resource],e.list);if(e.list!==void 0&&!o)return(0,X.jsx)(V,{title:B(`notFound`),children:Y(`noList`,{name:e.list})});if(o?.searchesOf)return(0,X.jsx)(da,{model:i,view:o});let s=fe(t,n,e.resource,e.list);if(o&&s.listOf){let t=s.model;return(0,X.jsx)(Ni,{model:i,view:o,target:t,children:n=>(0,X.jsx)(ya,{model:t,address:e,scope:n,heading:{title:o.names?.plural??R(i.name),subtitle:o.help}})})}return(0,X.jsx)(ya,{model:i,address:e})},ya=({model:e,address:t,scope:n,heading:r})=>{let a=he(),{set:l,listTo:u,go:f,href:m}=c(),g=e.name,_=Ge(a.views[g],t.list),v=(0,Z.useMemo)(()=>ct(_,e),[_,e]),{fields:x}=ee(),S=(0,Z.useMemo)(()=>Mi(p(je(we(e,_),e,_,x),e,a.resources,a.views),e,_,a.resources,a.views),[e,_,x,a.resources,a.views]),C=t.filter,w=(0,Z.useMemo)(()=>pt(v,C),[v,C]),T=w.ok?w.state:Gt,E=w.ok?w.extras:[],{orderBy:D,filterLayout:O}=t,k=y(),te=de(),[ne,re]=(0,Z.useState)(!1),ie=n?[...E,n]:E,le=o(),fe=Mr({model:e,resources:a.resources,views:a.views,view:_,state:T,extras:ie,titleOf:le}),A=n?dt(v,T,ie):w.ok?C:``,j=(0,Z.useMemo)(()=>xe(e,_,S.map(e=>e.id)),[e,_,S]),pe=(0,Z.useMemo)(()=>st(_,a.resources,a.views,j),[_,a.resources,a.views,j]),M=en({resources:a.resources,views:a.views,model:e,columns:j,filter:A,orderBy:D,related:pe}),N=me(e,_,t.display),P=Be(g),F=n?void 0:rn(e,P),[ge,_e]=(0,Z.useState)(!1),I=ge&&F!==void 0,ve=!N&&!I&&nn(_,F,D,A),be=I||N?.kind!==`map`;s(be);let Se=an(e,M.page,M.key,N?.kind===`custom`),L=Si(),Ce=Ue(e,_),z=e=>({key:e.id,title:String(typeof e[Ce]==`object`?e[Ce].name:e[Ce]??e.id),etag:typeof e.etag==`string`?e.etag:void 0,snapshot:e}),Te=_?.names?.singular??R(g),De=ha(e,_,P),{state:B}=ce(),Oe=Yt(e),V=qt({model:e,view:_,restore:Oe,onReview:e=>f({kind:`record`,resource:g,key:e.key})}),ke=Mt(e),Me=_?.actions.some(e=>e.run?.kind===`delete`)??!1,H=(e,t=E)=>l({filter:dt(v,e,t)}),Pe=_a(E),Ie=e=>{let t=E.filter(e=>e.kind!==`search`);H(T,e?[...t,ga.search(e)]:t)},U=_?.names?.plural??R(g),Le=N?.kind===`calendar`||N?.kind===`timeline`||N?.kind===`board`&&Fe(e)?void 0:N,Re=Le&&(0,X.jsx)(Dt,{model:e,view:_,display:Le,orderBy:D,onChange:e=>l({orderBy:e})}),ze=e.search?.length?(0,X.jsx)(ji,{value:Pe?.kind===`search`?Pe.text:``,onCommit:Ie,placeholder:Y(`searchPlural`,{plural:U}),className:k?void 0:`min-h-11`}):null,Ve=(0,X.jsx)(Xn,{layout:O,config:fe,value:T,onChange:H,leading:O===`bar`?Re:void 0,trailing:ze}),W=O===`bar`?Ve:(0,X.jsx)(Jn,{groups:[Re?[Re]:[]],trailing:ze}),K=yt(fe,T),qe=(0,X.jsx)(On,{scroll:!0,chips:K,onRemove:e=>H(ut(T,e)),onClear:()=>H(Gt)}),Je=Le&&(0,X.jsx)(Fn,{title:Y(`sort`),children:(0,X.jsx)(Dt,{model:e,view:_,display:Le,orderBy:D,onChange:e=>l({orderBy:e}),className:`min-h-11 w-full`})}),Xe=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(G,{className:`min-h-11`,onClick:()=>re(!0),"aria-haspopup":`dialog`,children:[(0,X.jsx)(bn,{className:`size-3.5`}),K.length>0?Y(`filtersCount`,{count:K.length}):Y(`filters`)]}),ze??(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:qe})]}),ze&&qe,(0,X.jsx)(se,{title:Y(`filters`),open:ne,onClose:()=>re(!1),children:(0,X.jsx)(Xn,{layout:`panel`,fullWidth:!0,config:fe,value:T,onChange:H,leading:Je})})]}),Ze=!n&&h(_,a.pages,P)&&(0,X.jsxs)(Ye,{to:{kind:`create`,resource:g},className:ye({variant:`primary`}),children:[(0,X.jsx)(oe,{className:`size-3.5`}),Y(`newRecord`,{singular:Te})]}),Qe=_?.saveSearch&&!n&&w.ok&&C&&(0,X.jsx)(ia,{model:e,view:_,search:_.saveSearch,filter:C,chips:mt(e,_,C,Nt(fe))}),$e=!n&&(0,X.jsx)(Fr,{model:e}),et=Yr({model:e,view:_,resources:a.resources,views:a.views,plural:U,filter:A,orderBy:D}),tt=ar(_)&&(0,X.jsxs)(G,{onClick:()=>et.open(),...!k&&{"aria-label":Y(`export`),title:Y(`export`)},children:[(0,X.jsx)(Ae,{className:`size-3.5`}),k&&Y(`export`)]}),rt=F&&!ve&&(0,X.jsx)(Xt,{sorting:I,onChange:_e,iconOnly:!k}),it=t=>!I&&(0,X.jsx)(Bt,{view:_,choices:i(e,_,te),value:N?.name??`table`,onChange:e=>l({display:e}),menu:t}),at=tn(e),ot=t=>{at(b(e,t).record),f({kind:`record`,resource:g,key:We(e,t)})},lt=async e=>{let t=e.map(z),n=await V.startBulk(t);return e.filter((e,r)=>n.includes(t[r]))},q=M.source?(0,X.jsx)(vt,{columns:S,source:M.source,sort:Ke(D),onSortChange:e=>l({orderBy:ae(e)}),onOpenRow:ot,rowLink:t=>({href:m({kind:`record`,resource:g,key:We(e,t)}),onFollow:()=>ot(t)}),cellEditor:De.editor,rowPatches:De.patches,initialScrollIndex:L.initialIndex,onScrollIndex:L.remember,rowActions:[{label:Y(`openRecord`,{singular:Te}),onSelect:ot},...ke.rowActions,...d(P,`delete`)&&!Me?[{label:Y(`delete`),destructive:!0,available:e=>Ne(e,`delete`),onSelect:e=>void V.start(z(e))}]:[]],bulkActions:[...ar(_)&&dr(e)?[{label:e=>Y(`exportCount`,{count:e}),onRun:e=>et.open(e)}]:[],...ke.bulkActions,...d(P,`delete`)?[{label:e=>Y(`deleteCount`,{count:e}),destructive:!0,onRun:e=>lt(e)}]:[]],rowNumbers:!1,pinKey:B.kind===`signed-in`?Ot(B.user.id,ue(g,t.list)):void 0,scroll:`parent`,className:`flex-1`}):(0,X.jsx)(`div`,{"aria-busy":!0,className:`flex-1 rounded-lg border bg-surface`}),ft={...M,initialIndex:L.initialIndex,onScrollIndex:L.remember},ht=Zr({plural:U,search:Pe?.kind===`search`?Pe.text:``,filtered:K.length>0,scoped:!!n||E.some(e=>e.kind!==`search`),canCreate:!!Ze}),gt=(0,X.jsx)(Xr,{state:ht,onClearSearch:()=>Ie(``),onClearFilters:()=>H(Gt),create:Ze}),_t=I?(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:Y(`dragToSort`)}),(0,X.jsx)(Jt,{model:e,view:_,field:F,filter:``,columns:He(e,_)})]}):ve?(0,X.jsx)(Jt,{model:e,view:_,field:F,filter:``,columns:He(e,_),sort:{value:Ke(D),onChange:e=>l({orderBy:ae(e)})}}):N?N.kind===`cards`?(0,X.jsx)(fi,{model:e,view:_,display:N,list:ft,empty:gt},M.key.join(` `)):N.kind===`map`?(0,X.jsx)(jt,{model:e,view:_,display:N,filter:A,orderBy:D,fields:j,at:t.map,onMove:e=>l({map:e}),flush:!0}):N.kind===`board`?(0,X.jsx)(kt,{model:e,view:_,display:N,fields:j,filter:A,orderBy:D}):N.kind===`calendar`?(0,X.jsx)(Lt,{model:e,view:_,display:N,fields:j,filter:A,at:t.calendar,linkTo:e=>u({calendar:e})}):N.kind===`timeline`?(0,X.jsx)(Ft,{model:e,view:_,display:N,fields:j,filter:A,at:t.timeline,linkTo:e=>u({timeline:e})}):(0,X.jsx)(Vt,{display:N,list:Se}):M.source?.total===0&&!M.error?gt:q;return(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[V.dialogs,et.dialogs,ke.prompt,(0,X.jsx)(Qt,{title:r?.title??U,subtitle:r?r.subtitle:_?.help,subtitleBelow:!0,actions:(0,X.jsxs)(X.Fragment,{children:[it(!k),rt,Qe,$e,tt,Ze]})}),!w.ok&&(0,X.jsx)(Ee,{title:Y(`unreadableFilter`),error:Error(w.errors.map(e=>e.message).join(`; `))}),M.error&&!N&&!I&&(0,X.jsx)(Ee,{title:Y(`couldNotLoadRows`),error:M.error}),_?.chart&&!I&&(nt(_.chart)?(0,X.jsx)(Ai,{model:e,view:_,chart:_.chart,plural:U,filter:A}):(0,X.jsx)(Oi,{resource:g,chart:_.chart,title:Y(`created`,{plural:U}),filter:A})),!I&&(k?W:Xe),k&&O===`panel`&&!I?(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-4`,children:[(0,X.jsx)(`div`,{className:be?`sticky top-[calc(var(--pb-sticky-top,0px)+1rem)] flex max-h-[calc(100dvh-var(--pb-sticky-top,0px)-var(--pb-sticky-bottom,0px)-2rem)] shrink-0 self-start`:`flex shrink-0`,children:Ve}),_t]}):_t]})};export{va as ListPage,xr as a,_r as c,mr as d,pr as f,un as h,Sr as i,hr as l,Q as m,wr as n,vr as o,ur as p,Cr as r,br as s,Er as t,gr as u};
4
+ //# debugId=f79c8130-19fc-402f-b473-932adaaee41f
@@ -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{Co as r,Wc as i,el as a,iu as o}from"./app-CK_M0TgA.js";import{i as s,n as c,r as l,t as u}from"./lib-maplibre-gl-CFGgq6sa.js";import{n as d,o as f,t as p}from"./lib-vis.gl-react-maplibre-1cv426UN.js";import{t as m}from"./lib-pmtiles-G7iEFxNu.js";var h={name:`map-pin`,size:24,node:[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]};h.node;var g=i(h),_=e(t(),1),v=`protobase:map-layer`,y=(e,t)=>e.find(e=>e.id===t),b=e=>o(()=>e.getItem(v),null),x=(e,t)=>o(()=>t===void 0?e.removeItem(v):e.setItem(v,t),void 0),S=a(`app/map`),C=e(n(),1),w=``,T=({layers:e,below:t})=>{let[n,i]=(0,_.useState)(()=>b(localStorage)),{current:a}=f();if(!e||e.length===0)return null;let o=y(e,n),s=e=>{let t=e===w?void 0:e;x(localStorage,t),i(t??null)},c=t&&a?.getLayer(t)?t:void 0;return(0,C.jsxs)(C.Fragment,{children:[o&&(0,C.jsx)(d,{id:`map-layer-${o.id}`,type:`raster`,tiles:[o.tiles],tileSize:256,attribution:o.attribution,maxzoom:o.maxzoom??22,...o.bounds&&{bounds:o.bounds},children:(0,C.jsx)(p,{id:`map-layer-${o.id}`,type:`raster`,...c&&{beforeId:c}})},o.id),(0,C.jsx)(`div`,{className:`absolute left-2.5 top-2.5 z-10 rounded-md shadow`,children:(0,C.jsx)(r,{label:S(`mapLayer`),value:o?.id??w,onChange:s,options:[{value:w,label:S(`map`)},...e.map(e=>({value:e.id,label:e.label}))]})})]})};l(u),c(`pmtiles`,new m().tile);var E=s;export{T as n,g as r,E as t};
2
- //# debugId=7a9f0375-519f-44d6-9d81-508cb8dbc986
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{Co as r,Wc as i,el as a,iu as o}from"./app-B8KcM2Z-.js";import{i as s,n as c,r as l,t as u}from"./lib-maplibre-gl-CFGgq6sa.js";import{n as d,o as f,t as p}from"./lib-vis.gl-react-maplibre-1cv426UN.js";import{t as m}from"./lib-pmtiles-G7iEFxNu.js";var h={name:`map-pin`,size:24,node:[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]};h.node;var g=i(h),_=e(t(),1),v=`protobase:map-layer`,y=(e,t)=>e.find(e=>e.id===t),b=e=>o(()=>e.getItem(v),null),x=(e,t)=>o(()=>t===void 0?e.removeItem(v):e.setItem(v,t),void 0),S=a(`app/map`),C=e(n(),1),w=``,T=({layers:e,below:t})=>{let[n,i]=(0,_.useState)(()=>b(localStorage)),{current:a}=f();if(!e||e.length===0)return null;let o=y(e,n),s=e=>{let t=e===w?void 0:e;x(localStorage,t),i(t??null)},c=t&&a?.getLayer(t)?t:void 0;return(0,C.jsxs)(C.Fragment,{children:[o&&(0,C.jsx)(d,{id:`map-layer-${o.id}`,type:`raster`,tiles:[o.tiles],tileSize:256,attribution:o.attribution,maxzoom:o.maxzoom??22,...o.bounds&&{bounds:o.bounds},children:(0,C.jsx)(p,{id:`map-layer-${o.id}`,type:`raster`,...c&&{beforeId:c}})},o.id),(0,C.jsx)(`div`,{className:`absolute left-2.5 top-2.5 z-10 rounded-md shadow`,children:(0,C.jsx)(r,{label:S(`mapLayer`),value:o?.id??w,onChange:s,options:[{value:w,label:S(`map`)},...e.map(e=>({value:e.id,label:e.label}))]})})]})};l(u),c(`pmtiles`,new m().tile);var E=s;export{T as n,g as r,E as t};
2
+ //# debugId=3919c573-b547-493d-883b-73285459f9a8
@@ -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{Gc as r,L as i}from"./app-CK_M0TgA.js";import{t as a}from"./lib-dompurify-Dr60P-Rn.js";import{t as o}from"./lib-marked-Bg9_sE-m.js";import{a as s,i as c,n as l,o as u,r as d,t as f}from"./safe-html-CmkqDcA6.js";var p=e(t(),1),m=(e,t)=>t===0?e:Math.min(6,Math.max(t+1,e+t-1)),h=({inLink:e=!1})=>new o({gfm:!0,breaks:!0,renderer:{html:({text:e,block:t})=>t?`<p>${f(e)}</p>`:f(e),link({href:t,title:n,tokens:r}){let i=this.parser.parseInline(r),a=e?null:s(t,d);return a===null?i:c(a,n,i)},image({href:t,title:n,text:r}){let i=e?null:s(t,l);return i===null?f(r):`<img src="${f(i)}" alt="${f(r)}"${u(n)} loading="lazy">`}}}),g={inLink:h({inLink:!0}),page:h({})},_=(e,{inLink:t=!1,headingsUnder:n=0}={})=>{let r=t?g.inLink:g.page,i=r.lexer(e);return r.walkTokens(i,e=>{e.type===`heading`&&(e.depth=m(e.depth,n))}),r.parser(i)},v=e(n(),1),y=r(`break-words [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,`[&_p]:my-2 [&_ul]:my-2 [&_ol]:my-2 [&_pre]:my-2 [&_blockquote]:my-2 [&_table]:my-2 [&_hr]:my-3`,`[&_h1]:mt-4 [&_h1]:mb-2 [&_h1]:text-lg [&_h1]:font-semibold [&_h2]:mt-4 [&_h2]:mb-2 [&_h2]:text-base [&_h2]:font-semibold`,`[&_h3]:mt-3 [&_h3]:mb-1 [&_h3]:font-semibold [&_h4]:mt-3 [&_h4]:mb-1 [&_h4]:font-semibold [&_h5]:font-semibold [&_h6]:font-semibold`,`[&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5 [&_li:has(>input)]:list-none [&_li>input]:mr-1.5 [&_li>input]:-ml-5 [&_li>input]:align-middle`,`[&_a]:text-primary-text [&_a]:underline [&_a]:underline-offset-2 hover:[&_a]:text-primary-hover`,`[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.9em]`,`[&_pre]:whitespace-pre-wrap [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre_code]:bg-transparent [&_pre_code]:p-0`,`[&_blockquote]:border-l-2 [&_blockquote]:border-border-strong [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground`,`[&_table]:w-full [&_table]:border-collapse [&_th]:border [&_th]:border-border [&_th]:bg-surface [&_th]:px-2 [&_th]:py-1 [&_th]:text-left [&_th]:font-semibold`,`[&_td]:border [&_td]:border-border [&_td]:px-2 [&_td]:py-1 [&_td]:[overflow-wrap:anywhere]`,`[&_hr]:border-border [&_img]:inline [&_img]:max-w-full [&_img]:rounded [&_del]:text-muted-foreground`),b=r(`[&_*]:my-0 [&_h1]:font-semibold [&_h2]:font-semibold [&_h3]:font-semibold [&_ul]:list-inside [&_ol]:list-inside [&_pre]:whitespace-pre-wrap [&_code]:font-mono [&_code]:text-[0.9em]`),x=({source:e,inLink:t=!1,className:n})=>{let o=i(),s=(0,p.useMemo)(()=>a.sanitize(_(e,{inLink:t,headingsUnder:o}),{ADD_ATTR:[`target`]}),[e,t,o]);return(0,v.jsx)(`div`,{className:r(t?b:y,n),dangerouslySetInnerHTML:{__html:s}})};export{x as MarkdownContent};
2
- //# debugId=bcb0ba29-5898-4c6e-896e-b460cc5264c9
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{Gc as r,L as i}from"./app-B8KcM2Z-.js";import{t as a}from"./lib-dompurify-Dr60P-Rn.js";import{t as o}from"./lib-marked-Bg9_sE-m.js";import{a as s,i as c,n as l,o as u,r as d,t as f}from"./safe-html-CmkqDcA6.js";var p=e(t(),1),m=(e,t)=>t===0?e:Math.min(6,Math.max(t+1,e+t-1)),h=({inLink:e=!1})=>new o({gfm:!0,breaks:!0,renderer:{html:({text:e,block:t})=>t?`<p>${f(e)}</p>`:f(e),link({href:t,title:n,tokens:r}){let i=this.parser.parseInline(r),a=e?null:s(t,d);return a===null?i:c(a,n,i)},image({href:t,title:n,text:r}){let i=e?null:s(t,l);return i===null?f(r):`<img src="${f(i)}" alt="${f(r)}"${u(n)} loading="lazy">`}}}),g={inLink:h({inLink:!0}),page:h({})},_=(e,{inLink:t=!1,headingsUnder:n=0}={})=>{let r=t?g.inLink:g.page,i=r.lexer(e);return r.walkTokens(i,e=>{e.type===`heading`&&(e.depth=m(e.depth,n))}),r.parser(i)},v=e(n(),1),y=r(`break-words [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,`[&_p]:my-2 [&_ul]:my-2 [&_ol]:my-2 [&_pre]:my-2 [&_blockquote]:my-2 [&_table]:my-2 [&_hr]:my-3`,`[&_h1]:mt-4 [&_h1]:mb-2 [&_h1]:text-lg [&_h1]:font-semibold [&_h2]:mt-4 [&_h2]:mb-2 [&_h2]:text-base [&_h2]:font-semibold`,`[&_h3]:mt-3 [&_h3]:mb-1 [&_h3]:font-semibold [&_h4]:mt-3 [&_h4]:mb-1 [&_h4]:font-semibold [&_h5]:font-semibold [&_h6]:font-semibold`,`[&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5 [&_li:has(>input)]:list-none [&_li>input]:mr-1.5 [&_li>input]:-ml-5 [&_li>input]:align-middle`,`[&_a]:text-primary-text [&_a]:underline [&_a]:underline-offset-2 hover:[&_a]:text-primary-hover`,`[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.9em]`,`[&_pre]:whitespace-pre-wrap [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre_code]:bg-transparent [&_pre_code]:p-0`,`[&_blockquote]:border-l-2 [&_blockquote]:border-border-strong [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground`,`[&_table]:w-full [&_table]:border-collapse [&_th]:border [&_th]:border-border [&_th]:bg-surface [&_th]:px-2 [&_th]:py-1 [&_th]:text-left [&_th]:font-semibold`,`[&_td]:border [&_td]:border-border [&_td]:px-2 [&_td]:py-1 [&_td]:[overflow-wrap:anywhere]`,`[&_hr]:border-border [&_img]:inline [&_img]:max-w-full [&_img]:rounded [&_del]:text-muted-foreground`),b=r(`[&_*]:my-0 [&_h1]:font-semibold [&_h2]:font-semibold [&_h3]:font-semibold [&_ul]:list-inside [&_ol]:list-inside [&_pre]:whitespace-pre-wrap [&_code]:font-mono [&_code]:text-[0.9em]`),x=({source:e,inLink:t=!1,className:n})=>{let o=i(),s=(0,p.useMemo)(()=>a.sanitize(_(e,{inLink:t,headingsUnder:o}),{ADD_ATTR:[`target`]}),[e,t,o]);return(0,v.jsx)(`div`,{className:r(t?b:y,n),dangerouslySetInnerHTML:{__html:s}})};export{x as MarkdownContent};
2
+ //# debugId=d59a0fe4-c776-460b-8fa8-49b9905faed1
@@ -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{$c as r,Fa as i,Qa as a,Qo as o,Ss as s,Ts as c,Ya as l,Zo as u,eo as d,fc as f,ja as p,ns as m,ro as h,uc as g,yo as _}from"./app-CK_M0TgA.js";import{o as v}from"./vendor-t7Q7QbPu.js";import{t as y}from"./page-header-Ddz2r5ic.js";import{n as b,t as x}from"./person-row-YwRtkzbb.js";var S=e(t(),1),C=e(n(),1),w=e=>e?.role===`owner`?[`owner`,`admin`,`member`]:[`admin`,`member`],T=({member:e,current:t,status:n,presence:r,onChanged:i})=>{let{session:o,organizations:c}=s(),u=p(),f=t.organization.id,{busy:m,error:v,run:y}=l(),S=c?.roles??[],T=e.id===t.memberId,E=w(t),D=e.role===`owner`&&t.role!==`owner`,O=S.filter(e=>e.membership);return(0,C.jsx)(x,{name:e.name,email:e.email,self:T,error:v,...(n||r)&&{status:(0,C.jsx)(_,{status:n,presence:r})},actions:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`select`,{"aria-label":u(`roleOf`,{name:e.name}),value:e.role,disabled:m||D,onChange:t=>void y(async()=>{await o.organizations.setRole(f,e.id,t.target.value),i()}),className:`h-7 rounded-md border border-border-strong bg-background px-2 text-body`,children:(D?[e.role]:E).map(e=>(0,C.jsx)(`option`,{value:e,children:d(e)},e))}),!T&&(0,C.jsx)(g,{size:`sm`,variant:`danger`,loading:m,disabled:D,onClick:()=>void y(async()=>{await o.organizations.removeMember(f,e.id),i()}),children:h(`remove`)})]}),children:(0,C.jsx)(b,{roles:O,selected:e.appRoles,grantable:a(S,t),disabled:m,onChange:t=>void y(async()=>{await o.organizations.setAppRoles(e.id,t),i()})})})},E=({current:e,statuses:t,presence:n})=>{let{session:a}=s(),l=p(),d=e?.organization?.id,g=v({queryKey:r.organizationMembers(d??``),queryFn:()=>a.organizations.members(d),enabled:!!d,retry:!1}),_=g.data,b=g.error?g.error instanceof c?m(g.error):h(`couldNotReadMembers`):void 0,{refetch:x}=g,w=(0,S.useCallback)(()=>void x(),[x]);return e?.organization?(0,C.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6`,children:[(0,C.jsx)(y,{title:h(`members`),subtitle:h(`whoWorks`,{organization:e.organization.name})}),(0,C.jsxs)(u,{title:h(`members`),description:l(`membersDescription`),children:[(0,C.jsx)(o,{message:b}),_?(0,C.jsx)(`ul`,{className:`divide-y rounded-md border`,children:_.map(r=>(0,C.jsx)(T,{member:r,current:e,status:t?.find(e=>e.userId===r.userId),presence:i(n,r.userId),onChanged:w},`${r.id}/${r.role}/${r.appRoles.join()}`))}):!b&&(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,C.jsx)(f,{}),` `,h(`loading`)]})]})]}):null};export{E as MembersPage,w as assignableOrganizationRoles};
2
- //# debugId=a004e6e8-6501-450f-b7fc-58067a91298b
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,Fa as i,Qa as a,Qo as o,Ss as s,Ts as c,Ya as l,Zo as u,eo as d,fc as f,ja as p,ns as m,ro as h,uc as g,yo as _}from"./app-B8KcM2Z-.js";import{o as v}from"./vendor-t7Q7QbPu.js";import{t as y}from"./page-header-Ddz2r5ic.js";import{n as b,t as x}from"./person-row-CgvcHRmL.js";var S=e(t(),1),C=e(n(),1),w=e=>e?.role===`owner`?[`owner`,`admin`,`member`]:[`admin`,`member`],T=({member:e,current:t,status:n,presence:r,onChanged:i})=>{let{session:o,organizations:c}=s(),u=p(),f=t.organization.id,{busy:m,error:v,run:y}=l(),S=c?.roles??[],T=e.id===t.memberId,E=w(t),D=e.role===`owner`&&t.role!==`owner`,O=S.filter(e=>e.membership);return(0,C.jsx)(x,{name:e.name,email:e.email,self:T,error:v,...(n||r)&&{status:(0,C.jsx)(_,{status:n,presence:r})},actions:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`select`,{"aria-label":u(`roleOf`,{name:e.name}),value:e.role,disabled:m||D,onChange:t=>void y(async()=>{await o.organizations.setRole(f,e.id,t.target.value),i()}),className:`h-7 rounded-md border border-border-strong bg-background px-2 text-body`,children:(D?[e.role]:E).map(e=>(0,C.jsx)(`option`,{value:e,children:d(e)},e))}),!T&&(0,C.jsx)(g,{size:`sm`,variant:`danger`,loading:m,disabled:D,onClick:()=>void y(async()=>{await o.organizations.removeMember(f,e.id),i()}),children:h(`remove`)})]}),children:(0,C.jsx)(b,{roles:O,selected:e.appRoles,grantable:a(S,t),disabled:m,onChange:t=>void y(async()=>{await o.organizations.setAppRoles(e.id,t),i()})})})},E=({current:e,statuses:t,presence:n})=>{let{session:a}=s(),l=p(),d=e?.organization?.id,g=v({queryKey:r.organizationMembers(d??``),queryFn:()=>a.organizations.members(d),enabled:!!d,retry:!1}),_=g.data,b=g.error?g.error instanceof c?m(g.error):h(`couldNotReadMembers`):void 0,{refetch:x}=g,w=(0,S.useCallback)(()=>void x(),[x]);return e?.organization?(0,C.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6`,children:[(0,C.jsx)(y,{title:h(`members`),subtitle:h(`whoWorks`,{organization:e.organization.name})}),(0,C.jsxs)(u,{title:h(`members`),description:l(`membersDescription`),children:[(0,C.jsx)(o,{message:b}),_?(0,C.jsx)(`ul`,{className:`divide-y rounded-md border`,children:_.map(r=>(0,C.jsx)(T,{member:r,current:e,status:t?.find(e=>e.userId===r.userId),presence:i(n,r.userId),onChanged:w},`${r.id}/${r.role}/${r.appRoles.join()}`))}):!b&&(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,C.jsx)(f,{}),` `,h(`loading`)]})]})]}):null};export{E as MembersPage,w as assignableOrganizationRoles};
2
+ //# debugId=e8465f9b-f4a0-4043-9c24-ed021e3f3f6d
@@ -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{Gc as r,Ot as i,kt as a}from"./app-CK_M0TgA.js";import{t as o}from"./lib-dompurify-Dr60P-Rn.js";import{t as s}from"./lib-marked-Bg9_sE-m.js";import{a as c,i as l,r as u,t as d}from"./safe-html-CmkqDcA6.js";var f=e(t(),1),p=/^(?:[a-z][a-z0-9+.-]*:\/\/)?((?:[\p{L}\p{N}-]+\.)+[\p{L}]{2,})(?::\d+)?(?:[/?#]\S*)?$/iu,m=e=>{if(URL.canParse(e))return new URL(e).hostname.toLowerCase()},h=(e,t)=>{let n=p.exec(e.trim())?.[1];if(!n)return!1;let r=m(`http://${n}`);return!r||m(t)!==r},g=/^ {0,3}(`{3,}(?=[^`]*$)|~{3,})/,_=(e,t)=>RegExp(`^ {0,3}${t}[~\`]* *$`).test(e),v=/^ {0,3}>/,y=/^( {0,3})>(?=[^ \t>])/,b=/^ {0,3}([-*+]|\d{1,9}[.)])([ \t]|$)/,x=/^ {0,3}([-_])[ \t]*(\1[ \t]*){2,}$/,S=/^[ \t]/,C=/\r\n?|\n/,w=e=>{let t=[],n,r=!1;for(let i of e.split(C)){if(n){_(i,n)&&(n=void 0),t.push(i);continue}let e=g.exec(i)?.[1];if(e){n=e,r=!1,t.push(i);continue}let a=i.replace(y,`$1\\>`).replace(x,e=>e.replace(/^ */,`$&\\`)),o=a.trim()===``,s=v.test(a)||b.test(a);r&&!o&&!s&&!S.test(a)&&t.push(``),r=s||r&&!o&&S.test(a),t.push(a)}return t.join(`
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{Gc as r,Ot as i,kt as a}from"./app-B8KcM2Z-.js";import{t as o}from"./lib-dompurify-Dr60P-Rn.js";import{t as s}from"./lib-marked-Bg9_sE-m.js";import{a as c,i as l,r as u,t as d}from"./safe-html-CmkqDcA6.js";var f=e(t(),1),p=/^(?:[a-z][a-z0-9+.-]*:\/\/)?((?:[\p{L}\p{N}-]+\.)+[\p{L}]{2,})(?::\d+)?(?:[/?#]\S*)?$/iu,m=e=>{if(URL.canParse(e))return new URL(e).hostname.toLowerCase()},h=(e,t)=>{let n=p.exec(e.trim())?.[1];if(!n)return!1;let r=m(`http://${n}`);return!r||m(t)!==r},g=/^ {0,3}(`{3,}(?=[^`]*$)|~{3,})/,_=(e,t)=>RegExp(`^ {0,3}${t}[~\`]* *$`).test(e),v=/^ {0,3}>/,y=/^( {0,3})>(?=[^ \t>])/,b=/^ {0,3}([-*+]|\d{1,9}[.)])([ \t]|$)/,x=/^ {0,3}([-_])[ \t]*(\1[ \t]*){2,}$/,S=/^[ \t]/,C=/\r\n?|\n/,w=e=>{let t=[],n,r=!1;for(let i of e.split(C)){if(n){_(i,n)&&(n=void 0),t.push(i);continue}let e=g.exec(i)?.[1];if(e){n=e,r=!1,t.push(i);continue}let a=i.replace(y,`$1\\>`).replace(x,e=>e.replace(/^ */,`$&\\`)),o=a.trim()===``,s=v.test(a)||b.test(a);r&&!o&&!s&&!S.test(a)&&t.push(``),r=s||r&&!o&&S.test(a),t.push(a)}return t.join(`
2
2
  `)},T=()=>void 0,E=e=>e.map(e=>`tokens`in e&&e.tokens?E(e.tokens):`text`in e?e.text:``).join(``),D=new s({gfm:!0,breaks:!0,tokenizer:{heading:T,lheading:T,hr:T,table:T,def:T,code:T},renderer:{html:({text:e,block:t})=>t?`<p>${d(e)}</p>`:d(e),link({href:e,title:t,tokens:n,misleading:r}){let i=this.parser.parseInline(n),a=c(e,u);return a===null?i:r?l(a,t,d(e)):l(a,t,i)},image:({raw:e})=>d(e)}}),O=(e,t)=>i(e,t).map(e=>`mention`in e?`<span class="${d(a)}">@${d(e.mention)}</span>`:d(e.text)).join(``),k=(e,t)=>{let n=D.lexer(w(e));return D.walkTokens(n,e=>{e.type===`link`&&(e.misleading=h(E(e.tokens??[]),e.href)),e.type===`strong`&&e.raw.startsWith(`__`)&&Object.assign(e,{type:`text`,text:e.raw,tokens:void 0}),!(e.type!==`text`||e.tokens)&&(e.text=O(e.text,t),e.escaped=!0)}),D.parser(n)},A=e(n(),1),j=r(`break-words [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,`[&_p]:my-2 [&_ul]:my-1 [&_ol]:my-1 [&_pre]:my-1 [&_blockquote]:my-1`,`[&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5 [&_li:has(>input)]:list-none [&_li>input]:mr-1.5 [&_li>input]:-ml-5 [&_li>input]:align-middle`,`[&_a]:text-primary-text [&_a]:underline [&_a]:underline-offset-2 hover:[&_a]:text-primary-hover`,`[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.9em]`,`[&_pre]:whitespace-pre-wrap [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre_code]:bg-transparent [&_pre_code]:p-0`,`[&_blockquote]:border-l-2 [&_blockquote]:border-border-strong [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground [&_del]:text-muted-foreground`),M=({text:e,mentions:t})=>{let n=(0,f.useMemo)(()=>o.sanitize(k(e,t),{ADD_ATTR:[`target`]}),[e,t]);return(0,A.jsx)(`div`,{className:j,dangerouslySetInnerHTML:{__html:n}})};export{M as MessageContent};
3
- //# debugId=64be406d-3eb4-4a79-a8d9-afe6c7173733
3
+ //# debugId=697d3aec-5a1b-4a51-913a-823b64d68666
@@ -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{Da as e,Ql as t,Ys as n,Zl as r,di as i,el as a,gl as o,ll as s,wa as c,xa as l}from"./app-CK_M0TgA.js";var u=(t,n)=>{let r=t.position;if(!r||!e(n,`update`))return;let i=t.fields[r.field];return i&&!i.readOnly?r.field:void 0},d=(e,t)=>e.position?.within===void 0?u(e,t):void 0,f=(e,t,n)=>t.position?.within!==void 0&&e.field===t.position.within&&!e.through&&!e.from&&!e.filter?u(t,n):void 0,p=(e,t,n,r)=>{if(t===void 0||e?.list?.drag?.rank!==!0||r!==``)return!1;let i=l(n);return i.columnId===t&&i.direction===`asc`},m=a(`app/hand-order`),h=(e,t,{title:r,place:a})=>!n(e)||e.status!==412?{state:`error`,title:t,description:i(e)}:r===void 0?{state:`warning`,title:t,description:m(`orderChangedSince`,{place:a})}:{state:`warning`,title:m(`notSaved`,{title:r}),description:m(`orderChangedThere`,{place:a})},g=(e,t,n)=>t.flatMap(({before:t,record:r,etag:i})=>{let a=n.filter(e=>Object.hasOwn(t,e)&&t[e]!==r[e]);return a.length===0?[]:[{op:`update`,resource:e.name,key:c(e,r),data:Object.fromEntries(a.map(e=>[e,t[e]])),etag:i}]}),_=async(e,t,n)=>{let r=[],i=``;do{let a=await e.search(t,{filter:n,pageSize:100,...i&&{pageToken:i}});r.push(...a.items),i=a.nextPageToken}while(i);return r},v=(e,t)=>t===void 0?e:`(${e}) AND (${t})`,y=async(e,n,i,a)=>{let l=n.position?.after;if(!l)return{after:[],before:[]};let u=n.primaryKey[0],d=c(n,a),f=e=>o([e]),p=await _(e,l.resource,v(t(r.or(r.eq(l.field,d),r.eq(l.key,d))),l.filter)),m=(e,t)=>p.flatMap(n=>f(n[e])===f(d)&&f(n[t])!==f(d)?[n[t]]:[]),h=m(l.field,l.key),g=m(l.key,l.field),[y,b]=await Promise.all([_(e,n.name,v(t(r.in(u,[d,...h])),l.while)),g.length===0?[]:_(e,n.name,t(r.in(u,g)))]),x=e=>{let t=o(c(n,e));return{key:t,rank:e[n.position.field],title:s(n,i,e,t)}},S=y.some(e=>f(e[u])===f(d));return{after:y.filter(e=>f(e[u])!==f(d)).map(x),before:S?b.map(x):[]}},b=(e,t,n,r,i,a=!1)=>{let o=t=>r[t]?c(e,r[t]):null,s=a&&i===r.length-1;return{op:`move`,resource:e.name,field:t,key:c(e,r[i]),after:o(i-1),...!s&&{before:o(i+1)},...n&&{filter:n}}},x=(e,t)=>{let n=new Map;for(let r of e)if(r.op===`reorder`||r.op===`move`)for(let e of r.records){let r=t(e.record);n.has(r)||n.set(r,e.previous)}return n},S=a(`app/rank-after`);export{g as a,p as c,y as i,d as l,x as n,h as o,b as r,m as s,S as t,f as u};
2
- //# debugId=aa61357d-f1f4-472a-ac59-3e8e1c22c17d
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{Da as e,Ql as t,Ys as n,Zl as r,di as i,el as a,gl as o,ll as s,wa as c,xa as l}from"./app-B8KcM2Z-.js";var u=(t,n)=>{let r=t.position;if(!r||!e(n,`update`))return;let i=t.fields[r.field];return i&&!i.readOnly?r.field:void 0},d=(e,t)=>e.position?.within===void 0?u(e,t):void 0,f=(e,t,n)=>t.position?.within!==void 0&&e.field===t.position.within&&!e.through&&!e.from&&!e.filter?u(t,n):void 0,p=(e,t,n,r)=>{if(t===void 0||e?.list?.drag?.rank!==!0||r!==``)return!1;let i=l(n);return i.columnId===t&&i.direction===`asc`},m=a(`app/hand-order`),h=(e,t,{title:r,place:a})=>!n(e)||e.status!==412?{state:`error`,title:t,description:i(e)}:r===void 0?{state:`warning`,title:t,description:m(`orderChangedSince`,{place:a})}:{state:`warning`,title:m(`notSaved`,{title:r}),description:m(`orderChangedThere`,{place:a})},g=(e,t,n)=>t.flatMap(({before:t,record:r,etag:i})=>{let a=n.filter(e=>Object.hasOwn(t,e)&&t[e]!==r[e]);return a.length===0?[]:[{op:`update`,resource:e.name,key:c(e,r),data:Object.fromEntries(a.map(e=>[e,t[e]])),etag:i}]}),_=async(e,t,n)=>{let r=[],i=``;do{let a=await e.search(t,{filter:n,pageSize:100,...i&&{pageToken:i}});r.push(...a.items),i=a.nextPageToken}while(i);return r},v=(e,t)=>t===void 0?e:`(${e}) AND (${t})`,y=async(e,n,i,a)=>{let l=n.position?.after;if(!l)return{after:[],before:[]};let u=n.primaryKey[0],d=c(n,a),f=e=>o([e]),p=await _(e,l.resource,v(t(r.or(r.eq(l.field,d),r.eq(l.key,d))),l.filter)),m=(e,t)=>p.flatMap(n=>f(n[e])===f(d)&&f(n[t])!==f(d)?[n[t]]:[]),h=m(l.field,l.key),g=m(l.key,l.field),[y,b]=await Promise.all([_(e,n.name,v(t(r.in(u,[d,...h])),l.while)),g.length===0?[]:_(e,n.name,t(r.in(u,g)))]),x=e=>{let t=o(c(n,e));return{key:t,rank:e[n.position.field],title:s(n,i,e,t)}},S=y.some(e=>f(e[u])===f(d));return{after:y.filter(e=>f(e[u])!==f(d)).map(x),before:S?b.map(x):[]}},b=(e,t,n,r,i,a=!1)=>{let o=t=>r[t]?c(e,r[t]):null,s=a&&i===r.length-1;return{op:`move`,resource:e.name,field:t,key:c(e,r[i]),after:o(i-1),...!s&&{before:o(i+1)},...n&&{filter:n}}},x=(e,t)=>{let n=new Map;for(let r of e)if(r.op===`reorder`||r.op===`move`)for(let e of r.records){let r=t(e.record);n.has(r)||n.set(r,e.previous)}return n},S=a(`app/rank-after`);export{g as a,p as c,y as i,d as l,x as n,h as o,b as r,m as s,S as t,f as u};
2
+ //# debugId=9942f3d4-650a-4a81-b92e-cb81646567cb
@@ -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{$a as r,Aa as i,Ao as a,M as o,Qo as s,Ss as c,Ya as l,Zo as u,cc as d,eo as f,fs as p,ja as m,ro as h,uc as g,us as _}from"./app-CK_M0TgA.js";import{t as v}from"./page-header-Ddz2r5ic.js";var y=e(t(),1),b=e(n(),1),x=({organization:e,editable:t,onSaved:n})=>{let{session:r}=c(),[i,o]=(0,y.useState)(e.name),[d,f]=(0,y.useState)(e.slug),{busy:p,error:m,run:_}=l(),v=i.trim()!==e.name||d!==e.slug;return(0,b.jsxs)(u,{title:h(`details`),description:h(t?`detailsEditable`:`detailsReadOnly`),children:[(0,b.jsx)(s,{message:m}),(0,b.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:t=>{t.preventDefault(),_(async()=>{await r.organizations.rename(e.id,{name:i.trim(),slug:d}),n()})},children:[(0,b.jsx)(a,{"aria-label":h(`name`),value:i,disabled:!t,onChange:e=>o(e.target.value),wrapperClassName:`flex-1`}),(0,b.jsx)(a,{"aria-label":h(`slug`),value:d,disabled:!t,onChange:e=>f(e.target.value),wrapperClassName:`sm:w-48`}),t&&(0,b.jsx)(g,{type:`submit`,variant:`primary`,loading:p,disabled:!v||!i.trim(),children:h(`save`)})]})]})},S=({organization:e,memberId:t})=>{let{session:n}=c(),[r,i]=(0,y.useState)([]),[a,o]=(0,y.useState)(``),{busy:d,error:f,run:p}=l();return(0,y.useEffect)(()=>{n.organizations.members(e.id).then(e=>i(e.filter(e=>e.id!==t)),()=>i([]))},[n,e.id,t]),(0,b.jsxs)(u,{title:h(`handOver`),description:h(`handOverDescription`),children:[(0,b.jsx)(s,{message:f}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,b.jsxs)(`select`,{"aria-label":h(`newOwner`),value:a,onChange:e=>o(e.target.value),className:`h-8 flex-1 rounded-md border border-border-strong bg-background px-2`,children:[(0,b.jsx)(`option`,{value:``,children:h(`chooseMember`)}),r.map(e=>(0,b.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.email,`)`]},e.id))]}),(0,b.jsx)(g,{loading:d,disabled:!a,onClick:()=>void p(async()=>{await n.organizations.transferOwnership(a),window.location.reload()}),children:h(`handOver`)})]})]})},C=({organization:e,basePath:t})=>{let{session:n}=c(),[r,o]=(0,y.useState)(!1),[f,p]=(0,y.useState)(``),{busy:_,error:v,run:x}=l(),S=m(),C=()=>x(async()=>{await n.organizations.remove(e.id),i(t)});return(0,b.jsxs)(u,{title:S(`deleteOrganization`),description:S(`deleteDescription`),children:[(0,b.jsx)(s,{message:r?void 0:v}),(0,b.jsx)(g,{variant:`danger`,onClick:()=>o(!0),children:S(`deleteOrganization`)}),r&&(0,b.jsxs)(d,{title:h(`deleteTitle`,{name:e.name}),description:h(`deleteConfirm`),onClose:()=>o(!1),actions:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(g,{onClick:()=>o(!1),children:h(`cancel`)}),(0,b.jsx)(g,{variant:`danger`,loading:_,disabled:f!==e.name,onClick:()=>void C(),children:h(`delete`)})]}),children:[(0,b.jsx)(s,{message:v}),(0,b.jsx)(a,{"aria-label":S(`organizationName`),value:f,onChange:e=>p(e.target.value)})]})]})},w=({editable:e})=>{let t=p(),[n,r]=(0,y.useState)(),{busy:i,error:a,run:c}=l();return(0,y.useEffect)(()=>{t.callGuests.allowed().then(r)},[t]),n===void 0?null:(0,b.jsxs)(u,{title:h(`guestLinks`),description:h(`guestLinksDescription`),children:[(0,b.jsx)(s,{message:a}),(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,b.jsx)(o,{checked:n,label:h(`guestLinksAllowed`),...e&&!i&&{onChange:e=>void c(async()=>{await t.callGuests.setAllowed(e),r(e)})}}),h(`guestLinksAllowed`)]})]})},T=({organization:e,basePath:t,owner:n})=>{let{session:r}=c(),{busy:a,error:o,run:d}=l();return(0,b.jsxs)(u,{title:h(`leave`),description:h(n?`leaveOwner`:`leaveMember`),children:[(0,b.jsx)(s,{message:o}),(0,b.jsx)(g,{loading:a,onClick:()=>void d(async()=>{await r.organizations.leave(e.id),i(t)}),children:h(`leaveName`,{name:e.name})})]})},E=({current:e,basePath:t,onChanged:n})=>{let i=_().data?.calls===!0,a=m(),o=e?.organization;if(!o)return(0,b.jsx)(`div`,{className:`mx-auto w-full max-w-3xl px-4 py-6 md:px-6`,children:(0,b.jsx)(v,{title:a(`organization`),subtitle:a(`noOrganization`)})});let s=e.role===`owner`;return(0,b.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6`,children:[(0,b.jsx)(v,{title:o.name,subtitle:e.role?h(`youAre`,{role:f(e.role).toLowerCase()}):h(`throughGlobalRoles`)}),(0,b.jsx)(x,{organization:o,editable:r(e),onSaved:n},`${o.name}/${o.slug}`),i&&e.role&&(0,b.jsx)(w,{editable:r(e)}),s&&e.memberId&&(0,b.jsx)(S,{organization:o,memberId:e.memberId}),e.role&&(0,b.jsx)(T,{organization:o,basePath:t,owner:s}),s&&(0,b.jsx)(C,{organization:o,basePath:t})]})};export{E as OrganizationPage};
2
- //# debugId=9406cacd-cd1d-49d8-a6f5-dd9094a0c280
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,Aa as i,Ao as a,M as o,Qo as s,Ss as c,Ya as l,Zo as u,cc as d,eo as f,fs as p,ja as m,ro as h,uc as g,us as _}from"./app-B8KcM2Z-.js";import{t as v}from"./page-header-Ddz2r5ic.js";var y=e(t(),1),b=e(n(),1),x=({organization:e,editable:t,onSaved:n})=>{let{session:r}=c(),[i,o]=(0,y.useState)(e.name),[d,f]=(0,y.useState)(e.slug),{busy:p,error:m,run:_}=l(),v=i.trim()!==e.name||d!==e.slug;return(0,b.jsxs)(u,{title:h(`details`),description:h(t?`detailsEditable`:`detailsReadOnly`),children:[(0,b.jsx)(s,{message:m}),(0,b.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:t=>{t.preventDefault(),_(async()=>{await r.organizations.rename(e.id,{name:i.trim(),slug:d}),n()})},children:[(0,b.jsx)(a,{"aria-label":h(`name`),value:i,disabled:!t,onChange:e=>o(e.target.value),wrapperClassName:`flex-1`}),(0,b.jsx)(a,{"aria-label":h(`slug`),value:d,disabled:!t,onChange:e=>f(e.target.value),wrapperClassName:`sm:w-48`}),t&&(0,b.jsx)(g,{type:`submit`,variant:`primary`,loading:p,disabled:!v||!i.trim(),children:h(`save`)})]})]})},S=({organization:e,memberId:t})=>{let{session:n}=c(),[r,i]=(0,y.useState)([]),[a,o]=(0,y.useState)(``),{busy:d,error:f,run:p}=l();return(0,y.useEffect)(()=>{n.organizations.members(e.id).then(e=>i(e.filter(e=>e.id!==t)),()=>i([]))},[n,e.id,t]),(0,b.jsxs)(u,{title:h(`handOver`),description:h(`handOverDescription`),children:[(0,b.jsx)(s,{message:f}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,b.jsxs)(`select`,{"aria-label":h(`newOwner`),value:a,onChange:e=>o(e.target.value),className:`h-8 flex-1 rounded-md border border-border-strong bg-background px-2`,children:[(0,b.jsx)(`option`,{value:``,children:h(`chooseMember`)}),r.map(e=>(0,b.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.email,`)`]},e.id))]}),(0,b.jsx)(g,{loading:d,disabled:!a,onClick:()=>void p(async()=>{await n.organizations.transferOwnership(a),window.location.reload()}),children:h(`handOver`)})]})]})},C=({organization:e,basePath:t})=>{let{session:n}=c(),[r,o]=(0,y.useState)(!1),[f,p]=(0,y.useState)(``),{busy:_,error:v,run:x}=l(),S=m(),C=()=>x(async()=>{await n.organizations.remove(e.id),i(t)});return(0,b.jsxs)(u,{title:S(`deleteOrganization`),description:S(`deleteDescription`),children:[(0,b.jsx)(s,{message:r?void 0:v}),(0,b.jsx)(g,{variant:`danger`,onClick:()=>o(!0),children:S(`deleteOrganization`)}),r&&(0,b.jsxs)(d,{title:h(`deleteTitle`,{name:e.name}),description:h(`deleteConfirm`),onClose:()=>o(!1),actions:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(g,{onClick:()=>o(!1),children:h(`cancel`)}),(0,b.jsx)(g,{variant:`danger`,loading:_,disabled:f!==e.name,onClick:()=>void C(),children:h(`delete`)})]}),children:[(0,b.jsx)(s,{message:v}),(0,b.jsx)(a,{"aria-label":S(`organizationName`),value:f,onChange:e=>p(e.target.value)})]})]})},w=({editable:e})=>{let t=p(),[n,r]=(0,y.useState)(),{busy:i,error:a,run:c}=l();return(0,y.useEffect)(()=>{t.callGuests.allowed().then(r)},[t]),n===void 0?null:(0,b.jsxs)(u,{title:h(`guestLinks`),description:h(`guestLinksDescription`),children:[(0,b.jsx)(s,{message:a}),(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,b.jsx)(o,{checked:n,label:h(`guestLinksAllowed`),...e&&!i&&{onChange:e=>void c(async()=>{await t.callGuests.setAllowed(e),r(e)})}}),h(`guestLinksAllowed`)]})]})},T=({organization:e,basePath:t,owner:n})=>{let{session:r}=c(),{busy:a,error:o,run:d}=l();return(0,b.jsxs)(u,{title:h(`leave`),description:h(n?`leaveOwner`:`leaveMember`),children:[(0,b.jsx)(s,{message:o}),(0,b.jsx)(g,{loading:a,onClick:()=>void d(async()=>{await r.organizations.leave(e.id),i(t)}),children:h(`leaveName`,{name:e.name})})]})},E=({current:e,basePath:t,onChanged:n})=>{let i=_().data?.calls===!0,a=m(),o=e?.organization;if(!o)return(0,b.jsx)(`div`,{className:`mx-auto w-full max-w-3xl px-4 py-6 md:px-6`,children:(0,b.jsx)(v,{title:a(`organization`),subtitle:a(`noOrganization`)})});let s=e.role===`owner`;return(0,b.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6`,children:[(0,b.jsx)(v,{title:o.name,subtitle:e.role?h(`youAre`,{role:f(e.role).toLowerCase()}):h(`throughGlobalRoles`)}),(0,b.jsx)(x,{organization:o,editable:r(e),onSaved:n},`${o.name}/${o.slug}`),i&&e.role&&(0,b.jsx)(w,{editable:r(e)}),s&&e.memberId&&(0,b.jsx)(S,{organization:o,memberId:e.memberId}),e.role&&(0,b.jsx)(T,{organization:o,basePath:t,owner:s}),s&&(0,b.jsx)(C,{organization:o,basePath:t})]})};export{E as OrganizationPage};
2
+ //# debugId=de69094f-a29d-4ffe-8e1f-56444c2b64ff
@@ -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{Aa as r,Ga as i,Qo as a,Ss as o,Ya as s,Zo as c,es as l,ja as u,ro as d,uc as f}from"./app-CK_M0TgA.js";import{t as p}from"./page-header-Ddz2r5ic.js";import{n as m,t as h}from"./use-paged-search-DjnlXbQ5.js";import{i as g,n as _,r as v,t as y}from"./use-my-invitations-B4h6GyJO.js";var b=e(t(),1),x=e(n(),1),S=({organization:e,current:t,busy:n,onOpen:r})=>(0,x.jsxs)(`li`,{className:`flex items-center gap-3 px-3 py-2.5`,children:[(0,x.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`span`,{className:`block truncate font-medium`,children:e.name}),(0,x.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.slug})]}),t?(0,x.jsx)(l,{tone:`green`,children:d(`current`)}):(0,x.jsx)(f,{size:`sm`,loading:n,onClick:r,children:d(`open`)})]}),C=({basePath:e,currentId:t})=>{let{session:n}=o(),i=u(),[a,c]=(0,b.useState)(``),l=(0,b.useCallback)((e,t)=>n.organizations.search(e,t).then(e=>({items:e.organizations,total:e.total})),[n]),f=h(l,a),{busy:p,error:g,run:_}=s();return(0,x.jsx)(m,{title:i(`allOrganizations`),description:i(`allOrganizationsDescription`),searchLabel:i(`findOrganization`),placeholder:d(`nameOrSlug`),query:a,onQuery:c,list:f,error:g,renderRow:i=>(0,x.jsx)(S,{organization:i,current:i.id===t,busy:p,onOpen:()=>void _(async()=>{await n.organizations.switchTo(i.id),r(e)})},i.id)})},w=({basePath:e})=>{let t=u(),n=y(),i=n.state===`ready`?n.invitations:void 0,{busy:o,error:s,joining:l,join:d}=_(()=>r(e));return!i||i.length===0?null:(0,x.jsxs)(c,{title:t(`invitationsForYou`),description:t(`invitationsForYouDescription`),children:[(0,x.jsx)(a,{message:s}),(0,x.jsx)(`ul`,{className:`divide-y rounded-md border`,children:i.map(e=>(0,x.jsx)(g,{invitation:e,t,busy:o,joining:l===e.id,onJoin:()=>d(e.id)},e.id))})]})},T=({state:e,basePath:t})=>{let{session:n,organizations:l,state:d}=o(),f=u(),{busy:m,error:h,run:g}=s(),_=d.kind===`signed-in`?d.user:void 0,y=l?.create===`everyone`||_!==void 0&&i(_),b=e.current?.organization?.id;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)(p,{title:f(`organizations`),subtitle:f(`organizationsSubtitle`)}),(0,x.jsxs)(c,{title:f(`yourOrganizations`),description:e.organizations.length>0?f(`memberOf`):f(`notMember`),children:[(0,x.jsx)(a,{message:h??e.error}),e.organizations.length>0&&(0,x.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.organizations.map(e=>(0,x.jsx)(S,{organization:e,current:e.id===b,busy:m,onOpen:()=>void g(async()=>{await n.organizations.switchTo(e.id),r(t)})},e.id))})]}),(0,x.jsx)(w,{basePath:t}),y&&(0,x.jsx)(c,{title:f(`newOrganization`),description:f(`newOrganizationDescription`),children:(0,x.jsx)(v,{onCreated:()=>r(t)})}),(e.current?.globalRoles.length??0)>0&&(0,x.jsx)(C,{basePath:t,currentId:b})]})};export{T as OrganizationsPage};
2
- //# debugId=ff8a67d3-51aa-4831-9045-bb4382c8bcd8
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{Aa as r,Ga as i,Qo as a,Ss as o,Ya as s,Zo as c,es as l,ja as u,ro as d,uc as f}from"./app-B8KcM2Z-.js";import{t as p}from"./page-header-Ddz2r5ic.js";import{n as m,t as h}from"./use-paged-search-CxaSlMkh.js";import{i as g,n as _,r as v,t as y}from"./use-my-invitations-APXH_Xf1.js";var b=e(t(),1),x=e(n(),1),S=({organization:e,current:t,busy:n,onOpen:r})=>(0,x.jsxs)(`li`,{className:`flex items-center gap-3 px-3 py-2.5`,children:[(0,x.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`span`,{className:`block truncate font-medium`,children:e.name}),(0,x.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.slug})]}),t?(0,x.jsx)(l,{tone:`green`,children:d(`current`)}):(0,x.jsx)(f,{size:`sm`,loading:n,onClick:r,children:d(`open`)})]}),C=({basePath:e,currentId:t})=>{let{session:n}=o(),i=u(),[a,c]=(0,b.useState)(``),l=(0,b.useCallback)((e,t)=>n.organizations.search(e,t).then(e=>({items:e.organizations,total:e.total})),[n]),f=h(l,a),{busy:p,error:g,run:_}=s();return(0,x.jsx)(m,{title:i(`allOrganizations`),description:i(`allOrganizationsDescription`),searchLabel:i(`findOrganization`),placeholder:d(`nameOrSlug`),query:a,onQuery:c,list:f,error:g,renderRow:i=>(0,x.jsx)(S,{organization:i,current:i.id===t,busy:p,onOpen:()=>void _(async()=>{await n.organizations.switchTo(i.id),r(e)})},i.id)})},w=({basePath:e})=>{let t=u(),n=y(),i=n.state===`ready`?n.invitations:void 0,{busy:o,error:s,joining:l,join:d}=_(()=>r(e));return!i||i.length===0?null:(0,x.jsxs)(c,{title:t(`invitationsForYou`),description:t(`invitationsForYouDescription`),children:[(0,x.jsx)(a,{message:s}),(0,x.jsx)(`ul`,{className:`divide-y rounded-md border`,children:i.map(e=>(0,x.jsx)(g,{invitation:e,t,busy:o,joining:l===e.id,onJoin:()=>d(e.id)},e.id))})]})},T=({state:e,basePath:t})=>{let{session:n,organizations:l,state:d}=o(),f=u(),{busy:m,error:h,run:g}=s(),_=d.kind===`signed-in`?d.user:void 0,y=l?.create===`everyone`||_!==void 0&&i(_),b=e.current?.organization?.id;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)(p,{title:f(`organizations`),subtitle:f(`organizationsSubtitle`)}),(0,x.jsxs)(c,{title:f(`yourOrganizations`),description:e.organizations.length>0?f(`memberOf`):f(`notMember`),children:[(0,x.jsx)(a,{message:h??e.error}),e.organizations.length>0&&(0,x.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.organizations.map(e=>(0,x.jsx)(S,{organization:e,current:e.id===b,busy:m,onOpen:()=>void g(async()=>{await n.organizations.switchTo(e.id),r(t)})},e.id))})]}),(0,x.jsx)(w,{basePath:t}),y&&(0,x.jsx)(c,{title:f(`newOrganization`),description:f(`newOrganizationDescription`),children:(0,x.jsx)(v,{onCreated:()=>r(t)})}),(e.current?.globalRoles.length??0)>0&&(0,x.jsx)(C,{basePath:t,currentId:b})]})};export{T as OrganizationsPage};
2
+ //# debugId=e5a2c965-d9bc-4097-973e-f39d4c7372d9
@@ -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{Ao as r,Qo as i,Ya as a,Zo as o,el as s,rl as c,uc as l}from"./app-CK_M0TgA.js";var u=e(t(),1),d=s(`invitations`),f=e(n(),1),p=({link:e})=>e?(0,f.jsx)(`p`,{className:`mt-3 break-all rounded-md border bg-muted px-3 py-2 text-xs`,children:d.rich(`passLinkOn`,{link:(0,f.jsx)(`span`,{className:`font-mono`,children:e})})}):null,m=({title:e,description:t,onInvite:n,beside:s,children:c,incomplete:m=!1})=>{let[h,g]=(0,u.useState)(``),[_,v]=(0,u.useState)(),{busy:y,error:b,run:x}=a(),S=()=>x(async()=>{v((await n(h.trim())).link),g(``)});return(0,f.jsxs)(o,{title:e,description:t,children:[(0,f.jsx)(i,{message:b}),(0,f.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),S()},children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,f.jsx)(r,{"aria-label":d(`email`),type:`email`,placeholder:`name@example.com`,value:h,onChange:e=>g(e.target.value),wrapperClassName:`flex-1`}),s,(0,f.jsx)(l,{type:`submit`,variant:`primary`,loading:y,disabled:!h.trim()||m,children:d(`invite`)})]}),c]}),(0,f.jsx)(p,{link:_})]})},h=({email:e,gives:t,expiresAt:n,onResend:r,onRevoke:o})=>{let[s,m]=(0,u.useState)(),{busy:h,error:g,run:_}=a(),v=new Date(n).getTime()<Date.now();return(0,f.jsxs)(`li`,{className:`px-3 py-2.5`,children:[(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,f.jsx)(`span`,{className:`block truncate font-medium`,children:e}),(0,f.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[t,` · `,v?d(`expired`):d(`until`,{date:new Date(n).toLocaleDateString(c())})]})]}),(0,f.jsx)(l,{size:`sm`,loading:h,onClick:()=>void _(async()=>m((await r()).link)),children:d(`sendAgain`)}),(0,f.jsx)(l,{size:`sm`,variant:`danger`,loading:h,onClick:()=>void _(o),children:d(`revoke`)})]}),(0,f.jsx)(i,{message:g}),(0,f.jsx)(p,{link:s})]})};export{m as n,h as t};
2
- //# debugId=f88056a9-76fb-42de-96fb-7bdc1777f6d1
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{Ao as r,Qo as i,Ya as a,Zo as o,el as s,rl as c,uc as l}from"./app-B8KcM2Z-.js";var u=e(t(),1),d=s(`invitations`),f=e(n(),1),p=({link:e})=>e?(0,f.jsx)(`p`,{className:`mt-3 break-all rounded-md border bg-muted px-3 py-2 text-xs`,children:d.rich(`passLinkOn`,{link:(0,f.jsx)(`span`,{className:`font-mono`,children:e})})}):null,m=({title:e,description:t,onInvite:n,beside:s,children:c,incomplete:m=!1})=>{let[h,g]=(0,u.useState)(``),[_,v]=(0,u.useState)(),{busy:y,error:b,run:x}=a(),S=()=>x(async()=>{v((await n(h.trim())).link),g(``)});return(0,f.jsxs)(o,{title:e,description:t,children:[(0,f.jsx)(i,{message:b}),(0,f.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),S()},children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,f.jsx)(r,{"aria-label":d(`email`),type:`email`,placeholder:`name@example.com`,value:h,onChange:e=>g(e.target.value),wrapperClassName:`flex-1`}),s,(0,f.jsx)(l,{type:`submit`,variant:`primary`,loading:y,disabled:!h.trim()||m,children:d(`invite`)})]}),c]}),(0,f.jsx)(p,{link:_})]})},h=({email:e,gives:t,expiresAt:n,onResend:r,onRevoke:o})=>{let[s,m]=(0,u.useState)(),{busy:h,error:g,run:_}=a(),v=new Date(n).getTime()<Date.now();return(0,f.jsxs)(`li`,{className:`px-3 py-2.5`,children:[(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,f.jsx)(`span`,{className:`block truncate font-medium`,children:e}),(0,f.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[t,` · `,v?d(`expired`):d(`until`,{date:new Date(n).toLocaleDateString(c())})]})]}),(0,f.jsx)(l,{size:`sm`,loading:h,onClick:()=>void _(async()=>m((await r()).link)),children:d(`sendAgain`)}),(0,f.jsx)(l,{size:`sm`,variant:`danger`,loading:h,onClick:()=>void _(o),children:d(`revoke`)})]}),(0,f.jsx)(i,{message:g}),(0,f.jsx)(p,{link:s})]})};export{m as n,h as t};
2
+ //# debugId=2deb7c80-c08f-4a9d-af09-58d97a7907df
@@ -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{Wo as r,da as i,fa as a,pa as o,rl as s}from"./app-CK_M0TgA.js";import{bt as c,vt as l}from"./embedded-list-COr7SEcU.js";import{a as u,c as d,d as f,f as p,i as m,n as h,o as g,r as _,s as v,u as y}from"./lib-recharts-B1lKFZ5P.js";import{t as b}from"./legend-item-DlKFFY7e.js";var x=e(t(),1),S=864e5,C={day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`,hour12:!1},w={day:`numeric`,month:`short`,year:`numeric`},T={day:`numeric`,month:`short`},E={minute:C,"5_minutes":C,"15_minutes":C,hour:C,day:w,year:{year:`numeric`}},D=e=>o(`period:${JSON.stringify(e)}`,t=>new Intl.DateTimeFormat(t,{...e,timeZone:`UTC`})),O=(e,t)=>{let n=new Date(e);if(t===`day`)return e+S;if(t===`week`)return e+7*S;if(t===`month`)return Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,1);if(t===`year`)return Date.UTC(n.getUTCFullYear()+1,0,1)},k=(e,t,n)=>{let r=O(e,t);return e<=n&&r!==void 0&&n<r},A=(e,t,n)=>{if(k(e,t,n)){if(t===`day`)return c(`today`);let r=new Date(e).getUTCFullYear()===new Date(n).getUTCFullYear();return c(`toToday`,{start:D(r?T:w).format(e)})}let r=E[t];if(r)return D(r).format(e);let i=O(e,t);if(i===void 0)throw Error(`A ${t} bucket has no period to name`);return D(w).formatRange(e,i-S)},j=e(n(),1),M=({points:e,measure:t,bucket:n,now:r,series:i})=>{let a=i??[],o=!i||t.kind===`count`||t.kind===`sum`;return(0,j.jsx)(`div`,{className:`sr-only`,children:(0,j.jsxs)(`table`,{children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{scope:`col`,children:c(`period`)}),a.map(e=>(0,j.jsx)(`th`,{scope:`col`,children:e.label},e.key)),o&&(0,j.jsx)(`th`,{scope:`col`,children:c(t.kind)})]})}),(0,j.jsx)(`tbody`,{children:e.map(e=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{scope:`row`,children:A(e.at,n,r)}),a.map(n=>(0,j.jsx)(`td`,{children:l(e[n.key]??null,n.measure??t)},n.key)),o&&(0,j.jsx)(`td`,{children:l(e.value,t)})]},e.at))})]})})},N={hour:`2-digit`,minute:`2-digit`,hour12:!1},P={day:`numeric`,month:`short`,...N},F={minute:N,"5_minutes":N,"15_minutes":N,hour:N,day:{day:`numeric`,month:`short`},week:{day:`numeric`,month:`short`},month:{month:`short`,year:`2-digit`},year:{year:`numeric`}},I=e=>{let t=new Intl.DateTimeFormat(s(),{...e,timeZone:`UTC`});return e=>t.format(e)},L={fontSize:`0.6875rem`,fill:`var(--muted-foreground)`},R=864e5,z=new Set([`minute`,`5_minutes`,`15_minutes`,`hour`]),B=(e,t)=>{let n=t.length>1?t.at(-1).at-t[0].at:0;return z.has(e)&&n>=R?P:F[e]},V=()=>{let e=Date.now();return e+a(e,i())},H=({active:e,payload:t,measure:n,bucket:r,now:i,series:a})=>{let o=t?.[0]?.payload;return!e||!o?null:(0,j.jsxs)(`div`,{className:`rounded-md border bg-background px-2.5 py-1.5 text-xs shadow-pop`,children:[(0,j.jsx)(`div`,{className:`text-muted-foreground`,children:A(o.at,r,i)}),a?.map(e=>(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`size-2 shrink-0 rounded-full`,style:{background:e.color},"aria-hidden":!0}),(0,j.jsx)(`span`,{className:`flex-1`,children:e.label}),(0,j.jsx)(`span`,{className:`font-semibold tabular-nums`,children:l(o[e.key]??null,e.measure??n)})]},e.key)),a&&(n.kind===`count`||n.kind===`sum`)&&(0,j.jsx)(`div`,{className:`mt-0.5 border-t pt-0.5 font-semibold tabular-nums`,children:l(o.value,n)}),!a&&(0,j.jsx)(`div`,{className:`font-semibold tabular-nums`,children:l(o.value,n)})]})},U=e=>({fillOpacity:.35,stroke:e,strokeWidth:1.5,strokeDasharray:`3 2`}),W=`[&_.recharts-surface]:rounded-sm [&_.recharts-surface:focus-visible]:outline-2 [&_.recharts-surface:focus-visible]:outline-offset-2 [&_.recharts-surface:focus-visible]:outline-primary`,G=({points:e,measure:t,bucket:n,type:i,series:a,resource:o,view:l,compact:S})=>{let C=r(`(min-width: 640px)`),[w,T]=(0,x.useState)(!1),E=V(),D=e.findIndex(e=>k(e.at,n,E)),O=I(B(n,e)),A=(0,j.jsx)(d,{vertical:!1,stroke:`var(--border)`}),N=(0,j.jsx)(u,{dataKey:`at`,tickFormatter:O,tick:L,axisLine:!1,tickLine:!1,minTickGap:C?24:40,height:18}),P=(0,j.jsx)(m,{width:C?48:36,tick:L,axisLine:!1,tickLine:!1,tickCount:3,tickFormatter:e=>e.toLocaleString(s(),{notation:`compact`})}),F=(0,j.jsx)(f,{...w&&{active:!1},cursor:i===`bar`?{fill:`var(--muted)`}:{stroke:`var(--border-strong)`},content:(0,j.jsx)(H,{measure:t,bucket:n,now:E,...a&&{series:a}}),isAnimationActive:!1}),R=a??[{key:`value`,label:``,color:`var(--chart-1)`}],z=t=>({cx:n,cy:r,index:i})=>n===void 0||r===void 0?null:i===D?(0,j.jsx)(`circle`,{cx:n,cy:r,r:3.5,fill:`var(--background)`,stroke:t,strokeWidth:2}):e.length<=31?(0,j.jsx)(`circle`,{cx:n,cy:r,r:3,fill:t}):null,G=e=>T(e.key===`Escape`),K=()=>T(!1),q={"aria-label":c(`chartKeys`)},J=(0,j.jsxs)(`div`,{className:`${S?`h-24`:`h-40`} ${W}`,onKeyDown:G,onPointerMove:K,onFocus:K,children:[(0,j.jsx)(p,{width:`100%`,height:`100%`,children:i===`line`?(0,j.jsxs)(_,{data:e,margin:{top:6,right:6,bottom:0,left:0},...q,children:[A,N,P,F,R.map(e=>(0,j.jsx)(v,{dataKey:e.key,stroke:e.color,strokeWidth:2,dot:z(e.color),activeDot:{r:4,stroke:`var(--background)`,strokeWidth:2},isAnimationActive:!1},e.key))]}):(0,j.jsxs)(h,{data:e,margin:{top:6,right:0,bottom:0,left:0},barCategoryGap:`22%`,...q,children:[A,N,P,F,R.map((t,n)=>(0,j.jsx)(g,{dataKey:t.key,fill:t.color,...a&&{stackId:`split`},radius:n===R.length-1?[4,4,0,0]:0,isAnimationActive:!1,children:e.map((e,n)=>(0,j.jsx)(y,{...n===D&&U(t.color)},e.at))},t.key))]})}),(0,j.jsx)(M,{points:e,measure:t,bucket:n,now:E,...a&&{series:a}})]});return!a||o===void 0?J:(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[J,(0,j.jsx)(`ul`,{className:`flex flex-wrap gap-x-3 gap-y-0.5 text-sm`,children:a.map(e=>(0,j.jsx)(b,{resource:o,view:l,color:e.color,label:e.label,...e.filter!==void 0&&{filter:e.filter}},e.key))})]})};export{G as PeriodChart};
2
- //# debugId=a1147353-1048-48ba-9ada-e997fef949fc
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{Wo as r,da as i,fa as a,pa as o,rl as s}from"./app-B8KcM2Z-.js";import{bt as c,vt as l}from"./embedded-list-C3nd1V5o.js";import{a as u,c as d,d as f,f as p,i as m,n as h,o as g,r as _,s as v,u as y}from"./lib-recharts-B1lKFZ5P.js";import{t as b}from"./legend-item-9nkaAII6.js";var x=e(t(),1),S=864e5,C={day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`,hour12:!1},w={day:`numeric`,month:`short`,year:`numeric`},T={day:`numeric`,month:`short`},E={minute:C,"5_minutes":C,"15_minutes":C,hour:C,day:w,year:{year:`numeric`}},D=e=>o(`period:${JSON.stringify(e)}`,t=>new Intl.DateTimeFormat(t,{...e,timeZone:`UTC`})),O=(e,t)=>{let n=new Date(e);if(t===`day`)return e+S;if(t===`week`)return e+7*S;if(t===`month`)return Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,1);if(t===`year`)return Date.UTC(n.getUTCFullYear()+1,0,1)},k=(e,t,n)=>{let r=O(e,t);return e<=n&&r!==void 0&&n<r},A=(e,t,n)=>{if(k(e,t,n)){if(t===`day`)return c(`today`);let r=new Date(e).getUTCFullYear()===new Date(n).getUTCFullYear();return c(`toToday`,{start:D(r?T:w).format(e)})}let r=E[t];if(r)return D(r).format(e);let i=O(e,t);if(i===void 0)throw Error(`A ${t} bucket has no period to name`);return D(w).formatRange(e,i-S)},j=e(n(),1),M=({points:e,measure:t,bucket:n,now:r,series:i})=>{let a=i??[],o=!i||t.kind===`count`||t.kind===`sum`;return(0,j.jsx)(`div`,{className:`sr-only`,children:(0,j.jsxs)(`table`,{children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{scope:`col`,children:c(`period`)}),a.map(e=>(0,j.jsx)(`th`,{scope:`col`,children:e.label},e.key)),o&&(0,j.jsx)(`th`,{scope:`col`,children:c(t.kind)})]})}),(0,j.jsx)(`tbody`,{children:e.map(e=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{scope:`row`,children:A(e.at,n,r)}),a.map(n=>(0,j.jsx)(`td`,{children:l(e[n.key]??null,n.measure??t)},n.key)),o&&(0,j.jsx)(`td`,{children:l(e.value,t)})]},e.at))})]})})},N={hour:`2-digit`,minute:`2-digit`,hour12:!1},P={day:`numeric`,month:`short`,...N},F={minute:N,"5_minutes":N,"15_minutes":N,hour:N,day:{day:`numeric`,month:`short`},week:{day:`numeric`,month:`short`},month:{month:`short`,year:`2-digit`},year:{year:`numeric`}},I=e=>{let t=new Intl.DateTimeFormat(s(),{...e,timeZone:`UTC`});return e=>t.format(e)},L={fontSize:`0.6875rem`,fill:`var(--muted-foreground)`},R=864e5,z=new Set([`minute`,`5_minutes`,`15_minutes`,`hour`]),B=(e,t)=>{let n=t.length>1?t.at(-1).at-t[0].at:0;return z.has(e)&&n>=R?P:F[e]},V=()=>{let e=Date.now();return e+a(e,i())},H=({active:e,payload:t,measure:n,bucket:r,now:i,series:a})=>{let o=t?.[0]?.payload;return!e||!o?null:(0,j.jsxs)(`div`,{className:`rounded-md border bg-background px-2.5 py-1.5 text-xs shadow-pop`,children:[(0,j.jsx)(`div`,{className:`text-muted-foreground`,children:A(o.at,r,i)}),a?.map(e=>(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`size-2 shrink-0 rounded-full`,style:{background:e.color},"aria-hidden":!0}),(0,j.jsx)(`span`,{className:`flex-1`,children:e.label}),(0,j.jsx)(`span`,{className:`font-semibold tabular-nums`,children:l(o[e.key]??null,e.measure??n)})]},e.key)),a&&(n.kind===`count`||n.kind===`sum`)&&(0,j.jsx)(`div`,{className:`mt-0.5 border-t pt-0.5 font-semibold tabular-nums`,children:l(o.value,n)}),!a&&(0,j.jsx)(`div`,{className:`font-semibold tabular-nums`,children:l(o.value,n)})]})},U=e=>({fillOpacity:.35,stroke:e,strokeWidth:1.5,strokeDasharray:`3 2`}),W=`[&_.recharts-surface]:rounded-sm [&_.recharts-surface:focus-visible]:outline-2 [&_.recharts-surface:focus-visible]:outline-offset-2 [&_.recharts-surface:focus-visible]:outline-primary`,G=({points:e,measure:t,bucket:n,type:i,series:a,resource:o,view:l,compact:S})=>{let C=r(`(min-width: 640px)`),[w,T]=(0,x.useState)(!1),E=V(),D=e.findIndex(e=>k(e.at,n,E)),O=I(B(n,e)),A=(0,j.jsx)(d,{vertical:!1,stroke:`var(--border)`}),N=(0,j.jsx)(u,{dataKey:`at`,tickFormatter:O,tick:L,axisLine:!1,tickLine:!1,minTickGap:C?24:40,height:18}),P=(0,j.jsx)(m,{width:C?48:36,tick:L,axisLine:!1,tickLine:!1,tickCount:3,tickFormatter:e=>e.toLocaleString(s(),{notation:`compact`})}),F=(0,j.jsx)(f,{...w&&{active:!1},cursor:i===`bar`?{fill:`var(--muted)`}:{stroke:`var(--border-strong)`},content:(0,j.jsx)(H,{measure:t,bucket:n,now:E,...a&&{series:a}}),isAnimationActive:!1}),R=a??[{key:`value`,label:``,color:`var(--chart-1)`}],z=t=>({cx:n,cy:r,index:i})=>n===void 0||r===void 0?null:i===D?(0,j.jsx)(`circle`,{cx:n,cy:r,r:3.5,fill:`var(--background)`,stroke:t,strokeWidth:2}):e.length<=31?(0,j.jsx)(`circle`,{cx:n,cy:r,r:3,fill:t}):null,G=e=>T(e.key===`Escape`),K=()=>T(!1),q={"aria-label":c(`chartKeys`)},J=(0,j.jsxs)(`div`,{className:`${S?`h-24`:`h-40`} ${W}`,onKeyDown:G,onPointerMove:K,onFocus:K,children:[(0,j.jsx)(p,{width:`100%`,height:`100%`,children:i===`line`?(0,j.jsxs)(_,{data:e,margin:{top:6,right:6,bottom:0,left:0},...q,children:[A,N,P,F,R.map(e=>(0,j.jsx)(v,{dataKey:e.key,stroke:e.color,strokeWidth:2,dot:z(e.color),activeDot:{r:4,stroke:`var(--background)`,strokeWidth:2},isAnimationActive:!1},e.key))]}):(0,j.jsxs)(h,{data:e,margin:{top:6,right:0,bottom:0,left:0},barCategoryGap:`22%`,...q,children:[A,N,P,F,R.map((t,n)=>(0,j.jsx)(g,{dataKey:t.key,fill:t.color,...a&&{stackId:`split`},radius:n===R.length-1?[4,4,0,0]:0,isAnimationActive:!1,children:e.map((e,n)=>(0,j.jsx)(y,{...n===D&&U(t.color)},e.at))},t.key))]})}),(0,j.jsx)(M,{points:e,measure:t,bucket:n,now:E,...a&&{series:a}})]});return!a||o===void 0?J:(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[J,(0,j.jsx)(`ul`,{className:`flex flex-wrap gap-x-3 gap-y-0.5 text-sm`,children:a.map(e=>(0,j.jsx)(b,{resource:o,view:l,color:e.color,label:e.label,...e.filter!==void 0&&{filter:e.filter}},e.key))})]})};export{G as PeriodChart};
2
+ //# debugId=55bfd902-fc44-4596-bf1b-73601b5fbac2
@@ -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{t}from"./react-CuiNlnus.js";import{Gc as n,Qo as r,io as i,ro as a}from"./app-CK_M0TgA.js";var o=e(t(),1),s=({roles:e,selected:t,grantable:r,disabled:s,onChange:c})=>(0,o.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-2`,children:e.map(e=>{let l=t.includes(e.name),u=s||!r.has(e.name);return(0,o.jsxs)(`label`,{title:u&&!s?a(`cannotChangeRole`):void 0,className:n(`inline-flex items-center gap-1.5`,u&&`text-muted-foreground`),children:[(0,o.jsx)(i,{checked:l,label:e.label,onChange:u?void 0:n=>c(n?[...t,e.name]:t.filter(t=>t!==e.name)),className:n(u&&`cursor-default opacity-60`)}),e.label]},e.name)})}),c=({name:e,email:t,self:n,actions:i,children:a,error:s,status:c})=>(0,o.jsxs)(`li`,{className:`flex flex-col gap-2 px-3 py-3`,children:[(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,o.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c?(0,o.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,o.jsxs)(`span`,{className:`truncate font-medium`,children:[e,n&&` (you)`]}),c]}):(0,o.jsxs)(`span`,{className:`block truncate font-medium`,children:[e,n&&` (you)`]}),(0,o.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:t})]}),i]}),a,(0,o.jsx)(r,{message:s})]});export{s as n,c as t};
2
- //# debugId=18c11b64-cdb6-4919-a5bb-d5a21efc95fd
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{t}from"./react-CuiNlnus.js";import{Gc as n,Qo as r,io as i,ro as a}from"./app-B8KcM2Z-.js";var o=e(t(),1),s=({roles:e,selected:t,grantable:r,disabled:s,onChange:c})=>(0,o.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-2`,children:e.map(e=>{let l=t.includes(e.name),u=s||!r.has(e.name);return(0,o.jsxs)(`label`,{title:u&&!s?a(`cannotChangeRole`):void 0,className:n(`inline-flex items-center gap-1.5`,u&&`text-muted-foreground`),children:[(0,o.jsx)(i,{checked:l,label:e.label,onChange:u?void 0:n=>c(n?[...t,e.name]:t.filter(t=>t!==e.name)),className:n(u&&`cursor-default opacity-60`)}),e.label]},e.name)})}),c=({name:e,email:t,self:n,actions:i,children:a,error:s,status:c})=>(0,o.jsxs)(`li`,{className:`flex flex-col gap-2 px-3 py-3`,children:[(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,o.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c?(0,o.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,o.jsxs)(`span`,{className:`truncate font-medium`,children:[e,n&&` (you)`]}),c]}):(0,o.jsxs)(`span`,{className:`block truncate font-medium`,children:[e,n&&` (you)`]}),(0,o.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:t})]}),i]}),a,(0,o.jsx)(r,{message:s})]});export{s as n,c as t};
2
+ //# debugId=a0bdc1d1-98bc-408f-8793-e113fb78d74e
@@ -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{$c as r,R as i,Ys as a,_ as o,a as s,b as c,c as l,do as u,el as d,fc as f,fl as p,fs as m,gr as h,i as g,is as _,o as v,po as y,ss as b,u as x,uc as S,v as C,y as w}from"./app-CK_M0TgA.js";import{o as T}from"./vendor-t7Q7QbPu.js";import{n as E,t as D}from"./lib-altcha-lib-BK1uKcxH.js";var O=e(t(),1),k=d(`forms`),A=async(e,t)=>{let n=await e.formChallenge(t),r=await E({challenge:n,deriveKey:D});if(!r)throw Error(k(`checkTooLong`));return{challenge:n,solution:{counter:r.counter,derivedKey:r.derivedKey}}},j=e(n(),1),M=({name:e})=>{let t=m(),n=T({queryKey:r.publicForm(e),queryFn:()=>t.form(e)});return n.isPending?(0,j.jsxs)(`div`,{className:`flex h-full min-h-48 items-center justify-center gap-2 text-muted-foreground`,children:[(0,j.jsx)(f,{}),` `,k(`loading`)]}):n.error?a(n.error)&&n.error.status===404?(0,j.jsx)(_,{title:k(`notFound`),children:k(`noForm`)}):(0,j.jsx)(_,{title:b(`cannotReach`),children:a(n.error)?n.error.message:b(`noAnswer`)}):(0,j.jsx)(N,{form:n.data})},N=({form:e})=>{let t=m(),{resource:n,view:r}=e,a=e.title??r.names?.singular??p(r.resource);y(a);let[d,f]=(0,O.useState)(()=>v(n,[{title:a,fields:e.fields}])),[_,b]=(0,O.useState)({}),[T,E]=(0,O.useState)(),[D,M]=(0,O.useState)(!1),[N,P]=(0,O.useState)(!1),[F,I]=(0,O.useState)(0),L=o(F);if(N)return(0,j.jsx)(u,{title:a,size:`md`,children:(0,j.jsx)(`p`,{role:`status`,className:`rounded-md bg-success-soft px-3 py-2 text-body font-medium text-success-text`,children:e.thanks})});let R=(e,t)=>{b(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e))),f(n=>({...n,[e]:t}))},z=async()=>{M(!0),E(void 0);try{await t.submitForm(e.name,g(n,{},d),await A(t,e.name)),P(!0)}catch(e){let t=C(e);b(t),Object.keys(t).length>0?I(e=>e+1):E(e)}finally{M(!1)}};return(0,j.jsx)(u,{title:a,size:`md`,children:(0,j.jsxs)(`form`,{ref:L,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),z()},children:[e.fields.map(e=>{let t=n.fields[e],a=r.fields[e],o=a?.label??p(e),u=_[e];return(0,j.jsx)(i,{name:e,label:o,help:a?.help,required:l(t),error:u&&w(t,o,u),children:(0,j.jsx)(c,{field:t,hints:a,value:d[e]??(t.type!==`boolean`&&``),stored:void 0,placeholder:s(t)?k(`setByDatabase`):x(t),invalid:!!u,onChange:t=>R(e,t)})},e)}),T!==void 0&&(0,j.jsx)(h,{title:k(`notSent`),error:T}),(0,j.jsx)(S,{variant:`primary`,type:`submit`,loading:D,className:`min-h-10`,children:k(`send`)})]})})};export{M as PublicFormPage};
2
- //# debugId=28c97f9a-f8a0-4946-9839-5788146b35a8
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,R as i,Ys as a,_ as o,a as s,b as c,c as l,do as u,el as d,fc as f,fl as p,fs as m,gr as h,i as g,is as _,o as v,po as y,ss as b,u as x,uc as S,v as C,y as w}from"./app-B8KcM2Z-.js";import{o as T}from"./vendor-t7Q7QbPu.js";import{n as E,t as D}from"./lib-altcha-lib-BK1uKcxH.js";var O=e(t(),1),k=d(`forms`),A=async(e,t)=>{let n=await e.formChallenge(t),r=await E({challenge:n,deriveKey:D});if(!r)throw Error(k(`checkTooLong`));return{challenge:n,solution:{counter:r.counter,derivedKey:r.derivedKey}}},j=e(n(),1),M=({name:e})=>{let t=m(),n=T({queryKey:r.publicForm(e),queryFn:()=>t.form(e)});return n.isPending?(0,j.jsxs)(`div`,{className:`flex h-full min-h-48 items-center justify-center gap-2 text-muted-foreground`,children:[(0,j.jsx)(f,{}),` `,k(`loading`)]}):n.error?a(n.error)&&n.error.status===404?(0,j.jsx)(_,{title:k(`notFound`),children:k(`noForm`)}):(0,j.jsx)(_,{title:b(`cannotReach`),children:a(n.error)?n.error.message:b(`noAnswer`)}):(0,j.jsx)(N,{form:n.data})},N=({form:e})=>{let t=m(),{resource:n,view:r}=e,a=e.title??r.names?.singular??p(r.resource);y(a);let[d,f]=(0,O.useState)(()=>v(n,[{title:a,fields:e.fields}])),[_,b]=(0,O.useState)({}),[T,E]=(0,O.useState)(),[D,M]=(0,O.useState)(!1),[N,P]=(0,O.useState)(!1),[F,I]=(0,O.useState)(0),L=o(F);if(N)return(0,j.jsx)(u,{title:a,size:`md`,children:(0,j.jsx)(`p`,{role:`status`,className:`rounded-md bg-success-soft px-3 py-2 text-body font-medium text-success-text`,children:e.thanks})});let R=(e,t)=>{b(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e))),f(n=>({...n,[e]:t}))},z=async()=>{M(!0),E(void 0);try{await t.submitForm(e.name,g(n,{},d),await A(t,e.name)),P(!0)}catch(e){let t=C(e);b(t),Object.keys(t).length>0?I(e=>e+1):E(e)}finally{M(!1)}};return(0,j.jsx)(u,{title:a,size:`md`,children:(0,j.jsxs)(`form`,{ref:L,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),z()},children:[e.fields.map(e=>{let t=n.fields[e],a=r.fields[e],o=a?.label??p(e),u=_[e];return(0,j.jsx)(i,{name:e,label:o,help:a?.help,required:l(t),error:u&&w(t,o,u),children:(0,j.jsx)(c,{field:t,hints:a,value:d[e]??(t.type!==`boolean`&&``),stored:void 0,placeholder:s(t)?k(`setByDatabase`):x(t),invalid:!!u,onChange:t=>R(e,t)})},e)}),T!==void 0&&(0,j.jsx)(h,{title:k(`notSent`),error:T}),(0,j.jsx)(S,{variant:`primary`,type:`submit`,loading:D,className:`min-h-10`,children:k(`send`)})]})})};export{M as PublicFormPage};
2
+ //# debugId=abb8d9ea-a9c8-4e52-8ba0-bcd96f80f9dc