@shapio/cms 0.0.0-stage → 0.3.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 (307) hide show
  1. package/README.md +27 -2
  2. package/dist/admin/apple-touch-icon.png +0 -0
  3. package/dist/admin/assets/AssistError-BITJ_tpg.js +2 -0
  4. package/dist/admin/assets/AssistError-BITJ_tpg.js.map +1 -0
  5. package/dist/admin/assets/BlockMenuItems-CcluK965.js +6 -0
  6. package/dist/admin/assets/BlockMenuItems-CcluK965.js.map +1 -0
  7. package/dist/admin/assets/Body-BXa9DhtH.js +2 -0
  8. package/dist/admin/assets/Body-BXa9DhtH.js.map +1 -0
  9. package/dist/admin/assets/Builder-DcpRfXuc.js +2 -0
  10. package/dist/admin/assets/Builder-DcpRfXuc.js.map +1 -0
  11. package/dist/admin/assets/ConfirmDialog-B9nWhIIz.js +2 -0
  12. package/dist/admin/assets/ConfirmDialog-B9nWhIIz.js.map +1 -0
  13. package/dist/admin/assets/CopyButton-BoWb-xi1.js +2 -0
  14. package/dist/admin/assets/CopyButton-BoWb-xi1.js.map +1 -0
  15. package/dist/admin/assets/CursorPager-BnxmTk47.js +2 -0
  16. package/dist/admin/assets/CursorPager-BnxmTk47.js.map +1 -0
  17. package/dist/admin/assets/ExternalLink-Eeb9mONJ.js +2 -0
  18. package/dist/admin/assets/ExternalLink-Eeb9mONJ.js.map +1 -0
  19. package/dist/admin/assets/Form-DZRLD3vH.js +2 -0
  20. package/dist/admin/assets/Form-DZRLD3vH.js.map +1 -0
  21. package/dist/admin/assets/FormCheckboxGroup-uIC2XQIL.js +2 -0
  22. package/dist/admin/assets/FormCheckboxGroup-uIC2XQIL.js.map +1 -0
  23. package/dist/admin/assets/FormRadioGroup-hd95vPOu.js +2 -0
  24. package/dist/admin/assets/FormRadioGroup-hd95vPOu.js.map +1 -0
  25. package/dist/admin/assets/FormSelectField-D7VHmnx5.js +2 -0
  26. package/dist/admin/assets/FormSelectField-D7VHmnx5.js.map +1 -0
  27. package/dist/admin/assets/FormSwitchField-ft8Jbe6E.js +2 -0
  28. package/dist/admin/assets/FormSwitchField-ft8Jbe6E.js.map +1 -0
  29. package/dist/admin/assets/FormTextareaField-DzyOzfZb.js +2 -0
  30. package/dist/admin/assets/FormTextareaField-DzyOzfZb.js.map +1 -0
  31. package/dist/admin/assets/HintedLabel-CvC46uy_.js +2 -0
  32. package/dist/admin/assets/HintedLabel-CvC46uy_.js.map +1 -0
  33. package/dist/admin/assets/InfoHint-GJLRVumb.js +2 -0
  34. package/dist/admin/assets/InfoHint-GJLRVumb.js.map +1 -0
  35. package/dist/admin/assets/InsertMenuItem-D976G0Rj.js +2 -0
  36. package/dist/admin/assets/InsertMenuItem-D976G0Rj.js.map +1 -0
  37. package/dist/admin/assets/LinkTabs-BZSlA57U.js +2 -0
  38. package/dist/admin/assets/LinkTabs-BZSlA57U.js.map +1 -0
  39. package/dist/admin/assets/Match-DdxTHHM4.js +2 -0
  40. package/dist/admin/assets/Match-DdxTHHM4.js.map +1 -0
  41. package/dist/admin/assets/Panel-iIKjEURi.js +2 -0
  42. package/dist/admin/assets/Panel-iIKjEURi.js.map +1 -0
  43. package/dist/admin/assets/QueryView-D6aZQJRN.js +2 -0
  44. package/dist/admin/assets/QueryView-D6aZQJRN.js.map +1 -0
  45. package/dist/admin/assets/RadioTile-BpB79rIK.js +2 -0
  46. package/dist/admin/assets/RadioTile-BpB79rIK.js.map +1 -0
  47. package/dist/admin/assets/RichTextField-BuHCONPu.js +144 -0
  48. package/dist/admin/assets/RichTextField-BuHCONPu.js.map +1 -0
  49. package/dist/admin/assets/RowTitle--uFCpx8n.js +2 -0
  50. package/dist/admin/assets/RowTitle--uFCpx8n.js.map +1 -0
  51. package/dist/admin/assets/SecretReveal-DFpzeNE0.js +2 -0
  52. package/dist/admin/assets/SecretReveal-DFpzeNE0.js.map +1 -0
  53. package/dist/admin/assets/SharedGlyph-Cqkx30tn.js +2 -0
  54. package/dist/admin/assets/SharedGlyph-Cqkx30tn.js.map +1 -0
  55. package/dist/admin/assets/StepList-BY5MuJPJ.js +2 -0
  56. package/dist/admin/assets/StepList-BY5MuJPJ.js.map +1 -0
  57. package/dist/admin/assets/Structure-CqRa2t7z.js +2 -0
  58. package/dist/admin/assets/Structure-CqRa2t7z.js.map +1 -0
  59. package/dist/admin/assets/SubNavLink-B2o4kSZ9.js +2 -0
  60. package/dist/admin/assets/SubNavLink-B2o4kSZ9.js.map +1 -0
  61. package/dist/admin/assets/SuggestAltButton-4rf2xhEJ.js +2 -0
  62. package/dist/admin/assets/SuggestAltButton-4rf2xhEJ.js.map +1 -0
  63. package/dist/admin/assets/TextLink-D15oyXlc.js +2 -0
  64. package/dist/admin/assets/TextLink-D15oyXlc.js.map +1 -0
  65. package/dist/admin/assets/Thumbnail-CP5mfgNY.js +2 -0
  66. package/dist/admin/assets/Thumbnail-CP5mfgNY.js.map +1 -0
  67. package/dist/admin/assets/UnsavedChangesGuard-DgOASh0p.js +2 -0
  68. package/dist/admin/assets/UnsavedChangesGuard-DgOASh0p.js.map +1 -0
  69. package/dist/admin/assets/UserAvatar-BocvNVL-.js +2 -0
  70. package/dist/admin/assets/UserAvatar-BocvNVL-.js.map +1 -0
  71. package/dist/admin/assets/View-BLsQYPow.js +11 -0
  72. package/dist/admin/assets/View-BLsQYPow.js.map +1 -0
  73. package/dist/admin/assets/arrow-up-gf_j6SVQ.js +2 -0
  74. package/dist/admin/assets/arrow-up-gf_j6SVQ.js.map +1 -0
  75. package/dist/admin/assets/auth-pcS9CCXu.js +2 -0
  76. package/dist/admin/assets/auth-pcS9CCXu.js.map +1 -0
  77. package/dist/admin/assets/badge-DD0mE96i.js +2 -0
  78. package/dist/admin/assets/badge-DD0mE96i.js.map +1 -0
  79. package/dist/admin/assets/boxes-DcK-kaSa.js +2 -0
  80. package/dist/admin/assets/boxes-DcK-kaSa.js.map +1 -0
  81. package/dist/admin/assets/calendar-clock-DEwACe0M.js +2 -0
  82. package/dist/admin/assets/calendar-clock-DEwACe0M.js.map +1 -0
  83. package/dist/admin/assets/changeSets-BjUEfYbj.js +2 -0
  84. package/dist/admin/assets/changeSets-BjUEfYbj.js.map +1 -0
  85. package/dist/admin/assets/chevron-left-BsQYDUEC.js +2 -0
  86. package/dist/admin/assets/chevron-left-BsQYDUEC.js.map +1 -0
  87. package/dist/admin/assets/circle-check-Dq1owihe.js +2 -0
  88. package/dist/admin/assets/circle-check-Dq1owihe.js.map +1 -0
  89. package/dist/admin/assets/circle-x-Dx6zIZko.js +2 -0
  90. package/dist/admin/assets/circle-x-Dx6zIZko.js.map +1 -0
  91. package/dist/admin/assets/client-C8vMCv-p.js +10 -0
  92. package/dist/admin/assets/client-C8vMCv-p.js.map +1 -0
  93. package/dist/admin/assets/clock-DQvkffqQ.js +2 -0
  94. package/dist/admin/assets/clock-DQvkffqQ.js.map +1 -0
  95. package/dist/admin/assets/cn-BQ3voEft.js +2 -0
  96. package/dist/admin/assets/cn-BQ3voEft.js.map +1 -0
  97. package/dist/admin/assets/coerce-OsqQRj19.js +2 -0
  98. package/dist/admin/assets/coerce-OsqQRj19.js.map +1 -0
  99. package/dist/admin/assets/constants-DCtq_UOe.js +2 -0
  100. package/dist/admin/assets/constants-DCtq_UOe.js.map +1 -0
  101. package/dist/admin/assets/constants-DUBUgzpU.js +2 -0
  102. package/dist/admin/assets/constants-DUBUgzpU.js.map +1 -0
  103. package/dist/admin/assets/constants-SrImR6C3.js +2 -0
  104. package/dist/admin/assets/constants-SrImR6C3.js.map +1 -0
  105. package/dist/admin/assets/content-_SLbbnfX.js +3 -0
  106. package/dist/admin/assets/content-_SLbbnfX.js.map +1 -0
  107. package/dist/admin/assets/contentCounts-Ch3uMXVU.js +2 -0
  108. package/dist/admin/assets/contentCounts-Ch3uMXVU.js.map +1 -0
  109. package/dist/admin/assets/contentTypes-BCOdUK_Z.js +2 -0
  110. package/dist/admin/assets/contentTypes-BCOdUK_Z.js.map +1 -0
  111. package/dist/admin/assets/copy-BDc3r0fO.js +2 -0
  112. package/dist/admin/assets/copy-BDc3r0fO.js.map +1 -0
  113. package/dist/admin/assets/dateTimeLocal-C92tyKwz.js +2 -0
  114. package/dist/admin/assets/dateTimeLocal-C92tyKwz.js.map +1 -0
  115. package/dist/admin/assets/defineEditor-CiJc766Y.js +2 -0
  116. package/dist/admin/assets/defineEditor-CiJc766Y.js.map +1 -0
  117. package/dist/admin/assets/develop-DS9TlDmv.js +11 -0
  118. package/dist/admin/assets/develop-DS9TlDmv.js.map +1 -0
  119. package/dist/admin/assets/dropdown-menu-gmP2Rp3n.js +2 -0
  120. package/dist/admin/assets/dropdown-menu-gmP2Rp3n.js.map +1 -0
  121. package/dist/admin/assets/ellipsis-NK0pWgqU.js +2 -0
  122. package/dist/admin/assets/ellipsis-NK0pWgqU.js.map +1 -0
  123. package/dist/admin/assets/external-link-D3Aoi2yX.js +2 -0
  124. package/dist/admin/assets/external-link-D3Aoi2yX.js.map +1 -0
  125. package/dist/admin/assets/file-text-DxXAmmxL.js +2 -0
  126. package/dist/admin/assets/file-text-DxXAmmxL.js.map +1 -0
  127. package/dist/admin/assets/fileRoute-C2tOrKhO.js +2 -0
  128. package/dist/admin/assets/fileRoute-C2tOrKhO.js.map +1 -0
  129. package/dist/admin/assets/followPlural-CN6cQfNk.js +2 -0
  130. package/dist/admin/assets/followPlural-CN6cQfNk.js.map +1 -0
  131. package/dist/admin/assets/globe-CuElSilX.js +2 -0
  132. package/dist/admin/assets/globe-CuElSilX.js.map +1 -0
  133. package/dist/admin/assets/image-CsH8dZve.js +2 -0
  134. package/dist/admin/assets/image-CsH8dZve.js.map +1 -0
  135. package/dist/admin/assets/image-off-B_uBCsYu.js +2 -0
  136. package/dist/admin/assets/image-off-B_uBCsYu.js.map +1 -0
  137. package/dist/admin/assets/inbox-3iAHL3pC.js +2 -0
  138. package/dist/admin/assets/inbox-3iAHL3pC.js.map +1 -0
  139. package/dist/admin/assets/inbox-DsuXNaKE.js +2 -0
  140. package/dist/admin/assets/inbox-DsuXNaKE.js.map +1 -0
  141. package/dist/admin/assets/index-BLYOgCKc.css +2 -0
  142. package/dist/admin/assets/index-BSzXA60W.js +4 -0
  143. package/dist/admin/assets/index-BSzXA60W.js.map +1 -0
  144. package/dist/admin/assets/jsx-runtime-DREnUpxT.js +2 -0
  145. package/dist/admin/assets/jsx-runtime-DREnUpxT.js.map +1 -0
  146. package/dist/admin/assets/key-round-B17HiT3K.js +2 -0
  147. package/dist/admin/assets/key-round-B17HiT3K.js.map +1 -0
  148. package/dist/admin/assets/link-2-off-hWGS8LW6.js +2 -0
  149. package/dist/admin/assets/link-2-off-hWGS8LW6.js.map +1 -0
  150. package/dist/admin/assets/link-bhHmG4Tc.js +2 -0
  151. package/dist/admin/assets/link-bhHmG4Tc.js.map +1 -0
  152. package/dist/admin/assets/list-DRtRdjBC.js +2 -0
  153. package/dist/admin/assets/list-DRtRdjBC.js.map +1 -0
  154. package/dist/admin/assets/locales-BzPbz8FF.js +2 -0
  155. package/dist/admin/assets/locales-BzPbz8FF.js.map +1 -0
  156. package/dist/admin/assets/media-WLnWaL7U.js +2 -0
  157. package/dist/admin/assets/media-WLnWaL7U.js.map +1 -0
  158. package/dist/admin/assets/media-Xzot1ueY.js +2 -0
  159. package/dist/admin/assets/media-Xzot1ueY.js.map +1 -0
  160. package/dist/admin/assets/modelPermissions-DZ1lWfQZ.js +2 -0
  161. package/dist/admin/assets/modelPermissions-DZ1lWfQZ.js.map +1 -0
  162. package/dist/admin/assets/network-DHGqLwji.js +2 -0
  163. package/dist/admin/assets/network-DHGqLwji.js.map +1 -0
  164. package/dist/admin/assets/pencil-Bdp2z9D_.js +2 -0
  165. package/dist/admin/assets/pencil-Bdp2z9D_.js.map +1 -0
  166. package/dist/admin/assets/plus-BN_iSsnp.js +2 -0
  167. package/dist/admin/assets/plus-BN_iSsnp.js.map +1 -0
  168. package/dist/admin/assets/preload-helper-DAbCfXID.js +2 -0
  169. package/dist/admin/assets/preload-helper-DAbCfXID.js.map +1 -0
  170. package/dist/admin/assets/publishing-B7zv1e7j.js +2 -0
  171. package/dist/admin/assets/publishing-B7zv1e7j.js.map +1 -0
  172. package/dist/admin/assets/publishing-d9yhMwgA.js +2 -0
  173. package/dist/admin/assets/publishing-d9yhMwgA.js.map +1 -0
  174. package/dist/admin/assets/radio-group-DHIxK-IU.js +2 -0
  175. package/dist/admin/assets/radio-group-DHIxK-IU.js.map +1 -0
  176. package/dist/admin/assets/react-CQOZoUwg.js +2 -0
  177. package/dist/admin/assets/react-CQOZoUwg.js.map +1 -0
  178. package/dist/admin/assets/react-dom-pEVw9mjF.js +2 -0
  179. package/dist/admin/assets/react-dom-pEVw9mjF.js.map +1 -0
  180. package/dist/admin/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
  181. package/dist/admin/assets/root-CDpNo7ef.js +2 -0
  182. package/dist/admin/assets/root-CDpNo7ef.js.map +1 -0
  183. package/dist/admin/assets/rotate-ccw-CBoZle-b.js +2 -0
  184. package/dist/admin/assets/rotate-ccw-CBoZle-b.js.map +1 -0
  185. package/dist/admin/assets/schedules-Dy89Nm6P.js +2 -0
  186. package/dist/admin/assets/schedules-Dy89Nm6P.js.map +1 -0
  187. package/dist/admin/assets/schema-B4smPFcR.js +2 -0
  188. package/dist/admin/assets/schema-B4smPFcR.js.map +1 -0
  189. package/dist/admin/assets/scroll-text-UbyzpWh-.js +2 -0
  190. package/dist/admin/assets/scroll-text-UbyzpWh-.js.map +1 -0
  191. package/dist/admin/assets/search-_YlNpPvU.js +2 -0
  192. package/dist/admin/assets/search-_YlNpPvU.js.map +1 -0
  193. package/dist/admin/assets/searchSchema-CvOhn4FV.js +2 -0
  194. package/dist/admin/assets/searchSchema-CvOhn4FV.js.map +1 -0
  195. package/dist/admin/assets/searchSchemas-BxRnxenn.js +2 -0
  196. package/dist/admin/assets/searchSchemas-BxRnxenn.js.map +1 -0
  197. package/dist/admin/assets/sections-Bb3Q4bcY.js +2 -0
  198. package/dist/admin/assets/sections-Bb3Q4bcY.js.map +1 -0
  199. package/dist/admin/assets/sections-DiySZZHb.js +2 -0
  200. package/dist/admin/assets/sections-DiySZZHb.js.map +1 -0
  201. package/dist/admin/assets/select-tHVWX85X.js +2 -0
  202. package/dist/admin/assets/select-tHVWX85X.js.map +1 -0
  203. package/dist/admin/assets/send-BqECHYi6.js +2 -0
  204. package/dist/admin/assets/send-BqECHYi6.js.map +1 -0
  205. package/dist/admin/assets/settings-D-v8gL8F.js +2 -0
  206. package/dist/admin/assets/settings-D-v8gL8F.js.map +1 -0
  207. package/dist/admin/assets/settle-LRKtTN_e.js +2 -0
  208. package/dist/admin/assets/settle-LRKtTN_e.js.map +1 -0
  209. package/dist/admin/assets/shared-react-KADNSNpb.js +1 -0
  210. package/dist/admin/assets/shared-react-dom-BpneAejY.js +1 -0
  211. package/dist/admin/assets/shared-react-dom-client-CnpZTXxo.js +1 -0
  212. package/dist/admin/assets/shared-react-jsx-runtime-CU_Fm1m8.js +1 -0
  213. package/dist/admin/assets/shared-shapio-editor-sdk-9ANIbEN0.js +1 -0
  214. package/dist/admin/assets/sites-C6_THCVK.js +2 -0
  215. package/dist/admin/assets/sites-C6_THCVK.js.map +1 -0
  216. package/dist/admin/assets/skeleton-C3QLIh7W.js +42 -0
  217. package/dist/admin/assets/skeleton-C3QLIh7W.js.map +1 -0
  218. package/dist/admin/assets/snapshots-BQrhsCmC.js +2 -0
  219. package/dist/admin/assets/snapshots-BQrhsCmC.js.map +1 -0
  220. package/dist/admin/assets/sparkles-BW4CbD6W.js +2 -0
  221. package/dist/admin/assets/sparkles-BW4CbD6W.js.map +1 -0
  222. package/dist/admin/assets/src-XaU0N8C-.js +4 -0
  223. package/dist/admin/assets/src-XaU0N8C-.js.map +1 -0
  224. package/dist/admin/assets/stableId-C9Yq5iUw.js +2 -0
  225. package/dist/admin/assets/stableId-C9Yq5iUw.js.map +1 -0
  226. package/dist/admin/assets/store-BphwUzV5.js +2 -0
  227. package/dist/admin/assets/store-BphwUzV5.js.map +1 -0
  228. package/dist/admin/assets/switch-BVy02Vc8.js +2 -0
  229. package/dist/admin/assets/switch-BVy02Vc8.js.map +1 -0
  230. package/dist/admin/assets/table-CZYtdoHn.js +56 -0
  231. package/dist/admin/assets/table-CZYtdoHn.js.map +1 -0
  232. package/dist/admin/assets/tabs-quHbeVxA.js +5 -0
  233. package/dist/admin/assets/tabs-quHbeVxA.js.map +1 -0
  234. package/dist/admin/assets/textarea-B8Vl5gJ1.js +2 -0
  235. package/dist/admin/assets/textarea-B8Vl5gJ1.js.map +1 -0
  236. package/dist/admin/assets/titles-B2z5ckxG.js +2 -0
  237. package/dist/admin/assets/titles-B2z5ckxG.js.map +1 -0
  238. package/dist/admin/assets/tokens-Fh_OeIlf.js +2 -0
  239. package/dist/admin/assets/tokens-Fh_OeIlf.js.map +1 -0
  240. package/dist/admin/assets/tooltip-DwqM3opE.js +2 -0
  241. package/dist/admin/assets/tooltip-DwqM3opE.js.map +1 -0
  242. package/dist/admin/assets/undo-2-D4Fz4JMZ.js +2 -0
  243. package/dist/admin/assets/undo-2-D4Fz4JMZ.js.map +1 -0
  244. package/dist/admin/assets/useAuditLabels-DKrsrciQ.js +2 -0
  245. package/dist/admin/assets/useAuditLabels-DKrsrciQ.js.map +1 -0
  246. package/dist/admin/assets/useConfirmTarget-Dp8mCulm.js +2 -0
  247. package/dist/admin/assets/useConfirmTarget-Dp8mCulm.js.map +1 -0
  248. package/dist/admin/assets/useContentSchema-Bv4_6VJR.js +2 -0
  249. package/dist/admin/assets/useContentSchema-Bv4_6VJR.js.map +1 -0
  250. package/dist/admin/assets/useCursorPager-B1upg5EU.js +2 -0
  251. package/dist/admin/assets/useCursorPager-B1upg5EU.js.map +1 -0
  252. package/dist/admin/assets/useDebouncedValue-Dqs3wwhn.js +2 -0
  253. package/dist/admin/assets/useDebouncedValue-Dqs3wwhn.js.map +1 -0
  254. package/dist/admin/assets/useDiscardGuard-34ynGJIk.js +2 -0
  255. package/dist/admin/assets/useDiscardGuard-34ynGJIk.js.map +1 -0
  256. package/dist/admin/assets/useMediaUploader-QXSjZStv.js +2 -0
  257. package/dist/admin/assets/useMediaUploader-QXSjZStv.js.map +1 -0
  258. package/dist/admin/assets/usePaletteItems-62-TZhy7.js +2 -0
  259. package/dist/admin/assets/usePaletteItems-62-TZhy7.js.map +1 -0
  260. package/dist/admin/assets/usePlaces-CY6f2DmI.js +2 -0
  261. package/dist/admin/assets/usePlaces-CY6f2DmI.js.map +1 -0
  262. package/dist/admin/assets/useQueries-BuKJBA0M.js +2 -0
  263. package/dist/admin/assets/useQueries-BuKJBA0M.js.map +1 -0
  264. package/dist/admin/assets/useSaveShortcut-rKtp1qK7.js +2 -0
  265. package/dist/admin/assets/useSaveShortcut-rKtp1qK7.js.map +1 -0
  266. package/dist/admin/assets/useSchemaScopeAccess-DUBeS9kU.js +2 -0
  267. package/dist/admin/assets/useSchemaScopeAccess-DUBeS9kU.js.map +1 -0
  268. package/dist/admin/assets/useSearchInput-1fDoEtXe.js +2 -0
  269. package/dist/admin/assets/useSearchInput-1fDoEtXe.js.map +1 -0
  270. package/dist/admin/assets/users-BOn2ohJQ.js +2 -0
  271. package/dist/admin/assets/users-BOn2ohJQ.js.map +1 -0
  272. package/dist/admin/assets/users-BkKc4MNB.js +2 -0
  273. package/dist/admin/assets/users-BkKc4MNB.js.map +1 -0
  274. package/dist/admin/assets/w3c-keyname-BOAvb0qz.js +2 -0
  275. package/dist/admin/assets/w3c-keyname-BOAvb0qz.js.map +1 -0
  276. package/dist/admin/assets/zod-BHAd1wTC.js +2 -0
  277. package/dist/admin/assets/zod-BHAd1wTC.js.map +1 -0
  278. package/dist/admin/favicon-32.png +0 -0
  279. package/dist/admin/favicon.svg +5 -0
  280. package/dist/admin/fonts/OFL-SourceSerif4.txt +93 -0
  281. package/dist/admin/fonts/OFL.txt +93 -0
  282. package/dist/admin/fonts/manrope-latin-ext-wght-normal.woff2 +0 -0
  283. package/dist/admin/fonts/manrope-latin-wght-normal.woff2 +0 -0
  284. package/dist/admin/fonts/source-serif-4-latin-ext-wght-italic.woff2 +0 -0
  285. package/dist/admin/fonts/source-serif-4-latin-ext-wght-normal.woff2 +0 -0
  286. package/dist/admin/fonts/source-serif-4-latin-wght-italic.woff2 +0 -0
  287. package/dist/admin/fonts/source-serif-4-latin-wght-normal.woff2 +0 -0
  288. package/dist/admin/index.html +90 -0
  289. package/dist/admin/theme-init.js +18 -0
  290. package/dist/cli.js +5383 -0
  291. package/dist/cli.js.map +1 -0
  292. package/dist/config.d.ts +2 -0
  293. package/dist/config.js +39 -0
  294. package/dist/config.js.map +1 -0
  295. package/dist/index.d.ts +1056 -0
  296. package/dist/index.js +3 -0
  297. package/dist/public-CGO8RBn3.d.ts +1185 -0
  298. package/dist/worker-BLXy8aRW.js +47532 -0
  299. package/dist/worker-BLXy8aRW.js.map +1 -0
  300. package/package.json +97 -3
  301. package/vendor/graphiql/LICENSE.graphiql +21 -0
  302. package/vendor/graphiql/LICENSE.react +21 -0
  303. package/vendor/graphiql/LICENSE.react-dom +21 -0
  304. package/vendor/graphiql/graphiql.min.css +1 -0
  305. package/vendor/graphiql/graphiql.min.js +46 -0
  306. package/vendor/graphiql/react-dom.production.min.js +267 -0
  307. package/vendor/graphiql/react.production.min.js +31 -0
@@ -0,0 +1,2 @@
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{H as n,P as r,l as i}from"./cn-BQ3voEft.js";var a=e(t(),1),o=6e4,s=()=>{let e=n({queryKey:r.contentCounts,queryFn:()=>i.contentCounts.list(),staleTime:o,meta:{silent:!0}});return(0,a.useMemo)(()=>e.data?new Map(e.data.counts.map(e=>[e.modelId,e.total])):void 0,[e.data])};export{s as t};
2
+ //# sourceMappingURL=contentCounts-Ch3uMXVU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contentCounts-Ch3uMXVU.js","names":["useMemo","__toESM","useQuery","queryKeys","adminApi","import_react","require_react","COUNTS_STALE_MS","useContentCounts","query","count"],"sources":["../../src/api/contentCounts.ts"],"sourcesContent":["import { useQuery } from '@tanstack/react-query';\nimport { useMemo } from 'react';\nimport { adminApi } from './client';\nimport { queryKeys } from './queryKeys';\n\n/** The server caches counts for 60s; asking more often would only return the same numbers. */\nconst COUNTS_STALE_MS = 60_000;\n\n/** Entries per model (readable models only), keyed by model ID; undefined while loading or on failure. */\nexport const useContentCounts = () => {\n const query = useQuery({\n queryKey: queryKeys.contentCounts,\n queryFn: () => adminApi.contentCounts.list(),\n staleTime: COUNTS_STALE_MS,\n meta: { silent: true },\n });\n return useMemo(\n () =>\n query.data\n ? new Map(query.data.counts.map((count) => [count.modelId, count.total] as const))\n : undefined,\n [query.data],\n );\n};\n"],"mappings":"wJAMMO,EAAkB,IAGXC,MAAyB,CACpC,IAAMC,EAAQP,EAAS,CACrB,SAAUC,EAAU,cACpB,YAAeC,EAAS,cAAc,KAAK,EAC3C,UAAWG,EACX,KAAM,CAAE,OAAQ,EAAK,CACvB,CAAC,EACD,OAAA,EAAOP,EAAAA,QAAAA,KAEHS,EAAM,KACF,IAAI,IAAIA,EAAM,KAAK,OAAO,IAAK,GAAU,CAACC,EAAM,QAASA,EAAM,KAAK,CAAU,CAAC,EAC/E,IAAA,GACN,CAACD,EAAM,IAAI,CACb,CACF"}
@@ -0,0 +1,2 @@
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{t as n}from"./jsx-runtime-DREnUpxT.js";import{j as r}from"./cn-BQ3voEft.js";import{C as i,T as a,o,x as s}from"./auth-pcS9CCXu.js";import{_ as c,a as l,i as u,j as d,o as f,t as p}from"./badge-DD0mE96i.js";import{t as m}from"./fileRoute-C2tOrKhO.js";import{i as h}from"./skeleton-C3QLIh7W.js";import{n as g,t as _}from"./Form-DZRLD3vH.js";import{a as v,d as y}from"./constants-SrImR6C3.js";import{t as b}from"./Builder-DcpRfXuc.js";import{t as x}from"./plus-BN_iSsnp.js";import{u as S}from"./changeSets-BjUEfYbj.js";import{t as C}from"./HintedLabel-CvC46uy_.js";import{s as w}from"./schema-B4smPFcR.js";import{t as T}from"./QueryView-D6aZQJRN.js";import{t as E}from"./textarea-B8Vl5gJ1.js";import{c as D,g as O,i as k,r as A,t as j}from"./AssistError-BITJ_tpg.js";import{t as M}from"./Panel-iIKjEURi.js";import{a as N,i as P}from"./followPlural-CN6cQfNk.js";var F=e(n(),1),I=()=>{let{t:e}=r(),t=w(`component`),n=o(`schema.create`),{locked:i,reason:a}=N(),c=n&&!i?(0,F.jsx)(h,{asChild:!0,children:(0,F.jsxs)(s,{to:`/develop/components/new`,children:[(0,F.jsx)(x,{"aria-hidden":`true`}),e(`contentTypes.newComponentTitle`)]})}):null;return(0,F.jsxs)(l,{children:[(0,F.jsx)(u,{title:e(`shell.nav.components`),actions:c}),i?(0,F.jsx)(P,{reason:a}):null,(0,F.jsx)(T,{query:t,isEmpty:e=>e.length===0,empty:(0,F.jsx)(f,{icon:y,title:e(`contentTypes.noComponents`),description:e(`models.emptyDescription`),action:c}),children:e=>(0,F.jsx)(g,{items:e})})]})},L=()=>{let{componentId:e}=d({from:`/app/develop/components/$componentId`});return(0,F.jsx)(b,{category:`component`,id:e})},R=[`component`],z=()=>{let{t:e}=r();return(0,F.jsx)(_,{title:e(`contentTypes.newComponentTitle`),kinds:R,back:i({to:`/develop/components`}),backLabel:e(`shell.nav.components`)})},B=e(t(),1),V=()=>{let{t:e}=r(),t=a(),[n,i]=(0,B.useState)(``),[o,s]=(0,B.useState)(null),c=D(),l=S();return{description:n,setDescription:i,proposal:o,run:()=>{n.trim()!==``&&(s(null),l.reset(),c.mutate({description:n.trim()},{onSuccess:s}))},discard:()=>{s(null),c.reset(),l.reset()},addToChangeSet:()=>{o&&l.mutate({definitions:o.definitions,newSetTitle:e(`assist.describe.setTitle`,{model:o.model})},{onSuccess:e=>void t({to:`/changes/$changeSetId`,params:{changeSetId:e}})})},proposing:c.isPending,proposeError:c.error,adding:l.isPending,addError:l.error}},H=({proposal:e})=>{let{t}=r();return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsx)(`p`,{className:`text-meta text-muted-foreground`,children:t(`assist.describe.proposedBy`,{model:e.model})}),(0,F.jsx)(`ul`,{"aria-label":t(`assist.describe.proposalLabel`),className:`space-y-3`,children:e.definitions.map(e=>(0,F.jsxs)(`li`,{className:`rounded-lg border p-3`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-sm font-semibold`,children:e.label}),(0,F.jsx)(p,{variant:`secondary`,children:t(v[e.kind])}),(0,F.jsx)(`span`,{className:`font-mono text-meta text-muted-foreground`,children:e.apiKey})]}),(0,F.jsx)(`ul`,{className:`mt-2 space-y-0.5 text-meta text-muted-foreground`,children:e.fields.map(e=>(0,F.jsxs)(`li`,{children:[(0,F.jsx)(`span`,{className:`text-foreground`,children:e.label}),` `,t(`assist.describe.fieldType`,{type:t(`models.dataTypes.${e.type}.name`)})]},e.id))})]},e.id))})]})},U=()=>{let{t:e}=r(),t=(0,B.useId)(),n=k(),{locked:i}=N(),a=V();return n?(0,F.jsx)(M,{title:e(`assist.describe.title`),titleAs:`h2`,children:(0,F.jsx)(`div`,{className:`space-y-3`,children:a.proposal?(0,F.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),a.addToChangeSet()},children:[(0,F.jsx)(H,{proposal:a.proposal}),(0,F.jsx)(j,{error:a.addError}),(0,F.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,F.jsx)(h,{type:`button`,variant:`outline`,onClick:a.discard,children:e(`assist.discard`)}),(0,F.jsx)(c,{pending:a.adding,pendingLabel:e(`common.saving`),disabled:i,children:e(`assist.describe.add`)})]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(C,{htmlFor:`${t}-description`,label:e(`assist.describe.label`),hint:e(`assist.describe.hint`)}),(0,F.jsx)(E,{id:`${t}-description`,value:a.description,rows:4,maxLength:O,placeholder:e(`assist.describe.placeholder`),disabled:a.proposing,onChange:e=>a.setDescription(e.target.value)})]}),(0,F.jsx)(j,{error:a.proposeError}),(0,F.jsx)(`div`,{className:`flex justify-end`,children:(0,F.jsx)(A,{variant:`outline`,size:`default`,pending:a.proposing,pendingLabel:e(`assist.working`),disabled:a.description.trim()===``||i,onClick:a.run,children:e(`assist.describe.run`)})})]})})}):null},W=[`collection`,`singleton`],G={newContentType:m(`/app/content/new`)({component:()=>{let{t:e}=r();return(0,F.jsx)(_,{title:e(`contentTypes.newTitle`),kinds:W,back:i({to:`/content`}),backLabel:e(`content.title`),intro:(0,F.jsx)(U,{})})}}),components:m(`/app/develop/components`)({component:I}),newComponent:m(`/app/develop/components/new`)({component:z}),component:m(`/app/develop/components/$componentId`)({component:L})};export{G as contentTypesLazyRoutes};
2
+ //# sourceMappingURL=contentTypes-BCOdUK_Z.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contentTypes-BCOdUK_Z.js","names":["DefinitionBuilder","KINDS","New","useState","useId","_Fragment","NewContentType","NewComponent","ComponentBuilder","__toESM","require_jsx_runtime","useTranslation","linkOptions","useNavigate","Link","SubmitButton","Page","PageHeader","useParams","EmptyState","Badge","createLazyRoute","Button","List","Form","KIND_LABEL_KEYS","Blocks","Builder$1","Plus","useSaveNewDefinitionsToChangeSet","HintedLabel","useDefinitions","QueryView","Textarea","useProposeSchema","SCHEMA_DESCRIPTION_MAX","useAssistEnabled","AssistButton","AssistError","Panel","useSchemaLock","LockNotice","import_jsx_runtime","Components","components","canCreate","useHasGlobalPermission","createAction","locked","t","data","Builder","componentId","KINDS$1","New$1","import_react","require_react","useDescribeSchema","navigate","description","setDescription","proposal","setProposal","propose","save","Proposal","definition","field","Describe","id","enabled","describe","event","KINDS","contentTypesLazyRoutes"],"sources":["../../src/features/Components/index.tsx","../../src/features/Components/Builder/index.tsx","../../src/features/Components/New/index.tsx","../../src/features/Content/New/hooks/useDescribeSchema.ts","../../src/features/Content/New/Describe/Proposal/index.tsx","../../src/features/Content/New/Describe/index.tsx","../../src/features/Content/New/index.tsx","../../src/app/lazyRoutes/contentTypes.tsx"],"sourcesContent":["import { Link } from '@tanstack/react-router';\nimport { Blocks, Plus } from 'lucide-react';\nimport { useTranslation } from 'react-i18next';\nimport { useHasGlobalPermission } from '@/api/auth';\nimport { useDefinitions } from '@/api/schema';\nimport { EmptyState } from '@/components/EmptyState';\nimport { Page } from '@/components/Page';\nimport { PageHeader } from '@/components/PageHeader';\nimport { QueryView } from '@/components/QueryView';\nimport { Button } from '@/components/ui/button';\nimport { useSchemaLock } from '@/features/Models/hooks/useSchemaLock';\nimport { List } from '@/features/Models/List';\nimport { LockNotice } from '@/features/Models/LockNotice';\n\n/** `/develop/components`: reusable field groups that content types embed (Develop → Components). */\nexport const Components = () => {\n const { t } = useTranslation();\n const components = useDefinitions('component');\n const canCreate = useHasGlobalPermission('schema.create');\n const { locked, reason } = useSchemaLock();\n const createAction =\n canCreate && !locked ? (\n <Button asChild>\n <Link to=\"/develop/components/new\">\n <Plus aria-hidden=\"true\" />\n {t('contentTypes.newComponentTitle')}\n </Link>\n </Button>\n ) : null;\n return (\n <Page>\n <PageHeader title={t('shell.nav.components')} actions={createAction} />\n {locked ? <LockNotice reason={reason} /> : null}\n <QueryView\n query={components}\n isEmpty={(data) => data.length === 0}\n empty={\n <EmptyState\n icon={Blocks}\n title={t('contentTypes.noComponents')}\n description={t('models.emptyDescription')}\n action={createAction}\n />\n }\n >\n {(data) => <List items={data} />}\n </QueryView>\n </Page>\n );\n};\n","import { useParams } from '@tanstack/react-router';\nimport { Builder as DefinitionBuilder } from '@/features/Models/Builder';\n\n/** `/develop/components/:componentId`: a component in the shared definition builder. */\nexport const Builder = () => {\n const { componentId } = useParams({ from: '/app/develop/components/$componentId' });\n return <DefinitionBuilder category=\"component\" id={componentId} />;\n};\n","import { linkOptions } from '@tanstack/react-router';\nimport { useTranslation } from 'react-i18next';\nimport { Form } from '@/features/Content/New/Form';\n\nconst KINDS = ['component'] as const;\n\n/** `/develop/components/new`: a reusable component (Develop → Components). */\nexport const New = () => {\n const { t } = useTranslation();\n return (\n <Form\n title={t('contentTypes.newComponentTitle')}\n kinds={KINDS}\n back={linkOptions({ to: '/develop/components' })}\n backLabel={t('shell.nav.components')}\n />\n );\n};\n","import type { SchemaDraftResult } from '@shapio/client';\nimport { useNavigate } from '@tanstack/react-router';\nimport { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useProposeSchema } from '@/api/assist';\nimport { useSaveNewDefinitionsToChangeSet } from '@/api/changeSets';\n\n/**\n * \"Describe it\": a description → proposed definitions (nothing written) → saved as schema drafts into a\n * change set, whose review opens next. Shipping them stays a person's decision there.\n */\nexport const useDescribeSchema = () => {\n const { t } = useTranslation();\n const navigate = useNavigate();\n const [description, setDescription] = useState('');\n const [proposal, setProposal] = useState<SchemaDraftResult | null>(null);\n const propose = useProposeSchema();\n const save = useSaveNewDefinitionsToChangeSet();\n const run = () => {\n if (description.trim() === '') {\n return;\n }\n setProposal(null);\n save.reset();\n propose.mutate({ description: description.trim() }, { onSuccess: setProposal });\n };\n const discard = () => {\n setProposal(null);\n propose.reset();\n save.reset();\n };\n const addToChangeSet = () => {\n if (!proposal) {\n return;\n }\n save.mutate(\n {\n definitions: proposal.definitions,\n newSetTitle: t('assist.describe.setTitle', { model: proposal.model }),\n },\n {\n onSuccess: (changeSetId) => void navigate({ to: '/changes/$changeSetId', params: { changeSetId } }),\n },\n );\n };\n return {\n description,\n setDescription,\n proposal,\n run,\n discard,\n addToChangeSet,\n proposing: propose.isPending,\n proposeError: propose.error,\n adding: save.isPending,\n addError: save.error,\n };\n};\n","import type { SchemaDraftResult } from '@shapio/client';\nimport { useTranslation } from 'react-i18next';\nimport { Badge } from '@/components/ui/badge';\nimport { KIND_LABEL_KEYS } from '@/features/Models/constants';\n\ntype ProposalProps = { proposal: SchemaDraftResult };\n\n/** The proposed definitions at a glance: name, kind, API ID and fields, before they go into a change set. */\nexport const Proposal = ({ proposal }: ProposalProps) => {\n const { t } = useTranslation();\n return (\n <div className=\"space-y-3\">\n <p className=\"text-meta text-muted-foreground\">\n {t('assist.describe.proposedBy', { model: proposal.model })}\n </p>\n <ul aria-label={t('assist.describe.proposalLabel')} className=\"space-y-3\">\n {proposal.definitions.map((definition) => (\n <li key={definition.id} className=\"rounded-lg border p-3\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"text-sm font-semibold\">{definition.label}</span>\n <Badge variant=\"secondary\">{t(KIND_LABEL_KEYS[definition.kind])}</Badge>\n <span className=\"font-mono text-meta text-muted-foreground\">{definition.apiKey}</span>\n </div>\n <ul className=\"mt-2 space-y-0.5 text-meta text-muted-foreground\">\n {definition.fields.map((field) => (\n <li key={field.id}>\n <span className=\"text-foreground\">{field.label}</span>{' '}\n {t('assist.describe.fieldType', { type: t(`models.dataTypes.${field.type}.name`) })}\n </li>\n ))}\n </ul>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n","import { useId } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useAssistEnabled } from '@/api/assist';\nimport { AssistButton } from '@/components/AssistButton';\nimport { AssistError } from '@/components/AssistError';\nimport { HintedLabel } from '@/components/HintedLabel';\nimport { Panel } from '@/components/Panel';\nimport { SubmitButton } from '@/components/SubmitButton';\nimport { Button } from '@/components/ui/button';\nimport { Textarea } from '@/components/ui/textarea';\nimport { SCHEMA_DESCRIPTION_MAX } from '@/constants/assist';\nimport { useSchemaLock } from '@/features/Models/hooks/useSchemaLock';\nimport { useDescribeSchema } from '../hooks/useDescribeSchema';\nimport { Proposal } from './Proposal';\n\n/** \"Describe it\" above the new content type form: a model proposes the types, a change set holds them. */\nexport const Describe = () => {\n const { t } = useTranslation();\n const id = useId();\n const enabled = useAssistEnabled();\n const { locked } = useSchemaLock();\n const describe = useDescribeSchema();\n if (!enabled) {\n return null;\n }\n return (\n <Panel title={t('assist.describe.title')} titleAs=\"h2\">\n <div className=\"space-y-3\">\n {describe.proposal ? (\n <form\n className=\"space-y-3\"\n onSubmit={(event) => {\n event.preventDefault();\n describe.addToChangeSet();\n }}\n >\n <Proposal proposal={describe.proposal} />\n <AssistError error={describe.addError} />\n <div className=\"flex flex-wrap justify-end gap-2\">\n <Button type=\"button\" variant=\"outline\" onClick={describe.discard}>\n {t('assist.discard')}\n </Button>\n <SubmitButton pending={describe.adding} pendingLabel={t('common.saving')} disabled={locked}>\n {t('assist.describe.add')}\n </SubmitButton>\n </div>\n </form>\n ) : (\n <>\n <div className=\"space-y-2\">\n <HintedLabel\n htmlFor={`${id}-description`}\n label={t('assist.describe.label')}\n hint={t('assist.describe.hint')}\n />\n <Textarea\n id={`${id}-description`}\n value={describe.description}\n rows={4}\n maxLength={SCHEMA_DESCRIPTION_MAX}\n placeholder={t('assist.describe.placeholder')}\n disabled={describe.proposing}\n onChange={(event) => describe.setDescription(event.target.value)}\n />\n </div>\n <AssistError error={describe.proposeError} />\n <div className=\"flex justify-end\">\n <AssistButton\n variant=\"outline\"\n size=\"default\"\n pending={describe.proposing}\n pendingLabel={t('assist.working')}\n disabled={describe.description.trim() === '' || locked}\n onClick={describe.run}\n >\n {t('assist.describe.run')}\n </AssistButton>\n </div>\n </>\n )}\n </div>\n </Panel>\n );\n};\n","import { linkOptions } from '@tanstack/react-router';\nimport { useTranslation } from 'react-i18next';\nimport { Describe } from './Describe';\nimport { Form } from './Form';\n\nconst KINDS = ['collection', 'singleton'] as const;\n\n/** `/content/new`: a new content type (a place for editors), live as soon as it is created. */\nexport const New = () => {\n const { t } = useTranslation();\n return (\n <Form\n title={t('contentTypes.newTitle')}\n kinds={KINDS}\n back={linkOptions({ to: '/content' })}\n backLabel={t('content.title')}\n intro={<Describe />}\n />\n );\n};\n","import { createLazyRoute } from '@tanstack/react-router';\nimport { Components } from '@/features/Components';\nimport { Builder as ComponentBuilder } from '@/features/Components/Builder';\nimport { New as NewComponent } from '@/features/Components/New';\nimport { New as NewContentType } from '@/features/Content/New';\n\n/** Creating content types and components, and Develop → Components (with @shapio/schema's validators). */\nexport const contentTypesLazyRoutes = {\n newContentType: createLazyRoute('/app/content/new')({ component: NewContentType }),\n components: createLazyRoute('/app/develop/components')({ component: Components }),\n newComponent: createLazyRoute('/app/develop/components/new')({ component: NewComponent }),\n component: createLazyRoute('/app/develop/components/$componentId')({ component: ComponentBuilder }),\n};\n"],"mappings":"s8BAea2C,MAAmB,CAC9B,GAAM,CAAE,KAAMhC,EAAe,EACvBiC,EAAab,EAAe,WAAW,EACvCc,EAAYC,EAAuB,eAAe,EAClD,CAAE,SAAQ,UAAWN,EAAc,EACnCO,EACJF,GAAa,CAACG,GACZ,EAAAN,EAAA,IAAA,CAACpB,EAAD,CAAQ,QAAA,GACN,UAAA,EAAAoB,EAAA,KAAA,CAAC5B,EAAD,CAAM,GAAG,0BAAT,SAAA,EACE,EAAA4B,EAAA,IAAA,CAACd,EAAD,CAAM,cAAY,MAAQ,CAAA,EACzBqB,EAAE,gCAAgC,CAC/B,GACA,CAAA,EACN,KACN,OACE,EAAAP,EAAA,KAAA,CAAC1B,EAAD,CAAA,SAAA,EACE,EAAA0B,EAAA,IAAA,CAACzB,EAAD,CAAY,MAAOgC,EAAE,sBAAsB,EAAG,QAASF,CAAe,CAAA,EACrEC,GAAS,EAAAN,EAAA,IAAA,CAACD,EAAD,CAAoB,QAAS,CAAA,EAAI,MAC3C,EAAAC,EAAA,IAAA,CAACV,EAAD,CACE,MAAOY,EACP,QAAU,GAASM,EAAK,SAAW,EACnC,OACE,EAAAR,EAAA,IAAA,CAACvB,EAAD,CACE,KAAMO,EACN,MAAOuB,EAAE,2BAA2B,EACpC,YAAaA,EAAE,yBAAyB,EACxC,OAAQF,CACT,CAAA,EAGD,SAAA,IAAS,EAAAL,EAAA,IAAA,CAACnB,EAAD,CAAM,MAAO2B,CAAO,CAAA,CACtB,CAAA,CACP,CAAA,CAAA,CAEV,EC7CaC,MAAgB,CAC3B,GAAM,CAAE,eAAgBjC,EAAU,CAAE,KAAM,sCAAuC,CAAC,EAClF,OAAO,EAAAwB,EAAA,IAAA,CAAC1C,EAAD,CAAmB,SAAS,YAAY,GAAIoD,CAAc,CAAA,CACnE,ECHMnD,EAAQ,CAAC,WAAW,EAGbC,MAAY,CACvB,GAAM,CAAE,KAAMS,EAAe,EAC7B,OACE,EAAA+B,EAAA,IAAA,CAAClB,EAAD,CACE,MAAOyB,EAAE,gCAAgC,EACzC,MAAOhD,EACP,KAAMW,EAAY,CAAE,GAAI,qBAAsB,CAAC,EAC/C,UAAWqC,EAAE,sBAAsB,CACpC,CAAA,CAEL,aCNaQ,MAA0B,CACrC,GAAM,CAAE,KAAM9C,EAAe,EACvB+C,EAAW7C,EAAY,EACvB,CAAC8C,EAAaC,IAAA,EAAkBzD,EAAAA,SAAAA,CAAS,EAAE,EAC3C,CAAC0D,EAAUC,IAAA,EAAe3D,EAAAA,SAAAA,CAAmC,IAAI,EACjE4D,EAAU7B,EAAiB,EAC3B8B,EAAOnC,EAAiC,EA4B9C,MAAO,CACL,cACA,iBACA,WACA,QA/BgB,CACZ8B,EAAY,KAAK,IAAM,KAG3BG,EAAY,IAAI,EAChBE,EAAK,MAAM,EACXD,EAAQ,OAAO,CAAE,YAAaJ,EAAY,KAAK,CAAE,EAAG,CAAE,UAAWG,CAAY,CAAC,EAChF,EAyBE,YAxBoB,CACpBA,EAAY,IAAI,EAChBC,EAAQ,MAAM,EACdC,EAAK,MAAM,CACb,EAqBE,mBApB2B,CACtBH,GAGLG,EAAK,OACH,CACE,YAAaH,EAAS,YACtB,YAAaZ,EAAE,2BAA4B,CAAE,MAAOY,EAAS,KAAM,CAAC,CACtE,EACA,CACE,UAAY,GAAgB,KAAKH,EAAS,CAAE,GAAI,wBAAyB,OAAQ,CAAE,aAAY,CAAE,CAAC,CACpG,CACF,CACF,EAQE,UAAWK,EAAQ,UACnB,aAAcA,EAAQ,MACtB,OAAQC,EAAK,UACb,SAAUA,EAAK,KACjB,CACF,ECjDaC,GAAY,CAAE,cAA8B,CACvD,GAAM,CAAE,GAAMtD,EAAe,EAC7B,OACE,EAAA+B,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,YAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,IAAD,CAAG,UAAU,kCACV,SAAA,EAAE,6BAA8B,CAAE,MAAOmB,EAAS,KAAM,CAAC,CACzD,CAAA,GACH,EAAAnB,EAAA,IAAA,CAAC,KAAD,CAAI,aAAY,EAAE,+BAA+B,EAAG,UAAU,YAC3D,SAAAmB,EAAS,YAAY,IAAK,IACzB,EAAAnB,EAAA,KAAA,CAAC,KAAD,CAAwB,UAAU,wBAAlC,SAAA,EACE,EAAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,oCAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,wBAAyB,SAAAwB,EAAW,KAAY,CAAA,GAChE,EAAAxB,EAAA,IAAA,CAACtB,EAAD,CAAO,QAAQ,YAAa,SAAA,EAAEK,EAAgByC,EAAW,KAAK,CAAS,CAAA,GACvE,EAAAxB,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,4CAA6C,SAAAwB,EAAW,MAAa,CAAA,CAClF,CACL,CAAA,GAAA,EAAAxB,EAAA,IAAA,CAAC,KAAD,CAAI,UAAU,mDACX,SAAAwB,EAAW,OAAO,IAAK,IACtB,EAAAxB,EAAA,KAAA,CAAC,KAAD,CAAA,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,kBAAmB,SAAAyB,EAAM,KAAY,CAAA,EAAE,IACtD,EAAE,4BAA6B,CAAE,KAAM,EAAE,oBAAoBA,EAAM,KAAK,MAAM,CAAE,CAAC,CAChF,CAAA,EAHKA,EAAM,EAGX,CACL,CACC,CAAA,CACF,CAdK,EAAAD,EAAW,EAchB,CACL,CACC,CAAA,CACD,GAET,ECpBaE,MAAiB,CAC5B,GAAM,CAAE,KAAMzD,EAAe,EACvB0D,GAAA,EAAKjE,EAAAA,MAAAA,CAAM,EACXkE,EAAUlC,EAAiB,EAC3B,CAAE,UAAWI,EAAc,EAC3B+B,EAAWd,EAAkB,EAInC,OAHKa,GAIH,EAAA5B,EAAA,IAAA,CAACH,EAAD,CAAO,MAAOU,EAAE,uBAAuB,EAAG,QAAQ,KAChD,UAAA,EAAAP,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,YACZ,SAAA6B,EAAS,UACR,EAAA7B,EAAA,KAAA,CAAC,OAAD,CACE,UAAU,YACV,SAAW,GAAU,CACnB8B,EAAM,eAAe,EACrBD,EAAS,eAAe,CAC1B,EALF,SAAA,EAOE,EAAA7B,EAAA,IAAA,CAACuB,EAAD,CAAU,SAAUM,EAAS,QAAW,CAAA,GACxC,EAAA7B,EAAA,IAAA,CAACJ,EAAD,CAAa,MAAOiC,EAAS,QAAW,CAAA,GACxC,EAAA7B,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,mCAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAACpB,EAAD,CAAQ,KAAK,SAAS,QAAQ,UAAU,QAASiD,EAAS,QACvD,SAAAtB,EAAE,gBAAgB,CACb,CAAA,GACR,EAAAP,EAAA,IAAA,CAAC3B,EAAD,CAAc,QAASwD,EAAS,OAAQ,aAActB,EAAE,eAAe,EAAG,SAAUD,EACjF,SAAAC,EAAE,qBAAqB,CACZ,CAAA,CACX,GACD,CAEN,CAAA,GAAA,EAAAP,EAAA,KAAA,CAAArC,EAAAA,SAAA,CAAA,SAAA,EACE,EAAAqC,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,YAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAACZ,EAAD,CACE,QAAS,GAAGuC,EAAG,cACf,MAAOpB,EAAE,uBAAuB,EAChC,KAAMA,EAAE,sBAAsB,CAC/B,CAAA,GACD,EAAAP,EAAA,IAAA,CAACT,EAAD,CACE,GAAI,GAAGoC,EAAG,cACV,MAAOE,EAAS,YAChB,KAAM,EACN,UAAWpC,EACX,YAAac,EAAE,6BAA6B,EAC5C,SAAUsB,EAAS,UACnB,SAAW,GAAUA,EAAS,eAAeC,EAAM,OAAO,KAAK,CAChE,CAAA,CACE,KACL,EAAA9B,EAAA,IAAA,CAACJ,EAAD,CAAa,MAAOiC,EAAS,YAAe,CAAA,GAC5C,EAAA7B,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,mBACb,UAAA,EAAAA,EAAA,IAAA,CAACL,EAAD,CACE,QAAQ,UACR,KAAK,UACL,QAASkC,EAAS,UAClB,aAActB,EAAE,gBAAgB,EAChC,SAAUsB,EAAS,YAAY,KAAK,IAAM,IAAMvB,EAChD,QAASuB,EAAS,IAEjB,SAAAtB,EAAE,qBAAqB,CACZ,CAAA,CACX,CAAA,CACL,CAAA,CAAA,CAED,CAAA,CACA,CAAA,EA1DA,IA4DX,EC9EMwB,EAAQ,CAAC,aAAc,WAAW,ECE3BC,EAAyB,CACpC,eAAgBrD,EAAgB,kBAAkB,CAAC,CAAC,CAAE,cDA/B,CACvB,GAAM,CAAE,KAAMV,EAAe,EAC7B,OACE,EAAA+B,EAAA,IAAA,CAAClB,EAAD,CACE,MAAOyB,EAAE,uBAAuB,EAChC,MAAOwB,EACP,KAAM7D,EAAY,CAAE,GAAI,UAAW,CAAC,EACpC,UAAWqC,EAAE,eAAe,EAC5B,OAAO,EAAAP,EAAA,IAAA,CAAC0B,EAAD,CAAW,CAAA,CACnB,CAAA,CAEL,CCXkF,CAAC,EACjF,WAAY/C,EAAgB,yBAAyB,CAAC,CAAC,CAAE,UAAWsB,CAAW,CAAC,EAChF,aAActB,EAAgB,6BAA6B,CAAC,CAAC,CAAE,UAAWd,CAAa,CAAC,EACxF,UAAWc,EAAgB,sCAAsC,CAAC,CAAC,CAAE,UAAWb,CAAiB,CAAC,CACpG"}
@@ -0,0 +1,2 @@
1
+ import{i as e}from"./cn-BQ3voEft.js";var t={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};t.node;var n=e(t);export{n as t};
2
+ //# sourceMappingURL=copy-BDc3r0fO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-BDc3r0fO.js","names":["createLucideIcon","__iconData","Copy"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.49.0_@types+react@19.3.0_react@19.3.0/node_modules/lucide-react/dist/esm/icons/copy.mjs"],"sourcesContent":["/**\n * @license lucide-react v1.49.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"copy\",\n size: 24,\n node: [\n [\"rect\", { width: \"14\", height: \"14\", x: \"8\", y: \"8\", rx: \"2\", ry: \"2\", key: \"17jyea\" }],\n [\"path\", { d: \"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\", key: \"zix9uf\" }]\n ]\n};\n__iconData.node;\nconst Copy = createLucideIcon(__iconData);\n\nexport { __iconData, Copy as default };\n//# sourceMappingURL=copy.mjs.map\n"],"ignoreList":[0],"mappings":"qCASA,IAAMC,EAAa,CACjB,KAAM,OACN,KAAM,GACN,KAAM,CACJ,CAAC,OAAQ,CAAE,MAAO,KAAM,OAAQ,KAAM,EAAG,IAAK,EAAG,IAAK,GAAI,IAAK,GAAI,IAAK,IAAK,QAAS,CAAC,EACvF,CAAC,OAAQ,CAAE,EAAG,0DAA2D,IAAK,QAAS,CAAC,CAC1F,CACF,EACAA,EAAW,KACX,IAAMC,EAAOF,EAAiBC,CAAU"}
@@ -0,0 +1,2 @@
1
+ import{_ as e}from"./table-CZYtdoHn.js";var t=e=>String(e).padStart(2,`0`),n=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?$/,r=36e5,i=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}`,a=e=>{let t=n.exec(e);if(!t)return;let[r=0,i=0,a=0,o=0,s=0,c=0]=t.slice(1).map(e=>e===void 0?0:Number(e)),l=new Date(r,i-1,a,o,s,c);return l.getFullYear()===r&&l.getMonth()===i-1&&l.getDate()===a&&l.getHours()===o&&l.getMinutes()===s?l.toISOString():void 0},o=(e=new Date)=>{let t=new Date(e.getTime()+r/2);return t.setMinutes(0,0,0),i(new Date(t.getTime()+r))},s=()=>e().refine(e=>a(e)!==void 0,`validation.dateTime`);export{a as n,o as r,s as t};
2
+ //# sourceMappingURL=dateTimeLocal-C92tyKwz.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateTimeLocal-C92tyKwz.js","names":["z.string","string","pad","value","DATE_TIME_LOCAL","HOUR_MS","toDateTimeLocalValue","date","dateTimeLocalToIso","match","year","month","day","hours","minutes","seconds","part","defaultScheduleValue","next","now","dateTimeLocalField"],"sources":["../../src/features/Publishing/helpers/dateTimeLocal.ts"],"sourcesContent":["import { z } from 'zod';\n\nconst pad = (value: number) => String(value).padStart(2, '0');\n\nconst DATE_TIME_LOCAL = /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2})(?::(\\d{2}))?$/;\n\nconst HOUR_MS = 60 * 60 * 1000;\n\n/** `YYYY-MM-DDTHH:mm` in the browser's time zone: the value format of `<input type=\"datetime-local\">`. */\nexport const toDateTimeLocalValue = (date: Date): string =>\n `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;\n\n/**\n * The instant a `datetime-local` value means (read in the browser's time zone) as an ISO string for the\n * API, or `undefined` when the value is not a real date and time (e.g. 31 February).\n */\nexport const dateTimeLocalToIso = (value: string): string | undefined => {\n const match = DATE_TIME_LOCAL.exec(value);\n if (!match) {\n return undefined;\n }\n // Seconds are optional in the value; a missing group reads as 0.\n const [year = 0, month = 0, day = 0, hours = 0, minutes = 0, seconds = 0] = match\n .slice(1)\n .map((part) => (part === undefined ? 0 : Number(part)));\n const date = new Date(year, month - 1, day, hours, minutes, seconds);\n const roundTrips =\n date.getFullYear() === year &&\n date.getMonth() === month - 1 &&\n date.getDate() === day &&\n date.getHours() === hours &&\n date.getMinutes() === minutes;\n return roundTrips ? date.toISOString() : undefined;\n};\n\n/** The default time offered for a new schedule: the start of the next hour, at least 30 minutes away. */\nexport const defaultScheduleValue = (now: Date = new Date()): string => {\n const next = new Date(now.getTime() + HOUR_MS / 2);\n next.setMinutes(0, 0, 0);\n return toDateTimeLocalValue(new Date(next.getTime() + HOUR_MS));\n};\n\n/** A form field holding a `datetime-local` value that must be a real date and time. */\nexport const dateTimeLocalField = () =>\n z.string().refine((value) => dateTimeLocalToIso(value) !== undefined, 'validation.dateTime');\n"],"mappings":"wCAEA,IAAME,EAAO,GAAkB,OAAOC,CAAK,CAAC,CAAC,SAAS,EAAG,GAAG,EAEtDC,EAAkB,yDAElBC,EAAU,KAGHC,EAAwB,GACnC,GAAGC,EAAK,YAAY,EAAE,GAAGL,EAAIK,EAAK,SAAS,EAAI,CAAC,EAAE,GAAGL,EAAIK,EAAK,QAAQ,CAAC,EAAE,GAAGL,EAAIK,EAAK,SAAS,CAAC,EAAE,GAAGL,EAAIK,EAAK,WAAW,CAAC,IAM9GC,EAAsB,GAAsC,CACvE,IAAMC,EAAQL,EAAgB,KAAKD,CAAK,EACxC,GAAI,CAACM,EACH,OAGF,GAAM,CAACC,EAAO,EAAGC,EAAQ,EAAGC,EAAM,EAAGC,EAAQ,EAAGC,EAAU,EAAGC,EAAU,GAAKN,EACzE,MAAM,CAAC,CAAC,CACR,IAAK,GAAUO,IAAS,IAAA,GAAY,EAAI,OAAOA,CAAI,CAAE,EAClDT,EAAO,IAAI,KAAKG,EAAMC,EAAQ,EAAGC,EAAKC,EAAOC,EAASC,CAAO,EAOnE,OALER,EAAK,YAAY,IAAMG,GACvBH,EAAK,SAAS,IAAMI,EAAQ,GAC5BJ,EAAK,QAAQ,IAAMK,GACnBL,EAAK,SAAS,IAAMM,GACpBN,EAAK,WAAW,IAAMO,EACJP,EAAK,YAAY,EAAI,IAAA,EAC3C,EAGaU,GAAwB,EAAY,IAAI,OAAmB,CACtE,IAAMC,EAAO,IAAI,KAAKC,EAAI,QAAQ,EAAId,EAAU,CAAC,EAEjD,OADAa,EAAK,WAAW,EAAG,EAAG,CAAC,EAChBZ,EAAqB,IAAI,KAAKY,EAAK,QAAQ,EAAIb,CAAO,CAAC,CAChE,EAGae,MACXpB,EAAS,CAAC,CAAC,OAAQ,GAAUQ,EAAmBL,CAAK,IAAM,IAAA,GAAW,qBAAqB"}
@@ -0,0 +1,2 @@
1
+ var e=1,t=/^[A-Za-z][A-Za-z0-9_-]*(\.[A-Za-z][A-Za-z0-9_-]*)+$/,n=e=>{if(!t.test(e.id))throw Error(`Editor ID "${e.id}" must be namespaced like "acme.starRating" (letters, digits, _ and -)`);if(e.dataTypes.length===0)throw Error(`Editor "${e.id}" must list at least one data type`);return{...e,contractVersion:1}},r=e=>typeof e==`object`&&!!e&&!Array.isArray(e),i=e=>r(e)&&typeof e.id==`string`&&t.test(e.id)&&typeof e.contractVersion==`number`&&Array.isArray(e.dataTypes)&&e.dataTypes.every(e=>typeof e==`string`)&&(typeof e.component==`function`||r(e.component));export{i as n,e as r,n as t};
2
+ //# sourceMappingURL=defineEditor-CiJc766Y.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineEditor-CiJc766Y.js","names":["EDITOR_CONTRACT_VERSION","EDITOR_ID_PATTERN","defineEditor","definition","isRecord","value","isEditorDefinition","type"],"sources":["../../../../packages/editor-sdk/src/types.ts","../../../../packages/editor-sdk/src/defineEditor.ts"],"sourcesContent":["import type { DataType, DataTypeSettings, JsonValue, MEDIA_KINDS } from '@shapio/schema';\nimport type { ComponentType } from 'react';\n\n/**\n * The contract between the Shapio admin and a field editor (brief §6, ADR 0009). Built-in editors and\n * custom editors loaded at runtime from a project's `extensions/editors/*.js` receive exactly these props.\n *\n * An editor gets the field's value and metadata plus a small, explicit context. It never gets a network\n * client, a session, tokens or secrets: everything it can do goes through `onChange` and the context\n * functions. The server validates the value the same way whatever editor produced it.\n *\n * Bump EDITOR_CONTRACT_VERSION on any breaking change. The admin refuses editors built for another\n * version and falls back to the field's built-in editor.\n */\nexport const EDITOR_CONTRACT_VERSION = 1;\n\n/** The rich-text envelope stored for `richtext` fields (ADR 0003). `doc` is ProseMirror JSON. */\nexport type RichTextValue = {\n format: 'shapio-richtext';\n version: number;\n doc: { type: 'doc'; content?: JsonValue[] };\n};\n\n/** A component value: its fields keyed by API key. */\nexport type ComponentValue = { [apiKey: string]: unknown };\n\n/** A dynamic-zone item: a component value plus the component's API key in `__component`. */\nexport type DynamicZoneItem = ComponentValue & { __component: string };\n\n/**\n * The value type of each data type, as the admin API reads and writes it. Dates and times are canonical\n * UTC ISO-8601 text; decimals and big integers are strings so no precision is lost; relations and media\n * are IDs (lists of IDs when the field holds several).\n */\nexport type EditorValueMap = {\n string: string;\n text: string;\n richtext: RichTextValue;\n number: number;\n integer: number;\n decimal: string;\n biginteger: string;\n boolean: boolean;\n date: string;\n datetime: string;\n time: string;\n enum: string | string[];\n json: JsonValue;\n slug: string;\n email: string;\n url: string;\n uid: string;\n media: string | string[];\n relation: string | string[];\n component: ComponentValue | ComponentValue[];\n dynamiczone: DynamicZoneItem[];\n};\n\nexport type EditorValue<T extends DataType = DataType> = EditorValueMap[T];\n\n/** The field being edited, from the active model definition. */\nexport type EditorField<T extends DataType = DataType> = {\n /** Stable field ID (never changes when the field is renamed). */\n id: string;\n apiKey: string;\n label: string;\n description: string | undefined;\n type: T;\n required: boolean;\n /** True when the value is per locale; false when it is shared by every locale of the entry. */\n localized: boolean;\n /** Type settings: validation rules (min, max, pattern...), enum values, relation target... */\n settings: DataTypeSettings[T];\n /** This editor's options, as configured on the field in the model builder. */\n options: Readonly<Record<string, JsonValue>>;\n};\n\n/** The model (or component) the field belongs to. */\nexport type EditorModel = {\n id: string;\n apiKey: string;\n label: string;\n kind: 'collection' | 'singleton' | 'component';\n localized: boolean;\n};\n\nexport type MediaKind = (typeof MEDIA_KINDS)[number];\n\nexport type MediaPickOptions = {\n multiple?: boolean;\n /** Restrict the picker to these kinds of files. */\n allowedKinds?: readonly MediaKind[];\n};\n\n/** What the media picker hands back: enough to preview and reference an asset, never storage details. */\nexport type PickedMedia = {\n id: string;\n filename: string;\n mimeType: string;\n /** For previews in the admin only. Private assets have expiring URLs; store the `id`, never the URL. */\n url: string;\n alt: string;\n width: number | null;\n height: number | null;\n};\n\n/** The limited capabilities an editor may use. */\nexport type EditorContext = {\n /** The content locale being edited, or null when the model is not localized. */\n locale: string | null;\n /** The entry being edited, or null for an entry that is not created yet. */\n entryId: string | null;\n /** The admin's interface language (e.g. `en`), for editors that ship their own strings. */\n uiLanguage: string;\n /** Opens the media library; resolves with the chosen assets, or null when the person cancels. */\n pickMedia: (options?: MediaPickOptions) => Promise<PickedMedia[] | null>;\n /** Translates one of the admin's own keys (e.g. `common.remove`); unknown keys return `fallback`. */\n translate: (key: string, fallback: string, values?: Readonly<Record<string, string | number>>) => string;\n};\n\nexport type FieldValidationState = {\n /** Server and client validation messages for this value, already translated. */\n errors: readonly string[];\n invalid: boolean;\n};\n\nexport type FieldEditorProps<T extends DataType = DataType> = {\n /** The DOM id the field's label points at: put it on the editor's main focusable element. */\n inputId: string;\n /** The DOM id of the field's visible label: use `aria-labelledby` on group controls (radio groups...). */\n labelId: string;\n /** Ids of the description and error elements: pass to `aria-describedby`. */\n describedBy: string | undefined;\n /** The current value; null when the field is empty. */\n value: EditorValue<T> | null;\n /** Report a new value. Pass null to clear the field. */\n onChange: (value: EditorValue<T> | null) => void;\n /** Call when the editor loses focus (client-side checks run then). */\n onBlur: () => void;\n validation: FieldValidationState;\n /** Shown but not editable (e.g. a field the person may not change). Keep the value selectable. */\n readOnly: boolean;\n /** Temporarily unavailable (e.g. while the entry is being saved or reloaded). */\n disabled: boolean;\n field: EditorField<T>;\n model: EditorModel;\n context: EditorContext;\n};\n\n/** A field editor: what a module in `extensions/editors/` exports (see `defineEditor`). */\nexport type EditorDefinition<T extends DataType = DataType> = {\n /** Namespaced ID referenced from field definitions, e.g. `acme.starRating` (letters, digits, `_`, `-`). */\n id: string;\n /** The contract version the editor was built against (set by `defineEditor`). */\n contractVersion: number;\n /** Data types the editor can edit. */\n dataTypes: readonly T[];\n component: ComponentType<FieldEditorProps<T>>;\n};\n","import type { DataType } from '@shapio/schema';\nimport { EDITOR_CONTRACT_VERSION, type EditorDefinition } from './types.js';\n\n/** `vendor.name`, the same rule as `CUSTOM_EDITOR_ID_PATTERN` in @shapio/schema. */\nconst EDITOR_ID_PATTERN = /^[A-Za-z][A-Za-z0-9_-]*(\\.[A-Za-z][A-Za-z0-9_-]*)+$/;\n\n/**\n * Declares a field editor. Export the result from your editor module as `editor`:\n *\n * ```tsx\n * export const editor = defineEditor({\n * id: 'acme.starRating',\n * dataTypes: ['integer'],\n * component: StarRating,\n * });\n * ```\n *\n * It stamps the contract version the editor was built against, so the admin can refuse an editor built\n * for an incompatible release instead of failing at runtime.\n */\nexport const defineEditor = <T extends DataType>(\n definition: Omit<EditorDefinition<T>, 'contractVersion'>,\n): EditorDefinition<T> => {\n if (!EDITOR_ID_PATTERN.test(definition.id)) {\n throw new Error(\n `Editor ID \"${definition.id}\" must be namespaced like \"acme.starRating\" (letters, digits, _ and -)`,\n );\n }\n if (definition.dataTypes.length === 0) {\n throw new Error(`Editor \"${definition.id}\" must list at least one data type`);\n }\n return { ...definition, contractVersion: EDITOR_CONTRACT_VERSION };\n};\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\n/** Runtime check of a module export (the admin's loader uses it on untrusted modules). */\nexport const isEditorDefinition = (value: unknown): value is EditorDefinition =>\n isRecord(value) &&\n typeof value.id === 'string' &&\n EDITOR_ID_PATTERN.test(value.id) &&\n typeof value.contractVersion === 'number' &&\n Array.isArray(value.dataTypes) &&\n value.dataTypes.every((type) => typeof type === 'string') &&\n (typeof value.component === 'function' || isRecord(value.component));\n"],"mappings":"AAcA,IAAaA,EAA0B,ECVjCC,EAAoB,sDAgBbC,EACX,GACwB,CACxB,GAAI,CAACD,EAAkB,KAAKE,EAAW,EAAE,EACvC,MAAU,MACR,cAAcA,EAAW,GAAG,uEAC9B,EAEF,GAAIA,EAAW,UAAU,SAAW,EAClC,MAAU,MAAM,WAAWA,EAAW,GAAG,mCAAmC,EAE9E,MAAO,CAAE,GAAGA,EAAY,gBAAA,CAAyC,CACnE,EAEMC,EAAY,GAChB,OAAOC,GAAU,YAAYA,GAAkB,CAAC,MAAM,QAAQA,CAAK,EAGxDC,EAAsB,GACjCF,EAASC,CAAK,GACd,OAAOA,EAAM,IAAO,UACpBJ,EAAkB,KAAKI,EAAM,EAAE,GAC/B,OAAOA,EAAM,iBAAoB,UACjC,MAAM,QAAQA,EAAM,SAAS,GAC7BA,EAAM,UAAU,MAAO,GAAS,OAAOE,GAAS,QAAQ,IACvD,OAAOF,EAAM,WAAc,YAAcD,EAASC,EAAM,SAAS"}
@@ -0,0 +1,11 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./View-BLsQYPow.js","./rolldown-runtime-Dd_uD5pT.js","./react-CQOZoUwg.js","./jsx-runtime-DREnUpxT.js","./w3c-keyname-BOAvb0qz.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{t as n}from"./jsx-runtime-DREnUpxT.js";import{H as r,P as i,V as a,bt as o,d as s,f as c,i as l,j as u,l as d,p as f,r as p,s as m,t as h,u as g,ut as ee}from"./cn-BQ3voEft.js";import{t as _}from"./useQueries-BuKJBA0M.js";import{C as v,T as y,et as te,h as ne,u as re,x as b}from"./auth-pcS9CCXu.js";import{A as ie,O as ae,_ as x,a as S,i as C,j as oe,k as se,n as w,o as T,r as ce,t as E,v as D}from"./badge-DD0mE96i.js";import{c as le,f as ue,i as de,l as fe,o as pe,t as me}from"./searchSchema-CvOhn4FV.js";import{i as O,n as k,o as he,t as ge}from"./RowTitle--uFCpx8n.js";import{t as A}from"./fileRoute-C2tOrKhO.js";import{t as _e}from"./UnsavedChangesGuard-DgOASh0p.js";import{B as ve,G as j,H as ye,R as be,U as xe,a as Se,d as Ce,i as we,n as Te,o as Ee,t as De}from"./InfoHint-GJLRVumb.js";import{i as M,k as Oe,n as ke}from"./skeleton-C3QLIh7W.js";import{E as Ae,V as je,_ as Me,a as Ne,c as Pe,h as Fe,i as N,n as P,o as Ie,r as Le,s as Re,t as ze,z as Be}from"./tabs-quHbeVxA.js";import{u as Ve}from"./constants-SrImR6C3.js";import{i as He,t as Ue}from"./useSchemaScopeAccess-DUBeS9kU.js";import{t as We}from"./calendar-clock-DEwACe0M.js";import{a as Ge,i as Ke,n as qe,r as Je,t as Ye}from"./select-tHVWX85X.js";import{t as Xe}from"./CursorPager-BnxmTk47.js";import{n as Ze,t as Qe}from"./preload-helper-DAbCfXID.js";import{a as F,i as $e,n as et,o as I,r as L,s as tt}from"./ConfirmDialog-B9nWhIIz.js";import{t as nt}from"./circle-check-Dq1owihe.js";import{a as rt,d as it,f as at,n as ot,r as st,t as ct,u as lt}from"./StepList-BY5MuJPJ.js";import{t as ut}from"./clock-DQvkffqQ.js";import{a as dt,c as ft,d as pt,i as mt,m as ht,n as gt,o as _t,p as vt,r as yt,t as bt}from"./snapshots-BQrhsCmC.js";import{l as xt}from"./Thumbnail-CP5mfgNY.js";import{t as St}from"./stableId-C9Yq5iUw.js";import{t as Ct}from"./image-off-B_uBCsYu.js";import{t as wt}from"./inbox-3iAHL3pC.js";import{t as Tt}from"./pencil-Bdp2z9D_.js";import{t as Et}from"./plus-BN_iSsnp.js";import{_ as Dt,a as Ot,c as kt,d as At,f as jt,g as Mt,h as Nt,i as Pt,l as Ft,n as It,o as Lt,p as Rt,r as zt,s as Bt,t as Vt,v as Ht}from"./changeSets-BjUEfYbj.js";import{D as Ut,O as Wt,b as Gt,d as Kt,p as qt,t as Jt}from"./useCursorPager-B1upg5EU.js";import{t as Yt}from"./rotate-ccw-CBoZle-b.js";import{t as Xt}from"./send-BqECHYi6.js";import{t as Zt}from"./users-BOn2ohJQ.js";import{n as Qt,o as $t,t as en,u as tn}from"./zod-BHAd1wTC.js";import{t as nn}from"./settle-LRKtTN_e.js";import{_ as rn,a as R,g as an,i as z,n as B,o as V,r as H,s as on,t as U}from"./table-CZYtdoHn.js";import{t as sn}from"./HintedLabel-CvC46uy_.js";import{r as cn}from"./sites-C6_THCVK.js";import{p as ln,r as un,s as dn,t as fn}from"./schema-B4smPFcR.js";import{t as W}from"./QueryView-D6aZQJRN.js";import{t as pn}from"./useDebouncedValue-Dqs3wwhn.js";import{C as mn,H as G,O as hn,R as gn,V as _n,a as vn,d as yn,f as bn,n as xn,o as Sn,p as Cn,r as wn,s as Tn,t as En,v as Dn,z as On}from"./src-XaU0N8C-.js";import{r as kn}from"./locales-BzPbz8FF.js";import{t as K}from"./Panel-iIKjEURi.js";import{r as An}from"./schedules-Dy89Nm6P.js";import{n as jn,r as Mn,t as Nn}from"./dateTimeLocal-C92tyKwz.js";import{t as Pn}from"./CopyButton-BoWb-xi1.js";import{t as Fn}from"./FormTextareaField-DzyOzfZb.js";import{n as In,r as Ln,t as Rn}from"./SubNavLink-B2o4kSZ9.js";import{n as zn,t as Bn}from"./FormSelectField-D7VHmnx5.js";import{t as Vn}from"./tokens-Fh_OeIlf.js";import{c as Hn}from"./users-BkKc4MNB.js";var Un={name:`calendar-x`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`m14 13-4 4`,key:`1gib57`}],[`path`,{d:`m10 13 4 4`,key:`153uiq`}]]};Un.node;var Wn=l(Un),Gn={name:`file-type`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M11 18h2`,key:`12mj7e`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5`,key:`qbrxap`}]]};Gn.node;var Kn=l(Gn),qn={name:`git-compare`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]};qn.node;var Jn=l(qn),Yn={name:`git-merge`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]};Yn.node;var Xn=l(Yn),Zn={name:`package`,size:24,node:[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]};Zn.node;var Qn=l(Zn),$n={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};$n.node;var er=l($n),tr={name:`puzzle`,size:24,node:[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]};tr.node;var nr=l(tr),rr={name:`radio`,size:24,node:[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]};rr.node;var ir=l(rr),ar={name:`workflow`,size:24,node:[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]};ar.node;var or=l(ar),sr=(e,t)=>e.version===t.version||e.hash===t.hash,cr=(e,t,n)=>t&&e.hash===t.hash?{action:`skip`,reason:`unchangedLocally`}:n?n.hash===e.hash?{action:`skip`,reason:`alreadyApplied`}:t?sr(n,t)?{action:`update`,expectedVersion:n.version}:{action:`conflict`,reason:`changedOnBoth`}:{action:`conflict`,reason:`existsOnTarget`}:t?{action:`conflict`,reason:`deletedOnTarget`}:{action:`create`},lr=({local:e,base:t,remote:n,prune:r})=>e?cr(e,t,n):t?n?r?sr(n,t)?{action:`delete`,expectedVersion:n.version}:{action:`conflict`,reason:`changedOnTargetBeforeDelete`}:{action:`skip`,reason:`deletedLocallyWithoutPrune`}:{action:`skip`,reason:`alreadyDeleted`}:{action:`skip`,reason:`remoteOnly`},q=e(t(),1),ur={silent:!0},dr={openApi:`/api/docs/openapi.json`,typescript:`/api/docs/typescript`,playground:`api/graphql/playground`},fr={openApi:[...i.schema.all,`docs`,`openapi`],typescript:[...i.schema.all,`docs`,`typescript`],playground:[`develop`,`graphqlPlayground`]},pr=()=>r({queryKey:fr.openApi,queryFn:()=>s.request(dr.openApi),meta:ur}),mr=()=>r({queryKey:fr.typescript,queryFn:()=>s.request(dr.typescript),meta:ur}),hr=()=>new URL(dr.playground,g()).href,gr=()=>r({queryKey:fr.playground,queryFn:async()=>(await fetch(hr(),{method:`HEAD`,credentials:`same-origin`})).ok,staleTime:1/0,meta:ur}),J=e(n(),1),Y=({code:e,label:t,copyable:n=!0,className:r})=>(0,J.jsxs)(`div`,{className:h(`min-w-0 space-y-2`,r),children:[(0,J.jsxs)(`div`,{className:`flex min-h-9 items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs font-semibold tracking-wide text-muted-foreground uppercase`,children:t}),n?(0,J.jsx)(Pn,{value:e}):null]}),(0,J.jsx)(`pre`,{role:`region`,"aria-label":t,tabIndex:0,className:`max-h-[28rem] overflow-auto rounded-lg border bg-muted p-3 font-mono text-xs leading-5 text-foreground outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,J.jsx)(`code`,{children:e})})]}),_r=()=>{let e=re().data?.site;return e&&!e.isPrimary?e.key:void 0},vr=e=>{switch(e.type){case`richtext`:return`${e.apiKey} { html }`;case`media`:return`${e.apiKey} { url alt }`;case`relation`:return`${e.apiKey} { id }`;case`component`:case`dynamiczone`:return`${e.apiKey} { __typename }`;default:return e.apiKey}},yr=(e,t)=>[`id`,...e.fields.filter(e=>!e.deprecated).map(vr)].map(e=>`${t}${e}`).join(`
3
+ `),br=`graphql:`,xr=e=>{let t={id:`${br}${e.apiKey}`,name:e.apiKey,modelId:e.id,list:!1,query:e.kind===`collection`?`query ($id: ID!) {\n ${e.apiKey}(id: $id) {\n${yr(e,` `)}\n }\n}\n`:`query {\n ${e.apiKey} {\n${yr(e,` `)}\n }\n}\n`};if(e.kind!==`collection`)return[t];let n=yn(e);return[{id:`${br}${n}`,name:n,modelId:e.id,list:!0,query:`query {\n ${n}(pageSize: 10) {\n totalCount\n nodes {\n${yr(e,` `)}\n }\n }\n}\n`},t]},Sr=({selected:e})=>{let{t}=u(),{definitions:n}=un(),r=gr(),i=_r(),a=(0,q.useMemo)(()=>(n??[]).map(({definition:e})=>e).filter(G).sort((e,t)=>e.label.localeCompare(t.label)).map(e=>({model:e,operations:xr(e)})),[n]),o=a.flatMap(e=>e.operations),s=o.find(t=>t.id===e)??o[0];return(0,J.jsxs)(`div`,{className:`flex flex-col gap-6 lg:flex-row`,children:[a.length>0?(0,J.jsx)(In,{label:t(`develop.api.graphql.operations`),children:a.map(({model:e,operations:t})=>(0,J.jsx)(Ln,{label:e.label,children:t.map(e=>(0,J.jsx)(Rn,{to:`/api-explorer`,search:{tab:`graphql`,op:e.id},"aria-current":e.id===s?.id?`page`:void 0,children:(0,J.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.name})},e.id))},e.id))}):null,(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-6`,children:[s?(0,J.jsx)(K,{title:t(`develop.api.graphql.example`,{name:s.name}),children:(0,J.jsx)(Y,{label:t(`develop.api.graphql.query`),code:s.query})}):null,(0,J.jsx)(K,{title:t(`develop.api.graphql.playground`),flush:!0,children:r.isPending?(0,J.jsx)(D,{rows:6,className:`p-5`}):r.data?(0,J.jsx)(`iframe`,{title:t(`develop.api.graphql.playgroundFrame`),src:cn(hr(),i),className:`block h-[40rem] w-full rounded-b-xl bg-card`}):(0,J.jsx)(T,{size:`panel`,icon:or,title:t(`develop.api.graphql.unavailable`),description:t(`develop.api.graphql.unavailableDescription`)})})]})]})},Cr=`/api/content/`,wr=e=>Object.entries(e.paths).flatMap(([e,t])=>{let n=t.get;if(!e.startsWith(`/api/content/`)||!n?.operationId)return[];let r=n.parameters??[];return[{id:n.operationId,path:e,summary:n.summary??e,tag:n.tags?.[0]??``,routeKey:e.slice(13).split(`/`)[0]??``,byId:e.includes(`{id}`),list:r.some(e=>e.name===`filters`),parameters:r}]}),Tr=(e,t)=>{let n=(e.tags??[]).map(e=>e.name);return[...new Set([...n,...t.map(e=>e.tag)])].map(e=>({tag:e,operations:t.filter(t=>t.tag===e)})).filter(e=>e.operations.length>0)},Er=(e,t)=>e.parameters.some(e=>e.name===t),Dr=`GET`,Or=({groups:e,selectedId:t})=>{let{t:n}=u();return(0,J.jsx)(In,{label:n(`develop.api.endpoints`),children:e.map(e=>(0,J.jsx)(Ln,{label:e.tag,children:e.operations.map(e=>(0,J.jsxs)(Rn,{to:`/api-explorer`,search:{tab:`rest`,op:e.id},title:e.summary,"aria-current":e.id===t?`page`:void 0,children:[(0,J.jsx)(`span`,{className:`font-mono text-2xs font-semibold text-muted-foreground`,children:Dr}),(0,J.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.path.slice(Cr.length-1)})]},e.id))},e.tag))})},kr={id:``,locale:``,snapshot:``,fields:``,populate:``,sort:``,page:``,pageSize:``,q:``,filters:[]},Ar=[`locale`,`snapshot`,`fields`,`populate`,`sort`,`page`,`pageSize`,`q`],jr=e=>`filters${e.replace(/^filters/,``).split(/[[\].]+/).filter(e=>e!==``).map(e=>`[${e}]`).join(``)}`,Mr=(e,t)=>{let n=e.path.replace(`{id}`,t.id.trim()?encodeURIComponent(t.id.trim()):`{id}`),r=new URLSearchParams;for(let n of Ar){let i=t[n].trim();i&&e.parameters.some(e=>e.name===n)&&r.append(n,i)}if(e.list)for(let e of t.filters)e.key.trim()&&e.value!==``&&r.append(jr(e.key.trim()),e.value);let i=r.toString();return i?`${n}?${i}`:n},Nr=(e,t)=>!e.byId||t.id.trim()!==``,Pr=`$SHAPIO_TOKEN`,Fr=(e,t)=>[`curl '${e.replace(/'/g,`'\\''`)}'`,` -H 'accept: application/json'`].concat(t?[` -H "authorization: Bearer ${Pr}"`]:[]).join(` \\
4
+ `),Ir=(e,t)=>{let n=t?`{
5
+ accept: 'application/json',
6
+ authorization: \`Bearer \${process.env.SHAPIO_TOKEN}\`,
7
+ }`:`{ accept: 'application/json' }`;return`const response = await fetch(${JSON.stringify(e)}, {\n headers: ${n},\n});\nconst { data, meta } = await response.json();\n`},Lr=e=>{let[t,n]=(0,q.useState)({});return{draft:e&&t[e]||kr,setDraft:t=>{e&&n(n=>({...n,[e]:t}))}}},Rr=e=>new URL(e.replace(/^\//,``),g()).href,zr=e=>{try{return JSON.parse(e)}catch{return e}},Br=()=>a({mutationKey:[`develop`,`explorer`,`send`],mutationFn:async({path:e,token:t})=>{let n=Rr(e),r=performance.now(),i=await fetch(n,{headers:{accept:`application/json`,...t?{authorization:`Bearer ${t}`}:{}},credentials:`omit`,cache:`no-store`}),a=await i.text();return{url:n,status:i.status,statusText:i.statusText,ok:i.ok,durationMs:Math.round(performance.now()-r),body:zr(a),text:a}}}),Vr=({rows:e,onChange:t})=>{let{t:n}=u(),r=(n,r)=>t(e.map(e=>e.id===n?{...e,...r}:e));return(0,J.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,J.jsx)(`legend`,{className:`text-sm font-semibold`,children:n(`develop.api.request.filters`)}),e.map((i,a)=>(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(ke,{"aria-label":n(`develop.api.request.filterKey`,{index:a+1}),placeholder:n(`develop.api.request.filterKeyPlaceholder`),className:`font-mono`,value:i.key,onChange:e=>r(i.id,{key:e.target.value})}),(0,J.jsx)(ke,{"aria-label":n(`develop.api.request.filterValue`,{index:a+1}),placeholder:n(`develop.api.request.filterValuePlaceholder`),value:i.value,onChange:e=>r(i.id,{value:e.target.value})}),(0,J.jsx)(M,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":n(`develop.api.request.removeFilter`,{index:a+1}),onClick:()=>t(e.filter(e=>e.id!==i.id)),children:(0,J.jsx)(ae,{"aria-hidden":`true`})})]},i.id)),(0,J.jsxs)(M,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>t([...e,{id:St(),key:``,value:``}]),children:[(0,J.jsx)(Et,{"aria-hidden":`true`}),n(`develop.api.request.addFilter`)]})]})},Hr=f()(e=>({token:``,setToken:t=>e({token:t})}));c.subscribe((e,t)=>{t.csrfToken!==void 0&&e.csrfToken===void 0&&Hr.setState({token:``})});var X=({label:e,hint:t,value:n,onChange:r,mono:i=!1,...a})=>{let o=(0,q.useId)(),s=`${o}-hint`;return(0,J.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,J.jsx)(sn,{htmlFor:o,label:e,hint:t,hintId:t?s:void 0}),(0,J.jsx)(ke,{id:o,value:n,onChange:e=>r(e.target.value),"aria-describedby":t?s:void 0,className:h(i&&`font-mono`),spellCheck:!1,...a})]})},Ur=`__default__`,Wr=`GET`,Gr=({operation:e,draft:t,onDraftChange:n,path:r,sendable:i,sending:a,onSend:o})=>{let{t:s}=u(),c=(0,q.useId)(),l=kn().data??[],d=Hr(e=>e.token),f=Hr(e=>e.setToken),p=e=>n({...t,...e});return(0,J.jsx)(K,{title:e.summary,titleAs:`h2`,children:(0,J.jsxs)(`form`,{className:`space-y-5`,onSubmit:e=>{e.preventDefault(),i&&o()},children:[(0,J.jsxs)(`p`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(E,{variant:`outline`,className:`font-mono`,children:Wr}),(0,J.jsx)(`code`,{className:`min-w-0 font-mono text-xs break-all`,children:r})]}),(0,J.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[e.byId?(0,J.jsx)(X,{label:s(`develop.api.request.id`),value:t.id,onChange:e=>p({id:e}),required:!0,mono:!0}):null,Er(e,`locale`)?(0,J.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,J.jsx)(sn,{htmlFor:c,label:s(`develop.api.request.locale`),hint:s(`develop.api.request.localeHint`)}),(0,J.jsxs)(Ye,{value:t.locale||Ur,onValueChange:e=>p({locale:e===Ur?``:e}),children:[(0,J.jsx)(Ke,{id:c,className:`w-full`,children:(0,J.jsx)(Ge,{})}),(0,J.jsxs)(qe,{children:[(0,J.jsx)(Je,{value:Ur,children:s(`develop.api.request.defaultLocale`)}),l.map(e=>(0,J.jsx)(Je,{value:e.code,children:s(`develop.api.request.localeOption`,{label:e.label,code:e.code})},e.code))]})]})]}):null,Er(e,`snapshot`)?(0,J.jsx)(X,{label:s(`develop.api.request.snapshot`),hint:s(`develop.api.request.snapshotHint`),value:t.snapshot,onChange:e=>p({snapshot:e}),inputMode:`numeric`}):null,(0,J.jsx)(X,{label:s(`develop.api.request.fields`),hint:s(`develop.api.request.fieldsHint`),value:t.fields,onChange:e=>p({fields:e}),mono:!0}),(0,J.jsx)(X,{label:s(`develop.api.request.populate`),hint:s(`develop.api.request.populateHint`),value:t.populate,onChange:e=>p({populate:e}),mono:!0}),e.list?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(X,{label:s(`develop.api.request.sort`),hint:s(`develop.api.request.sortHint`),value:t.sort,onChange:e=>p({sort:e}),mono:!0}),(0,J.jsx)(X,{label:s(`develop.api.request.search`),value:t.q,onChange:e=>p({q:e})}),(0,J.jsx)(X,{label:s(`develop.api.request.page`),value:t.page,onChange:e=>p({page:e}),inputMode:`numeric`}),(0,J.jsx)(X,{label:s(`develop.api.request.pageSize`),value:t.pageSize,onChange:e=>p({pageSize:e}),inputMode:`numeric`})]}):null]}),e.list?(0,J.jsx)(Vr,{rows:t.filters,onChange:e=>p({filters:e})}):null,(0,J.jsx)(X,{label:s(`develop.api.request.token`),hint:s(`develop.api.request.tokenHint`),value:d,onChange:f,type:`password`,autoComplete:`off`,placeholder:s(`develop.api.request.tokenPlaceholder`),mono:!0}),(0,J.jsx)(`div`,{className:`flex justify-end`,children:(0,J.jsxs)(M,{type:`submit`,disabled:!i||a,children:[(0,J.jsx)(Xt,{"aria-hidden":`true`}),s(a?`develop.api.sending`:`develop.api.send`)]})})]})})},Kr=[`title`,`name`,`label`,`heading`,`slug`],qr=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Jr=e=>{if(!qr(e)||typeof e.id!=`string`)return[];let t=Kr.find(t=>typeof e[t]==`string`&&e[t]!==``);return[{id:e.id,locale:typeof e.locale==`string`?e.locale:void 0,label:t?String(e[t]):void 0}]},Yr=e=>qr(e)?Array.isArray(e.data)?e.data.flatMap(Jr):Jr(e.data):[],Xr=({entries:e,modelKey:t})=>{let{t:n}=u();return(0,J.jsx)(`ul`,{"aria-label":n(`develop.api.response.entries`),className:`divide-y rounded-lg border`,children:e.map(e=>(0,J.jsxs)(`li`,{className:`flex min-w-0 items-center gap-3 px-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.label??n(`content.untitled`)}),(0,J.jsx)(`p`,{className:`truncate font-mono text-2xs text-muted-foreground`,children:e.locale?n(`develop.api.response.idLocale`,{id:e.id,locale:e.locale}):e.id})]}),(0,J.jsx)(M,{asChild:!0,variant:`outline`,size:`sm`,children:(0,J.jsxs)(b,{to:`/content/$modelKey/$entryId`,params:{modelKey:t,entryId:e.id},search:e.locale?{locale:e.locale}:{},"aria-label":n(`develop.api.response.editEntryLabel`,{entry:e.label??e.id}),children:[(0,J.jsx)(Tt,{"aria-hidden":`true`}),n(`develop.api.response.editEntry`)]})})]},`${e.id}:${e.locale??``}`))})},Zr=({response:e,modelKey:t})=>{let{t:n}=u(),r=(0,q.useMemo)(()=>e?.ok?Yr(e.body):[],[e]),i=(0,q.useMemo)(()=>e&&typeof e.body!=`string`?JSON.stringify(e.body,null,2):e?.text,[e]);return(0,J.jsx)(K,{title:n(`develop.api.response.title`),actions:e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(w,{tone:e.ok?`success`:`danger`,label:`${e.status} ${e.statusText}`.trim(),size:`sm`}),(0,J.jsx)(`span`,{className:`text-meta text-muted-foreground tabular-nums`,children:n(`develop.api.response.duration`,{ms:e.durationMs})})]}):null,children:e?(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsx)(`p`,{role:`status`,className:`sr-only`,children:n(`develop.api.response.announce`,{status:e.status,ms:e.durationMs})}),r.length>0&&t?(0,J.jsx)(Xr,{entries:r,modelKey:t}):null,(0,J.jsx)(Y,{label:n(`develop.api.response.body`),code:i??``})]}):(0,J.jsx)(T,{size:`panel`,icon:ir,title:n(`develop.api.response.empty`)})})},Qr=(e,t)=>({queryKey:i.develop.usage.model(e,t),queryFn:()=>d.usage.fields({modelId:e,days:t}),meta:{silent:!0}}),$r=e=>{let t=new Map;for(let n of e){for(let e of n.principals)t.set(e.principalKey,{...e,fields:t.get(e.principalKey)?.fields??[]});for(let e of n.fields)for(let r of e.principals)t.get(r.principalKey)?.fields.push({modelId:n.modelId,apiKeyPath:e.apiKeyPath??e.fieldPath,reads:r.reads,lastReadAt:r.lastReadAt,selection:r.selection})}return[...t.values()].sort((e,t)=>t.requests-e.requests)},ei=(e,t,n=7)=>_({queries:e.map(e=>({...Qr(e,n),enabled:t})),combine:e=>{let n=e.flatMap(e=>e.data?[e.data]:[]);return{principals:$r(n),tracking:n.every(e=>e.tracking),isPending:t&&e.some(e=>e.isPending),error:e.find(e=>e.error)?.error??null,refetch:()=>Promise.all(e.map(e=>e.refetch()))}}}),ti=e=>r({queryKey:i.develop.usage.model(e,7),queryFn:()=>d.usage.fields({modelId:e,days:7}),meta:{silent:!0}}),ni={required:`develop.api.shape.flags.required`,localized:`develop.api.shape.flags.localized`,private:`develop.api.shape.flags.private`,unique:`develop.api.shape.flags.unique`,filterable:`develop.api.shape.flags.filterable`,sortable:`develop.api.shape.flags.sortable`},ri=e=>[e.required&&`required`,e.localized&&`localized`,!e.public&&`private`,e.unique&&`unique`,e.filterable&&`filterable`,e.sortable&&`sortable`].filter(e=>e!==!1),ii=(e,t)=>{let n=e?.fields.find(e=>e.apiKeyPath===t);return n?{reads:n.reads,readers:n.principals}:void 0},ai=({model:e})=>{let{t}=u(),n=ti(e.id),r=(e,n)=>n??t(e===`anonymous`?`develop.api.shape.anonymous`:`develop.api.shape.appUsers`),i=e.fields.filter(e=>!e.deprecated);return(0,J.jsx)(K,{title:t(`develop.api.shape.title`),description:t(`develop.api.shape.description`,{model:e.label,days:7}),flush:!0,children:(0,J.jsxs)(U,{children:[(0,J.jsx)(R,{children:(0,J.jsxs)(V,{children:[(0,J.jsx)(z,{children:t(`develop.api.shape.field`)}),(0,J.jsx)(z,{children:t(`develop.api.shape.readers`)})]})}),(0,J.jsx)(B,{children:i.map(e=>{let i=ii(n.data,e.apiKey);return(0,J.jsxs)(V,{children:[(0,J.jsxs)(H,{className:`h-auto py-2 align-top`,children:[(0,J.jsx)(`p`,{className:`font-mono text-xs font-semibold`,children:e.apiKey}),(0,J.jsx)(`p`,{className:`text-meta text-muted-foreground`,children:t(`models.dataTypes.${e.type}.name`)}),ri(e).length>0?(0,J.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:ri(e).map(e=>(0,J.jsx)(E,{variant:`outline`,className:`text-2xs`,children:t(ni[e])},e))}):null]}),(0,J.jsx)(H,{className:`h-auto py-2 align-top text-meta`,children:i?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`tabular-nums`,children:t(`develop.api.shape.reads`,{count:i.reads})}),(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:i.readers.map(e=>r(e.principalKey,e.tokenName)).join(`, `)})]}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:n.isPending?t(`common.loading`):n.data?.tracking===!1?t(`develop.api.shape.trackingOff`):t(`develop.api.shape.noReads`)})})]},e.id)})})]})})},oi=({url:e,withToken:t})=>{let{t:n}=u();return(0,J.jsxs)(ze,{defaultValue:`curl`,children:[(0,J.jsxs)(Le,{"aria-label":n(`develop.api.copyAs`),className:`self-start`,children:[(0,J.jsx)(N,{value:`curl`,children:n(`develop.api.curl`)}),(0,J.jsx)(N,{value:`fetch`,children:n(`develop.api.fetch`)})]}),(0,J.jsx)(P,{value:`curl`,children:(0,J.jsx)(Y,{label:n(`develop.api.curlLabel`),code:Fr(e,t)})}),(0,J.jsx)(P,{value:`fetch`,children:(0,J.jsx)(Y,{label:n(`develop.api.fetchLabel`),code:Ir(e,t)})})]})},si=({groups:e,operation:t})=>{let{draft:n,setDraft:r}=Lr(t.id),i=Hr(e=>e.token),a=Br(),{definitions:o}=un(),s=(0,q.useMemo)(()=>o?.map(({definition:e})=>e).filter(G).find(e=>bn(e)===t.routeKey),[o,t.routeKey]),c=_r(),l=cn(Mr(t,n),c),u=a.data&&a.variables?.operationId===t.id?a.data:void 0;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-6 lg:flex-row`,children:[(0,J.jsx)(Or,{groups:e,selectedId:t.id}),(0,J.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-6 2xl:grid-cols-[minmax(0,1fr)_24rem]`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 space-y-6`,children:[(0,J.jsx)(Gr,{operation:t,draft:n,onDraftChange:r,path:l,sendable:Nr(t,n),sending:a.isPending,onSend:()=>a.mutate({operationId:t.id,path:l,token:i})}),(0,J.jsx)(oi,{url:Rr(l),withToken:i!==``}),(0,J.jsx)(Zr,{response:u,modelKey:s?.apiKey})]}),s?(0,J.jsx)(ai,{model:s}):null]})]})},ci=ue(`/app/api-explorer`),li={rest:`develop.api.tabs.rest`,graphql:`develop.api.tabs.graphql`},ui=({document:e})=>{let{t}=u(),{tab:n=`rest`,op:r}=ci.useSearch(),i=ci.useNavigate(),a=(0,q.useMemo)(()=>wr(e),[e]),o=(0,q.useMemo)(()=>Tr(e,a),[e,a]),s=a.find(e=>e.id===r)??o[0]?.operations[0];return(0,J.jsxs)(ze,{value:n,onValueChange:e=>void i({search:{tab:e},replace:!0}),children:[(0,J.jsx)(C,{title:t(`develop.apiExplorerTitle`),meta:t(`develop.api.meta`,{version:e.info.version,count:a.length}),tabs:(0,J.jsx)(Le,{variant:`underline`,"aria-label":t(`develop.api.tabs.label`),children:pe.map(e=>(0,J.jsx)(N,{value:e,children:t(li[e])},e))})}),(0,J.jsx)(P,{value:`rest`,className:`pt-4`,children:s?(0,J.jsx)(si,{groups:o,operation:s}):(0,J.jsx)(T,{icon:He,title:t(`develop.api.empty`),description:t(`develop.api.emptyDescription`)})}),(0,J.jsx)(P,{value:`graphql`,className:`pt-4`,children:(0,J.jsx)(Sr,{selected:r})})]})},di=()=>{let e=pr();return(0,J.jsx)(S,{width:`full`,children:(0,J.jsx)(W,{query:e,children:e=>(0,J.jsx)(ui,{document:e})})})},fi=an({title:$t().max(200,`validation.tooLong`),description:rn().max(5e3,`validation.tooLong`)}),pi={title:``,description:``},mi=(e,t)=>{let n=Lt(),r=tn({resolver:en(fi),defaultValues:pi}),{reset:i}=r;return Ut(e,i,pi,n.reset),{form:r,onSubmit:r.handleSubmit(async({title:e,description:r})=>{let a=await nn(n.mutateAsync({title:e.trim(),description:r.trim()}));a.ok&&(i(pi),t(a.value))}),createChangeSet:n}},hi=({open:e,onOpenChange:t,onCreated:n})=>{let{t:r}=u(),{form:i,onSubmit:a,createChangeSet:o}=mi(e,n);return(0,J.jsxs)(zn,{open:e,onOpenChange:t,size:`md`,title:r(`changes.createTitle`),dirty:i.formState.isDirty,pending:o.isPending,submitLabel:r(`common.create`),pendingLabel:r(`common.saving`),onSubmit:e=>void a(e),children:[(0,J.jsx)(Qt,{control:i.control,name:`title`,label:r(`changes.fields.title`),autoComplete:`off`}),(0,J.jsx)(Fn,{control:i.control,name:`description`,label:r(`changes.fields.description`),rows:3}),(0,J.jsx)($e,{error:o.error})]})},gi=`changes.manage`,_i=`changes.ship`,vi=`tokens.manage`,yi={open:{labelKey:`changes.statuses.open`,tone:`neutral`},scheduled:{labelKey:`changes.statuses.scheduled`,tone:`scheduled`},shipping:{labelKey:`changes.statuses.shipping`,tone:`progress`},shipped:{labelKey:`changes.statuses.shipped`,tone:`success`},failed:{labelKey:`changes.statuses.failed`,tone:`danger`},discarded:{labelKey:`changes.statuses.discarded`,tone:`muted`}},bi=new Set([`open`,`failed`]),Z=()=>{let e=re().data?.globalPermissions??[];return{canManageChanges:e.includes(gi),canShipChanges:e.includes(_i),canReadUsage:e.includes(vi),canManagePublishing:e.includes(`publishing.manage`),canManageWebhooks:e.includes(`webhooks.manage`)}},xi=({size:e})=>{let{t}=u();return(0,J.jsx)(T,{icon:ie,size:e,title:t(`develop.noAccess`),description:t(`develop.noAccessDescription`)})},Si={admin:`develop.actors.admin`,token:`develop.actors.token`,system:`develop.actors.system`},Ci=e=>e in Si,Q=()=>{let{t:e}=u();return t=>t?t.name?t.name:Ci(t.type)?e(Si[t.type]):t.type:e(`develop.actors.system`)},wi=({set:e,connectionName:t})=>{let{t:n}=u(),r=Q(),i=yi[e.status],a=e.scheduledFor??e.updatedAt;return(0,J.jsxs)(V,{children:[(0,J.jsxs)(H,{className:`max-w-80`,children:[(0,J.jsx)(ge,{asChild:!0,className:`block truncate`,children:(0,J.jsx)(b,{to:`/changes/$changeSetId`,params:{changeSetId:e.id},children:e.title})}),e.description?(0,J.jsx)(`span`,{className:`block truncate text-meta text-muted-foreground`,children:e.description}):null]}),(0,J.jsx)(H,{children:(0,J.jsx)(w,{tone:i.tone,label:n(i.labelKey)})}),(0,J.jsx)(H,{className:`text-right tabular-nums`,children:n(`changes.itemCount`,{count:e.entryItemCount+e.schemaItemCount})}),(0,J.jsx)(H,{className:`whitespace-nowrap`,children:r(e.createdBy)}),(0,J.jsxs)(H,{className:`whitespace-nowrap`,title:k(a),children:[e.scheduledFor?n(`changes.scheduledFor`,{at:k(e.scheduledFor)}):O(a),t?(0,J.jsx)(`span`,{className:`block text-meta text-muted-foreground`,children:n(`changes.deploysTo`,{name:t})}):null]})]})},Ti=()=>{let{t:e}=u(),t=Ot(),n=Gt(),r=e=>e?n.data?.find(t=>t.id===e)?.name:void 0;return(0,J.jsx)(K,{title:e(`changes.openTitle`),flush:!0,children:(0,J.jsx)(W,{query:t,isEmpty:e=>e.items.length===0,empty:(0,J.jsx)(T,{icon:at,size:`panel`,title:e(`changes.empty`),description:e(`changes.emptyDescription`)}),children:t=>(0,J.jsxs)(U,{children:[(0,J.jsx)(R,{children:(0,J.jsxs)(V,{children:[(0,J.jsx)(z,{children:e(`changes.fields.title`)}),(0,J.jsx)(z,{children:e(`changes.fields.status`)}),(0,J.jsx)(z,{className:`text-right`,children:e(`changes.fields.items`)}),(0,J.jsx)(z,{children:e(`changes.fields.author`)}),(0,J.jsx)(z,{children:e(`changes.fields.when`)})]})}),(0,J.jsx)(B,{children:t.items.map(e=>(0,J.jsx)(wi,{set:e,connectionName:r(e.deploymentConnectionId)},e.id))})]})})})},Ei=()=>{let{t:e}=u(),t=An({status:`scheduled`,limit:25});return(0,J.jsx)(K,{title:e(`changes.scheduledPublications`),flush:!0,children:(0,J.jsx)(W,{query:t,isEmpty:e=>e.items.length===0,empty:(0,J.jsx)(T,{icon:We,size:`panel`,title:e(`changes.noScheduledPublications`)}),children:t=>(0,J.jsxs)(U,{children:[(0,J.jsx)(R,{children:(0,J.jsxs)(V,{children:[(0,J.jsx)(z,{children:e(`changes.fields.model`)}),(0,J.jsx)(z,{children:e(`changes.fields.entry`)}),(0,J.jsx)(z,{children:e(`changes.fields.locale`)}),(0,J.jsx)(z,{children:e(`changes.fields.action`)}),(0,J.jsx)(z,{children:e(`changes.fields.when`)})]})}),(0,J.jsx)(B,{children:t.items.map(t=>(0,J.jsxs)(V,{children:[(0,J.jsx)(H,{className:`font-mono text-xs`,children:t.modelKey??e(`common.unknown`)}),(0,J.jsx)(H,{className:`max-w-48`,children:(0,J.jsx)(`span`,{className:`block truncate font-mono text-xs`,title:t.entryId,children:t.entryId})}),(0,J.jsx)(H,{className:`font-mono text-xs`,children:t.locale}),(0,J.jsx)(H,{children:e(qt[t.action])}),(0,J.jsx)(H,{className:`whitespace-nowrap`,title:k(t.runAt),children:O(t.runAt)})]},t.id))})]})})})},Di=e=>{let{t}=u(),n=Vt(),r=Lt(),i={modelKey:e.modelKey??``,entryId:e.entryId,locale:e.locale,action:`publish`},a=async e=>{let r=await n.mutateAsync({id:e,input:i});j.success(t(`changes.added`,{title:r.title}))};return{addTo:a,createAndAdd:async e=>{let t=await r.mutateAsync({title:e});await a(t.id)},pending:n.isPending||r.isPending,error:n.error??r.error,reset:()=>{n.reset(),r.reset()}}},Oi=({entry:e,label:t})=>{let{t:n}=u(),r=(0,q.useId)(),i=(0,q.useId)(),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(``),l=Ot(`open`),{addTo:d,createAndAdd:f,pending:p,error:m,reset:h}=Di(e),g=e=>void e().then(()=>o(!1),e=>ye(e,`adding an entry to a change set`));return(0,J.jsxs)(Te,{open:a,onOpenChange:e=>{p||(o(e),e&&(h(),c(``)))},modal:!0,children:[(0,J.jsx)(Se,{asChild:!0,children:(0,J.jsxs)(M,{variant:`outline`,size:`sm`,"aria-label":t,children:[(0,J.jsx)(xt,{"aria-hidden":`true`}),n(`changes.addTo`)]})}),(0,J.jsxs)(we,{align:`end`,"aria-labelledby":r,className:`w-80 space-y-3`,children:[(0,J.jsx)(`p`,{id:r,className:`text-sm font-semibold`,children:n(`changes.addToTitle`)}),l.data&&l.data.items.length>0?(0,J.jsx)(`ul`,{className:`max-h-56 space-y-1 overflow-y-auto`,children:l.data.items.map(e=>(0,J.jsx)(`li`,{children:(0,J.jsx)(M,{variant:`ghost`,size:`sm`,className:`w-full justify-start truncate`,disabled:p,onClick:()=>g(()=>d(e.id)),children:e.title})},e.id))}):(0,J.jsx)(`p`,{className:`text-meta text-muted-foreground`,children:n(`changes.noOpenSets`)}),(0,J.jsxs)(`form`,{noValidate:!0,className:`space-y-2 border-t pt-3`,onSubmit:e=>{e.preventDefault();let t=s.trim();t&&g(()=>f(t))},children:[(0,J.jsx)(`label`,{htmlFor:i,className:`text-sm font-semibold`,children:n(`changes.newSetTitle`)}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(ke,{id:i,inputSize:`sm`,value:s,maxLength:200,autoComplete:`off`,onChange:e=>c(e.target.value)}),(0,J.jsx)(x,{size:`sm`,pending:p,pendingLabel:n(`common.saving`),disabled:!s.trim(),children:n(`common.create`)})]})]}),(0,J.jsx)($e,{error:m})]})]})},ki={draft:{labelKey:`changes.unassigned.statuses.draft`,tone:`neutral`},modified:{labelKey:`changes.unassigned.statuses.modified`,tone:`warning`}},Ai=()=>{let{t:e}=u(),t=Nt();return(0,J.jsx)(K,{title:e(`changes.unassigned.title`),flush:!0,children:(0,J.jsx)(W,{query:t,isEmpty:e=>e.items.length===0,empty:(0,J.jsx)(T,{icon:wt,size:`panel`,title:e(`changes.unassigned.empty`)}),children:t=>(0,J.jsxs)(U,{children:[(0,J.jsx)(R,{children:(0,J.jsxs)(V,{children:[(0,J.jsx)(z,{children:e(`changes.fields.entry`)}),(0,J.jsx)(z,{children:e(`changes.fields.model`)}),(0,J.jsx)(z,{children:e(`changes.fields.locale`)}),(0,J.jsx)(z,{children:e(`changes.fields.status`)}),(0,J.jsx)(z,{children:e(`changes.fields.updated`)}),(0,J.jsx)(z,{children:(0,J.jsx)(`span`,{className:`sr-only`,children:e(`common.actions`)})})]})}),(0,J.jsx)(B,{children:t.items.map(t=>{let n=ki[t.status],r=t.title??t.entryId;return(0,J.jsxs)(V,{children:[(0,J.jsx)(H,{className:`max-w-72`,children:t.modelKey?(0,J.jsx)(ge,{asChild:!0,className:`block truncate`,children:(0,J.jsx)(b,{to:`/content/$modelKey/$entryId`,params:{modelKey:t.modelKey,entryId:t.entryId},search:{locale:t.locale},children:r})}):(0,J.jsx)(ge,{className:`block truncate`,children:r})}),(0,J.jsx)(H,{className:`font-mono text-xs`,children:t.modelKey??e(`common.unknown`)}),(0,J.jsx)(H,{className:`font-mono text-xs`,children:t.locale}),(0,J.jsx)(H,{children:(0,J.jsx)(w,{tone:n.tone,label:e(n.labelKey)})}),(0,J.jsx)(H,{className:`whitespace-nowrap`,title:k(t.updatedAt),children:O(t.updatedAt)}),(0,J.jsx)(H,{className:`text-right`,children:(0,J.jsx)(Oi,{entry:t,label:e(`changes.addToLabel`,{title:r})})})]},`${t.entryId}:${t.locale}`)})})]})})})},ji=()=>{let{t:e}=u(),t=y(),{canManageChanges:n}=Z(),[r,i]=(0,q.useState)(!1);return(0,J.jsxs)(S,{children:[(0,J.jsx)(C,{title:e(`changes.title`),actions:n?(0,J.jsxs)(M,{onClick:()=>i(!0),children:[(0,J.jsx)(Et,{"aria-hidden":`true`}),e(`changes.create`)]}):void 0}),n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Ti,{}),(0,J.jsx)(Ai,{}),(0,J.jsx)(Ei,{}),(0,J.jsx)(hi,{open:r,onOpenChange:i,onCreated:e=>{i(!1),t({to:`/changes/$changeSetId`,params:{changeSetId:e.id}})}})]}):(0,J.jsx)(xi,{})]})},Mi=an({connectionId:$t()}),Ni=({flow:e,connections:t,currentConnectionId:n,disabled:r})=>{let{t:i}=u(),a=(0,q.useId)(),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(null),d=(0,q.useMemo)(()=>({connectionId:n??t[0]?.id??``}),[n,t]),f=tn({resolver:en(Mi),values:d}),p=f.handleSubmit(async({connectionId:t})=>{l(null);try{await e.shipNow(t),s(!1)}catch(e){l(e)}});return(0,J.jsxs)(Te,{open:o,onOpenChange:t=>e.shipping&&!t?void 0:s(t),modal:!0,children:[(0,J.jsx)(Se,{asChild:!0,children:(0,J.jsxs)(M,{variant:`outline`,disabled:r,children:[(0,J.jsx)(Wt,{"aria-hidden":`true`}),i(`changes.review.shipWithDeploy`)]})}),(0,J.jsx)(we,{align:`end`,"aria-labelledby":a,className:`w-80`,children:(0,J.jsxs)(`form`,{noValidate:!0,onSubmit:e=>void p(e),className:`space-y-4`,children:[(0,J.jsx)(`p`,{id:a,className:`text-sm font-semibold`,children:i(`changes.review.shipWithDeployTitle`)}),(0,J.jsx)(Bn,{control:f.control,name:`connectionId`,label:i(`changes.review.connection`),options:t.map(e=>({value:e.id,label:e.name}))}),(0,J.jsx)(`p`,{className:`text-meta text-muted-foreground`,children:i(`changes.review.shipWithDeployHint`)}),(0,J.jsx)($e,{error:c}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)(M,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>s(!1),children:i(`common.cancel`)}),(0,J.jsx)(x,{size:`sm`,pending:e.shipping,pendingLabel:i(`changes.review.shipping`),children:i(`changes.review.shipWithDeploy`)})]})]})})]})},Pi=an({at:Nn()}),Fi=({flow:e,disabled:t})=>{let{t:n}=u(),r=(0,q.useId)(),[i,a]=(0,q.useState)(!1),o=(0,q.useMemo)(()=>({at:i?Mn():``}),[i]),s=tn({resolver:en(Pi),defaultValues:o});Ut(i,s.reset,o,e.resetSchedule);let c=s.handleSubmit(async({at:t})=>{let n=jn(t);n&&(await nn(e.scheduleAt(n))).ok&&a(!1)});return(0,J.jsxs)(Te,{open:i,onOpenChange:t=>e.scheduling&&!t?void 0:a(t),modal:!0,children:[(0,J.jsx)(Se,{asChild:!0,children:(0,J.jsxs)(M,{variant:`outline`,disabled:t,children:[(0,J.jsx)(We,{"aria-hidden":`true`}),n(`changes.review.schedule`)]})}),(0,J.jsx)(we,{align:`end`,"aria-labelledby":r,className:`w-80`,children:(0,J.jsxs)(`form`,{noValidate:!0,onSubmit:e=>void c(e),className:`space-y-4`,children:[(0,J.jsx)(`p`,{id:r,className:`text-sm font-semibold`,children:n(`changes.review.scheduleTitle`)}),(0,J.jsx)(Qt,{control:s.control,name:`at`,type:`datetime-local`,label:n(`changes.review.scheduleAt`),description:n(`publishing.fields.localTimeHint`,{timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone})}),(0,J.jsx)($e,{error:e.scheduleError}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)(M,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>a(!1),children:n(`common.cancel`)}),(0,J.jsx)(x,{size:`sm`,pending:e.scheduling,pendingLabel:n(`common.saving`),children:n(`changes.review.schedule`)})]})]})})]})},Ii=({set:e,flow:t})=>{let{t:n}=u(),r=y(),i=Bt(),a=Mt(),o=Gt(),{canShipChanges:s}=Z(),c=(o.data??[]).filter(e=>e.enabled),l=bi.has(e.status),d=!t.canShip||!t.acknowledged||t.shipping,f=e.entryItemCount+e.schemaItemCount;return e.status===`shipped`||e.status===`discarded`||e.status===`shipping`?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(L,{tone:`danger`,title:n(`changes.review.discardTitle`,{title:e.title}),description:n(`changes.review.discardDescription`),confirmLabel:n(`changes.review.discard`),onConfirm:()=>i.mutateAsync(e.id,{onSuccess:()=>{j.success(n(`changes.review.discarded`)),r({to:`/changes`})}}),trigger:(0,J.jsxs)(M,{variant:`destructive-ghost`,disabled:t.shipping,children:[(0,J.jsx)(be,{"aria-hidden":`true`}),n(`changes.review.discard`)]})}),e.status===`scheduled`?(0,J.jsxs)(M,{variant:`outline`,disabled:a.isPending,onClick:()=>a.mutate(e.id,{onSuccess:()=>j.success(n(`changes.review.unscheduled`))}),children:[(0,J.jsx)(Wn,{"aria-hidden":`true`}),n(`changes.review.unschedule`)]}):null,l&&s?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Fi,{flow:t,disabled:d}),c.length>0?(0,J.jsx)(Ni,{flow:t,connections:c,currentConnectionId:e.deploymentConnectionId,disabled:d}):null,(0,J.jsx)(L,{tone:`default`,title:n(`changes.review.shipTitle`,{title:e.title}),description:n(`changes.review.shipDescription`,{count:f}),confirmLabel:n(`changes.review.ship`),pendingLabel:n(`changes.review.shipping`),onConfirm:()=>t.shipNow(),trigger:(0,J.jsxs)(M,{disabled:d,"aria-busy":t.shipping||void 0,children:[t.shipping?(0,J.jsx)(p,{"aria-hidden":`true`,className:`animate-spin motion-reduce:animate-none`}):(0,J.jsx)(Xt,{"aria-hidden":`true`}),t.shipping?n(`changes.review.shipping`):n(`changes.review.ship`)]})})]}):null]})},Li={NEW_FIELDS_AFTER_SHIP:`changes.review.notices.newFieldsAfterShip`},Ri=e=>e in Li,zi=`font-semibold text-link underline-offset-4 hover:underline`,Bi=({set:e,flow:t,notices:n,showAcknowledgementHint:r})=>{let{t:i}=u();return(0,J.jsxs)(J.Fragment,{children:[e.status===`shipped`&&e.shippedSnapshot!==null?(0,J.jsxs)(F,{variant:`success`,role:`status`,children:[(0,J.jsx)(nt,{"aria-hidden":`true`}),(0,J.jsx)(I,{children:(0,J.jsxs)(`p`,{children:[i(`changes.review.shippedIn`),` `,(0,J.jsx)(b,{to:`/snapshots/$seq`,params:{seq:String(e.shippedSnapshot)},className:zi,children:i(`snapshots.version`,{seq:e.shippedSnapshot})})]})})]}):null,e.status===`failed`&&e.error&&!t.stale?(0,J.jsxs)(F,{variant:`destructive`,children:[(0,J.jsx)(se,{"aria-hidden":`true`}),(0,J.jsx)(tt,{children:i(`changes.review.failedTitle`)}),(0,J.jsx)(I,{children:e.error.message})]}):null,t.stale?(0,J.jsxs)(F,{variant:`warning`,className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(Ht,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":`true`}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(tt,{children:i(`changes.review.staleTitle`)}),(0,J.jsx)(I,{children:i(`changes.review.staleDescription`)})]})]}),(0,J.jsx)(M,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void t.refresh(),children:i(`changes.review.refresh`)})]}):null,r&&(t.needsBreaking||t.needsDestructive)&&!t.acknowledged?(0,J.jsxs)(F,{variant:`warning`,role:`status`,children:[(0,J.jsx)(se,{"aria-hidden":`true`}),(0,J.jsx)(I,{children:(0,J.jsxs)(`p`,{children:[i(`changes.review.acknowledgeInChecks`),` `,(0,J.jsx)(b,{to:`/changes/$changeSetId`,params:{changeSetId:e.id},search:{tab:`checks`},className:zi,children:i(`changes.tabs.checks`)})]})})]}):null,n.filter(Ri).map(e=>(0,J.jsxs)(F,{variant:`info`,role:`status`,children:[(0,J.jsx)(ve,{"aria-hidden":`true`}),(0,J.jsx)(I,{children:i(Li[e])})]},e))]})},Vi=240,Hi=e=>{if(e==null)return``;let t=typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e);return t.length>Vi?`${t.slice(0,239)}…`:t},Ui=({value:e,side:t})=>{let{t:n}=u(),r=Hi(e);return(0,J.jsx)(H,{className:`max-w-80 align-top whitespace-normal`,children:r?(0,J.jsx)(`span`,{className:t===`before`?`text-muted-foreground line-through decoration-destructive/60`:``,children:r}):(0,J.jsx)(`span`,{className:`text-meta text-muted-foreground italic`,children:n(`changes.review.empty`)})})},Wi={unpublished:{labelKey:`changes.review.liveStates.unpublished`,tone:`neutral`},published:{labelKey:`changes.review.liveStates.published`,tone:`success`},modified:{labelKey:`changes.review.liveStates.modified`,tone:`warning`},missing:{labelKey:`changes.review.liveStates.missing`,tone:`danger`}},Gi=({item:e,onRemove:t})=>{let{t:n}=u(),r=e.title??e.entryId,i=Wi[e.liveState];return(0,J.jsxs)(K,{title:r,titleAs:`h3`,flush:!0,actions:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(E,{variant:`outline`,className:`font-mono`,children:e.locale}),(0,J.jsx)(E,{variant:`secondary`,children:n(qt[e.action])}),(0,J.jsx)(w,{tone:i.tone,label:n(i.labelKey),size:`sm`}),e.modelKey?(0,J.jsx)(M,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,J.jsx)(b,{to:`/content/$modelKey/$entryId`,params:{modelKey:e.modelKey,entryId:e.entryId},search:{locale:e.locale},children:n(`changes.review.openEntry`)})}):null,t?(0,J.jsx)(L,{tone:`danger`,title:n(`changes.review.removeItemTitle`,{title:r}),description:n(`changes.review.removeItemDescription`),confirmLabel:n(`common.remove`),onConfirm:t,trigger:(0,J.jsx)(M,{variant:`destructive-ghost`,size:`icon-sm`,"aria-label":n(`changes.review.removeItem`,{title:r}),children:(0,J.jsx)(be,{"aria-hidden":`true`})})}):null]}),children:[e.fields.length===0?(0,J.jsx)(`p`,{className:`px-5 py-4 text-meta text-muted-foreground`,children:n(`changes.review.noFieldChanges`)}):(0,J.jsxs)(U,{"aria-label":n(`changes.review.fieldChangesOf`,{title:r}),children:[(0,J.jsx)(R,{children:(0,J.jsxs)(V,{children:[(0,J.jsx)(z,{children:n(`changes.review.field`)}),(0,J.jsx)(z,{children:n(`changes.review.before`)}),(0,J.jsx)(z,{children:n(`changes.review.after`)})]})}),(0,J.jsx)(B,{children:e.fields.map(e=>(0,J.jsxs)(V,{children:[(0,J.jsxs)(H,{className:`align-top`,children:[(0,J.jsx)(`span`,{className:`block font-semibold`,children:e.label}),(0,J.jsx)(`span`,{className:`block font-mono text-meta text-muted-foreground`,children:e.apiKey})]}),(0,J.jsx)(Ui,{value:e.before,side:`before`}),(0,J.jsx)(Ui,{value:e.after,side:`after`})]},e.fieldId))})]}),e.issues.length>0?(0,J.jsx)(`ul`,{className:`space-y-1 border-t px-5 py-3 text-sm text-destructive`,children:e.issues.map(e=>(0,J.jsx)(`li`,{children:e.message},`${e.path}-${e.code}`))}):null]})},Ki=new Set([`requiredField`,`validation`,`constraint`,`index`]),qi=new Set([`metadata`,`editorSwap`]),Ji=e=>e.breaking||e.destructive?`breaking`:e.category===`conversion`?`conversion`:Ki.has(e.category)?`validation`:qi.has(e.category)?`metadata`:`additive`,Yi={breaking:{labelKey:`changes.classes.breaking`,tone:`warning`},conversion:{labelKey:`changes.classes.conversion`,tone:`warning`},validation:{labelKey:`changes.classes.validation`,tone:`neutral`},additive:{labelKey:`changes.classes.additive`,tone:`success`},metadata:{labelKey:`changes.classes.metadata`,tone:`muted`}},Xi=new Set([`definition.added`,`field.added`]),Zi=new Set([`definition.removed`,`field.removed`]),Qi=e=>Xi.has(e.kind)?`+`:Zi.has(e.kind)?`−`:`~`,$i=({changeClass:e,size:t})=>{let{t:n}=u(),r=Yi[e];return(0,J.jsx)(w,{tone:r.tone,label:n(r.labelKey),size:t})},ea=(e,t)=>{let n=jt(e,t.definitionId),i=r({...fn(t.category,t.definitionId),enabled:t.operation!==`create`,retry:!1});return{before:i.data?.definition??null,after:n.data?.definition??null,shared:i.data?i.data.scope===`network`:n.data?.shared??!1}},ta={"+":`text-success`,"−":`text-destructive`,"~":`text-muted-foreground`},na={create:`changes.review.operations.create`,update:`changes.review.operations.update`,delete:`changes.review.operations.delete`},ra=({changeSetId:e,item:t})=>{let{t:n}=u(),{before:r,after:i,shared:a}=ea(e,t),{multiSite:o}=Ue(),s=t.plan?.changes??[],c=i?.label??r?.label??t.apiKey;return(0,J.jsxs)(K,{title:c,titleAs:`h3`,flush:!0,actions:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(E,{variant:`outline`,children:n(na[t.operation])}),o&&a?(0,J.jsxs)(E,{variant:`outline`,"data-shared":!0,children:[(0,J.jsx)(Ve,{"aria-hidden":`true`}),n(`changes.review.shared`)]}):null,(0,J.jsx)(`span`,{className:`font-mono text-meta text-muted-foreground`,children:t.apiKey})]}),children:[t.stale?(0,J.jsx)(`div`,{className:`border-b p-4`,children:(0,J.jsxs)(F,{variant:`warning`,children:[(0,J.jsx)(se,{"aria-hidden":`true`}),(0,J.jsx)(I,{children:n(`changes.review.schemaStale`,{base:t.baseVersion??0,active:t.activeVersion??0})})]})}):null,t.alsoChangedIn.length>0?(0,J.jsxs)(`p`,{className:`border-b px-5 py-2.5 text-meta text-muted-foreground`,children:[n(`changes.review.alsoChangedIn`),` `,t.alsoChangedIn.map((e,t)=>(0,J.jsxs)(`span`,{children:[t>0?`, `:``,(0,J.jsx)(b,{to:`/changes/$changeSetId`,params:{changeSetId:e.id},className:`text-link underline-offset-4 hover:underline`,children:e.title})]},e.id))]}):null,s.length===0?(0,J.jsx)(`p`,{className:`px-5 py-4 text-meta text-muted-foreground`,children:n(`changes.review.noSchemaChanges`)}):(0,J.jsx)(`ul`,{"aria-label":n(`changes.review.schemaChangesOf`,{name:c}),className:`divide-y text-sm`,children:s.map((e,t)=>{let n=Qi(e);return(0,J.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 px-5 py-2.5`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:h(`w-3 shrink-0 font-mono font-semibold`,ta[n]),children:n}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1`,children:ot(e,r,i)}),(0,J.jsx)($i,{changeClass:Ji(e),size:`sm`})]},`${e.kind}-${e.fieldId??``}-${e.property??``}-${t}`)})})]})},ia=({review:e,editable:t})=>{let{t:n}=u(),r=kt(),i=e.changeSet.id;return e.schema.length===0&&e.entries.length===0?(0,J.jsx)(T,{icon:Qn,title:n(`changes.review.noItems`),description:n(`changes.review.noItemsDescription`)}):(0,J.jsxs)(`div`,{className:`space-y-4`,children:[e.schema.map(e=>(0,J.jsx)(ra,{changeSetId:i,item:e},e.itemId)),e.entries.map(e=>(0,J.jsx)(Gi,{item:e,onRemove:t?()=>r.mutateAsync({id:i,itemId:e.itemId},{onSuccess:()=>j.success(n(`changes.review.itemRemoved`))}):void 0},e.itemId))]})},aa={error:{labelKey:`develop.health.error`,tone:`danger`},warning:{labelKey:`develop.health.warning`,tone:`warning`}},oa=({severity:e})=>{let{t}=u(),n=aa[e];return(0,J.jsx)(w,{tone:n.tone,label:t(n.labelKey),size:`sm`})},sa=200,ca=e=>{let t=[...new Set(e.flatMap(e=>e.modelKey?[e.modelKey]:[]))],n=new Set(e.map(e=>e.entryId));return _({queries:t.map(e=>{let t={modelKey:e,limit:sa};return{queryKey:i.develop.setHealthFindings(t),queryFn:()=>d.contentHealth.list(t),meta:{silent:!0}}}),combine:e=>({findings:e.flatMap(e=>(e.data?.items??[]).filter(e=>n.has(e.entryId))),isPending:e.some(e=>e.isPending),error:e.find(e=>e.error)?.error??null})})},la=({issues:e})=>(0,J.jsx)(`ul`,{className:`list-disc space-y-1 pl-4`,children:e.map(e=>(0,J.jsx)(`li`,{children:e.message},`${e.path}-${e.code}`))}),ua=({changeSetId:e,item:t})=>{let{t:n}=u(),{before:r,after:i}=ea(e,t),a=t.plan;return(0,J.jsx)(K,{title:n(`changes.review.plannerTitle`,{name:i?.label??r?.label??t.apiKey}),titleAs:`h3`,description:n(`changes.review.affected`,{count:t.impact?.affectedHeads??0}),children:(0,J.jsxs)(`div`,{className:`space-y-4`,children:[t.issues.length>0?(0,J.jsxs)(F,{variant:`destructive`,children:[(0,J.jsx)(se,{"aria-hidden":`true`}),(0,J.jsx)(I,{children:(0,J.jsx)(la,{issues:t.issues})})]}):null,a&&a.prerequisites.length>0?(0,J.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`models.plan.prerequisites`),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`h4`,{className:`text-sm font-semibold`,children:n(`models.plan.prerequisites`)}),(0,J.jsx)(De,{about:n(`models.plan.prerequisites`),children:n(`models.plan.prerequisitesHint`)})]}),(0,J.jsx)(ct,{phase:`before`,steps:a.prerequisites,impacts:t.impact?.steps,before:r,after:i})]}):(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,J.jsx)(nt,{"aria-hidden":`true`,className:`size-4 text-success`}),n(`changes.review.noPrerequisites`)]}),a&&a.followUps.length>0?(0,J.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`models.plan.followUps`),children:[(0,J.jsx)(`h4`,{className:`text-sm font-semibold`,children:n(`models.plan.followUps`)}),(0,J.jsx)(ct,{phase:`after`,steps:a.followUps,before:r,after:i})]}):null]})})},da={entry_deleted:`changes.review.notRestorable.entry_deleted`,model_missing:`changes.review.notRestorable.model_missing`,publishing_disabled:`changes.review.notRestorable.publishing_disabled`,localization_changed:`changes.review.notRestorable.localization_changed`,locale_missing:`changes.review.notRestorable.locale_missing`,invalid:`changes.review.notRestorable.invalid`,unique_conflict:`changes.review.notRestorable.unique_conflict`},fa=({review:e,flow:t})=>{let{t:n}=u(),{findings:r}=ca(e.entries),i=e.entries.filter(e=>e.issues.length>0);return(0,J.jsxs)(`div`,{className:`space-y-4`,children:[e.checks.blocking.length>0?(0,J.jsxs)(F,{variant:`destructive`,children:[(0,J.jsx)(se,{"aria-hidden":`true`}),(0,J.jsx)(tt,{children:n(`changes.review.blockingTitle`)}),(0,J.jsx)(I,{children:(0,J.jsx)(la,{issues:e.checks.blocking})})]}):null,e.checks.warnings.length>0?(0,J.jsxs)(F,{variant:`warning`,children:[(0,J.jsx)(ve,{"aria-hidden":`true`}),(0,J.jsx)(tt,{children:n(`changes.review.warningsTitle`)}),(0,J.jsx)(I,{children:(0,J.jsx)(la,{issues:e.checks.warnings})})]}):null,e.schema.map(t=>(0,J.jsx)(ua,{changeSetId:e.changeSet.id,item:t},t.itemId)),(0,J.jsx)(K,{title:n(`changes.review.validationTitle`),titleAs:`h3`,children:i.length===0?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,J.jsx)(nt,{"aria-hidden":`true`,className:`size-4 text-success`}),n(`changes.review.allEntriesValid`,{count:e.entries.length})]}):(0,J.jsx)(`ul`,{className:`space-y-3`,children:i.map(e=>(0,J.jsxs)(`li`,{className:`space-y-1 text-sm`,children:[e.modelKey?(0,J.jsx)(b,{to:`/content/$modelKey/$entryId`,params:{modelKey:e.modelKey,entryId:e.entryId},search:{locale:e.locale},className:`font-semibold text-link underline-offset-4 hover:underline`,children:e.title??e.entryId}):(0,J.jsx)(`span`,{className:`font-semibold`,children:e.title??e.entryId}),(0,J.jsx)(`div`,{className:`text-destructive`,children:(0,J.jsx)(la,{issues:e.issues})})]},e.itemId))})}),e.notRestorable.length>0?(0,J.jsx)(K,{title:n(`changes.review.notRestorableTitle`),titleAs:`h3`,children:(0,J.jsx)(`ul`,{className:`space-y-2 text-sm`,children:e.notRestorable.map(e=>(0,J.jsxs)(`li`,{children:[(0,J.jsxs)(`span`,{className:`font-mono text-xs`,children:[e.modelKey??n(`common.unknown`),` · `,e.entryId,` · `,e.locale]}),(0,J.jsxs)(`span`,{className:`block text-muted-foreground`,children:[n(da[e.reason]),e.detail?` (${e.detail})`:``]})]},`${e.entryId}:${e.locale}`))})}):null,(0,J.jsx)(K,{title:n(`changes.review.healthTitle`),titleAs:`h3`,children:r.length===0?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,J.jsx)(nt,{"aria-hidden":`true`,className:`size-4 text-success`}),n(`changes.review.noHealthFindings`)]}):(0,J.jsx)(`ul`,{className:`space-y-2 text-sm`,children:r.map(e=>(0,J.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(oa,{severity:e.severity}),(0,J.jsx)(`span`,{className:`font-semibold`,children:e.entryTitle??e.entryId}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:n(vt[e.rule])}),e.locale===`*`?null:(0,J.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.locale})]},e.id))})}),t.needsBreaking||t.needsDestructive?(0,J.jsxs)(`fieldset`,{className:`space-y-3 rounded-lg border border-warning/40 bg-warning-muted/40 p-4`,children:[(0,J.jsx)(`legend`,{className:`px-1 text-sm font-semibold text-warning`,children:n(`models.plan.acknowledge`)}),t.needsBreaking?(0,J.jsxs)(Ee,{orientation:`horizontal`,children:[(0,J.jsx)(et,{id:`change-set-ack-breaking`,checked:t.acknowledgedBreaking,onCheckedChange:e=>t.setAcknowledgedBreaking(e===!0)}),(0,J.jsx)(Ce,{htmlFor:`change-set-ack-breaking`,className:`font-normal`,children:n(`models.plan.acknowledgeBreaking`)})]}):null,t.needsDestructive?(0,J.jsxs)(Ee,{orientation:`horizontal`,children:[(0,J.jsx)(et,{id:`change-set-ack-destructive`,checked:t.acknowledgedDestructive,onCheckedChange:e=>t.setAcknowledgedDestructive(e===!0)}),(0,J.jsx)(Ce,{htmlFor:`change-set-ack-destructive`,className:`font-normal`,children:n(`models.plan.acknowledgeDestructive`)})]}):null]}):null]})},pa=()=>{let{t:e}=u();return(t,n)=>n||(t===`app_users`?e(`develop.principals.appUsers`):t===`anonymous`?e(`develop.principals.anonymous`):t.startsWith(`token:`)?e(`develop.principals.deletedToken`):t)},ma=({review:e})=>{let{t}=u(),n=pa(),{multiSite:r}=Ue(),i=e.consumers.filter(e=>e.consumers.length>0||(e.otherSites?.consumers??0)>0);return i.length===0?(0,J.jsx)(T,{icon:Zt,title:e.checks.breaking?t(`changes.consumers.none`):t(`changes.consumers.notBreaking`),description:t(`changes.consumers.window`,{count:e.usageDays})}):(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsx)(`p`,{className:`text-meta text-muted-foreground`,children:t(`changes.consumers.window`,{count:e.usageDays})}),i.map(e=>(0,J.jsx)(K,{title:e.apiKey,titleAs:`h3`,flush:!0,description:t(`changes.consumers.readers`,{count:e.consumers.length}),children:(0,J.jsxs)(U,{children:[(0,J.jsx)(R,{children:(0,J.jsxs)(V,{children:[(0,J.jsx)(z,{children:t(`changes.consumers.reader`)}),r?(0,J.jsx)(z,{children:t(`changes.consumers.site`)}):null,(0,J.jsx)(z,{className:`text-right`,children:t(`changes.consumers.reads`)}),(0,J.jsx)(z,{children:t(`changes.consumers.lastRead`)}),(0,J.jsx)(z,{children:t(`changes.consumers.selection`)})]})}),(0,J.jsxs)(B,{children:[e.consumers.map(e=>(0,J.jsxs)(V,{children:[(0,J.jsx)(H,{className:`font-semibold`,children:n(e.principalKey,e.label)}),r?(0,J.jsx)(H,{className:`font-mono text-meta text-muted-foreground`,children:e.site.key}):null,(0,J.jsx)(H,{className:`text-right tabular-nums`,children:e.reads.toLocaleString()}),(0,J.jsx)(H,{className:`whitespace-nowrap`,title:k(e.lastReadAt),children:e.lastReadAt?O(e.lastReadAt):t(`common.never`)}),(0,J.jsx)(H,{children:(0,J.jsx)(E,{variant:e.selection===`explicit`?`secondary`:`outline`,children:e.selection===`explicit`?t(`changes.consumers.explicit`):t(`changes.consumers.implicit`)})})]},`${e.site.id}:${e.principalKey}`)),e.otherSites&&e.otherSites.consumers>0?(0,J.jsx)(V,{"data-other-sites":!0,children:(0,J.jsx)(H,{colSpan:r?5:4,className:`text-muted-foreground`,children:t(`changes.consumers.otherSites`,{count:e.otherSites.consumers,reads:e.otherSites.reads.toLocaleString()})})}):null]})]})},`${e.modelId}:${e.fieldId}`))]})},ha=e=>ne(e,`CHANGE_SET_STALE`)||ne(e,`VERSION_CONFLICT`),ga=(e,t)=>{let{t:n}=u(),r=Rt(),i=At(),a=Dt(),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(!1),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(null),h=e.status===`failed`&&e.error?.code===`CHANGE_SET_STALE`&&p!==e.updatedAt,g=d||h,[ee,_]=(0,q.useState)(t.dataUpdatedAt);t.dataUpdatedAt!==ee&&(_(t.dataUpdatedAt),s(!1),l(!1));let v=t.data,y=v?.checks,te=y?.breaking??!1,ne=y?.destructive??!1,re=(!te||o)&&(!ne||c),b=e.entryItemCount+e.schemaItemCount,ie=(y?.blocking.length??0)>0,ae=bi.has(e.status)&&v!==void 0&&b>0&&!ie&&!g,x={...te?{acknowledgeBreaking:!0}:{},...ne?{acknowledgeDestructive:!0}:{}},S=async e=>{try{await e()}catch(e){if(ha(e)){f(!0);return}throw e}};return{needsBreaking:te,needsDestructive:ne,acknowledgedBreaking:o,acknowledgedDestructive:c,setAcknowledgedBreaking:s,setAcknowledgedDestructive:l,acknowledged:re,canShip:ae,shipping:r.isPending||a.isPending,shipNow:t=>S(async()=>{if(!v)return;let i=v.changeSet.version;t!==void 0&&t!==e.deploymentConnectionId&&(i=(await a.mutateAsync({id:e.id,input:{deploymentConnectionId:t,expectedVersion:i}})).version);let o=await r.mutateAsync({id:e.id,input:{expectedVersion:i,...x,itemVersions:v.entries.flatMap(e=>e.draftVersion===null?[]:[{itemId:e.itemId,draftVersion:e.draftVersion}])}});o.status===`shipped`?j.success(n(`changes.review.shipped`,{seq:o.shippedSnapshot??``})):o.status===`shipping`?j.info(n(`changes.review.shippingStarted`)):j.error(n(`changes.review.shipFailed`))}),scheduleAt:t=>S(async()=>{v&&(await i.mutateAsync({id:e.id,input:{at:t,expectedVersion:v.changeSet.version,...x}}),j.success(n(`changes.review.scheduled`)))}),scheduleError:i.error,resetSchedule:i.reset,scheduling:i.isPending,stale:g,refresh:async()=>{await t.refetch(),f(!1),m(e.updatedAt)}}},_a=({set:e})=>{let{t}=u(),n=(0,q.useId)(),r=(0,q.useId)(),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(e.title),c=Dt();return(0,J.jsxs)(Te,{open:i,onOpenChange:t=>{c.isPending||(a(t),t&&(s(e.title),c.reset()))},modal:!0,children:[(0,J.jsx)(Se,{asChild:!0,children:(0,J.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":t(`changes.review.rename`),children:(0,J.jsx)(Tt,{"aria-hidden":`true`})})}),(0,J.jsx)(we,{align:`start`,"aria-labelledby":n,className:`w-80`,children:(0,J.jsxs)(`form`,{noValidate:!0,className:`space-y-3`,onSubmit:n=>{n.preventDefault();let r=o.trim();if(!r||r===e.title){a(!1);return}nn(c.mutateAsync({id:e.id,input:{title:r,expectedVersion:e.version}})).then(e=>{e.ok&&(a(!1),j.success(t(`changes.review.renamed`)))})},children:[(0,J.jsx)(`label`,{id:n,htmlFor:r,className:`text-sm font-semibold`,children:t(`changes.fields.title`)}),(0,J.jsx)(ke,{id:r,value:o,maxLength:200,autoComplete:`off`,onChange:e=>s(e.target.value)}),(0,J.jsx)($e,{error:c.error}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)(M,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>a(!1),children:t(`common.cancel`)}),(0,J.jsx)(x,{size:`sm`,pending:c.isPending,pendingLabel:t(`common.saving`),disabled:!o.trim(),children:t(`common.saveChanges`)})]})]})})]})},va={created:{labelKey:`changes.timeline.created`,tone:`neutral`},updated:{labelKey:`changes.timeline.updated`,tone:`neutral`},item_added:{labelKey:`changes.timeline.itemAdded`,tone:`neutral`},item_removed:{labelKey:`changes.timeline.itemRemoved`,tone:`muted`},schema_draft_saved:{labelKey:`changes.timeline.schemaDraftSaved`,tone:`neutral`},reviewed:{labelKey:`changes.timeline.reviewed`,tone:`neutral`},scheduled:{labelKey:`changes.timeline.scheduled`,tone:`scheduled`},unscheduled:{labelKey:`changes.timeline.unscheduled`,tone:`muted`},shipping:{labelKey:`changes.timeline.shipping`,tone:`progress`},shipped:{labelKey:`changes.timeline.shipped`,tone:`success`},failed:{labelKey:`changes.timeline.failed`,tone:`danger`},discarded:{labelKey:`changes.timeline.discarded`,tone:`muted`},deploy_triggered:{labelKey:`changes.timeline.deployTriggered`,tone:`progress`},deploy_building:{labelKey:`changes.timeline.deployBuilding`,tone:`progress`},deploy_deployed:{labelKey:`changes.timeline.deployDeployed`,tone:`success`},deploy_failed:{labelKey:`changes.timeline.deployFailed`,tone:`danger`}},ya=e=>e in va,ba=({event:e,last:t})=>{let{t:n}=u(),r=Q(),i=ya(e.kind)?va[e.kind]:void 0;return(0,J.jsxs)(`li`,{className:`flex gap-3`,children:[(0,J.jsxs)(`span`,{"aria-hidden":`true`,className:`flex flex-col items-center`,children:[(0,J.jsx)(`span`,{className:`mt-1.5 size-2.5 shrink-0 rounded-full border-2 border-primary bg-card`}),t?null:(0,J.jsx)(`span`,{className:`w-px flex-1 bg-border`})]}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1 pb-5`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(w,{tone:i?.tone??`neutral`,label:i?n(i.labelKey):e.kind,live:!1,size:`sm`}),e.message?(0,J.jsx)(`span`,{className:`text-sm`,children:e.message}):null,e.snapshot===null?null:(0,J.jsx)(b,{to:`/snapshots/$seq`,params:{seq:String(e.snapshot)},className:`text-sm font-semibold text-link underline-offset-4 hover:underline`,children:n(`snapshots.version`,{seq:e.snapshot})}),e.deploymentRunId?(0,J.jsx)(b,{to:`/publishing/deployments/runs/$runId`,params:{runId:e.deploymentRunId},className:`text-sm text-link underline-offset-4 hover:underline`,children:n(`changes.timeline.deployRun`)}):null]}),(0,J.jsxs)(`p`,{className:`text-meta text-muted-foreground`,children:[r(e.actor),` ·`,` `,(0,J.jsx)(`time`,{dateTime:e.at,title:k(e.at),children:O(e.at)})]})]})]})},xa=({changeSetId:e})=>{let{t}=u(),n=Pt(e);return(0,J.jsx)(W,{query:n,isEmpty:e=>e.length===0,empty:(0,J.jsx)(T,{icon:je,title:t(`changes.timeline.empty`)}),children:e=>(0,J.jsx)(`ol`,{"aria-label":t(`changes.tabs.timeline`),className:`rounded-xl border bg-card p-5 pb-0`,children:e.map((t,n)=>(0,J.jsx)(ba,{event:t,last:n===e.length-1},`${t.at}-${t.kind}-${n}`))})})},Sa={changes:`changes.tabs.changes`,checks:`changes.tabs.checks`,consumers:`changes.tabs.consumers`,timeline:`changes.tabs.timeline`},Ca=({set:e})=>{let{t}=u(),n=Q(),r=he({from:`/app/changes/$changeSetId`}).tab??`changes`,i=y({from:`/changes/$changeSetId`}),a=zt(e.id),o=ga(e,a),s=yi[e.status],c=bi.has(e.status),l=e.entryItemCount+e.schemaItemCount,d=[t(`changes.review.openedBy`,{name:n(e.createdBy),at:O(e.createdAt)}),t(`changes.itemCount`,{count:l}),e.status===`scheduled`&&e.scheduledFor?t(`changes.scheduledFor`,{at:k(e.scheduledFor)}):``].filter(Boolean).join(` · `);return(0,J.jsx)(S,{children:(0,J.jsxs)(ze,{value:r,onValueChange:e=>void i({search:{tab:e},replace:!0}),className:`gap-6`,children:[(0,J.jsx)(C,{sticky:!0,breadcrumb:[{label:t(`changes.title`),link:v({to:`/changes`})}],title:e.title,badge:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(w,{tone:s.tone,label:t(s.labelKey)}),c?(0,J.jsx)(_a,{set:e}):null]}),meta:d,actions:(0,J.jsx)(Ii,{set:e,flow:o}),tabs:(0,J.jsx)(Le,{variant:`underline`,"aria-label":t(`changes.tabs.label`),children:de.map(e=>(0,J.jsx)(N,{value:e,children:t(Sa[e])},e))})}),(0,J.jsx)(Bi,{set:e,flow:o,notices:a.data?.notices??[],showAcknowledgementHint:c&&r!==`checks`}),(0,J.jsx)(W,{query:a,loadingRows:6,children:e=>(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(P,{value:`changes`,children:(0,J.jsx)(ia,{review:e,editable:c})}),(0,J.jsx)(P,{value:`checks`,children:(0,J.jsx)(fa,{review:e,flow:o})}),(0,J.jsx)(P,{value:`consumers`,children:(0,J.jsx)(ma,{review:e})})]})}),(0,J.jsx)(P,{value:`timeline`,children:(0,J.jsx)(xa,{changeSetId:e.id})})]})})},wa=()=>{let{changeSetId:e}=oe({from:`/app/changes/$changeSetId`}),{canManageChanges:t}=Z(),n=It(e);return t?(0,J.jsx)(W,{query:n,loadingRows:6,children:e=>(0,J.jsx)(Ca,{set:e})}):(0,J.jsx)(S,{children:(0,J.jsx)(xi,{})})},Ta={silent:!0},Ea=e=>r({queryKey:i.publishing.jobs.list(e),queryFn:()=>d.jobs.list(e),placeholderData:ee,meta:Ta}),Da=()=>r({queryKey:i.publishing.jobs.summary,queryFn:()=>d.jobs.summary(),meta:Ta}),Oa=()=>{let e=o();return a({mutationKey:[`jobs`,`retry`],mutationFn:e=>m(()=>d.jobs.retry(e)),onSettled:()=>e.invalidateQueries({queryKey:i.publishing.jobs.all})})},ka=20,Aa=()=>{let{t:e}=u(),t=Ea({status:`dead`,limit:ka}),n=Oa(),r=t=>n.mutate(t.id,{onSuccess:()=>j.success(e(`develop.live.jobRetried`,{type:t.type}))});return(0,J.jsx)(W,{query:t,loadingRows:3,children:t=>(0,J.jsx)(`ul`,{"aria-label":e(`develop.live.failedJobsTitle`),className:`mt-3 divide-y border-t`,children:t.items.map(t=>(0,J.jsxs)(`li`,{className:`flex items-start justify-between gap-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`font-mono text-xs font-semibold`,children:t.type}),t.lastError?(0,J.jsx)(`p`,{className:`line-clamp-2 text-meta text-destructive`,title:t.lastError,children:t.lastError}):null]}),(0,J.jsx)(M,{variant:`outline`,size:`sm`,disabled:n.isPending,"aria-label":e(`develop.live.retryJobLabel`,{type:t.type}),onClick:()=>r(t),children:e(`develop.live.retryJob`)})]},t.id))})})},ja=()=>{let{t:e}=u(),t=Da(),[n,r]=(0,q.useState)(!1),i=t.data?.counts.dead??0;return i===0?null:(0,J.jsxs)(K,{title:e(`develop.live.failedJobsTitle`),children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(w,{tone:`danger`,label:e(`develop.live.jobsFailed`,{count:i}),size:`sm`}),(0,J.jsx)(M,{variant:`link`,size:`sm`,"aria-expanded":n,onClick:()=>r(e=>!e),children:e(n?`develop.live.hideFailedJobs`:`develop.live.showFailedJobs`)})]}),n?(0,J.jsx)(Aa,{}):null]})},Ma=()=>{let{t:e}=u(),t=ft();return(0,J.jsx)(K,{title:e(`develop.live.healthTitle`),children:(0,J.jsx)(W,{query:t,loadingRows:2,children:t=>{let n=new Map(t.rules.map(({rule:e,count:t})=>[e,t])),r=pt.filter(e=>(n.get(e)??0)>0),i=r.reduce((e,t)=>e+(n.get(t)??0),0);return(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(w,{tone:i>0?`warning`:`success`,label:e(`develop.live.healthOpen`,{count:i})}),(0,J.jsx)(b,{to:`/`,className:`text-sm text-link underline-offset-4 hover:underline`,children:e(`develop.live.openInbox`)})]}),r.length>0?(0,J.jsx)(`ul`,{className:`space-y-1 text-sm`,children:r.map(t=>(0,J.jsxs)(`li`,{className:`flex justify-between gap-3`,children:[(0,J.jsx)(`span`,{children:e(vt[t])}),(0,J.jsx)(`span`,{className:`tabular-nums`,children:n.get(t)})]},t))}):(0,J.jsx)(`p`,{className:`text-meta text-muted-foreground`,children:e(`develop.live.healthClean`)})]})}})})},Na=()=>{let{t:e}=u(),t=Kt();if(!t.data)return null;let n=t.data.filter(e=>e.enabled),r=n.filter(e=>e.lastDelivery?.status===`dead`).length;return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`dt`,{children:(0,J.jsx)(b,{to:`/publishing/webhooks`,className:`text-sm font-semibold text-link underline-offset-4 hover:underline`,children:e(`develop.live.webhooks`)})}),(0,J.jsxs)(`dd`,{className:`flex flex-wrap gap-1.5`,children:[(0,J.jsx)(w,{tone:`success`,label:e(`develop.live.webhooksEnabled`,{count:n.length}),size:`sm`}),(0,J.jsx)(w,{tone:r>0?`danger`:`muted`,label:e(`develop.live.webhooksFailing`,{count:r}),size:`sm`})]})]})},Pa=()=>{let{t:e}=u(),{canManageWebhooks:t}=Z();return t?(0,J.jsx)(K,{title:e(`develop.live.webhooks`),children:(0,J.jsx)(`dl`,{className:`space-y-3`,children:(0,J.jsx)(Na,{})})}):null},Fa=e=>{let t=dn(`model`),n=ei((0,q.useMemo)(()=>(t.data??[]).map(({definition:e})=>e.id),[t.data]),e&&t.isSuccess),r=(0,q.useMemo)(()=>new Map((t.data??[]).map(({definition:e})=>[e.id,e.apiKey])),[t.data]);return{...n,isPending:t.isPending||n.isPending,error:t.error??n.error,modelKeyOf:e=>r.get(e)??e,servedReads:n.principals.reduce((e,t)=>e+t.requests,0)}},Ia=({fields:e,modelKeyOf:t})=>{let{t:n}=u(),r=new Map;for(let t of e)r.set(t.modelId,[...r.get(t.modelId)??[],t]);let i=[...r.entries()].flatMap(([e,r])=>{let i=t(e);return r.every(e=>e.selection===`implicit`)?[n(`develop.live.wholeModel`,{model:i})]:r.filter(e=>e.selection===`explicit`).map(e=>`${i}.${e.apiKeyPath}`)});return(0,J.jsx)(`span`,{className:`block truncate font-mono text-xs`,title:i.join(`, `),children:i.join(`, `)})},La=()=>{let{t:e}=u(),t=pa(),n=Fa(!0);return(0,J.jsxs)(K,{title:e(`develop.live.readersTitle`),description:e(`develop.live.servedReads`,{count:n.servedReads,days:7}),flush:!0,children:[n.tracking?null:(0,J.jsx)(`p`,{className:`border-b px-5 py-2.5 text-meta text-muted-foreground`,children:e(`develop.live.notTracking`)}),n.isPending?(0,J.jsx)(D,{rows:3}):n.error?(0,J.jsx)(ce,{error:n.error,onRetry:()=>void n.refetch()}):n.principals.length===0?(0,J.jsx)(T,{icon:Zt,size:`panel`,title:e(`develop.live.noReaders`,{count:7})}):(0,J.jsxs)(U,{children:[(0,J.jsx)(R,{children:(0,J.jsxs)(V,{children:[(0,J.jsx)(z,{children:e(`changes.consumers.reader`)}),(0,J.jsx)(z,{children:e(`develop.live.fields`)}),(0,J.jsx)(z,{className:`text-right`,children:e(`develop.live.requests`)}),(0,J.jsx)(z,{children:e(`changes.consumers.lastRead`)}),(0,J.jsx)(z,{children:e(`develop.live.pinned`)})]})}),(0,J.jsx)(B,{children:n.principals.map(r=>(0,J.jsxs)(V,{children:[(0,J.jsx)(H,{className:`font-semibold whitespace-nowrap`,children:t(r.principalKey,r.tokenName)}),(0,J.jsx)(H,{className:`max-w-96`,children:(0,J.jsx)(Ia,{fields:r.fields,modelKeyOf:n.modelKeyOf})}),(0,J.jsx)(H,{className:`text-right tabular-nums`,children:r.requests.toLocaleString()}),(0,J.jsx)(H,{className:`whitespace-nowrap`,title:k(r.lastReadAt),children:O(r.lastReadAt)}),(0,J.jsx)(H,{className:`whitespace-nowrap`,children:r.lastSnapshot===null?e(`develop.live.followsLive`):(0,J.jsx)(b,{to:`/snapshots/$seq`,params:{seq:String(r.lastSnapshot)},className:`text-link underline-offset-4 hover:underline`,children:e(`snapshots.version`,{seq:r.lastSnapshot})})})]},r.principalKey))})]})]})},Ra={publish:`snapshots.sources.publish`,unpublish:`snapshots.sources.unpublish`,delete:`snapshots.sources.delete`,schedule:`snapshots.sources.schedule`,change_set:`snapshots.sources.change_set`,schema:`snapshots.sources.schema`,conversion:`snapshots.sources.conversion`,import:`snapshots.sources.import`,legacy:`snapshots.sources.legacy`},za={queued:{labelKey:`publishing.deployments.statuses.queued`,tone:`neutral`},triggered:{labelKey:`publishing.deployments.statuses.triggered`,tone:`progress`},building:{labelKey:`publishing.deployments.statuses.building`,tone:`progress`},deployed:{labelKey:`publishing.deployments.statuses.deployed`,tone:`success`},failed:{labelKey:`publishing.deployments.statuses.failed`,tone:`danger`},unknown:{labelKey:`publishing.deployments.statuses.unknown`,tone:`muted`}},Ba=()=>{let{t:e}=u(),t=Q(),n=_t(void 0);return(0,J.jsx)(K,{title:e(`develop.live.snapshotTitle`),children:(0,J.jsx)(W,{query:n,loadingRows:2,children:n=>{let r=n.items.find(e=>e.seq===n.current);return(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(b,{to:`/snapshots/$seq`,params:{seq:String(n.current)},className:`text-title text-link underline-offset-4 hover:underline`,children:e(`snapshots.version`,{seq:n.current})}),r?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-meta text-muted-foreground`,children:[(0,J.jsx)(E,{variant:`secondary`,children:e(Ra[r.source])}),(0,J.jsx)(`span`,{title:k(r.createdAt),children:e(`develop.live.since`,{at:O(r.createdAt),name:t({type:r.actor.type})})}),r.schemaVersion===null?null:(0,J.jsx)(`span`,{children:e(`snapshots.schemaVersion`,{version:r.schemaVersion})})]}):null]})}})})},Va=()=>{let{t:e}=u(),{canManageChanges:t,canReadUsage:n,canManagePublishing:r,canManageWebhooks:i}=Z(),a=t||n||r||i;return(0,J.jsxs)(S,{children:[(0,J.jsx)(C,{title:e(`develop.live.title`)}),a?null:(0,J.jsx)(xi,{}),t?(0,J.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,J.jsx)(Ba,{}),(0,J.jsx)(Ma,{})]}):null,n?(0,J.jsx)(La,{}):null,r?(0,J.jsx)(ja,{}):null,(0,J.jsx)(Pa,{})]})},Ha={changedOnBoth:`develop.schema.conflicts.reasons.changedOnBoth`,deletedOnTarget:`develop.schema.conflicts.reasons.deletedOnTarget`,existsOnTarget:`develop.schema.conflicts.reasons.existsOnTarget`,changedOnTargetBeforeDelete:`develop.schema.conflicts.reasons.changedOnTargetBeforeDelete`},Ua=({label:e,before:t,after:n})=>{let r=lt(wn(t,n),{before:t,after:n});return(0,J.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold tracking-wide text-muted-foreground uppercase`,children:e}),(0,J.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-sm`,children:r.map((e,r)=>(0,J.jsx)(`li`,{children:ot(e,t,n)},`${e.kind}:${e.fieldId??``}:${e.property??``}:${r}`))})]})},Wa=({conflicts:e,textOf:t,onTakeRemote:n,onKeepLocal:r})=>{let{t:i}=u();return(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsxs)(F,{variant:`warning`,children:[(0,J.jsx)(Xn,{"aria-hidden":`true`}),(0,J.jsx)(tt,{children:i(`develop.schema.conflicts.title`,{count:e.length})}),(0,J.jsx)(I,{children:i(`develop.schema.conflicts.description`)})]}),e.map(e=>{let{file:a,local:o,remote:s}=e;return(0,J.jsxs)(K,{title:i(`develop.schema.conflicts.fileTitle`,{path:a.path}),description:i(Ha[e.reason]),actions:(0,J.jsx)(Pn,{value:t(e)}),children:[(0,J.jsxs)(`div`,{className:`grid gap-5 md:grid-cols-2`,children:[(0,J.jsx)(Ua,{label:i(`develop.schema.conflicts.theirs`),before:a.base.definition,after:s?.definition??null}),(0,J.jsx)(Ua,{label:i(`develop.schema.conflicts.yours`),before:a.base.definition,after:o.definition})]}),s?(0,J.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,J.jsx)(M,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>r(s),children:i(`develop.schema.conflicts.keepLocal`)}),(0,J.jsx)(L,{tone:`danger`,title:i(`develop.schema.conflicts.takeRemoteTitle`),description:i(`develop.schema.conflicts.takeRemoteDescription`),confirmLabel:i(`develop.schema.conflicts.takeRemote`),onConfirm:()=>n(s),trigger:(0,J.jsx)(M,{type:`button`,size:`sm`,variant:`outline`,children:i(`develop.schema.conflicts.takeRemote`)})})]}):null]},a.definitionId)})]})},Ga=`schema`,Ka=e=>e.kind===`component`?`component`:`model`,qa=e=>`${Ga}/${e.kind===`component`?`components`:`models`}/${e.apiKey}.json`,Ja={model:0,component:1},Ya=e=>e.definitions.map(({definition:e,version:t,hash:n})=>({path:qa(e),definitionId:e.id,category:Ka(e),apiKey:e.apiKey,base:{version:t,hash:n,definition:e,text:vn(e)}})).sort((e,t)=>Ja[e.category]-Ja[t.category]||e.path.localeCompare(t.path)),$=En,Xa=e=>({formatVersion:2,schemaVersion:e.schemaVersion,definitions:Object.fromEntries(e.definitions.map(({definition:e,version:t,hash:n})=>[e.id,{kind:e.kind,apiKey:e.apiKey,version:t,hash:n}]))}),Za=e=>xn(Xa(e)),Qa=({path:e,dirty:t,open:n,icon:r})=>{let{t:i}=u(),a=e.slice(e.lastIndexOf(`/`)+1);return(0,J.jsxs)(Rn,{to:`/schema`,search:{file:e},title:e,"aria-current":n?`page`:void 0,children:[(0,J.jsx)(r,{"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:a}),t?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto size-2 shrink-0 rounded-full bg-warning`}),(0,J.jsx)(`span`,{className:`sr-only`,children:i(`develop.schema.modified`)})]}):null]})},$a=({files:e,openPath:t,isDirty:n})=>{let{t:r}=u(),i=e.filter(e=>e.category===`model`),a=e.filter(e=>e.category===`component`);return(0,J.jsxs)(In,{label:r(`develop.schema.files`),children:[i.length>0?(0,J.jsx)(Ln,{label:r(`develop.schema.modelsDir`),children:i.map(e=>(0,J.jsx)(Qa,{path:e.path,dirty:n(e),open:e.path===t,icon:He},e.definitionId))}):null,a.length>0?(0,J.jsx)(Ln,{label:r(`develop.schema.componentsDir`),children:a.map(e=>(0,J.jsx)(Qa,{path:e.path,dirty:n(e),open:e.path===t,icon:nr},e.definitionId))}):null,(0,J.jsx)(Ln,{label:r(`develop.schema.lockDir`),children:(0,J.jsx)(Qa,{path:$,dirty:!1,open:t===$,icon:ie})})]})},eo={silent:!0},to=`/api/admin/schema/export`,no=[...i.schema.all,`export`],ro=te({queryKey:no,queryFn:()=>s.request(to),staleTime:0,meta:eo}),io=()=>r({...ro,refetchOnWindowFocus:!1}),ao=e=>{try{return{ok:!0,raw:JSON.parse(e)}}catch(e){return{ok:!1,message:e instanceof Error?e.message:String(e)}}},oo=(e,{previous:t,others:n})=>{let r=ao(e);if(!r.ok)return{status:`invalidJson`,message:r.message};let i=Tn(r.raw,{createId:St,...t?{previous:t}:{}});if(!i.ok)return{status:`invalid`,raw:r.raw,issues:i.issues};let{definition:a}=i,o=Sn([...n.filter(e=>e.id!==a.id),a]).filter(e=>e.definitionId===void 0||e.definitionId===a.id);return o.length>0?{status:`invalid`,raw:r.raw,issues:o}:{status:`valid`,raw:r.raw,definition:a}},so=e=>e.status===`invalid`?e.issues:[],co=(e,t)=>({definitionId:e.file.definitionId,category:e.file.category,definition:e.local.definition,baseVersion:t.action===`update`?t.expectedVersion:null}),lo=(e,t)=>{let n=new Map(t.definitions.map(e=>[e.definition.id,e])),r=[],i=[],a=0;for(let t of e){let e=n.get(t.file.definitionId),o=lr({local:{definition:t.local.definition,hash:vn(t.local.definition)},base:{version:t.file.base.version,hash:t.file.base.text},remote:e?{version:e.version,hash:vn(e.definition),definition:e.definition}:void 0,prune:!1});switch(o.action){case`conflict`:r.push({file:t.file,local:t.local,remote:e,reason:o.reason});break;case`create`:case`update`:i.push(co(t,o));break;default:a+=1}}return r.length>0?{status:`conflict`,conflicts:r}:{status:`ready`,drafts:i,skipped:a}},uo=e=>{let t=[];for(let n of e.dirtyFiles){let r=oo(e.textOf(n),{previous:n.base.definition,others:e.definitions.filter(e=>e.id!==n.definitionId)});if(r.status!==`valid`)return{invalid:n};t.push({file:n,local:{definition:r.definition}})}return{items:t}},fo=({onInvalid:e,onConflict:t,onApplied:n})=>{let{t:r}=u(),i=o(),a=Ft(),[s,c]=(0,q.useState)(!1),l=async e=>{let t=``;for(let{definitionId:n,...i}of e)t=await a.mutateAsync({definitionId:n,input:i,newSetTitle:r(`develop.schema.apply.newSetTitle`)});return t};return{apply:async a=>{c(!0);try{let o=uo(a);if(`invalid`in o){j.error(r(`develop.schema.apply.invalid`,{path:o.invalid.path})),e(o.invalid);return}let s=await i.fetchQuery(ro),c=lo(o.items,s);if(c.status===`conflict`){t(c.conflicts);return}if(c.drafts.length===0){j.info(r(`develop.schema.apply.nothing`));return}n(await l(c.drafts))}catch(e){xe(e,`apply schema files`)}finally{c(!1)}},pending:s}},po=(e,t)=>({...e,definitions:e.definitions.map(e=>e.definition.id===t.definition.id?t:e)}),mo=()=>{let e=io(),[t,n]=(0,q.useState)(),[r,i]=(0,q.useState)({}),a=t??e.data,o=(0,q.useMemo)(()=>a?Ya(a):[],[a]),s=(0,q.useMemo)(()=>a?Za(a):``,[a]),c=(0,q.useMemo)(()=>o.map(e=>e.base.definition),[o]),l=(0,q.useCallback)(e=>r[e.definitionId]??e.base.text,[r]),u=(0,q.useCallback)(e=>{let t=r[e.definitionId];return t!==void 0&&t!==e.base.text},[r]),d=(0,q.useCallback)((e,t)=>{n(e=>e??a),i(n=>({...n,[e.definitionId]:t}))},[a]),f=(0,q.useCallback)(e=>{n(t=>t&&po(t,e)),i(({[e.definition.id]:t,...n})=>n)},[]),p=(0,q.useCallback)(e=>{n(t=>t&&po(t,e))},[]),{refetch:m}=e,h=(0,q.useCallback)(async()=>(n(void 0),i({}),m()),[m]),g=(0,q.useMemo)(()=>o.filter(u),[o,u]);return{query:e,workspace:(0,q.useMemo)(()=>a?{schemaVersion:a.schemaVersion,files:o,lockText:s,definitions:c,textOf:l,setText:d,dirtyFiles:g,isDirty:u,takeRemote:f,keepLocal:p,reload:h}:void 0,[a,o,s,c,l,d,g,u,f,p,h])}},ho=(0,q.lazy)(()=>Qe(()=>import(`./View-BLsQYPow.js`).then(e=>({default:e.View})),__vite__mapDeps([0,1,2,3,4]),import.meta.url)),go=({className:e,...t})=>(0,J.jsx)(`div`,{className:h(`min-h-0 overflow-hidden rounded-xl border bg-card focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50`,e),children:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(D,{rows:8,className:`p-4`}),children:(0,J.jsx)(ho,{...t})})}),_o=()=>[],vo=({text:e})=>{let{t}=u();return(0,J.jsx)(K,{title:$,description:t(`develop.schema.lockDescription`),flush:!0,children:(0,J.jsx)(go,{className:`h-[28rem] rounded-none border-0 xl:h-[40rem]`,value:e,onChange:_o,label:t(`develop.schema.editorLabel`,{path:$}),readOnly:!0,schema:void 0,lint:_o})})},yo=e=>JSON.parse(JSON.stringify(e)),bo=e=>{let t=e.properties?.fields?.items;return t&&!Array.isArray(t)&&(t.allOf=Object.entries(hn).map(([e,t])=>({if:{properties:{type:{const:e}},required:[`type`]},then:{properties:{settings:yo(t)}}}))),e},xo={model:bo(yo(On)),component:bo(yo(gn))},So=e=>xo[e],Co=300,wo=(e,t,n)=>{let r=(0,q.useMemo)(()=>e?{previous:e.base.definition,others:n.filter(t=>t.id!==e.definitionId)}:void 0,[e,n]),i=pn(t,Co);return{analysis:(0,q.useMemo)(()=>r?oo(i,r):void 0,[r,i]),lint:(0,q.useCallback)(e=>r?so(oo(e,r)):[],[r])}},To=({issues:e,id:t})=>{let{t:n}=u();return e.length===0?null:(0,J.jsxs)(`div`,{id:t,role:`status`,className:`space-y-1.5 rounded-lg border border-destructive/40 bg-destructive-muted p-3`,children:[(0,J.jsx)(`p`,{className:`text-sm font-semibold text-destructive`,children:n(`develop.schema.problems`,{count:e.length})}),(0,J.jsx)(`ul`,{className:`space-y-1 text-meta text-foreground`,children:e.map(e=>(0,J.jsxs)(`li`,{className:`break-words`,children:[(0,J.jsx)(`code`,{className:`font-mono text-xs`,children:e.path||`/`}),` `,e.message]},`${e.path}:${e.code}:${e.message}`))})]})},Eo=e=>{let t=Dn(e);return[{id:`document`,kind:`document`,label:void 0,fields:[t.titleInline?t.title:void 0,t.cover,...t.canvas].filter(e=>e!==void 0)},...t.propertyGroups.map(e=>({id:`group-${e.id}`,kind:`properties`,label:e.label,fields:e.fields}))].filter(e=>e.fields.length>0)},Do=e=>({id:e.id,kind:`singleton`,apiKey:e.apiKey,label:e.label,localized:!1,draftAndPublish:!1,fields:e.fields,display:{...e.display.groups?{groups:e.display.groups}:{}}}),Oo=()=>Promise.resolve(null),ko=({definition:e,definitions:t})=>{let{t:n}=u(),r=Pe(),i=(0,q.useMemo)(()=>G(e)?e:Do(e),[e]),a=(0,q.useMemo)(()=>{let n=[...t.filter(t=>t.id!==e.id),e];return{idPrefix:`schema-preview-`,model:i,models:new Map(n.filter(G).map(e=>[e.id,e])),components:new Map(n.filter(_n).map(e=>[e.id,e])),locale:null,entryId:null,readOnly:!0,disabled:!1,runtimeEditors:r.editors,pickMedia:Oo}},[e,t,i,r.editors]),o=(0,q.useMemo)(()=>Fe(Ae(i.fields)),[i]);if(r.isLoading)return(0,J.jsx)(D,{rows:4});let s=Eo(i);return s.length===0?(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`develop.schema.preview.noFields`)}):(0,J.jsx)(Be,{environment:a,store:o,children:(0,J.jsx)(`div`,{className:`space-y-6`,children:s.map(e=>(0,J.jsxs)(`section`,{"aria-labelledby":`schema-preview-${e.id}`,className:`space-y-3`,children:[(0,J.jsx)(`h3`,{id:`schema-preview-${e.id}`,className:`text-xs font-semibold tracking-wide text-muted-foreground uppercase`,children:e.label??(e.kind===`document`?n(`develop.schema.preview.document`):n(`develop.schema.preview.properties`))}),(0,J.jsx)(Me,{fields:e.fields})]},e.id))})})},Ao=({definition:e,lookup:t})=>{let{t:n}=u(),r=(0,q.useMemo)(()=>Ne(e,t),[e,t]);return(0,J.jsx)(Y,{label:n(`develop.schema.preview.sdl`),code:r})},jo=({before:e,after:t})=>{let{t:n}=u(),r=(0,q.useMemo)(()=>lt(wn(e,t),{before:e,after:t}),[e,t]);if(r.length===0)return(0,J.jsx)(T,{size:`panel`,icon:nt,title:n(`develop.schema.plan.none`)});let i=it(r);return(0,J.jsxs)(`div`,{className:`space-y-5`,children:[i.breaking||i.destructive?(0,J.jsx)(F,{variant:`warning`,children:(0,J.jsx)(I,{children:i.destructive?n(`develop.schema.plan.destructive`):n(`develop.schema.plan.breaking`)})}):null,i.supported?null:(0,J.jsx)(F,{variant:`destructive`,children:(0,J.jsx)(I,{children:n(`develop.schema.plan.unsupported`)})}),rt(r).map(n=>(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(st,{bucket:n.bucket}),(0,J.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-sm`,children:n.changes.map((n,r)=>(0,J.jsx)(`li`,{children:ot(n,e,t)},`${n.kind}:${n.fieldId??``}:${n.property??``}:${r}`))})]},n.bucket)),(0,J.jsx)(`p`,{className:`text-meta text-muted-foreground`,children:n(`develop.schema.plan.serverChecks`)})]})},Mo=({definition:e,lookup:t})=>{let{t:n}=u(),r=Ie(e),i=(0,q.useMemo)(()=>Re(e,t),[e,t]);return(0,J.jsxs)(`div`,{className:`space-y-5`,children:[G(e)?(0,J.jsx)(`ul`,{"aria-label":n(`develop.schema.preview.endpoints`),className:`space-y-1.5`,children:r.map(e=>(0,J.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(E,{variant:`outline`,className:`w-16 justify-center font-mono`,children:e.method}),(0,J.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs`,children:e.path}),e.scope===`admin`?(0,J.jsx)(E,{variant:`secondary`,className:`ml-auto shrink-0`,children:n(`develop.schema.preview.admin`)}):null]},`${e.method} ${e.path}`))}):(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`develop.schema.preview.componentEndpoints`)}),(0,J.jsx)(Y,{label:G(e)?n(`develop.schema.preview.responseSample`):n(`develop.schema.preview.componentSample`),code:i})]})},No=(e,t)=>{let n=e.indexOf(`export type ${t} = `);if(n<0)return;let r=e.lastIndexOf(`/**`,n),i=e.lastIndexOf(`*/`,n),a=r>=0&&i>r&&e.slice(i+2,n).trim()===``?r:n,o=e.indexOf(`
8
+ };
9
+ `,n);return o<0?void 0:e.slice(a,o+4)},Po=(e,t)=>{let n=Cn(t);return[No(e,n),No(e,`${n}Input`)].filter(e=>e!==void 0).join(`
10
+ `)},Fo=({apiKey:e,edited:t})=>{let{t:n}=u(),r=mr();return(0,J.jsx)(W,{query:r,children:({source:r,schemaVersion:i})=>{let a=Po(r,e);return(0,J.jsxs)(`div`,{className:`space-y-4`,children:[t?(0,J.jsx)(F,{variant:`info`,children:(0,J.jsx)(I,{children:n(`develop.schema.preview.typesActive`,{version:i})})}):null,a?(0,J.jsx)(Y,{label:n(`develop.schema.preview.typescript`),code:a}):(0,J.jsx)(T,{size:`panel`,icon:Kn,title:n(`develop.schema.preview.noTypes`)})]})}})},Io=[`form`,`rest`,`graphql`,`types`,`plan`],Lo={form:`develop.schema.preview.tabs.form`,rest:`develop.schema.preview.tabs.rest`,graphql:`develop.schema.preview.tabs.graphql`,types:`develop.schema.preview.tabs.types`,plan:`develop.schema.preview.tabs.plan`},Ro=({file:e,analysis:t,edited:n,definitions:r})=>{let{t:i}=u(),[a,o]=(0,q.useState)(`form`),s=t?.status===`valid`?t.definition:void 0,c=(0,q.useMemo)(()=>new Map([...r.filter(t=>t.id!==e.definitionId),...s?[s]:[]].map(e=>[e.id,e])),[r,s,e.definitionId]),l=(0,J.jsx)(T,{size:`panel`,icon:ht,title:i(`develop.schema.preview.invalidTitle`),description:i(`develop.schema.preview.invalidDescription`)});return(0,J.jsx)(K,{title:i(`develop.schema.preview.title`),titleAs:`h2`,children:(0,J.jsxs)(ze,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(Le,{variant:`underline`,className:`w-full justify-start overflow-x-auto`,children:Io.map(e=>(0,J.jsx)(N,{value:e,children:i(Lo[e])},e))}),(0,J.jsx)(P,{value:`form`,className:`pt-4`,children:s?(0,J.jsx)(ko,{definition:s,definitions:r}):l}),(0,J.jsx)(P,{value:`rest`,className:`pt-4`,children:s?(0,J.jsx)(Mo,{definition:s,lookup:c}):l}),(0,J.jsx)(P,{value:`graphql`,className:`pt-4`,children:s?(0,J.jsx)(Ao,{definition:s,lookup:c}):l}),(0,J.jsx)(P,{value:`types`,className:`pt-4`,children:(0,J.jsx)(Fo,{apiKey:e.apiKey,edited:n})}),(0,J.jsx)(P,{value:`plan`,className:`pt-4`,children:s?(0,J.jsx)(jo,{before:e.base.definition,after:s}):l})]})})},zo=({file:e,workspace:t})=>{let{t:n}=u(),r=(0,q.useId)(),{setText:i,textOf:a,isDirty:o,definitions:s}=t,c=a(e),l=o(e),{analysis:d,lint:f}=wo(e,c,s),p=(0,q.useCallback)(t=>i(e,t),[i,e]),m=d?so(d):[];return(0,J.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-2`,children:[(0,J.jsxs)(K,{title:e.path.slice(e.path.lastIndexOf(`/`)+1),description:e.path,flush:!0,actions:l?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(w,{tone:`warning`,label:n(`develop.schema.modified`),size:`sm`}),(0,J.jsx)(L,{tone:`danger`,title:n(`develop.schema.revertTitle`),description:n(`develop.schema.revertDescription`),confirmLabel:n(`develop.schema.revert`),onConfirm:()=>i(e,e.base.text),trigger:(0,J.jsx)(M,{type:`button`,size:`sm`,variant:`ghost`,children:n(`develop.schema.revert`)})})]}):null,children:[(0,J.jsx)(go,{className:`h-[28rem] rounded-none border-0 xl:h-[40rem]`,value:c,onChange:p,label:n(`develop.schema.editorLabel`,{path:e.path}),describedBy:r,readOnly:!1,schema:So(e.category),lint:f}),d?.status===`invalidJson`?(0,J.jsx)(`p`,{role:`status`,className:`border-t px-5 py-3 text-meta text-destructive`,children:n(`develop.schema.invalidJson`,{message:d.message})}):null,m.length>0?(0,J.jsx)(`div`,{className:`border-t p-4`,children:(0,J.jsx)(To,{id:r,issues:m})}):null]}),(0,J.jsx)(Ro,{file:e,analysis:d,edited:l,definitions:s})]})},Bo=ue(`/app/schema`),Vo=({currentPath:e,nextPath:t})=>e!==t,Ho=()=>{let{t:e}=u(),{query:t,workspace:n}=mo();return(0,J.jsx)(S,{width:`full`,children:(0,J.jsx)(W,{query:t,children:()=>n?(0,J.jsx)(Uo,{workspace:n}):(0,J.jsx)(T,{icon:le,title:e(`develop.schemaTitle`)})})})},Uo=({workspace:e})=>{let{t}=u(),n=y(),{file:r}=Bo.useSearch(),i=ln().data,[a,o]=(0,q.useState)([]),[s,c]=(0,q.useState)(),{files:l,dirtyFiles:d}=e,f=d.length>0&&s===void 0,p=fo({onInvalid:e=>void n({to:`/schema`,search:{file:e.path}}),onConflict:o,onApplied:c});(0,q.useEffect)(()=>{s&&n({to:`/changes/$changeSetId`,params:{changeSetId:s}})},[s,n]);let m=l.find(e=>e.path===r)??(r===$?void 0:l[0]),h=r===$||l.length===0,g=i!==void 0&&i!==e.schemaVersion,ee=t=>e.textOf(t.file),_=e=>o(t=>t.filter(t=>t.file.definitionId!==e)),v=(0,J.jsxs)(M,{type:`button`,variant:`outline`,disabled:p.pending,children:[(0,J.jsx)(Ht,{"aria-hidden":`true`}),t(`develop.schema.reload`)]});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(C,{title:t(`develop.schemaTitle`),meta:t(`develop.schema.meta`,{version:e.schemaVersion,count:l.length}),actions:(0,J.jsxs)(J.Fragment,{children:[f?(0,J.jsx)(L,{tone:`danger`,title:t(`develop.schema.reloadTitle`),description:t(`develop.schema.reloadDescription`),confirmLabel:t(`develop.schema.reload`),onConfirm:()=>(o([]),e.reload()),trigger:v}):(0,J.jsxs)(M,{type:`button`,variant:`outline`,disabled:p.pending,onClick:()=>{o([]),e.reload()},children:[(0,J.jsx)(Ht,{"aria-hidden":`true`}),t(`develop.schema.reload`)]}),(0,J.jsx)(M,{type:`button`,disabled:!f||p.pending,onClick:()=>{o([]),p.apply(e)},children:p.pending?t(`develop.schema.applying`):t(`develop.schema.apply.label`,{count:d.length})})]})}),g?(0,J.jsx)(F,{variant:`info`,role:`status`,children:(0,J.jsx)(I,{children:t(`develop.schema.moved`,{loaded:e.schemaVersion,live:i})})}):null,a.length>0?(0,J.jsx)(Wa,{conflicts:a,textOf:ee,onTakeRemote:t=>{e.takeRemote(t),_(t.definition.id)},onKeepLocal:t=>{e.keepLocal(t),_(t.definition.id)}}):null,(0,J.jsxs)(`div`,{className:`flex flex-col gap-6 lg:flex-row`,children:[(0,J.jsx)($a,{files:l,openPath:h||!m?$:m.path,isDirty:e.isDirty}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:h||!m?(0,J.jsx)(vo,{text:e.lockText}):(0,J.jsx)(zo,{file:m,workspace:e},m.definitionId)})]}),(0,J.jsx)(_e,{when:f,shouldBlock:Vo})]})},Wo=()=>{let{canReadUsage:e}=Z(),t=pa(),n=dn(`model`),{principals:r}=ei((0,q.useMemo)(()=>(n.data??[]).map(({definition:e})=>e.id),[n.data]),e),i=new Map;for(let e of r)if(e.lastSnapshot!==null){let n=i.get(e.lastSnapshot)??[];n.push(t(e.principalKey,e.tokenName)),i.set(e.lastSnapshot,n)}return{canReadUsage:e,pinnedBy:e=>i.get(e)??[]}},Go=({seq:e,label:t,variant:n=`ghost`})=>{let{t:r}=u(),i=(0,q.useId)(),a=(0,q.useId)(),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(void 0),d=Vn(),f=_r(),p=(d.data??[]).filter(e=>e.revokedAt===null),m=p.find(e=>e.id===c)??p[0],h=cn(`api/content/<model>?snapshot=${e}`,f),ee=`curl -H "Authorization: Bearer ${m?`${m.tokenPrefix}…`:`<token>`}" "${g()}${h}"`;return(0,J.jsxs)(Te,{open:o,onOpenChange:s,modal:!0,children:[(0,J.jsx)(Se,{asChild:!0,children:(0,J.jsxs)(M,{variant:n,size:`sm`,"aria-label":t?void 0:r(`snapshots.pinLabel`,{seq:e}),children:[(0,J.jsx)(er,{"aria-hidden":`true`}),t??r(`snapshots.pin`)]})}),(0,J.jsxs)(we,{align:`end`,"aria-labelledby":i,className:`w-96 max-w-[calc(100vw-2rem)] space-y-3`,children:[(0,J.jsx)(`p`,{id:i,className:`text-sm font-semibold`,children:r(`snapshots.pinTitle`,{seq:e})}),(0,J.jsx)(`p`,{className:`text-meta text-muted-foreground`,children:r(`snapshots.pinDescription`)}),p.length>0?(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:a,className:`text-sm font-semibold`,children:r(`snapshots.pinToken`)}),(0,J.jsxs)(Ye,{value:m?.id,onValueChange:l,children:[(0,J.jsx)(Ke,{id:a,size:`sm`,className:`w-full`,children:(0,J.jsx)(Ge,{})}),(0,J.jsx)(qe,{children:p.map(e=>(0,J.jsx)(Je,{value:e.id,children:e.name},e.id))})]})]}):null,(0,J.jsx)(`pre`,{className:`overflow-x-auto rounded-lg bg-muted p-3 font-mono text-xs break-all whitespace-pre-wrap`,children:ee}),(0,J.jsx)(`div`,{className:`flex justify-end`,children:(0,J.jsx)(Pn,{value:ee})})]})]})},Ko=({seq:e,size:t=`sm`,label:n})=>{let{t:r}=u(),i=y(),a=gt();return(0,J.jsx)(L,{tone:`default`,title:r(`snapshots.restoreTitle`,{seq:e}),description:r(`snapshots.restoreDescription`,{seq:e}),confirmLabel:r(`snapshots.restore`),pendingLabel:r(`common.saving`),onConfirm:()=>a.mutateAsync(e,{onSuccess:e=>void i({to:`/changes/$changeSetId`,params:{changeSetId:e.id}})}),trigger:(0,J.jsxs)(M,{variant:`outline`,size:t,"aria-label":n?void 0:r(`snapshots.restoreLabel`,{seq:e}),children:[(0,J.jsx)(Yt,{"aria-hidden":`true`}),n??r(`snapshots.restore`)]})})},qo=({snapshots:e,current:t,pinnedBy:n,showPins:r})=>{let{t:i}=u(),a=Q(),o=i(`common.none`);return(0,J.jsxs)(U,{children:[(0,J.jsx)(R,{children:(0,J.jsxs)(V,{children:[(0,J.jsx)(z,{children:i(`snapshots.fields.version`)}),(0,J.jsx)(z,{children:i(`snapshots.fields.when`)}),(0,J.jsx)(z,{children:i(`snapshots.fields.source`)}),(0,J.jsx)(z,{className:`text-right`,children:i(`snapshots.fields.entries`)}),(0,J.jsx)(z,{children:i(`snapshots.fields.schema`)}),r?(0,J.jsx)(z,{children:i(`snapshots.fields.pinnedBy`)}):null,(0,J.jsx)(z,{children:i(`snapshots.fields.deploy`)}),(0,J.jsx)(z,{children:(0,J.jsx)(`span`,{className:`sr-only`,children:i(`common.actions`)})})]})}),(0,J.jsx)(B,{children:e.map(e=>{let s=n(e.seq),c=e.deploymentRuns.at(-1),l=c?za[c.status]:void 0;return(0,J.jsxs)(V,{children:[(0,J.jsx)(H,{className:`whitespace-nowrap`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(ge,{asChild:!0,children:(0,J.jsx)(b,{to:`/snapshots/$seq`,params:{seq:String(e.seq)},children:i(`snapshots.version`,{seq:e.seq})})}),e.seq===t?(0,J.jsx)(w,{tone:`success`,label:i(`snapshots.live`),size:`sm`}):null]})}),(0,J.jsxs)(H,{className:`whitespace-nowrap`,title:k(e.createdAt),children:[O(e.createdAt),(0,J.jsx)(`span`,{className:`block text-meta text-muted-foreground`,children:a({type:e.actor.type})})]}),(0,J.jsxs)(H,{className:`max-w-64`,children:[(0,J.jsx)(E,{variant:`secondary`,children:i(Ra[e.source])}),e.changeSetId&&e.changeSetTitle?(0,J.jsx)(b,{to:`/changes/$changeSetId`,params:{changeSetId:e.changeSetId},className:`block truncate text-meta text-link underline-offset-4 hover:underline`,children:e.changeSetTitle}):null]}),(0,J.jsx)(H,{className:`text-right tabular-nums`,children:e.changedEntries}),(0,J.jsx)(H,{className:`whitespace-nowrap tabular-nums`,children:e.schemaVersion===null?o:i(`snapshots.schemaVersion`,{version:e.schemaVersion})}),r?(0,J.jsx)(H,{className:`max-w-48`,children:s.length>0?(0,J.jsx)(`span`,{className:`block truncate`,children:s.join(`, `)}):o}):null,(0,J.jsx)(H,{children:c&&l?(0,J.jsx)(b,{to:`/publishing/deployments/runs/$runId`,params:{runId:c.id},className:`rounded-full`,children:(0,J.jsx)(w,{tone:l.tone,label:i(l.labelKey),size:`sm`})}):o}),(0,J.jsx)(H,{className:`text-right`,children:(0,J.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[e.seq===t?null:(0,J.jsx)(M,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,J.jsxs)(b,{to:`/snapshots/$seq`,params:{seq:String(t)},search:{from:e.seq},"aria-label":i(`snapshots.compareLabel`,{seq:e.seq,current:t}),children:[(0,J.jsx)(Jn,{"aria-hidden":`true`}),i(`snapshots.compare`)]})}),(0,J.jsx)(Go,{seq:e.seq}),e.seq===t?null:(0,J.jsx)(Ko,{seq:e.seq})]})})]},e.seq)})})]})},Jo=()=>{let{t:e}=u(),{canManageChanges:t}=Z(),{cursor:n}=he({from:`/app/snapshots`}),r=y({from:`/snapshots`}),{pagerProps:i}=Jt(n,e=>void r({search:{cursor:e}})),a=_t(n),{canReadUsage:o,pinnedBy:s}=Wo();return t?(0,J.jsxs)(S,{width:`full`,children:[(0,J.jsx)(C,{title:e(`snapshots.title`),meta:a.data?e(`snapshots.current`,{seq:a.data.current}):void 0}),(0,J.jsx)(W,{query:a,loadingRows:6,isEmpty:e=>e.items.length===0&&n===void 0,empty:(0,J.jsx)(T,{icon:fe,title:e(`snapshots.empty`)}),children:e=>(0,J.jsx)(on,{footer:(0,J.jsx)(Xe,{...i(e.nextCursor)}),children:(0,J.jsx)(qo,{snapshots:e.items,current:e.current,pinnedBy:s,showPins:o})})})]}):(0,J.jsxs)(S,{width:`full`,children:[(0,J.jsx)(C,{title:e(`snapshots.title`)}),(0,J.jsx)(xi,{})]})},Yo=({seq:e,row:t,previous:n,changedCount:r})=>{let{t:i}=u(),a=Q(),o=Hn(),s=t?.actor.type===`admin`?o.data?.find(e=>e.id===t.actor.id)?.name:void 0,c=[i(`snapshots.version`,{seq:e}),t?k(t.createdAt):``,t?i(`snapshots.timeline.shippedBy`,{name:s??a({type:t.actor.type})}):``,t?.schemaVersion==null?``:i(`snapshots.schemaVersion`,{version:t.schemaVersion}),n!==void 0&&r!==void 0?i(`snapshots.timeline.changedSince`,{count:r,seq:n}):``].filter(Boolean);return(0,J.jsx)(`p`,{"aria-live":`polite`,className:`text-sm font-semibold tabular-nums`,children:c.join(` · `)})},Xo=(e,t)=>{let n=mn(e),r=Dn(e).cover;return{modelId:e.id,modelKey:e.apiKey,routeKey:bn(e),label:e.label,singleton:e.kind===`singleton`,titleKey:n?.apiKey??null,coverKey:r?.apiKey??null,locales:t}},Zo=()=>{let e=dn(`model`),t=kn();return{places:(0,q.useMemo)(()=>{if(!e.data||!t.data)return;let n=t.data.map(e=>e.code),r=t.data.find(e=>e.isDefault)?.code??n[0]??`en`;return e.data.flatMap(({definition:e})=>e.kind===`component`?[]:[Xo(e,e.localized?n:[r])])},[e.data,t.data]),error:e.error??t.error}},Qo=(e,t)=>t?e.length>0&&e.every(e=>e===`published`)?`added`:e.length>0?`changed`:`unchanged`:`removed`,$o=(e,t)=>{let n=new Map;for(let t of e){let e=n.get(t.id);if(e){e.locales.includes(t.locale)||e.locales.push(t.locale),e.title??=t.title,e.coverUrl??=t.coverUrl;continue}n.set(t.id,{id:t.id,title:t.title,coverUrl:t.coverUrl,locales:[t.locale],mark:`unchanged`,revisionIds:{}})}let r=[];for(let e of t){let t=n.get(e.id),i=Object.fromEntries(e.locales.flatMap(({locale:e,revisionId:t})=>t?[[e,t]]:[])),a=Qo(e.locales.map(({change:e})=>e),t!==void 0);t?(t.mark=a,t.revisionIds=i,t.title??=e.title):a===`removed`&&r.push({id:e.id,title:e.title,coverUrl:null,locales:e.locales.map(({locale:e})=>e),mark:a,revisionIds:i})}return[...n.values(),...r]},es=(e,t=60)=>e<=t?1:Math.ceil(e/t),ts=10,ns=({seqs:e,value:t,onChange:n})=>{let{t:r}=u(),i=(0,q.useId)(),a=Math.max(e.indexOf(t),0),o=Math.max(e.length-1,1),s=es(e.length),c=r=>{let i=e[Math.min(Math.max(r,0),e.length-1)];i!==void 0&&i!==t&&n(i)};return(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`label`,{htmlFor:i,className:`text-sm font-semibold`,children:r(`snapshots.scrubber.label`)}),(0,J.jsx)(`span`,{className:`text-meta text-muted-foreground tabular-nums`,children:r(`snapshots.scrubber.range`,{min:e[0]??t,max:e.at(-1)??t})})]}),(0,J.jsx)(`input`,{id:i,type:`range`,min:0,max:e.length-1,step:1,value:a,"aria-valuetext":r(`snapshots.version`,{seq:t}),onKeyDown:e=>{if(!e.shiftKey)return;let t={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1}[e.key];t!==void 0&&(e.preventDefault(),c(a+t*ts))},onChange:e=>c(Number(e.target.value)),className:`h-2 w-full cursor-pointer accent-primary focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`}),(0,J.jsx)(`div`,{"aria-hidden":`true`,className:`relative mx-2 h-5`,children:e.map((i,a)=>a%s===0||a===e.length-1?(0,J.jsx)(`button`,{type:`button`,tabIndex:-1,title:r(`snapshots.version`,{seq:i}),onClick:()=>n(i),style:{"--tick":`${a/o*100}%`},className:h(`absolute top-0 left-(--tick) h-3 w-px -translate-x-1/2 cursor-pointer bg-border hover:bg-foreground`,i===t&&`h-4 w-0.5 bg-primary`)},i):null)})]})},rs=e=>{if(typeof e!=`object`||!e)return null;let t=e,n=t.variants?.find(e=>e.name===`thumbnail`)?.url;return typeof n==`string`?n:typeof t.url==`string`?t.url:null},is=(e,t)=>{let n=e.titleKey?t[e.titleKey]:void 0;return{id:String(t.id),locale:String(t.locale),title:typeof n==`string`&&n.trim()!==``?n:typeof n==`number`?String(n):null,coverUrl:e.coverKey?rs(t[e.coverKey]):null}},as=(e,t)=>t.flatMap(t=>t.locales.map(n=>({place:t,locale:n,seq:e}))),os=(e,t,n,r)=>{let i=o(),a=as(e,r),s=mt(t??0,e,t!==void 0),c=_({queries:a.map(({place:t,locale:n})=>bt(e,t,n)),combine:e=>({data:e.map(e=>e.data),isPending:e.some(e=>e.isPending),error:e.find(e=>e.error)?.error??null,refetch:()=>Promise.all(e.map(e=>e.refetch()))})});(0,q.useEffect)(()=>{for(let e of n)for(let t of as(e,r))i.prefetchQuery(bt(e,t.place,t.locale))},[n,r,i]);let l=s.data?.items??[];return{states:r.map(e=>({place:e,cards:$o(a.flatMap((t,n)=>t.place===e?(c.data[n]??[]).map(t=>is(e,t)):[]),l.filter(t=>t.modelId===e.modelId))})).filter(e=>e.cards.length>0),isPending:c.isPending||t!==void 0&&s.isPending,error:c.error??s.error,refetch:()=>Promise.all([c.refetch(),s.refetch()])}},ss={unchanged:{labelKey:`snapshots.timeline.marks.unchanged`,tone:`success`},added:{labelKey:`snapshots.timeline.marks.added`,tone:`success`},changed:{labelKey:`snapshots.timeline.marks.changed`,tone:`warning`},removed:{labelKey:`snapshots.timeline.marks.removed`,tone:`muted`}},cs={unchanged:``,added:`animate-in fade-in zoom-in-95 duration-500`,changed:`ring-2 ring-warning animate-in zoom-in-95 duration-500`,removed:`border-dashed bg-muted/40 animate-in fade-in duration-500`},ls=({card:e,onOpen:t})=>{let{t:n}=u(),r=ss[e.mark],i=e.title??n(`snapshots.timeline.untitled`);return(0,J.jsxs)(`li`,{"data-mark":e.mark,"aria-label":n(`snapshots.timeline.cardLabel`,{title:i,state:n(r.labelKey)}),className:h(`flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card motion-reduce:animate-none`,cs[e.mark]),children:[(0,J.jsx)(`div`,{className:h(`flex aspect-video items-center justify-center bg-muted transition-opacity duration-500 motion-reduce:transition-none`,e.mark===`removed`&&`opacity-40 grayscale`),children:e.coverUrl?(0,J.jsx)(`img`,{src:e.coverUrl,alt:``,loading:`lazy`,className:`size-full object-cover`}):(0,J.jsx)(Ct,{"aria-hidden":`true`,className:`size-5 text-muted-foreground`})}),(0,J.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 p-3`,children:[(0,J.jsx)(`p`,{className:h(`line-clamp-2 text-sm font-semibold`,e.mark===`removed`&&`line-through`),children:i}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,J.jsx)(w,{tone:r.tone,label:n(r.labelKey),size:`sm`,live:!1}),e.locales.map(e=>(0,J.jsx)(E,{variant:`outline`,className:`font-mono`,children:e},e))]}),(0,J.jsxs)(M,{variant:`ghost`,size:`sm`,className:`mt-auto self-start`,"aria-label":n(`snapshots.timeline.openVersionOf`,{title:i}),onClick:()=>t(e),children:[(0,J.jsx)(je,{"aria-hidden":`true`}),n(`snapshots.timeline.openVersion`)]})]})]})},us=new Set([`publish`,`restore`]),ds=(e,t)=>{let n=y(),r=o(),a=async(n,a)=>{let o=(await r.fetchQuery({queryKey:i.content.revisions(e,n,a),queryFn:()=>d.content.revisions(e,n,{locale:a})})).filter(e=>t===void 0||e.createdAt<=t),s=e=>[...e].sort((e,t)=>t.createdAt.localeCompare(e.createdAt))[0]?.id;return s(o.filter(e=>us.has(e.reason)))??s(o)};return async t=>{let r=t.locales[0];try{let i=(r?t.revisionIds[r]:void 0)??(r?await a(t.id,r):void 0);await n({to:`/content/$modelKey/$entryId`,params:{modelKey:e,entryId:t.id},search:{...r?{locale:r}:{},...i?{revision:i}:{}}})}catch(e){ye(e,`opening an entry version from the timeline`),j.error(Oe(e))}}},fs=({state:e,seq:t,snapshotCreatedAt:n})=>{let{t:r}=u(),i=ds(e.place.modelKey,n),a=e.cards.filter(e=>e.mark!==`removed`).length;return(0,J.jsxs)(`section`,{"aria-label":e.place.label,className:`space-y-3`,children:[(0,J.jsxs)(`h3`,{className:`flex items-baseline gap-2 text-base font-semibold`,children:[e.place.label,(0,J.jsx)(`span`,{className:`text-meta font-normal text-muted-foreground`,children:r(`snapshots.timeline.liveCount`,{count:a})})]}),(0,J.jsx)(`ul`,{className:`grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-4`,children:e.cards.map(e=>(0,J.jsx)(ls,{card:e,onOpen:e=>void i(e)},e.mark===`unchanged`?e.id:`${e.id}:${t}`))})]})},ps=({seq:e,seqs:t,previous:n,places:r,createdAt:i})=>{let{t:a}=u(),o=t.indexOf(e),s=t[o-1],c=t[o+1],l=os(e,n,(0,q.useMemo)(()=>[s,c].filter(e=>e!==void 0),[s,c]),r);return l.error?(0,J.jsx)(ce,{error:l.error,onRetry:()=>void l.refetch()}):l.isPending&&l.states.length===0?(0,J.jsx)(D,{rows:4}):l.states.length===0?(0,J.jsx)(T,{icon:ut,title:a(`snapshots.timeline.nothingLive`,{seq:e})}):(0,J.jsx)(`div`,{"aria-busy":l.isPending||void 0,className:`space-y-8`,children:l.states.map(t=>(0,J.jsx)(fs,{state:t,seq:e,snapshotCreatedAt:i},t.place.modelId))})},ms=150,hs=({at:e,onAtChange:t})=>{let{t:n}=u(),r=dt(),{places:i,error:a}=Zo(),[o,s]=(0,q.useState)(e),c=pn(o,ms),l=(0,q.useMemo)(()=>r.data?r.data.items.map(e=>e.seq).sort((e,t)=>e-t):[],[r.data]);(0,q.useEffect)(()=>{c!==e&&t(c)},[c,e,t]);let d=e=>l[l.indexOf(e)-1]??(e>0?e-1:void 0),f=d(c),p=mt(f??0,c,f!==void 0);if(r.isError||a)return(0,J.jsx)(ce,{error:r.error??a,onRetry:()=>void r.refetch()});if(!r.data||!i)return(0,J.jsx)(D,{rows:4});let m=r.data.items.find(e=>e.seq===o),h=r.data.items.find(e=>e.seq===c),g=r.data.current;return(0,J.jsxs)(`div`,{className:`space-y-6`,children:[(0,J.jsx)(K,{"aria-label":n(`snapshots.timeline.label`),children:(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsx)(Yo,{seq:o,row:m,previous:d(o),changedCount:o===c?p.data?.items.length:void 0}),(0,J.jsx)(ns,{seqs:l,value:o,onChange:s}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[o===g?null:(0,J.jsx)(Ko,{seq:o,size:`default`,label:n(`snapshots.timeline.restoreHere`)}),(0,J.jsx)(Go,{seq:o,variant:`outline`,label:n(`snapshots.timeline.pinHere`)})]})]})}),(0,J.jsx)(ps,{seq:c,seqs:l,previous:f,places:i,createdAt:h?.createdAt})]})},gs={published:{labelKey:`snapshots.changes.published`,tone:`success`},updated:{labelKey:`snapshots.changes.updated`,tone:`warning`},unpublished:{labelKey:`snapshots.changes.unpublished`,tone:`muted`}},_s=({page:e})=>{let{t}=u(),{schemaVersions:n}=e,r=n.from!==n.to;return(0,J.jsx)(on,{toolbar:(0,J.jsxs)(`p`,{className:`text-meta text-muted-foreground`,children:[t(e.nextCursor?`snapshots.diffSummaryMore`:`snapshots.diffSummary`,{from:e.from,to:e.to,count:e.items.length}),r?` · ${t(`snapshots.schemaMoved`,{from:n.from??`?`,to:n.to??`?`})}`:``]}),children:e.items.length===0?(0,J.jsx)(T,{icon:Ze,size:`panel`,title:t(`snapshots.noChanges`)}):(0,J.jsxs)(U,{children:[(0,J.jsx)(R,{children:(0,J.jsxs)(V,{children:[(0,J.jsx)(z,{children:t(`changes.fields.entry`)}),(0,J.jsx)(z,{children:t(`changes.fields.model`)}),(0,J.jsx)(z,{children:t(`snapshots.fields.locales`)})]})}),(0,J.jsx)(B,{children:e.items.map(e=>(0,J.jsxs)(V,{children:[(0,J.jsx)(H,{className:`max-w-72`,children:(0,J.jsx)(ge,{asChild:!0,className:`block truncate font-mono text-xs`,children:(0,J.jsx)(b,{to:`/content/$modelKey/$entryId`,params:{modelKey:e.modelKey,entryId:e.id},children:e.id})})}),(0,J.jsx)(H,{className:`font-mono text-xs`,children:e.modelKey}),(0,J.jsx)(H,{children:(0,J.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,children:e.locales.map(e=>{let n=gs[e.change];return(0,J.jsx)(`li`,{children:(0,J.jsx)(w,{tone:n.tone,size:`sm`,label:t(`snapshots.localeChange`,{locale:e.locale,change:t(n.labelKey)})})},e.locale)})})})]},e.id))})]})})},vs={diff:`snapshots.tabs.diff`,timeline:`snapshots.tabs.timeline`},ys=({snapshot:e})=>{let{t}=u(),n=Q(),r=he({from:`/app/snapshots/$seq`}),i=y({from:`/snapshots/$seq`}),a=r.tab??`diff`,o=(0,q.useCallback)(e=>void i({search:t=>({...t,at:e}),replace:!0}),[i]),s=r.from!==void 0&&r.from<e.seq?r.from:e.seq-1,c=_t(void 0).data?.current,l=mt(s,e.seq,a===`diff`),d=[k(e.createdAt),n({type:e.actor.type}),e.schemaVersion===null?``:t(`snapshots.schemaVersion`,{version:e.schemaVersion})].filter(Boolean).join(` · `);return(0,J.jsx)(S,{children:(0,J.jsxs)(ze,{value:a,onValueChange:e=>void i({search:t=>({...t,tab:e}),replace:!0}),className:`gap-6`,children:[(0,J.jsx)(C,{breadcrumb:[{label:t(`snapshots.title`),link:v({to:`/snapshots`})}],title:t(`snapshots.version`,{seq:e.seq}),badge:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(E,{variant:`secondary`,children:t(Ra[e.source])}),e.seq===c?(0,J.jsx)(w,{tone:`success`,label:t(`snapshots.live`)}):null]}),meta:d,actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Go,{seq:e.seq}),c!==void 0&&e.seq!==c?(0,J.jsx)(Ko,{seq:e.seq,size:`default`}):null]}),tabs:(0,J.jsx)(Le,{variant:`underline`,"aria-label":t(`snapshots.tabs.label`),children:me.map(e=>(0,J.jsx)(N,{value:e,children:t(vs[e])},e))})}),(0,J.jsx)(P,{value:`diff`,children:(0,J.jsx)(W,{query:l,loadingRows:4,children:e=>(0,J.jsx)(_s,{page:e})})}),(0,J.jsx)(P,{value:`timeline`,children:(0,J.jsx)(hs,{at:r.at??e.seq,onAtChange:o})})]})})},bs={changes:A(`/app/changes`)({component:ji}),changeSet:A(`/app/changes/$changeSetId`)({component:wa}),snapshots:A(`/app/snapshots`)({component:Jo}),snapshot:A(`/app/snapshots/$seq`)({component:()=>{let{seq:e}=oe({from:`/app/snapshots/$seq`}),{canManageChanges:t}=Z(),n=yt(Number(e));return t?(0,J.jsx)(W,{query:n,loadingRows:6,children:e=>(0,J.jsx)(ys,{snapshot:e})}):(0,J.jsx)(S,{children:(0,J.jsx)(xi,{})})}}),live:A(`/app/live`)({component:Va}),schema:A(`/app/schema`)({component:Ho}),apiExplorer:A(`/app/api-explorer`)({component:di})};export{bs as developLazyRoutes};
11
+ //# sourceMappingURL=develop-DS9TlDmv.js.map