headroom-cms 0.1.9 → 0.1.11

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 (154) hide show
  1. package/README.md +11 -6
  2. package/admin/assets/{AdminsPage-Bt_ekZen.js → AdminsPage-BnzH9TL3.js} +1 -1
  3. package/admin/assets/AllContentPage-BtObN6oy.js +1 -0
  4. package/admin/assets/{ApiKeysPage-BfWCxGhC.js → ApiKeysPage-DEAa8eyC.js} +1 -1
  5. package/admin/assets/AuditPage-BN9yNsxh.js +1 -0
  6. package/admin/assets/BlockEditor-3wnisTOZ.js +176 -0
  7. package/admin/assets/BlockEditor-CQpF8tYb.css +1 -0
  8. package/admin/assets/BlockTypeEditPage-C2evAESK.js +1 -0
  9. package/admin/assets/BlockTypesPage-Dhkho6T_.js +1 -0
  10. package/admin/assets/{BulkActionBar-TRiXXLQd.js → BulkActionBar-BxdfUSrN.js} +1 -1
  11. package/admin/assets/CollectionEditPage-lOb4hEZy.js +1 -0
  12. package/admin/assets/{CollectionsPage-ClplrxNn.js → CollectionsPage-CgtOloa1.js} +1 -1
  13. package/admin/assets/{ContentCreatePage-DfYcEH1u.js → ContentCreatePage-LeQjahp_.js} +1 -1
  14. package/admin/assets/ContentEditPage-xczr4d_h.js +1 -0
  15. package/admin/assets/ContentField-pilCbdnA.js +1 -0
  16. package/admin/assets/ContentListPage-BAKDn1Xy.js +1 -0
  17. package/admin/assets/CustomBlockPreview-DNnTFM0z.js +479 -0
  18. package/admin/assets/FieldRenderer-DiOKvkWV.js +2 -0
  19. package/admin/assets/FilterBar-BZoa63zh.js +1 -0
  20. package/admin/assets/FloatingComposerController-D4uLQfUX-BMIvFCoE.js +1 -0
  21. package/admin/assets/IconPicker-CpIgiQTC.js +3 -0
  22. package/admin/assets/{LoginPage-DutieANA.js → LoginPage-D9ZsGLIi.js} +1 -1
  23. package/admin/assets/MediaField-CxccCFGQ.js +1 -0
  24. package/admin/assets/MediaPage-QvMaH2YJ.js +1 -0
  25. package/admin/assets/Pagination-Df9nQ7Z0.js +1 -0
  26. package/admin/assets/RelationshipPicker-B3Ftmqxp.js +1 -0
  27. package/admin/assets/{SiteSettingsPage-BtCC3RKc.js → SiteSettingsPage-6NvH7CiQ.js} +1 -1
  28. package/admin/assets/{SiteUserEditPage-ClHmp0T-.js → SiteUserEditPage-D5VaQ1Xq.js} +1 -1
  29. package/admin/assets/SiteUsersPage-BYVduiqs.js +1 -0
  30. package/admin/assets/{SitesPage-Bw_WBN6v.js → SitesPage-rfWWE0yK.js} +1 -1
  31. package/admin/assets/{SubmissionDetailPage-DS08LGxd.js → SubmissionDetailPage-BSUR685F.js} +1 -1
  32. package/admin/assets/SubmissionEditPage-DjLXHjWU.js +1 -0
  33. package/admin/assets/SubmissionListPage-DBxNEvde.js +1 -0
  34. package/admin/assets/{TagInput-BILCaC9b.js → TagInput-57c4DG1w.js} +1 -1
  35. package/admin/assets/{TagsPage-DdeZokow.js → TagsPage-BEO5AwCv.js} +1 -1
  36. package/admin/assets/{UsersPage-B0vLxjrg.js → UsersPage-BpIRorJ1.js} +1 -1
  37. package/admin/assets/{WebhookEditPage-SlJE4d3z.js → WebhookEditPage-D5xgi56h.js} +1 -1
  38. package/admin/assets/{WebhooksPage-C6lGZLpr.js → WebhooksPage-BY7AaiGr.js} +1 -1
  39. package/admin/assets/{card-hXVtlM0q.js → card-C9hfyHXf.js} +1 -1
  40. package/admin/assets/checkbox-DVJcwUt1.js +1 -0
  41. package/admin/assets/{collapsible-B414SspL.js → collapsible-D3d29uJp.js} +1 -1
  42. package/admin/assets/{command-fvBFHye4.js → command-Bfmj0MEL.js} +1 -1
  43. package/admin/assets/contentStatus-CkPi9Dh6.js +1 -0
  44. package/admin/assets/{core.esm-B_kcYf6n.js → core.esm-DdQHdRkd.js} +2 -2
  45. package/admin/assets/index-BB9Syqw2.css +1 -0
  46. package/admin/assets/index-Ce5pmRMj.js +18 -0
  47. package/admin/assets/media-url-DdCoIedP.js +1 -0
  48. package/admin/assets/popover-CzaQYEEP.js +1 -0
  49. package/admin/assets/radix-C5ZmWuuL.js +51 -0
  50. package/admin/assets/select-CrRhFGIi.js +1 -0
  51. package/admin/assets/serializeToText-2VrsuRUh.js +2 -0
  52. package/admin/assets/{sortable.esm-QyXA6fio.js → sortable.esm-qVEMoaTg.js} +1 -1
  53. package/admin/assets/{table-DLoIbCQ5.js → table-_3bMY0_z.js} +1 -1
  54. package/admin/assets/{textarea-vSXNxwTe.js → textarea-6fq0R6VV.js} +1 -1
  55. package/admin/assets/useAdminResolver-BJNPz3OG.js +1 -0
  56. package/admin/assets/useContent-Bs7nel7C.js +1 -0
  57. package/admin/assets/useContentSearch-B3aTjuCu.js +1 -0
  58. package/admin/assets/{useMedia-e3sqWm_t.js → useMedia-ae3s_ajC.js} +1 -1
  59. package/admin/assets/usePageTitle-C1r1-C00.js +1 -0
  60. package/admin/assets/useSiteUsers-DIaqgNSp.js +1 -0
  61. package/admin/assets/{useTags-f7AVSLuj.js → useTags-B-HgMVwo.js} +1 -1
  62. package/admin/assets/{useWebhooks-BH_r8-Mo.js → useWebhooks-BvZjUJkJ.js} +1 -1
  63. package/admin/assets/yjs-tXBm_srz.js +5 -0
  64. package/admin/favicon-16x16.png +0 -0
  65. package/admin/favicon-32x32.png +0 -0
  66. package/admin/icons/icon-180x180.png +0 -0
  67. package/admin/icons/icon-192x192.png +0 -0
  68. package/admin/icons/icon-512x512.png +0 -0
  69. package/admin/icons/maskable-icon-512x512.png +0 -0
  70. package/admin/index.html +3 -3
  71. package/admin/sw.js +1 -1
  72. package/dist/admin-site.d.ts +16 -2
  73. package/dist/admin-site.d.ts.map +1 -1
  74. package/dist/admin-site.js +10 -3
  75. package/dist/admin-site.js.map +1 -1
  76. package/dist/api.d.ts +7 -0
  77. package/dist/api.d.ts.map +1 -1
  78. package/dist/api.js +8 -1
  79. package/dist/api.js.map +1 -1
  80. package/dist/cdn-api.d.ts +25 -0
  81. package/dist/cdn-api.d.ts.map +1 -0
  82. package/dist/{cdn.js → cdn-api.js} +7 -139
  83. package/dist/cdn-api.js.map +1 -0
  84. package/dist/cdn-media.d.ts +26 -0
  85. package/dist/cdn-media.d.ts.map +1 -0
  86. package/dist/cdn-media.js +202 -0
  87. package/dist/cdn-media.js.map +1 -0
  88. package/dist/collaboration.d.ts +55 -0
  89. package/dist/collaboration.d.ts.map +1 -0
  90. package/dist/collaboration.js +141 -0
  91. package/dist/collaboration.js.map +1 -0
  92. package/dist/index.d.ts +27 -3
  93. package/dist/index.d.ts.map +1 -1
  94. package/dist/index.js +47 -12
  95. package/dist/index.js.map +1 -1
  96. package/dist/storage.d.ts +2 -0
  97. package/dist/storage.d.ts.map +1 -1
  98. package/dist/storage.js +33 -0
  99. package/dist/storage.js.map +1 -1
  100. package/lambda/api/bootstrap +0 -0
  101. package/lambda/image-lambda/node_modules/.package-lock.json +3 -3
  102. package/lambda/image-lambda/node_modules/semver/README.md +19 -4
  103. package/lambda/image-lambda/node_modules/semver/bin/semver.js +14 -10
  104. package/lambda/image-lambda/node_modules/semver/functions/truncate.js +48 -0
  105. package/lambda/image-lambda/node_modules/semver/index.js +2 -0
  106. package/lambda/image-lambda/node_modules/semver/internal/re.js +1 -1
  107. package/lambda/image-lambda/node_modules/semver/package.json +3 -3
  108. package/lambda/image-lambda/node_modules/semver/range.bnf +5 -4
  109. package/lambda/webhook-worker/bootstrap +0 -0
  110. package/package.json +1 -1
  111. package/src/admin-site.ts +26 -5
  112. package/src/api.ts +15 -1
  113. package/src/{cdn.ts → cdn-api.ts} +8 -161
  114. package/src/cdn-media.ts +250 -0
  115. package/src/collaboration.ts +187 -0
  116. package/src/index.ts +77 -14
  117. package/src/sst-env.d.ts +28 -0
  118. package/src/storage.ts +35 -0
  119. package/admin/assets/AllContentPage-CFqEMAl9.js +0 -1
  120. package/admin/assets/AuditPage-BE0XIUl2.js +0 -1
  121. package/admin/assets/BlockEditor-6wqsThJ7.js +0 -179
  122. package/admin/assets/BlockEditor-Cp_wZ2xN.css +0 -1
  123. package/admin/assets/BlockTypeEditPage-CuNJfZw0.js +0 -1
  124. package/admin/assets/BlockTypesPage-BIMBVxBs.js +0 -1
  125. package/admin/assets/CollectionEditPage-BqX_0cC2.js +0 -1
  126. package/admin/assets/ContentEditPage-D3Rvlktk.js +0 -2
  127. package/admin/assets/ContentListPage-zmO8Is4d.js +0 -1
  128. package/admin/assets/CustomBlockPreview-C6HqS4xv.js +0 -479
  129. package/admin/assets/FieldBuilder-36tfpSyM.js +0 -3
  130. package/admin/assets/FilterBar-DhRwTqFv.js +0 -1
  131. package/admin/assets/MediaField-J2TLG_fu.js +0 -1
  132. package/admin/assets/MediaPage-DZZKMGF4.js +0 -1
  133. package/admin/assets/RelationshipPicker-CDFs4TMW.js +0 -1
  134. package/admin/assets/SiteUsersPage-AyJvcVM7.js +0 -1
  135. package/admin/assets/SubmissionEditPage-Brf-DK2X.js +0 -1
  136. package/admin/assets/SubmissionListPage-DNMzQZHS.js +0 -1
  137. package/admin/assets/checkbox-WGrS3sUr.js +0 -1
  138. package/admin/assets/contentStatus-BmaiYVOm.js +0 -1
  139. package/admin/assets/index-Cir9tY_P.js +0 -18
  140. package/admin/assets/index-DACBYsKM.css +0 -1
  141. package/admin/assets/media-url-DIg_vSyf.js +0 -1
  142. package/admin/assets/popover-D5_HjjUC.js +0 -1
  143. package/admin/assets/radix-C1kb_NqW.js +0 -51
  144. package/admin/assets/select-_uJYxzeZ.js +0 -1
  145. package/admin/assets/serializeToText-DR_WnxiI.js +0 -2
  146. package/admin/assets/useAdminResolver-D-LlmquD.js +0 -1
  147. package/admin/assets/useContent-e8beBIuq.js +0 -1
  148. package/admin/assets/useContentSearch-DOjveB9t.js +0 -1
  149. package/admin/assets/useDebouncedValue-C-cQUcLG.js +0 -1
  150. package/admin/assets/usePageTitle-BNSba9_L.js +0 -1
  151. package/admin/assets/useSiteUsers-BdnvuM2E.js +0 -1
  152. package/dist/cdn.d.ts +0 -27
  153. package/dist/cdn.d.ts.map +0 -1
  154. package/dist/cdn.js.map +0 -1
@@ -1 +0,0 @@
1
- .bn-block-outer{line-height:1.5;transition:margin .2s}.bn-block{display:flex;flex-direction:column}.bn-block-content{padding:3px 0;display:flex;transition:font-size .2s;width:100%}.bn-block-content.ProseMirror-selectednode>*,.ProseMirror-selectednode>.bn-block-content>*{border-radius:4px;outline:4px solid rgb(100,160,255)}.bn-block-content:before{content:"";margin-right:0;transition:all .2s;height:0;overflow:visible}.bn-inline-content{width:100%}.bn-block-group .bn-block-group{margin-left:24px}.bn-block-group .bn-block-group>.bn-block-outer{position:relative}.bn-block-group .bn-block-group>.bn-block-outer:not([data-prev-depth-changed]):before{content:" ";display:inline;position:absolute;left:-20px;height:100%;transition:all .2s .1s}.bn-block-group .bn-block-group>.bn-block-outer[data-prev-depth-change="-2"]:before{height:0}.bn-inline-content code{font-family:monospace}[data-prev-depth-change="1"]{--x: 1}[data-prev-depth-change="2"]{--x: 2}[data-prev-depth-change="3"]{--x: 3}[data-prev-depth-change="4"]{--x: 4}[data-prev-depth-change="5"]{--x: 5}[data-prev-depth-change="-1"]{--x: -1}[data-prev-depth-change="-2"]{--x: -2}[data-prev-depth-change="-3"]{--x: -3}[data-prev-depth-change="-4"]{--x: -4}[data-prev-depth-change="-5"]{--x: -5}.bn-block-outer[data-prev-depth-change]{margin-left:calc(10px * var(--x))}.bn-block-outer[data-prev-depth-change] .bn-block-outer[data-prev-depth-change]{margin-left:0}[data-content-type=heading]{--level: 3em}[data-content-type=heading][data-level="2"]{--level: 2em}[data-content-type=heading][data-level="3"]{--level: 1.3em}[data-content-type=heading][data-level="4"]{--level: 1em}[data-content-type=heading][data-level="5"]{--level: .9em}[data-content-type=heading][data-level="6"]{--level: .8em}[data-prev-level="1"]{--prev-level: 3em}[data-prev-level="2"]{--prev-level: 2em}[data-prev-level="3"]{--prev-level: 1.3em}[data-prev-level="4"]{--prev-level: 1em}[data-prev-level="5"]{--prev-level: .9em}[data-prev-level="6"]{--prev-level: .8em}.bn-block-outer[data-prev-type=heading]>.bn-block>.bn-block-content{font-size:var(--prev-level);font-weight:700}.bn-block-outer:not([data-prev-type])>.bn-block>.bn-block-content[data-content-type=heading],.bn-block-outer:not([data-prev-type])>.bn-block>div[data-type=modification]>div[data-type=modification]>.bn-block-content[data-content-type=heading]{font-size:var(--level);font-weight:700}[data-content-type=quote] blockquote{border-left:2px solid rgb(125,121,122);color:#7d797a;margin:0;padding-left:1em}[data-content-type=divider] hr{border:none;border-top:1px solid rgb(125,121,122);margin:.5em 0;flex:1}.bn-block-content:before{margin-right:0;content:""}.bn-block-content[data-content-type=numberedListItem]:before{display:flex;justify-content:center;min-width:24px;padding-right:4px}[data-content-type=numberedListItem]{--index: attr(data-index)}[data-prev-type=numberedListItem]{--prev-index: attr(data-prev-index)}.bn-block-outer[data-prev-type=numberedListItem]:not([data-prev-index=none])>.bn-block>.bn-block-content:before{content:var(--prev-index) "."}.bn-block-outer:not([data-prev-type])>.bn-block>.bn-block-content[data-content-type=numberedListItem]:before,.bn-block-outer:not([data-prev-type])>.bn-block>div[data-type=modification]>.bn-block-content[data-content-type=numberedListItem]:before{content:var(--index) "."}.bn-block-content[data-content-type=bulletListItem]:before{display:flex;justify-content:center;min-width:24px;padding-right:4px}.bn-block-content[data-content-type=checkListItem]>input{cursor:pointer;height:24px;margin-left:4px;margin-right:8px;margin-top:0;width:12px}.bn-block-content[data-content-type=checkListItem][data-checked=true] .bn-inline-content{text-decoration:line-through}.bn-block-content[data-text-alignment=center]{justify-content:center}.bn-block-content[data-text-alignment=right]{justify-content:flex-end}.bn-block:has(>.bn-block-content>div>.bn-toggle-wrapper[data-show-children=false])>.bn-block-group,.bn-block:has(>.react-renderer>.bn-block-content>div>.bn-toggle-wrapper[data-show-children=false])>.bn-block-group{display:none}.bn-toggle-wrapper{display:flex;align-items:center}.bn-toggle-button{color:var(--bn-colors-editor-text);padding:3px}.bn-toggle-button>svg{width:18px;height:18px}.bn-toggle-wrapper[data-show-children=true] .bn-toggle-button{transform:rotate(90deg)}.bn-toggle-add-block-button{font-size:16px;color:var(--bn-colors-side-menu);font-weight:400;margin-left:22px;padding-inline:2px;width:fit-content}.bn-toggle-button,.bn-toggle-add-block-button{background:none;border:none;border-radius:var(--bn-border-radius-small);cursor:pointer;display:flex;-webkit-user-select:none;user-select:none}.bn-toggle-button:hover,.bn-toggle-add-block-button:hover{background-color:var(--bn-colors-hovered-background)}.bn-block-outer[data-prev-type=bulletListItem]>.bn-block>.bn-block-content:before{content:"•"}.bn-block-outer:not([data-prev-type])>.bn-block>.bn-block-content[data-content-type=bulletListItem]:before,.bn-block-outer:not([data-prev-type])>.bn-block>div[data-type=modification]>.bn-block-content[data-content-type=bulletListItem]:before{content:"•"}[data-content-type=bulletListItem]~.bn-block-group>.bn-block-outer[data-prev-type=bulletListItem]>.bn-block>.bn-block-content:before{content:"◦"}[data-content-type=bulletListItem]~.bn-block-group>.bn-block-outer:not([data-prev-type])>.bn-block>.bn-block-content[data-content-type=bulletListItem]:before,[data-content-type=bulletListItem]~.bn-block-group>.bn-block-outer:not([data-prev-type])>.bn-block>div[data-type=modification]>.bn-block-content[data-content-type=bulletListItem]:before{content:"◦"}[data-content-type=bulletListItem]~.bn-block-group [data-content-type=bulletListItem]~.bn-block-group>.bn-block-outer[data-prev-type=bulletListItem]>.bn-block>.bn-block-content:before{content:"▪"}[data-content-type=bulletListItem]~.bn-block-group [data-content-type=bulletListItem]~.bn-block-group>.bn-block-outer:not([data-prev-type])>.bn-block>.bn-block-content[data-content-type=bulletListItem]:before,[data-content-type=bulletListItem]~.bn-block-group [data-content-type=bulletListItem]~.bn-block-group>.bn-block-outer:not([data-prev-type])>.bn-block>div[data-type=modification]>.bn-block-content[data-content-type=bulletListItem]:before{content:"▪"}.bn-block-content[data-content-type=codeBlock]{position:relative;background-color:#161616;color:#fff;border-radius:8px}.bn-block-content[data-content-type=codeBlock]>pre{white-space:pre;overflow-x:auto;margin:0;width:100%;-moz-tab-size:2;tab-size:2;padding:24px}.bn-block-content[data-content-type=codeBlock]>div{outline:none!important}.bn-block-content[data-content-type=codeBlock]>div>select{outline:none!important;-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-user-select:none;user-select:none;border:none;cursor:pointer;background-color:transparent;position:absolute;top:8px;left:18px;font-size:.8em;color:#fff;opacity:0;transition:opacity .3s;transition-delay:1s}.bn-block-content[data-content-type=codeBlock]>div>select>option{color:#000}.bn-block-content[data-content-type=codeBlock]:hover>div>select,.bn-block-content[data-content-type=codeBlock]>div>select:focus{opacity:.5;transition-delay:.1s}.bn-block-content[data-content-type=pageBreak]>div{width:100%;height:0;border-top:dotted rgb(125,121,122) 2px;margin-block:11px}@media print{.bn-block-content[data-content-type=pageBreak]>div{page-break-after:always}}[data-file-block] .bn-file-block-content-wrapper{cursor:pointer;display:flex;flex-direction:column;-webkit-user-select:none;user-select:none}[data-file-block] .bn-file-block-content-wrapper:has(.bn-add-file-button),[data-file-block] .bn-file-block-content-wrapper:has(.bn-file-name-with-icon){width:100%}[data-file-block] .bn-add-file-button{align-items:center;background-color:#f2f1ee;border-radius:4px;color:#7d797a;display:flex;gap:10px;padding:12px}.bn-editor[contenteditable=true] [data-file-block] .bn-add-file-button:hover,[data-file-block] .bn-file-name-with-icon:hover,.ProseMirror-selectednode .bn-file-name-with-icon{background-color:#e1e1e1}[data-file-block] .bn-add-file-button-icon,[data-file-block] .bn-file-icon{width:24px;height:24px}[data-file-block] .bn-add-file-button-text{font-size:.9rem}[data-file-block] .bn-file-name-with-icon{border-radius:4px;display:flex;gap:4px;padding:4px}[data-file-block] .bn-file-caption{font-size:.8em;padding-block:4px;word-break:break-word}[data-file-block] .bn-file-caption:empty{padding-block:0}[data-file-block] .bn-resize-handle{position:absolute;width:8px;height:30px;background-color:#000;border:1px solid white;border-radius:4px;cursor:ew-resize}[data-file-block] .bn-visual-media-wrapper{display:flex;align-items:center;position:relative;max-width:100%}[data-file-block] .bn-visual-media{border-radius:4px;width:100%}[data-content-type=audio]>.bn-file-block-content-wrapper,.bn-audio{width:100%}.bn-inline-content:has(>.ProseMirror-trailingBreak:only-child):before{pointer-events:none;height:0;position:absolute;font-style:italic}[data-style-type=textColor][data-value=gray],[data-text-color=gray],.bn-block:has(>.bn-block-content[data-text-color=gray]){color:#9b9a97}[data-style-type=textColor][data-value=brown],[data-text-color=brown],.bn-block:has(>.bn-block-content[data-text-color=brown]){color:#64473a}[data-style-type=textColor][data-value=red],[data-text-color=red],.bn-block:has(>.bn-block-content[data-text-color=red]){color:#e03e3e}[data-style-type=textColor][data-value=orange],[data-text-color=orange],.bn-block:has(>.bn-block-content[data-text-color=orange]){color:#d9730d}[data-style-type=textColor][data-value=yellow],[data-text-color=yellow],.bn-block:has(>.bn-block-content[data-text-color=yellow]){color:#dfab01}[data-style-type=textColor][data-value=green],[data-text-color=green],.bn-block:has(>.bn-block-content[data-text-color=green]){color:#4d6461}[data-style-type=textColor][data-value=blue],[data-text-color=blue],.bn-block:has(>.bn-block-content[data-text-color=blue]){color:#0b6e99}[data-style-type=textColor][data-value=purple],[data-text-color=purple],.bn-block:has(>.bn-block-content[data-text-color=purple]){color:#6940a5}[data-style-type=textColor][data-value=pink],[data-text-color=pink],.bn-block:has(>.bn-block-content[data-text-color=pink]){color:#ad1a72}[data-style-type=backgroundColor][data-value=gray],[data-background-color=gray],.bn-block:has(>.bn-block-content[data-background-color=gray]){background-color:#ebeced}[data-style-type=backgroundColor][data-value=brown],[data-background-color=brown],.bn-block:has(>.bn-block-content[data-background-color=brown]){background-color:#e9e5e3}[data-style-type=backgroundColor][data-value=red],[data-background-color=red],.bn-block:has(>.bn-block-content[data-background-color=red]){background-color:#fbe4e4}[data-style-type=backgroundColor][data-value=orange],[data-background-color=orange],.bn-block:has(>.bn-block-content[data-background-color=orange]){background-color:#f6e9d9}[data-style-type=backgroundColor][data-value=yellow],[data-background-color=yellow],.bn-block:has(>.bn-block-content[data-background-color=yellow]){background-color:#fbf3db}[data-style-type=backgroundColor][data-value=green],[data-background-color=green],.bn-block:has(>.bn-block-content[data-background-color=green]){background-color:#ddedea}[data-style-type=backgroundColor][data-value=blue],[data-background-color=blue],.bn-block:has(>.bn-block-content[data-background-color=blue]){background-color:#ddebf1}[data-style-type=backgroundColor][data-value=purple],[data-background-color=purple],.bn-block:has(>.bn-block-content[data-background-color=purple]){background-color:#eae4f2}[data-style-type=backgroundColor][data-value=pink],[data-background-color=pink],.bn-block:has(>.bn-block-content[data-background-color=pink]){background-color:#f4dfeb}[data-text-alignment=left]{justify-content:flex-start!important;text-align:left!important}[data-text-alignment=center]{justify-content:center!important;text-align:center!important}[data-text-alignment=right]{justify-content:flex-end!important;text-align:right!important}[data-text-alignment=justify]{justify-content:flex-start!important;text-align:justify!important}.bn-block-column-list{display:flex;flex-direction:row}.bn-block-column{flex:1;padding:12px 20px;overflow-x:auto}.bn-block-column:first-child{padding-left:0}.bn-block-column:last-child{padding-right:0}.bn-thread-mark:not([data-orphan=true]){background:#ffc80026}.bn-thread-mark .bn-thread-mark-selected{background:#ffc80040}.ProseMirror .tableWrapper{overflow-x:auto}.ProseMirror table{border-collapse:collapse;table-layout:fixed;width:100%;overflow:hidden}.ProseMirror td,.ProseMirror th{vertical-align:top;box-sizing:border-box;position:relative}.ProseMirror td:not([data-colwidth]):not(.column-resize-dragging),.ProseMirror th:not([data-colwidth]):not(.column-resize-dragging){min-width:var(--default-cell-min-width)}.ProseMirror .column-resize-handle{position:absolute;right:-2px;top:0;bottom:0;width:4px;z-index:20;background-color:#adf;pointer-events:none}.ProseMirror.resize-cursor{cursor:ew-resize;cursor:col-resize}.ProseMirror .selectedCell:after{z-index:2;position:absolute;content:"";inset:0;background:#c8c8ff66;pointer-events:none}.bn-editor{outline:none;padding-inline:54px;--N800: #172b4d;--N40: #dfe1e6}.bn-comment-editor{width:100%;padding:0}.bn-comment-editor .bn-editor{padding:0}.bn-root{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bn-root *,.bn-root *:before,.bn-root *:after{-webkit-box-sizing:inherit;-moz-box-sizing:inherit;box-sizing:inherit}.bn-default-styles p,.bn-default-styles h1,.bn-default-styles h2,.bn-default-styles h3,.bn-default-styles h4,.bn-default-styles h5,.bn-default-styles h6,.bn-default-styles li{margin:0;padding:0;font-size:inherit;min-width:2px!important}.bn-default-styles{font-size:16px;font-weight:400;font-family:Inter,SF Pro Display,-apple-system,BlinkMacSystemFont,Open Sans,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.bn-table-drop-cursor{position:absolute;z-index:20;background-color:#adf;pointer-events:none}.bn-drag-preview{position:absolute;top:0;left:0;padding:10px;opacity:.001}.bn-editor .bn-collaboration-cursor__base{position:relative}.bn-editor .bn-collaboration-cursor__base .bn-collaboration-cursor__caret{position:absolute;width:2px;top:1px;bottom:-2px;left:-1px}.bn-editor .bn-collaboration-cursor__base .bn-collaboration-cursor__label{pointer-events:none;border-radius:0 1.5px 1.5px 0;font-size:12px;font-style:normal;font-weight:600;line-height:normal;left:0;overflow:hidden;position:absolute;white-space:nowrap;-webkit-user-select:none;user-select:none;color:transparent;max-height:5px;max-width:4px;padding:0;top:-1px;transition:all .2s}.bn-editor .bn-collaboration-cursor__base[data-active] .bn-collaboration-cursor__label{color:#0d0d0d;max-height:1.1rem;max-width:20rem;padding:.1rem .3rem;top:-17px;left:0;border-radius:3px 3px 3px 0;transition:all .2s}.bn-editor [data-content-type=table] .tableWrapper{--bn-table-widget-size: 22px;--bn-table-handle-size: 9px ;overflow-y:hidden;padding:var(--bn-table-handle-size) var(--bn-table-widget-size) var(--bn-table-widget-size) var(--bn-table-handle-size);position:relative;width:100%}.bn-editor [data-content-type=table] table{width:auto!important;word-break:break-word}.bn-editor [data-content-type=table] th,.bn-editor [data-content-type=table] td{border:1px solid #ddd;padding:5px 10px}.bn-editor [data-content-type=table] th{font-weight:700;text-align:left}.bn-editor [data-content-type=table] th>p,.bn-editor [data-content-type=table] td>p{min-height:1.5rem}.ProseMirror td,.ProseMirror th{min-width:auto!important}.ProseMirror td:not([colwidth]):not(.column-resize-dragging),.ProseMirror th:not([colwidth]):not(.column-resize-dragging){min-width:var(--default-cell-min-width)!important}.prosemirror-dropcursor-block{transition-property:top,bottom;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.prosemirror-dropcursor-vertical{transition-property:left,right}[data-show-selection]{background-color:highlight;padding:2px 0}.bn-container{--bn-colors-editor-text: #3f3f3f;--bn-colors-editor-background: #ffffff;--bn-colors-menu-text: #3f3f3f;--bn-colors-menu-background: #ffffff;--bn-colors-tooltip-text: #3f3f3f;--bn-colors-tooltip-background: #efefef;--bn-colors-hovered-text: #3f3f3f;--bn-colors-hovered-background: #efefef;--bn-colors-selected-text: #ffffff;--bn-colors-selected-background: #3f3f3f;--bn-colors-disabled-text: #afafaf;--bn-colors-disabled-background: #efefef;--bn-colors-shadow: #cfcfcf;--bn-colors-border: #efefef;--bn-colors-side-menu: #cfcfcf;--bn-colors-highlights-gray-text: #9b9a97;--bn-colors-highlights-gray-background: #ebeced;--bn-colors-highlights-brown-text: #64473a;--bn-colors-highlights-brown-background: #e9e5e3;--bn-colors-highlights-red-text: #e03e3e;--bn-colors-highlights-red-background: #fbe4e4;--bn-colors-highlights-orange-text: #d9730d;--bn-colors-highlights-orange-background: #f6e9d9;--bn-colors-highlights-yellow-text: #dfab01;--bn-colors-highlights-yellow-background: #fbf3db;--bn-colors-highlights-green-text: #4d6461;--bn-colors-highlights-green-background: #ddedea;--bn-colors-highlights-blue-text: #0b6e99;--bn-colors-highlights-blue-background: #ddebf1;--bn-colors-highlights-purple-text: #6940a5;--bn-colors-highlights-purple-background: #eae4f2;--bn-colors-highlights-pink-text: #ad1a72;--bn-colors-highlights-pink-background: #f4dfeb;--bn-font-family: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Open Sans", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;--bn-border-radius: 6px;--bn-shadow-medium: 0 4px 12px var(--bn-colors-shadow);--bn-shadow-light: 0 2px 6px var(--bn-colors-border);--bn-border: 1px solid var(--bn-colors-border);--bn-border-radius-small: max(var(--bn-border-radius) - 2px, 1px);--bn-border-radius-medium: var(--bn-border-radius);--bn-border-radius-large: max(var(--bn-border-radius) + 2px, 1px)}.bn-container[data-color-scheme=dark]{--bn-colors-editor-text: #cfcfcf;--bn-colors-editor-background: #1f1f1f;--bn-colors-menu-text: #cfcfcf;--bn-colors-menu-background: #1f1f1f;--bn-colors-tooltip-text: #cfcfcf;--bn-colors-tooltip-background: #161616;--bn-colors-hovered-text: #cfcfcf;--bn-colors-hovered-background: #161616;--bn-colors-selected-text: #cfcfcf;--bn-colors-selected-background: #0f0f0f;--bn-colors-disabled-text: #3f3f3f;--bn-colors-disabled-background: #161616;--bn-colors-shadow: #0f0f0f;--bn-colors-border: #161616;--bn-colors-side-menu: #7f7f7f;--bn-colors-highlights-gray-text: #bebdb8;--bn-colors-highlights-gray-background: #9b9a97;--bn-colors-highlights-brown-text: #8e6552;--bn-colors-highlights-brown-background: #64473a;--bn-colors-highlights-red-text: #ec4040;--bn-colors-highlights-red-background: #be3434;--bn-colors-highlights-orange-text: #e3790d;--bn-colors-highlights-orange-background: #b7600a;--bn-colors-highlights-yellow-text: #dfab01;--bn-colors-highlights-yellow-background: #b58b00;--bn-colors-highlights-green-text: #6b8b87;--bn-colors-highlights-green-background: #4d6461;--bn-colors-highlights-blue-text: #0e87bc;--bn-colors-highlights-blue-background: #0b6e99;--bn-colors-highlights-purple-text: #8552d7;--bn-colors-highlights-purple-background: #6940a5;--bn-colors-highlights-pink-text: #da208f;--bn-colors-highlights-pink-background: #ad1a72}.bn-container{font-family:var(--bn-font-family)}.bn-editor{background-color:var(--bn-colors-editor-background);border-radius:var(--bn-border-radius-large);color:var(--bn-colors-editor-text)}.bn-react-node-view-renderer{display:flex;flex-direction:column;width:100%}.bn-block-group .bn-block:not(:has(.bn-toggle-wrapper)) .bn-block-group .bn-block-outer:not([data-prev-depth-changed]):before{border-left:1px solid var(--bn-colors-side-menu)}.bn-inline-content:has(>.ProseMirror-trailingBreak):before{color:var(--bn-colors-side-menu)}.bn-container .bn-color-icon{align-items:center;border:var(--bn-border);border-radius:var(--bn-border-radius-small);display:flex;justify-content:center}.bn-error-text{color:red;font-size:12px}[data-style-type=textColor][data-value=gray],[data-text-color=gray]{color:var(--bn-colors-highlights-gray-text)}[data-style-type=textColor][data-value=brown],[data-text-color=brown]{color:var(--bn-colors-highlights-brown-text)}[data-style-type=textColor][data-value=red],[data-text-color=red]{color:var(--bn-colors-highlights-red-text)}[data-style-type=textColor][data-value=orange],[data-text-color=orange]{color:var(--bn-colors-highlights-orange-text)}[data-style-type=textColor][data-value=yellow],[data-text-color=yellow]{color:var(--bn-colors-highlights-yellow-text)}[data-style-type=textColor][data-value=green],[data-text-color=green]{color:var(--bn-colors-highlights-green-text)}[data-style-type=textColor][data-value=blue],[data-text-color=blue]{color:var(--bn-colors-highlights-blue-text)}[data-style-type=textColor][data-value=purple],[data-text-color=purple]{color:var(--bn-colors-highlights-purple-text)}[data-style-type=textColor][data-value=pink],[data-text-color=pink]{color:var(--bn-colors-highlights-pink-text)}[data-style-type=backgroundColor][data-value=gray],[data-background-color=gray]{background-color:var(--bn-colors-highlights-gray-background)}[data-style-type=backgroundColor][data-value=brown],[data-background-color=brown]{background-color:var(--bn-colors-highlights-brown-background)}[data-style-type=backgroundColor][data-value=red],[data-background-color=red]{background-color:var(--bn-colors-highlights-red-background)}[data-style-type=backgroundColor][data-value=orange],[data-background-color=orange]{background-color:var(--bn-colors-highlights-orange-background)}[data-style-type=backgroundColor][data-value=yellow],[data-background-color=yellow]{background-color:var(--bn-colors-highlights-yellow-background)}[data-style-type=backgroundColor][data-value=green],[data-background-color=green]{background-color:var(--bn-colors-highlights-green-background)}[data-style-type=backgroundColor][data-value=blue],[data-background-color=blue]{background-color:var(--bn-colors-highlights-blue-background)}[data-style-type=backgroundColor][data-value=purple],[data-background-color=purple]{background-color:var(--bn-colors-highlights-purple-background)}[data-style-type=backgroundColor][data-value=pink],[data-background-color=pink]{background-color:var(--bn-colors-highlights-pink-background)}.bn-container{--bn-ui-base-z-index: 0}.bn-side-menu{height:30px}.bn-side-menu[data-block-type=heading][data-level="1"]{height:78px}.bn-side-menu[data-block-type=heading][data-level="2"]{height:54px}.bn-side-menu[data-block-type=heading][data-level="3"]{height:37px}.bn-side-menu[data-block-type=file]{height:38px}.bn-side-menu[data-block-type=audio]{height:60px}.bn-side-menu[data-url=false]{height:54px}.bn-threads-sidebar{border-radius:var(--bn-border-radius-medium);display:flex;flex-direction:column;gap:10px;overflow:auto}.bn-thread-expand-prompt .mantine-Text-root,.bn-thread .bn-header-text{color:var(--bn-colors-menu-text)}.bn-threads-sidebar .bn-thread .bn-editor{background-color:transparent}.bn-threads-sidebar .bn-thread.selected{background-color:#f5f9fd;border:2px solid #c2dcf8}.dark .bn-threads-sidebar .bn-thread.selected{background-color:#20242a;border:2px solid #23405b}em-emoji-picker{max-height:100%;z-index:11000}.bn-shadcn svg:not([class*=size-]){width:revert;height:revert}.bn-shadcn svg{pointer-events:all}.bn-shadcn .bn-editor a{color:revert;text-decoration:revert}.bn-shadcn .bn-editor:focus-visible{outline:none}.bn-shadcn .bn-side-menu{align-items:center;display:flex;justify-content:center}.bn-shadcn .bn-side-menu .bn-button{padding:0;height:24px}.bn-shadcn .bn-select{max-height:var(--radix-select-content-available-height)}.bn-shadcn .bn-menu-dropdown{max-height:var(--radix-dropdown-menu-content-available-height)}.bn-shadcn .bn-color-picker-dropdown{overflow:auto}.bn-shadcn .bn-extend-button-add-remove-columns{cursor:col-resize}.bn-shadcn .bn-extend-button-add-remove-rows{cursor:row-resize}.bn-shadcn .bn-toolbar{overflow-x:auto;max-width:100vw}.bn-shadcn .bn-comment-actions-wrapper{display:flex;justify-content:flex-end}.bn-shadcn .bn-table-cell-handle{padding:0 4px;height:12px}.bn-shadcn .bn-thread .bn-resolved-text{font-size:14px;font-style:italic}.bn-shadcn .bn-combobox-error{color:var(--bn-colors-highlights-red-background);font-weight:700}
@@ -1 +0,0 @@
1
- import{j as e}from"./tanstack-Bs3zYPPV.js";import{u as H,f as M,r as o}from"./react-vendor-C2CvUxFh.js";import{L as d,I as y,a9 as C,aA as R,S as T,aB as U,aC as V,aD as W,x as _,W as z,B as h,a as G,D as J,i as K,T as Q,k as X,l as Y,m as Z,n as ee,o as ae,v as j}from"./index-Cir9tY_P.js";import{I as se,F as te}from"./FieldBuilder-36tfpSyM.js";import{i as le}from"./format-C88SDH8g.js";import{T as ie}from"./textarea-vSXNxwTe.js";import{C as ne,a as re,b as oe,c as ce}from"./card-hXVtlM0q.js";import{C as de,a as me,b as pe}from"./collapsible-B414SspL.js";import{C as ue}from"./CustomBlockPreview-C6HqS4xv.js";import{u as B}from"./useDebouncedValue-C-cQUcLG.js";import{u as xe}from"./usePageTitle-BNSba9_L.js";import"./radix-C1kb_NqW.js";import"./core.esm-B_kcYf6n.js";import"./sortable.esm-QyXA6fio.js";import"./select-_uJYxzeZ.js";import"./checkbox-WGrS3sUr.js";function he({fields:s,previewTemplate:t,previewData:a,onPreviewDataChange:r,blockTypeName:c,blockTypeLabel:m,blockTypeIcon:b}){const i=B(t,300),f=B(a,300);return e.jsxs("div",{className:"space-y-4",children:[s.map(n=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs",children:n.label}),e.jsx(y,{value:String(a[n.name]??""),onChange:v=>r({...a,[n.name]:v.target.value}),placeholder:`Sample ${n.label}...`})]},n.name)),e.jsx(C,{}),e.jsx("div",{className:"rounded-md border p-4",children:e.jsx(ue,{blockType:{name:c,label:m,icon:b,fields:s,previewTemplate:i},props:f})})]})}function Le(){const{host:s,name:t}=H(),a=t==="new",{data:r,isLoading:c}=R(s,a?"":t);return!a&&c?e.jsxs("div",{className:"space-y-4",children:[e.jsx(T,{className:"h-8 w-64"}),e.jsx(T,{className:"h-64 w-full"})]}):a?e.jsx(N,{host:s,isNew:!0}):r?e.jsx(N,{host:s,isNew:!1,blockType:r},r.name):e.jsx("p",{className:"text-muted-foreground",children:"Block type not found."})}function N({host:s,isNew:t,blockType:a}){const r=M(),c=U(s),m=V(s,a?.name??""),b=W(s,a?.name??""),[i,f]=o.useState(a?.name??""),[n,v]=o.useState(a?.label??""),[g,D]=o.useState(a?.icon??""),[S,P]=o.useState(!t),F=new Set((a?.fields??[]).map(l=>l.name).filter(Boolean)),[p,L]=o.useState(a?.fields??[]),[u,I]=o.useState(a?.previewTemplate??""),[x,E]=o.useState(a?.previewData??{}),[O,k]=o.useState(!1),$=_();xe({title:t?"New Block Type":a?.label??i,showBack:!0,backTo:`/sites/${s}/settings/block-types`});async function q(l){l.preventDefault();try{t?(await c.mutateAsync({name:i,label:n,icon:g,fields:p,previewTemplate:u||void 0,previewData:Object.keys(x).length>0?x:void 0}),j.success("Block type created"),r(`/sites/${s}/settings/block-types/${i}`)):(await m.mutateAsync({label:n,icon:g,fields:p,previewTemplate:u||void 0,previewData:Object.keys(x).length>0?x:void 0}),j.success("Block type updated"))}catch(w){j.error(t?"Failed to create":"Failed to update",{description:w instanceof Error?w.message:void 0})}}async function A(){try{await b.mutateAsync(),j.success("Block type deleted"),r(`/sites/${s}/settings/block-types`)}catch(l){j.error("Failed to delete",{description:l instanceof Error?l.message:void 0})}}return e.jsxs("div",{className:"mx-auto max-w-2xl",children:[!$&&e.jsx("h1",{className:"mb-6 text-2xl font-semibold",children:t?"New Block Type":`Edit: ${a?.label??i}`}),e.jsxs(ne,{children:[e.jsx(re,{children:e.jsx(oe,{children:"Block Type Settings"})}),e.jsx(ce,{children:e.jsxs("form",{onSubmit:q,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"name",children:"Name"}),e.jsx(se,{id:"name",value:i,onChange:f,onBlur:()=>{i&&!S&&v(le(i))},readOnly:!t,placeholder:"e.g. hero_banner",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"label",children:"Label"}),e.jsx(y,{id:"label",value:n,onChange:l=>{v(l.target.value),P(!0)},required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"icon",children:"Icon"}),e.jsx(y,{id:"icon",value:g,onChange:l=>D(l.target.value)})]}),e.jsx(C,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{children:"Block Fields"}),e.jsx(te,{fields:p,onChange:L,existingFieldNames:F})]}),e.jsx(C,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"preview-template",children:"Preview Template (Liquid + Tailwind)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. Use Liquid syntax to render a preview. Block field values are available as template variables."}),e.jsx(ie,{id:"preview-template",value:u,onChange:l=>I(l.target.value),rows:6,placeholder:'<div class="p-4">{{ title }}</div>',className:"font-mono text-sm"})]}),(u||p.length>0)&&e.jsxs(de,{children:[e.jsxs(me,{className:"flex w-full items-center gap-2 text-sm font-medium",children:[e.jsx(z,{className:"h-4 w-4 transition-transform [[data-state=open]>&]:rotate-90"}),"Preview"]}),e.jsx(pe,{className:"mt-2",children:e.jsx(he,{fields:p,previewTemplate:u,previewData:x,onPreviewDataChange:E,blockTypeName:i,blockTypeLabel:n,blockTypeIcon:g})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(h,{type:"submit",disabled:c.isPending||m.isPending,children:[(c.isPending||m.isPending)&&e.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}),t?"Create":"Save"]}),e.jsx(h,{type:"button",variant:"outline",onClick:()=>r(`/sites/${s}/settings/block-types`),children:"Cancel"})]})]})})]}),!t&&e.jsx("div",{className:"mt-6",children:e.jsxs(J,{open:O,onOpenChange:k,children:[e.jsx(K,{asChild:!0,children:e.jsxs(h,{variant:"destructive",children:[e.jsx(Q,{className:"mr-2 h-4 w-4"}),"Delete Block Type"]})}),e.jsxs(X,{children:[e.jsxs(Y,{children:[e.jsx(Z,{children:"Delete block type?"}),e.jsx(ee,{children:"This will permanently delete this block type."})]}),e.jsxs(ae,{children:[e.jsx(h,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),e.jsx(h,{variant:"destructive",onClick:A,children:"Delete"})]})]})]})})]})}export{Le as BlockTypeEditPage};
@@ -1 +0,0 @@
1
- import{j as s}from"./tanstack-Bs3zYPPV.js";import{u as h,f as j}from"./react-vendor-C2CvUxFh.js";import{az as p,x as u,B as c,P as o,S as f}from"./index-Cir9tY_P.js";import{T as N,a as b,b as r,c as a,d as g,e as i}from"./table-DLoIbCQ5.js";import{u as k}from"./usePageTitle-BNSba9_L.js";import"./radix-C1kb_NqW.js";function C(){const{host:l}=h(),n=j(),{data:t,isLoading:m}=p(l),d=u();return k({title:"Block Types",actions:s.jsx(c,{size:"sm",onClick:()=>n(`/sites/${l}/settings/block-types/new`),children:s.jsx(o,{className:"h-4 w-4"})})}),s.jsxs("div",{children:[!d&&s.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[s.jsx("h1",{className:"text-2xl font-semibold",children:"Block Types"}),s.jsxs(c,{onClick:()=>n(`/sites/${l}/settings/block-types/new`),children:[s.jsx(o,{className:"mr-2 h-4 w-4"}),"New Block Type"]})]}),m?s.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((e,x)=>s.jsx(f,{className:"h-12 w-full"},x))}):t?.items.length?s.jsxs(N,{children:[s.jsx(b,{children:s.jsxs(r,{children:[s.jsx(a,{children:"Name"}),s.jsx(a,{children:"Label"}),s.jsx(a,{children:"Icon"}),s.jsx(a,{children:"Fields"})]})}),s.jsx(g,{children:t.items.map(e=>s.jsxs(r,{className:"cursor-pointer",onClick:()=>n(`/sites/${l}/settings/block-types/${e.name}`),children:[s.jsx(i,{className:"font-mono text-sm",children:e.name}),s.jsx(i,{children:e.label}),s.jsx(i,{children:e.icon}),s.jsx(i,{className:"text-muted-foreground",children:e.fields?.length??0})]},e.name))})]}):s.jsx("p",{className:"text-muted-foreground",children:"No block types defined."})]})}export{C as BlockTypesPage};
@@ -1 +0,0 @@
1
- import{j as e}from"./tanstack-Bs3zYPPV.js";import{r as i,u as fe,f as Ce}from"./react-vendor-C2CvUxFh.js";import{R as ve,W as Se,y as Q,as as Ne,B as C,T as ee,I as E,P as ye,at as V,au as ke,S as z,x as Pe,w as De,av as Le,aw as Ee,ax as Te,L as h,ay as we,a9 as G,a as Fe,D as Ie,i as Be,k as Ae,l as Re,m as Oe,n as Me,o as qe,v as L}from"./index-Cir9tY_P.js";import{I as se,F as Ue}from"./FieldBuilder-36tfpSyM.js";import{i as ae,c as $e}from"./format-C88SDH8g.js";import{C as O}from"./checkbox-WGrS3sUr.js";import{C as W,a as Y,b as K,c as X}from"./card-hXVtlM0q.js";import{u as _e}from"./usePageTitle-BNSba9_L.js";import{S as M,a as q,b as U,c as $,d as f}from"./select-_uJYxzeZ.js";import{C as He,u as Ve,a as ze,P as Ge,D as We,c as Ye}from"./core.esm-B_kcYf6n.js";import{u as Ke,S as Xe,v as Ze,a as Je}from"./sortable.esm-QyXA6fio.js";import{C as Qe,a as es,b as ss}from"./collapsible-B414SspL.js";import{P as as,a as ts,b as ls}from"./popover-D5_HjjUC.js";import"./radix-C1kb_NqW.js";import"./textarea-vSXNxwTe.js";function ns({id:a,relationship:s,onChange:t,onRemove:u,collections:x,readOnlyName:g,defaultExpanded:j}){const[o,k]=i.useState(j??!1),[m,P]=i.useState(!!s.label),{attributes:v,listeners:c,setNodeRef:r,transform:d,transition:S}=Ke({id:a}),y={transform:He.Transform.toString(d),transition:S};function p(n){t({...s,...n})}const T=x.find(n=>n.name===s.targetCollection)?.label??s.targetCollection;return e.jsx("div",{ref:r,style:y,className:"rounded-md border bg-card",children:e.jsxs(Qe,{open:o,onOpenChange:k,children:[e.jsxs("div",{className:"flex items-center gap-2 p-2",children:[e.jsx("button",{type:"button",className:"cursor-grab touch-none text-muted-foreground hover:text-foreground",...v,...c,children:e.jsx(ve,{className:"h-4 w-4"})}),e.jsx(es,{asChild:!0,children:e.jsx("button",{type:"button",className:"flex items-center",children:e.jsx(Se,{className:Q("h-4 w-4 transition-transform",o&&"rotate-90")})})}),e.jsx("span",{className:"min-w-[80px] text-sm font-mono",children:s.name||"unnamed"}),e.jsx(Ne,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:T}),e.jsx("span",{className:"flex-1 truncate text-sm text-muted-foreground",children:s.label}),e.jsx(C,{type:"button",variant:"ghost",size:"sm",onClick:u,className:"text-destructive",children:e.jsx(ee,{className:"h-3 w-3"})})]}),e.jsx(ss,{children:e.jsxs("div",{className:"space-y-3 border-t p-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Name"}),e.jsx(se,{value:s.name,onChange:n=>p({name:n}),onBlur:()=>{s.name&&!m&&p({label:ae(s.name)})},readOnly:g,className:"h-8 text-sm"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Label"}),e.jsx(E,{value:s.label,onChange:n=>{p({label:n.target.value}),P(!0)},className:"h-8 text-sm"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Target Collection"}),e.jsxs(M,{value:s.targetCollection,onValueChange:n=>p({targetCollection:n}),children:[e.jsx(q,{className:"h-8 text-sm",children:e.jsx(U,{placeholder:"Select collection..."})}),e.jsx($,{children:x.map(n=>e.jsx(f,{value:n.name,children:n.label},n.name))})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{id:`${a}-multiple`,checked:s.multiple,onCheckedChange:n=>p({multiple:!!n})}),e.jsx("label",{htmlFor:`${a}-multiple`,className:"text-sm",children:"Allow multiple"})]})]})})]})})}function is({relationships:a,onChange:s,collections:t,existingRelNames:u}){const x=Ve(ze(Ge)),g=a.map((c,r)=>`rel-${r}`),[j,o]=i.useState(null);function k(){o(a.length),s([...a,{name:"",label:"",targetCollection:"",multiple:!1}])}function m(c,r){const d=[...a];d[c]=r,s(d)}function P(c){s(a.filter((r,d)=>d!==c))}function v(c){const{active:r,over:d}=c;if(d&&r.id!==d.id){const S=g.indexOf(String(r.id)),y=g.indexOf(String(d.id));s(Je(a,S,y))}}return e.jsx(We,{sensors:x,collisionDetection:Ye,onDragEnd:v,children:e.jsx(Xe,{items:g,strategy:Ze,children:e.jsxs("div",{className:"space-y-2",children:[a.map((c,r)=>e.jsx(ns,{id:`rel-${r}`,relationship:c,onChange:d=>m(r,d),onRemove:()=>P(r),collections:t,readOnlyName:!!(u?.has(c.name)&&c.name),defaultExpanded:r===j},`rel-${r}`)),e.jsxs(C,{type:"button",variant:"outline",size:"sm",onClick:k,children:[e.jsx(ye,{className:"mr-2 h-3 w-3"})," Add Relationship"]})]})})})}const Z=["Newspaper","FileText","BookOpen","PenLine","Edit","Image","Camera","Video","Music","Mic","ShoppingCart","Store","Package","Tag","Gift","Users","User","UserPlus","Contact","Building","Calendar","Clock","Timer","CalendarDays","CalendarCheck","Star","Heart","ThumbsUp","Award","Trophy","Map","MapPin","Globe","Compass","Navigation","MessageSquare","Mail","Send","Phone","Bell","Folder","FolderOpen","Archive","Database","HardDrive","Settings","Wrench","Cog","Sliders","SlidersHorizontal","BarChart","PieChart","TrendingUp","Activity","LineChart","Code","Terminal","Braces","Bug","Puzzle","Home","Layout","Grid","List","Layers","Lightbulb","Zap","Flame","Sun","Moon","Link","ExternalLink","Share","Download","Upload","Lock","Unlock","Shield","Key","Eye"];function rs({value:a,onChange:s}){const[t,u]=i.useState(!1),[x,g]=i.useState(""),j=x?Z.filter(o=>o.toLowerCase().includes(x.toLowerCase())):Z;return e.jsxs(as,{open:t,onOpenChange:u,children:[e.jsx(ts,{asChild:!0,children:e.jsxs(C,{variant:"outline",className:"gap-2 w-full justify-start",children:[e.jsx(V,{name:a||"FileText",className:"h-4 w-4"}),e.jsx("span",{className:"truncate",children:a||"Select icon..."})]})}),e.jsxs(ls,{className:"w-72 p-2",align:"start",children:[e.jsx(E,{placeholder:"Search icons...",value:x,onChange:o=>g(o.target.value),className:"mb-2",autoFocus:!0}),e.jsxs("div",{className:"grid grid-cols-6 gap-1 max-h-48 overflow-y-auto",children:[j.map(o=>e.jsx("button",{type:"button",title:o,className:Q("flex items-center justify-center rounded-md p-2 hover:bg-accent transition-colors",a===o&&"bg-accent ring-1 ring-primary"),onClick:()=>{s(o),u(!1),g("")},children:e.jsx(V,{name:o,className:"h-4 w-4"})},o)),j.length===0&&e.jsx("p",{className:"col-span-6 text-center text-sm text-muted-foreground py-4",children:"No matching icons"})]})]})]})}const os=["text","textarea","number","boolean","select","array"],cs=["url","email","date","content","blocks"];function ks(){const{host:a,name:s}=fe(),t=s==="new",{data:u,isLoading:x}=ke(a,t?"":s);return!t&&x?e.jsxs("div",{className:"space-y-4",children:[e.jsx(z,{className:"h-8 w-64"}),e.jsx(z,{className:"h-64 w-full"})]}):t?e.jsx(J,{host:a,isNew:!0}):u?e.jsx(J,{host:a,isNew:!1,collection:u},u.name):e.jsx("p",{className:"text-muted-foreground",children:"Collection not found."})}function J({host:a,isNew:s,collection:t}){const u=Ce(),x=Pe(),{collections:g}=De(),j=Le(a),o=Ee(a,t?.name??""),k=Te(a,t?.name??""),[m,P]=i.useState(t?.name??""),[v,c]=i.useState(t?.label??""),[r,d]=i.useState(t?.labelSingular??""),[S,y]=i.useState(t?.slug??""),[p,T]=i.useState(t?.singleton??!1),[n,te]=i.useState(t?.mode??"content"),[F,le]=i.useState(t?.requireAuth??!1),b=n==="submission",[ne,ie]=i.useState(!s),[re,oe]=i.useState(!s),[ce,de]=i.useState(!s),ue=new Set((t?.fields??[]).map(l=>l.name).filter(Boolean)),I=[{name:"blocks",label:"Blocks",type:"blocks",options:{}}],[D,w]=i.useState(t?.fields??(s&&!p?I:[])),[B,me]=i.useState(t?.relationships??[]),xe=new Set((t?.relationships??[]).map(l=>l.name).filter(Boolean)),[A,he]=i.useState(t?.mobileNavPriority??0),[R,ge]=i.useState(t?.icon??""),[je,_]=i.useState(!1);_e({title:s?"New Collection":t?.label??m,showBack:!0,backTo:`/sites/${a}/settings/collections`});function pe(){if(!m)return;const l=ae(m);ne||c(l),re||d($e(l)),ce||y(m.replace(/_/g,"-"))}async function H(l){l?.preventDefault();try{s?(await j.mutateAsync({name:m,label:v,labelSingular:r,slug:S,singleton:b?!1:p,fields:D,relationships:B,mobileNavPriority:A,icon:R,mode:n,requireAuth:b?F:void 0}),L.success("Collection created"),u(`/sites/${a}/settings/collections/${m}`)):(await o.mutateAsync({label:v,labelSingular:r,slug:b?void 0:S,singleton:b?!1:p,fields:D,relationships:B,mobileNavPriority:A,icon:R,mode:n,requireAuth:b?F:void 0}),L.success("Collection updated"))}catch(N){L.error(s?"Failed to create":"Failed to update",{description:N instanceof Error?N.message:void 0})}}async function be(){try{await k.mutateAsync(),L.success("Collection deleted"),u(`/sites/${a}/settings/collections`)}catch(l){L.error("Failed to delete",{description:l instanceof Error?l.message:void 0})}}return e.jsxs("div",{className:"mx-auto max-w-2xl",children:[!x&&e.jsx("h1",{className:"mb-6 text-2xl font-semibold",children:s?"New Collection":`Edit: ${t?.label??m}`}),e.jsxs(W,{children:[e.jsx(Y,{children:e.jsx(K,{children:"Collection Settings"})}),e.jsx(X,{children:e.jsxs("form",{onSubmit:H,className:"space-y-4","aria-label":"Collection settings",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"name",children:"Name"}),e.jsx(se,{id:"name",value:m,onChange:P,onBlur:pe,readOnly:!s,placeholder:"e.g. blog_posts",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"mode",children:"Mode"}),e.jsxs(M,{value:n,onValueChange:l=>{te(l),l==="submission"&&s&&(T(!1),w(D.filter(N=>os.includes(N.type)))),l==="content"&&s&&D.length===0&&w(I)},disabled:!s,children:[e.jsx(q,{id:"mode",children:e.jsx(U,{})}),e.jsxs($,{children:[e.jsx(f,{value:"content",children:"Content"}),e.jsx(f,{value:"submission",children:"Submissions"})]})]}),!s&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Mode cannot be changed after creation."})]}),b&&e.jsx("div",{className:"rounded-md border border-blue-200 bg-blue-50 p-3 text-sm text-blue-800 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-200",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(we,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Submission Collection"}),e.jsxs("p",{className:"mt-1",children:["Submissions are created via the API:"," ",e.jsxs("code",{className:"rounded bg-blue-100 px-1 dark:bg-blue-900",children:["POST /v1/","{site}","/submit/",m||"{collection}"]})]})]})]})}),b&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{id:"requireAuth",checked:F,onCheckedChange:l=>le(!!l)}),e.jsx(h,{htmlFor:"requireAuth",children:"Require authentication (site users must be logged in to submit)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"label",children:"Label"}),e.jsx(E,{id:"label",value:v,onChange:l=>{c(l.target.value),ie(!0)},required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"label-singular",children:"Label Singular"}),e.jsx(E,{id:"label-singular",value:r,onChange:l=>{d(l.target.value),oe(!0)},required:!0})]}),!b&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"slug",children:"Slug"}),e.jsx(E,{id:"slug",value:S,onChange:l=>{y(l.target.value),de(!0)},required:!0})]}),!b&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{id:"singleton",checked:p,onCheckedChange:l=>{const N=!!l;T(N),s&&w(N?[]:I)},disabled:!s}),e.jsx(h,{htmlFor:"singleton",children:"Singleton (single entry, no list)"})]}),e.jsx(G,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{children:"Fields"}),e.jsx(Ue,{fields:D,onChange:w,excludeTypes:b?cs:void 0,existingFieldNames:ue})]}),e.jsx(G,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{children:"Relationships"}),e.jsx(is,{relationships:B,onChange:me,collections:g,existingRelNames:xe})]})]})})]}),e.jsxs(W,{className:"mt-6",children:[e.jsx(Y,{children:e.jsx(K,{children:"Navigation"})}),e.jsxs(X,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{children:"Icon"}),e.jsx(rs,{value:R,onChange:ge})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"mobileNavPriority",children:"Bottom Nav Priority"}),e.jsxs(M,{value:String(A),onValueChange:l=>he(Number(l)),children:[e.jsx(q,{id:"mobileNavPriority",children:e.jsx(U,{})}),e.jsxs($,{children:[e.jsx(f,{value:"0",children:"0 - Hidden"}),e.jsx(f,{value:"1",children:"1"}),e.jsx(f,{value:"2",children:"2"}),e.jsx(f,{value:"3",children:"3"}),e.jsx(f,{value:"4",children:"4"}),e.jsx(f,{value:"5",children:"5 - Highest"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Collections with priority > 0 appear in the mobile bottom navigation bar."})]})]})]}),e.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[e.jsx(C,{type:"button",variant:"outline",onClick:()=>u(`/sites/${a}/settings/collections`),children:"Cancel"}),e.jsxs(C,{onClick:H,disabled:j.isPending||o.isPending,children:[(j.isPending||o.isPending)&&e.jsx(Fe,{className:"mr-2 h-4 w-4 animate-spin"}),s?"Create":"Save"]})]}),!s&&e.jsx("div",{className:"mt-6",children:e.jsxs(Ie,{open:je,onOpenChange:_,children:[e.jsx(Be,{asChild:!0,children:e.jsxs(C,{variant:"destructive",children:[e.jsx(ee,{className:"mr-2 h-4 w-4"}),"Delete Collection"]})}),e.jsxs(Ae,{children:[e.jsxs(Re,{children:[e.jsx(Oe,{children:"Delete collection?"}),e.jsx(Me,{children:"This will permanently delete the collection and all its content."})]}),e.jsxs(qe,{children:[e.jsx(C,{variant:"outline",onClick:()=>_(!1),children:"Cancel"}),e.jsx(C,{variant:"destructive",onClick:be,children:"Delete"})]})]})]})})]})}export{ks as CollectionEditPage};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BlockEditor-6wqsThJ7.js","assets/tanstack-Bs3zYPPV.js","assets/react-vendor-C2CvUxFh.js","assets/index-Cir9tY_P.js","assets/radix-C1kb_NqW.js","assets/index-DACBYsKM.css","assets/command-fvBFHye4.js","assets/MediaField-J2TLG_fu.js","assets/useMedia-e3sqWm_t.js","assets/select-_uJYxzeZ.js","assets/card-hXVtlM0q.js","assets/media-url-DIg_vSyf.js","assets/CustomBlockPreview-C6HqS4xv.js","assets/RelationshipPicker-CDFs4TMW.js","assets/core.esm-B_kcYf6n.js","assets/sortable.esm-QyXA6fio.js","assets/popover-D5_HjjUC.js","assets/useContentSearch-DOjveB9t.js","assets/useDebouncedValue-C-cQUcLG.js","assets/useContent-e8beBIuq.js","assets/useAdminResolver-D-LlmquD.js","assets/usePageTitle-BNSba9_L.js","assets/serializeToText-DR_WnxiI.js","assets/format-C88SDH8g.js","assets/textarea-vSXNxwTe.js","assets/TagInput-BILCaC9b.js","assets/collapsible-B414SspL.js","assets/useTags-f7AVSLuj.js","assets/checkbox-WGrS3sUr.js","assets/contentStatus-BmaiYVOm.js","assets/BlockEditor-Cp_wZ2xN.css"])))=>i.map(i=>d[i]);
2
- import{j as e}from"./tanstack-Bs3zYPPV.js";import{r as c,u as Qs,f as Zs,m as et,L as st}from"./react-vendor-C2CvUxFh.js";import{f as tt,g as is,h as at,i as ls,j as nt,k as it,l as lt,m as rt,n as ct,o as ot,p as dt,q as ut,r as rs}from"./useContent-e8beBIuq.js";import{C as ye,v as S,E as ht,y as cs,F as mt,G as xt,J as pt,K as ft,S as F,M as os,N as ds,O as oe,Q as de,I as ue,B as f,P as gt,R as jt,T as us,V as bt,x as hs,_ as vt,L as X,e as yt,w as Nt,W as ms,X as Ge,Y as Ct,Z as Ye,$ as St,a0 as We,a1 as wt,j as kt,a as _,a2 as Xe,a3 as Qe,a4 as Dt,a5 as Ze,a6 as je,a7 as Pt,a8 as At,D as Ne,k as Ce,l as Se,m as we,n as ke,o as De,a9 as Tt,i as Lt}from"./index-Cir9tY_P.js";import{u as It}from"./useAdminResolver-D-LlmquD.js";import{u as Ft}from"./usePageTitle-BNSba9_L.js";import{s as Q,T as Rt,d as Ot}from"./serializeToText-DR_WnxiI.js";import{S as xs,a as ps,b as fs,c as gs,d as ce,e as Vt,f as Et,g as Bt}from"./select-_uJYxzeZ.js";import{f as U,a as be}from"./format-C88SDH8g.js";import{T as js}from"./textarea-vSXNxwTe.js";import{C as z,c as H,a as es,b as ss}from"./card-hXVtlM0q.js";import{T as $t,A as _t,a as Mt,b as Ut,c as zt,d as Ht,e as Jt,f as Kt,g as qt}from"./TagInput-BILCaC9b.js";import{C as bs,a as vs,b as ys}from"./collapsible-B414SspL.js";import{u as Gt}from"./useTags-f7AVSLuj.js";import{M as Yt,a as Wt}from"./MediaField-J2TLG_fu.js";import{m as Xt}from"./media-url-DIg_vSyf.js";import{C as Qt,R as Zt}from"./RelationshipPicker-CDFs4TMW.js";import{C as ea}from"./checkbox-WGrS3sUr.js";import{u as sa,a as ta,P as aa,D as na,c as ia,C as la}from"./core.esm-B_kcYf6n.js";import{S as ra,v as ca,a as oa,u as da}from"./sortable.esm-QyXA6fio.js";import{g as ua,a as ha,b as ma}from"./contentStatus-BmaiYVOm.js";const xa=3e3,pa="__HEADROOM_API_URL__".replace(/\/+$/,"");function fa(s,i,n,t){const l=tt(s,i),r=c.useRef(null),u=c.useRef(n?JSON.stringify(n):""),x=c.useRef(void 0),[g,o]=c.useState(null),[v,w]=c.useState(null),h=c.useRef(!1),p=c.useCallback(d=>{JSON.stringify(d)!==u.current&&(r.current=d,clearTimeout(x.current),x.current=window.setTimeout(()=>{if(r.current){const k=r.current,j=JSON.stringify(k);r.current=null,l.mutate(k,{onSuccess:b=>{if(h.current){h.current=!1;return}u.current=j,o(Date.now()),b?.blockId&&w(b.blockId)},onError:b=>{b instanceof ye&&b.code==="SLUG_TAKEN"?t?.():b instanceof ye&&b.status===400&&S.error("Auto-save failed",{description:b.message})}})}},xa))},[l,t]),m=c.useCallback(async d=>{if(clearTimeout(x.current),r.current){const y={...r.current};d?.createVersion&&(y.createVersion=!0);const k=JSON.stringify(r.current);r.current=null;const j=await l.mutateAsync(y);u.current=k,o(Date.now()),j?.blockId&&w(j.blockId)}else if(d?.createVersion&&u.current){const k={...JSON.parse(u.current),createVersion:!0},j=await l.mutateAsync(k);o(Date.now()),j?.blockId&&w(j.blockId)}},[l]),P=c.useCallback(()=>{clearTimeout(x.current),r.current=null},[]),D=c.useCallback(d=>{u.current=JSON.stringify(d)},[]),A=c.useCallback(()=>{clearTimeout(x.current),r.current=null,h.current=!0,w(null)},[]);return c.useEffect(()=>()=>{if(clearTimeout(x.current),r.current){const d=JSON.stringify(r.current),y=ht(),k=`${pa}/v1/admin/sites/${s}/content/${i}/draft`;fetch(k,{method:"PUT",body:d,headers:{"Content-Type":"application/json",...y?{Authorization:`Bearer ${y}`}:{}},keepalive:!0}).catch(()=>{}),r.current=null}},[s,i]),{schedule:p,flush:m,cancel:P,resetBaseline:D,discard:A,isSaving:l.isPending,lastSavedAt:g,lastSavedBlockId:v}}function ga({lines:s}){return e.jsx("div",{className:"font-mono text-sm leading-relaxed",children:s.map((i,n)=>e.jsx("div",{style:{paddingLeft:`${i.indent*1.5}rem`},className:cs("min-h-[1.5em]",i.type==="label"&&"text-muted-foreground font-semibold mt-1",i.type==="heading"&&"font-bold",i.type==="empty"&&"h-2"),children:i.text},n))})}function Pe(s){switch(s.kind){case"draft":return"Draft";case"published":return"Published";case"history":return U(s.createdAt)}}function he(s){switch(s.kind){case"draft":return"draft";case"published":return"published";case"history":return`history:${s.blockId}`}}function ts({value:s,onChange:i,isPublished:n,versions:t,exclude:l,size:r}){const u=l?he(l):null;function x(g){if(g==="draft")i({kind:"draft"});else if(g==="published")i({kind:"published"});else if(g.startsWith("history:")){const o=g.slice(8),v=t.find(w=>w.blockId===o);v&&i({kind:"history",blockId:v.blockId,createdAt:v.createdAt,title:v.title})}}return e.jsxs(xs,{value:he(s),onValueChange:x,children:[e.jsx(ps,{size:r,children:e.jsx(fs,{children:Pe(s)})}),e.jsxs(gs,{position:"popper",children:[u!=="draft"&&e.jsx(ce,{value:"draft",children:"Draft"}),n&&u!=="published"&&e.jsx(ce,{value:"published",children:"Published"}),t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Vt,{}),e.jsxs(Et,{children:[e.jsx(Bt,{children:"Version History"}),t.map(g=>{const o=`history:${g.blockId}`;return o===u?null:e.jsx(ce,{value:o,children:U(g.createdAt)},o)})]})]})]})]})}function as({ref:s,host:i,contentId:n,collectionFields:t,isSingleton:l,draftBody:r,draftMetadata:u,collectionRelationships:x,draftRelationships:g}){const o=s?.kind==="published",v=s?.kind==="history",w=v?s.blockId:null,{data:h,isLoading:p}=is(i,n,o),{data:m,isLoading:P}=at(i,n,v?w:null),D=c.useMemo(()=>(x??[]).map(y=>({name:y.name,label:y.label})),[x]);function A(y){if(D.length!==0)return{defs:D,values:y??{}}}const d=c.useMemo(()=>{if(!s)return[];if(s.kind==="draft")return r?Q(t,r,l?void 0:u,A(g)):[];if(s.kind==="published"){if(!h)return[];const j=l?void 0:{title:h.title,slug:h.slug,snippet:h.snippet,tags:h.tags},b=h.relationships;return Q(t,h.fields??{},j,A(b))}if(!m)return[];const y=l?void 0:{title:m.title,slug:m.slug,snippet:m.snippet,tags:m.tags},k=m.relationships;return Q(t,m.body??{},y,A(k))},[s,r,u,g,h,m,t,l,D]);return s?s.kind==="draft"?{lines:d,isLoading:!1,hasData:!!r}:s.kind==="published"?{lines:d,isLoading:p,hasData:!!h}:{lines:d,isLoading:P,hasData:!!m}:{lines:[],isLoading:!1,hasData:!1}}function ja({open:s,onOpenChange:i,host:n,contentId:t,collectionFields:l,isSingleton:r,isPublished:u,draftBody:x,draftMetadata:g,initialVersion:o,collectionRelationships:v,draftRelationships:w}){const[h,p]=c.useState(o??{kind:"published"}),[m,P]=c.useState({kind:"draft"}),[D,A]=c.useState(s),[d,y]=c.useState(o);if((s!==D||o!==d)&&(A(s),y(o),s)){const L=o??{kind:"published"};p(L),P(L.kind==="draft"?{kind:"published"}:{kind:"draft"})}he(h)===he(m)&&(h.kind!=="draft"?P({kind:"draft"}):u&&P({kind:"published"}));const{data:k}=ls(n,t),j=k?.items??[],b={host:n,contentId:t,collectionFields:l,isSingleton:r,draftBody:x,draftMetadata:g,collectionRelationships:v,draftRelationships:w},T=as({ref:s?h:null,...b}),N=as({ref:s?m:null,...b}),J=T.isLoading;return e.jsx(mt,{open:s,onOpenChange:i,children:e.jsxs(xt,{className:"w-[calc(100vw-2rem)] sm:max-w-2xl overflow-y-auto pt-[env(safe-area-inset-top,0px)] pr-[env(safe-area-inset-right,0px)]",children:[e.jsx(pt,{children:e.jsxs(ft,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground text-sm font-normal",children:"Viewing"}),e.jsx(ts,{value:h,onChange:p,isPublished:u,versions:j,size:"sm"})]})}),J&&e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(F,{className:"h-6 w-48"}),e.jsx(F,{className:"h-4 w-full"}),e.jsx(F,{className:"h-4 w-full"}),e.jsx(F,{className:"h-4 w-2/3"})]}),!J&&!T.hasData&&e.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"No data available for this version."}),!J&&T.hasData&&e.jsx("div",{className:"p-4",children:e.jsxs(os,{defaultValue:"changes",children:[e.jsxs(ds,{variant:"line",className:"mb-4",children:[e.jsx(oe,{value:"content",children:"Content"}),e.jsx(oe,{value:"changes",children:"Changes"})]}),e.jsx(de,{value:"content",children:e.jsx(ga,{lines:T.lines})}),e.jsxs(de,{value:"changes",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Compare with"}),e.jsx(ts,{value:m,onChange:P,isPublished:u,versions:j,exclude:h,size:"sm"})]}),N.isLoading?e.jsxs("div",{className:"space-y-4",children:[e.jsx(F,{className:"h-4 w-full"}),e.jsx(F,{className:"h-4 w-full"}),e.jsx(F,{className:"h-4 w-2/3"})]}):N.hasData?e.jsx(Rt,{left:N.lines,right:T.lines,leftLabel:Pe(m),rightLabel:Pe(h)}):e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No data available for comparison."})]})]})})]})})}function ve({field:s,value:i,onChange:n}){const t=s.options;return e.jsx(ue,{value:i??"",onChange:l=>n(l.target.value),placeholder:t?.placeholder,maxLength:t?.maxLength,required:!!t?.required,type:s.type==="url"?"url":s.type==="email"?"email":"text"})}function ba({field:s,value:i,onChange:n}){const t=s.options;return e.jsx(js,{value:i??"",onChange:l=>n(l.target.value),placeholder:t?.placeholder,maxLength:t?.maxLength,required:!!t?.required,rows:4})}function va({field:s,value:i,onChange:n}){const t=s.options;return e.jsx(ue,{type:"number",value:i??"",onChange:l=>n(l.target.value===""?void 0:Number(l.target.value)),min:t?.min,max:t?.max,step:t?.step,required:!!t?.required})}function ya({field:s,value:i,onChange:n}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ea,{id:`field-${s.name}`,checked:!!i,onCheckedChange:t=>n(!!t)}),e.jsx("label",{htmlFor:`field-${s.name}`,className:"text-sm text-muted-foreground",children:s.label})]})}function Na({field:s,value:i,onChange:n}){const l=s.options?.choices??[];return e.jsxs(xs,{value:i??"",onValueChange:r=>n(r),children:[e.jsx(ps,{children:e.jsx(fs,{placeholder:"Select..."})}),e.jsx(gs,{children:l.map(r=>e.jsx(ce,{value:r,children:r},r))})]})}function Ca({field:s,value:i,onChange:n}){const t=sa(ta(aa)),l=i??[],u=s.options?.itemFields??[],x=l.map((h,p)=>`item-${p}`);function g(){n([...l,{}])}function o(h){n(l.filter((p,m)=>m!==h))}function v(h,p){const m=[...l];m[h]=p,n(m)}function w(h){const{active:p,over:m}=h;if(m&&p.id!==m.id){const P=x.indexOf(String(p.id)),D=x.indexOf(String(m.id));n(oa(l,P,D))}}return e.jsx(na,{sensors:t,collisionDetection:ia,onDragEnd:w,children:e.jsx(ra,{items:x,strategy:ca,children:e.jsxs("div",{className:"space-y-3",children:[l.map((h,p)=>e.jsx(Sa,{id:`item-${p}`,itemFields:u,item:h,onUpdate:m=>v(p,m),onRemove:()=>o(p)},`item-${p}`)),e.jsxs(f,{type:"button",variant:"outline",size:"sm",onClick:g,children:[e.jsx(gt,{className:"mr-2 h-3 w-3"})," Add Item"]})]})})})}function Sa({id:s,itemFields:i,item:n,onUpdate:t,onRemove:l}){const{attributes:r,listeners:u,setNodeRef:x,transform:g,transition:o}=da({id:s}),v={transform:la.Transform.toString(g),transition:o};return e.jsx(z,{ref:x,style:v,children:e.jsxs(H,{className:"flex gap-2 p-3",children:[e.jsx("button",{type:"button",className:"cursor-grab touch-none text-muted-foreground hover:text-foreground",...r,...u,children:e.jsx(jt,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1",children:e.jsx(Ae,{fields:i,values:n,onChange:t})}),e.jsx(f,{type:"button",variant:"ghost",size:"sm",onClick:l,className:"text-destructive",children:e.jsx(us,{className:"h-3 w-3"})})]})})}const wa=c.lazy(()=>vt(()=>import("./BlockEditor-6wqsThJ7.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]))),ka=2,ns=c.createContext(0);function Da({value:s,onChange:i,compact:n=!0}){const t=c.useContext(ns),r=bt()?.blockTypes??[],u=hs();return t>=ka?e.jsx("div",{className:"rounded-md border border-muted p-4 text-sm text-muted-foreground",children:"Maximum nesting depth reached. Cannot embed another block editor here."}):e.jsx(ns.Provider,{value:t+1,children:e.jsx("div",{className:u?"":"rounded-md border",children:e.jsx(c.Suspense,{fallback:e.jsx(F,{className:"h-48"}),children:e.jsx(wa,{initialBlocks:s??[],onChange:i,blockTypes:r,compact:n})})})})}function Pa({field:s,value:i,onChange:n}){const l=s.options?.fields??[],r=i&&typeof i=="object"&&!Array.isArray(i)?i:{};return e.jsx(z,{children:e.jsx(H,{className:"p-3",children:e.jsx(Ae,{fields:l,values:r,onChange:u=>n(u)})})})}function Ae({fields:s,values:i,onChange:n}){function t(l,r){n({...i,[l]:r})}return e.jsx("div",{className:"space-y-4",children:s.map(l=>e.jsxs("div",{className:"space-y-2",children:[l.type!=="boolean"&&e.jsx(X,{children:l.label}),Aa(l,i[l.name],r=>t(l.name,r))]},l.name))})}function Aa(s,i,n){switch(s.type){case"text":case"url":case"email":return e.jsx(ve,{field:s,value:i,onChange:n});case"textarea":return e.jsx(ba,{field:s,value:i,onChange:n});case"number":return e.jsx(va,{field:s,value:i,onChange:n});case"boolean":return e.jsx(ya,{field:s,value:i,onChange:n});case"select":return e.jsx(Na,{field:s,value:i,onChange:n});case"media":return e.jsx(Yt,{field:s,value:i,onChange:n});case"content":return e.jsx(Qt,{field:s,value:i,onChange:n});case"blocks":return e.jsx(Da,{field:s,value:i,onChange:n});case"array":return e.jsx(Ca,{field:s,value:i,onChange:n});case"container":return e.jsx(Pa,{field:s,value:i,onChange:n});case"date":return e.jsx(ve,{field:{...s,type:"text"},value:i,onChange:n});default:return e.jsx(ve,{field:s,value:i,onChange:n})}}function Ta(){const{host:s,collection:i,id:n}=Qs(),{data:t,isLoading:l}=nt(s,n);return l?e.jsxs("div",{className:"space-y-4",children:[e.jsx(F,{className:"h-8 w-64"}),e.jsx(F,{className:"h-64 w-full"})]}):t?.content?e.jsx(La,{host:s,collection:i,contentId:n,content:t.content,draft:t.draft,publishedBlockId:t.publishedBlockId}):e.jsx("p",{className:"text-muted-foreground",children:"Content not found."})}function La({host:s,collection:i,contentId:n,content:t,draft:l,publishedBlockId:r}){const u=Zs(),x=yt(),{collections:g}=Nt(),o=it(s,n),v=lt(s,n),w=rt(s,n),h=ct(s,n),p=ot(s,n),m=dt(s,n),P=l?{title:l.title??t.title,slug:l.slug??t.slug??"",snippet:l.snippet??t.snippet??"",tags:l.tags??t.tags??[],cover:l.cover??t.cover??null,body:l.body??{},relationships:l.relationships??{}}:void 0,[D,A]=c.useState(null),d=fa(s,n,P,()=>{A("This slug is already in use by another item in this collection")}),{data:y}=Gt(s),k=y?.map(a=>a.tag),j=g.find(a=>a.name===i),b=c.useMemo(()=>j?.fields??[],[j?.fields]),T=c.useMemo(()=>j?.relationships??[],[j?.relationships]),N=j?.singleton??!1,J=hs(),[L,Te]=c.useState(l?.title??t.title),[E,Le]=c.useState(l?.slug??t.slug??""),[B,Ie]=c.useState(l?.snippet??t.snippet??""),Fe=l?.autoSnippet??"",[K,Re]=c.useState(l?.tags??t.tags??[]),[R,Oe]=c.useState(l?.cover??t.cover??null),[q,Ve]=c.useState(l?.body??{}),[G,Ee]=c.useState(l?.relationships??{}),[Ns,Cs]=c.useState(0),[Ss,ws]=c.useState(!1),[ks,Z]=c.useState(!1),[Ds,Y]=c.useState(!1),[Ps,ee]=c.useState(null),[me,se]=c.useState(!1),[As,te]=c.useState(!1),[Ts,ae]=c.useState(!1),[ne,Be]=c.useState(""),[Ls,xe]=c.useState(!1),[pe,$e]=c.useState(""),_e=ut(s,n),M=c.useCallback(()=>({title:L,slug:E,snippet:B,tags:K,cover:R,body:q,relationships:G}),[L,E,B,K,R,q,G]);function Is(a){Te(a),d.schedule({...M(),title:a})}function Fs(a){Le(a),A(null),d.schedule({...M(),slug:a})}function Rs(a){Ie(a),d.schedule({...M(),snippet:a})}function Os(a){Re(a),d.schedule({...M(),tags:a})}function Me(a){Oe(a),d.schedule({...M(),cover:a})}function Vs(a){Ve(a),d.schedule({...M(),body:a})}function Es(a){Ee(a),d.schedule({...M(),relationships:a})}const Bs=d.lastSavedBlockId??l?.blockId,O=ua(t.publishedAt,t.lastPublishedAt,r,Bs,t.scheduledAt,t.scheduledFailed),ie=ha(O),le=ma(O),{data:$}=is(s,n,!!t.publishedAt),V=c.useMemo(()=>{if(!me||!$)return null;const a=N?void 0:{title:$.title,slug:$.slug,snippet:$.snippet,tags:$.tags},C=T.map(I=>({name:I.name,label:I.label})),W=$.relationships,Je=C.length>0?{defs:C,values:W??{}}:void 0,qs=Q(b,$.fields??{},a,Je),Gs=N?void 0:{title:L,slug:E,snippet:B,tags:K},Ys=C.length>0?{defs:C,values:G}:void 0,Ws=Q(b,q,Gs,Ys),Xs=Ot(qs,Ws,{comparator:(I,ge)=>I.text===ge.text&&I.indent===ge.indent&&I.type===ge.type});let Ke=0,qe=0;for(const I of Xs)I.added?Ke+=I.count??0:I.removed&&(qe+=I.count??0);return{added:Ke,removed:qe}},[me,$,b,T,N,L,E,B,K,q,G]),[$s]=et(),_s=$s.get("from")==="recent"?`/sites/${s}/content`:`/sites/${s}/content/${i}`;Ft({title:N?j?.label??i:L||"Untitled",showBack:!N,backTo:N?void 0:_s,badge:{label:ie.label,variant:ie.variant}});function Ue(){if(t.publishedAt&&t.slug&&E!==t.slug){te(!0);return}O==="published-changes"?se(!0):re()}async function re(){try{d.cancel(),await d.flush({createVersion:!0}),await o.mutateAsync(void 0),d.discard(),S.success("Content published")}catch(a){if(a instanceof ye&&a.code==="SLUG_TAKEN"){A("This slug is already in use by another item in this collection"),S.error("Slug already in use",{description:"Please choose a different slug before publishing."});return}S.error("Failed to publish",{description:a instanceof Error?a.message:void 0})}}async function Ms(){try{await v.mutateAsync(),Y(!1),S.success("Content unpublished")}catch(a){S.error("Failed to unpublish",{description:a instanceof Error?a.message:void 0})}}async function Us(){try{d.discard();const a=await x.apiFetch(`/v1/admin/sites/${s}/content/${n}/published`);await _e.mutateAsync();const C={title:a.title??"",slug:a.slug??"",snippet:a.snippet??"",tags:a.tags??[],cover:a.cover??null,body:a.fields??{},relationships:a.relationships??{}};Te(C.title),Le(C.slug),Ie(C.snippet),Re(C.tags),Oe(C.cover),Ve(C.body),Ee(C.relationships),Cs(W=>W+1),d.resetBaseline(C),S.success("Changes discarded")}catch(a){S.error("Failed to discard changes",{description:a instanceof Error?a.message:void 0})}}async function zs(){try{await w.mutateAsync(),S.success("Content deleted"),u(`/sites/${s}/content/${i}`)}catch(a){S.error("Failed to delete",{description:a instanceof Error?a.message:void 0})}}async function Hs(){if(ne)try{d.cancel(),await d.flush({createVersion:!0});const a=new Date(ne).getTime();await p.mutateAsync(a),ae(!1),Be(""),S.success("Content scheduled for publishing")}catch(a){S.error("Failed to schedule",{description:a instanceof Error?a.message:void 0})}}async function Js(){try{await m.mutateAsync(),S.success("Schedule cancelled")}catch(a){S.error("Failed to cancel schedule",{description:a instanceof Error?a.message:void 0})}}async function Ks(){if(pe)try{const a=new Date(pe).getTime();await h.mutateAsync(a),xe(!1),S.success("Publish date updated")}catch(a){S.error("Failed to update publish date",{description:a instanceof Error?a.message:void 0})}}function fe(a){const C=new Date(a),W=C.getTimezoneOffset();return new Date(C.getTime()-W*6e4).toISOString().slice(0,16)}const ze=e.jsx("div",{className:"space-y-6",children:b.length>0?e.jsx(Ae,{fields:b,values:q,onChange:Vs},Ns):e.jsx(z,{children:e.jsx(H,{className:"py-8 text-center",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["No fields defined for this collection."," ",e.jsx(st,{to:`/sites/${s}/settings/collections/${i}`,className:"underline",children:"Configure fields"})]})})})}),He=e.jsxs("div",{className:"space-y-6",children:[!N&&e.jsx(z,{children:e.jsxs(H,{className:"space-y-4 pt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"title",children:"Title"}),e.jsx(ue,{id:"title",value:L,onChange:a=>Is(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"slug",children:"Slug"}),e.jsx(ue,{id:"slug",value:E,onChange:a=>Fs(a.target.value),className:D?"border-destructive":""}),D&&e.jsx("p",{className:"text-sm text-destructive",children:D})]}),e.jsxs(bs,{defaultOpen:!!B,children:[e.jsxs(vs,{className:"flex w-full items-center gap-2 text-sm font-medium",children:[e.jsx(ms,{className:"h-4 w-4 transition-transform [[data-state=open]>&]:rotate-90"}),"Snippet",e.jsx("span",{className:"text-xs text-muted-foreground",children:"(auto-generated if empty)"})]}),e.jsxs(ys,{className:"mt-2 space-y-2",children:[e.jsx(js,{id:"snippet",value:B,onChange:a=>Rs(a.target.value),rows:3,placeholder:"Brief summary of this content..."}),!B&&Fe&&e.jsxs("p",{className:"text-xs italic text-muted-foreground",children:["Auto-generated: ",Fe]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{children:"Cover Image"}),R?e.jsxs("div",{className:"flex items-center gap-3 rounded-md border p-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>Z(!0),children:[e.jsx("img",{src:Xt(R.url),alt:R.alt??R.filename??"",className:"h-10 w-10 rounded object-cover bg-muted"}),e.jsx("span",{className:"flex-1 truncate text-sm",children:R.filename??R.alt??R.id}),e.jsx(f,{type:"button",variant:"ghost",size:"sm",onClick:a=>{a.stopPropagation(),Me(null)},children:e.jsx(Ge,{className:"h-3 w-3"})})]}):e.jsxs(f,{type:"button",variant:"outline",className:"w-full",onClick:()=>Z(!0),children:[e.jsx(Ct,{className:"mr-2 h-4 w-4"}),"Select Image"]}),e.jsx(Wt,{open:ks,onClose:()=>Z(!1),onSelect:a=>{Me({id:a.mediaId,url:a.url,width:a.width??0,height:a.height??0,alt:a.alt,caption:a.caption,filename:a.filename}),Z(!1)},allowedTypes:["image/*"]})]})]})}),!N&&e.jsxs(z,{children:[e.jsx(es,{children:e.jsx(ss,{children:"Tags"})}),e.jsx(H,{children:e.jsx($t,{tags:K,onChange:Os,suggestions:k})})]}),T.length>0&&e.jsx(Zt,{relationships:T,values:G,onChange:Es,host:s}),e.jsxs(z,{children:[e.jsx(es,{children:e.jsx(ss,{children:"Info"})}),e.jsxs(H,{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Collection"}),e.jsx("span",{children:t.collection})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"ID"}),e.jsx("span",{className:"font-mono text-xs",children:t.contentId})]}),t.publishedAt?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-muted-foreground",children:"Published"}),Ls?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"datetime-local",value:pe,onChange:a=>$e(a.target.value),className:"text-xs border rounded px-1 py-0.5",max:fe(Date.now())}),e.jsx(f,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:Ks,disabled:h.isPending,children:e.jsx(Ye,{className:"h-3 w-3"})}),e.jsx(f,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>xe(!1),children:e.jsx(Ge,{className:"h-3 w-3"})})]}):e.jsxs("span",{className:"cursor-pointer hover:underline",title:U(t.publishedAt),onClick:()=>{$e(fe(t.publishedAt)),xe(!0)},children:[be(t.publishedAt),e.jsx(St,{className:"inline ml-1 h-3 w-3 text-muted-foreground"})]})]}),t.lastPublishedAt&&t.lastPublishedAt!==t.publishedAt&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Last published"}),e.jsx("span",{title:U(t.lastPublishedAt),children:be(t.lastPublishedAt)})]})]}):t.lastPublishedAt?e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Last published"}),e.jsx("span",{title:U(t.lastPublishedAt),children:be(t.lastPublishedAt)})]}):null,O==="scheduled"&&t.scheduledAt&&e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-muted-foreground",children:"Scheduled for"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(We,{className:"h-3 w-3"}),U(t.scheduledAt)]})]}),O==="schedule-failed"&&e.jsx("div",{className:"text-destructive text-xs",children:"Scheduled publishing failed after multiple attempts."}),t.publishedAt&&e.jsxs(f,{variant:"outline",size:"sm",className:"w-full mt-2",onClick:()=>{ee({kind:"published"}),Y(!0)},children:[e.jsx(wt,{className:"mr-2 h-4 w-4"}),"View published"]})]})]}),e.jsx(Ra,{host:s,contentId:n,onViewVersion:a=>{ee({kind:"history",blockId:a.blockId,createdAt:a.createdAt,title:a.title}),Y(!0)}}),!N&&e.jsx(Fa,{deleteOpen:Ss,setDeleteOpen:ws,onDelete:zs,host:s,contentId:n})]});return e.jsxs("div",{className:"mx-auto max-w-6xl",children:[!J&&e.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2 md:mb-6 md:flex-nowrap md:gap-3 md:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2 md:gap-3",children:[e.jsx("h1",{className:"truncate text-xl font-semibold md:text-2xl",children:N?j?.label??i:L||"Untitled"}),e.jsx(kt,{variant:ie.variant,children:ie.label}),d.isSaving&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(_,{className:"h-3 w-3 animate-spin"}),"Saving..."]}),!d.isSaving&&d.lastSavedAt&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Ye,{className:"h-3 w-3"}),"Saved"]})]}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[e.jsxs(f,{variant:"outline",onClick:()=>d.flush({createVersion:!0}),disabled:d.isSaving,children:[d.isSaving&&e.jsx(_,{className:"mr-2 h-4 w-4 animate-spin"}),"Save Draft"]}),O==="scheduled"&&e.jsxs(e.Fragment,{children:[e.jsxs(f,{variant:"outline",onClick:Js,disabled:m.isPending,children:[m.isPending&&e.jsx(_,{className:"mr-2 h-4 w-4 animate-spin"}),"Cancel Schedule"]}),e.jsxs(f,{onClick:()=>void re(),disabled:o.isPending,children:[o.isPending&&e.jsx(_,{className:"mr-2 h-4 w-4 animate-spin"}),"Publish Now"]})]}),O!=="scheduled"&&le&&e.jsxs("div",{className:"flex",children:[e.jsxs(f,{onClick:Ue,disabled:o.isPending,className:"rounded-r-none",children:[o.isPending&&e.jsx(_,{className:"mr-2 h-4 w-4 animate-spin"}),le]}),!t.publishedAt&&e.jsxs(Xe,{children:[e.jsx(Qe,{asChild:!0,children:e.jsx(f,{className:"rounded-l-none border-l px-2",disabled:o.isPending,children:e.jsx(Dt,{className:"h-4 w-4"})})}),e.jsx(Ze,{align:"end",children:e.jsxs(je,{onClick:()=>ae(!0),children:[e.jsx(We,{className:"mr-2 h-4 w-4"}),"Schedule for later"]})})]})]}),t.publishedAt&&e.jsxs(Xe,{children:[e.jsx(Qe,{asChild:!0,children:e.jsx(f,{variant:"outline",size:"icon",children:e.jsx(Pt,{className:"h-4 w-4"})})}),e.jsxs(Ze,{align:"end",children:[O==="published-changes"&&e.jsxs(je,{onClick:Us,disabled:_e.isPending,children:[e.jsx(At,{className:"mr-2 h-4 w-4"}),"Discard Changes"]}),e.jsx(je,{onClick:Ms,className:"text-destructive focus:text-destructive",children:"Unpublish"})]})]})]})]}),J?e.jsxs(os,{defaultValue:"content",children:[e.jsxs("div",{className:"mb-2 flex items-center",children:[e.jsxs(ds,{variant:"line",children:[e.jsx(oe,{value:"content",children:"Content"}),e.jsx(oe,{value:"info",children:"Info"})]}),e.jsxs("div",{className:"ml-auto flex gap-2",children:[e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>d.flush({createVersion:!0}),disabled:d.isSaving,children:[d.isSaving&&e.jsx(_,{className:"mr-1 h-3 w-3 animate-spin"}),"Save"]}),O!=="scheduled"&&le&&e.jsxs(f,{size:"sm",onClick:Ue,disabled:o.isPending,children:[o.isPending&&e.jsx(_,{className:"mr-1 h-3 w-3 animate-spin"}),le]})]})]}),e.jsx(de,{value:"content",className:"mt-0",children:ze}),e.jsx(de,{value:"info",className:"mt-0",children:He})]}):e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsx("div",{className:"lg:col-span-2",children:ze}),e.jsx("div",{children:He})]}),e.jsx(ja,{open:Ds,onOpenChange:a=>{Y(a),a||ee(null)},host:s,contentId:n,collectionFields:b,isSingleton:N,isPublished:!!t.publishedAt,draftBody:q,draftMetadata:N?void 0:{title:L,slug:E,snippet:B,tags:K},initialVersion:Ps,collectionRelationships:T,draftRelationships:G}),e.jsx(_t,{open:me,onOpenChange:se,children:e.jsxs(Mt,{children:[e.jsxs(Ut,{children:[e.jsx(zt,{children:"Publish changes?"}),e.jsx(Ht,{children:V?e.jsxs(e.Fragment,{children:[V.added>0&&e.jsxs("span",{className:"text-green-600",children:["+",V.added," added"]}),V.added>0&&V.removed>0&&", ",V.removed>0&&e.jsxs("span",{className:"text-red-600",children:["-",V.removed," removed"]}),V.added===0&&V.removed===0&&e.jsx("span",{children:"No visible changes detected."})]}):"This will update the published version with your current changes."})]}),e.jsx("div",{className:"mb-2",children:e.jsx(f,{variant:"link",className:"p-0 h-auto text-sm",onClick:()=>{se(!1),ee({kind:"draft"}),Y(!0)},children:"View full diff"})}),e.jsxs(Jt,{children:[e.jsx(Kt,{children:"Cancel"}),e.jsx(qt,{onClick:()=>{se(!1),re()},children:"Publish Update"})]})]})}),e.jsx(Ne,{open:As,onOpenChange:te,children:e.jsxs(Ce,{children:[e.jsxs(Se,{children:[e.jsx(we,{children:"Slug change detected"}),e.jsxs(ke,{children:["You are changing the slug from “",t.slug,"” to “",E,"”. This may break external bookmarks and SEO links."]})]}),e.jsx(Ia,{host:s,contentId:n}),e.jsxs(De,{children:[e.jsx(f,{variant:"outline",onClick:()=>te(!1),children:"Cancel"}),e.jsx(f,{onClick:()=>{te(!1),re()},children:"Publish Anyway"})]})]})}),e.jsx(Ne,{open:Ts,onOpenChange:ae,children:e.jsxs(Ce,{children:[e.jsxs(Se,{children:[e.jsx(we,{children:"Schedule publishing"}),e.jsx(ke,{children:"Choose a date and time to automatically publish this content. Times are rounded to the nearest 15-minute interval."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"schedule-date",children:"Publish at"}),e.jsx("input",{id:"schedule-date",type:"datetime-local",value:ne,onChange:a=>Be(a.target.value),min:fe(Date.now()+1200*1e3),className:"w-full rounded-md border px-3 py-2 text-sm",step:"900"})]}),e.jsxs(De,{children:[e.jsx(f,{variant:"outline",onClick:()=>ae(!1),children:"Cancel"}),e.jsxs(f,{onClick:Hs,disabled:!ne||p.isPending,children:[p.isPending&&e.jsx(_,{className:"mr-2 h-4 w-4 animate-spin"}),"Schedule"]})]})]})})]})}function Ia({host:s,contentId:i}){const{data:n}=rs(s,i,!0);return!n||n.count===0?null:e.jsxs("div",{className:"rounded-md border border-yellow-500/50 bg-yellow-50 p-3 text-sm dark:bg-yellow-950/30",children:[e.jsxs("p",{className:"font-medium text-yellow-800 dark:text-yellow-200",children:["This content is referenced by ",n.count," other"," ",n.count===1?"item":"items",":"]}),e.jsxs("ul",{className:"mt-1 list-disc pl-5 text-yellow-700 dark:text-yellow-300",children:[n.items.slice(0,5).map(t=>e.jsxs("li",{children:[t.title," (",t.collection,")"]},`${t.contentId}-${t.fieldName}`)),n.items.length>5&&e.jsxs("li",{children:["and ",n.items.length-5," more..."]})]})]})}function Fa({deleteOpen:s,setDeleteOpen:i,onDelete:n,host:t,contentId:l}){const{data:r}=rs(t,l,s);return e.jsxs(e.Fragment,{children:[e.jsx(Tt,{}),e.jsxs(Ne,{open:s,onOpenChange:i,children:[e.jsx(Lt,{asChild:!0,children:e.jsxs(f,{variant:"destructive",className:"w-full",children:[e.jsx(us,{className:"mr-2 h-4 w-4"}),"Delete"]})}),e.jsxs(Ce,{children:[e.jsxs(Se,{children:[e.jsx(we,{children:"Delete content?"}),e.jsx(ke,{children:"This action cannot be undone. The content will be permanently deleted."})]}),r&&r.count>0&&e.jsxs("div",{className:"rounded-md border border-yellow-500/50 bg-yellow-50 p-3 text-sm dark:bg-yellow-950/30",children:[e.jsxs("p",{className:"font-medium text-yellow-800 dark:text-yellow-200",children:["This content is referenced by ",r.count," other"," ",r.count===1?"item":"items",":"]}),e.jsxs("ul",{className:"mt-1 list-disc pl-5 text-yellow-700 dark:text-yellow-300",children:[r.items.slice(0,5).map(u=>e.jsxs("li",{children:[u.title," (",u.collection,")"]},`${u.contentId}-${u.fieldName}`)),r.items.length>5&&e.jsxs("li",{children:["and ",r.items.length-5," more..."]})]})]}),e.jsxs(De,{children:[e.jsx(f,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(f,{variant:"destructive",onClick:n,children:"Delete"})]})]})]})]})}function Ra({host:s,contentId:i,onViewVersion:n}){const{data:t}=ls(s,i),[l,r]=c.useState(!1),u=t?.items??[],x=u.map(o=>o.createdBy).filter(Boolean),{resolve:g}=It(x);return u.length===0?null:e.jsx(z,{children:e.jsx(H,{className:"pt-4",children:e.jsxs(bs,{open:l,onOpenChange:r,children:[e.jsxs(vs,{className:"flex w-full items-center gap-2 text-sm font-medium",children:[e.jsx(ms,{className:cs("h-4 w-4 transition",l&&"rotate-90")}),"Version History (",u.length,")"]}),e.jsx(ys,{className:"mt-2",children:e.jsx("div",{className:"space-y-1",children:u.map((o,v)=>e.jsxs("button",{className:"py-1 text-sm hover:bg-muted rounded px-1 -mx-1 transition-colors w-full text-left",onClick:()=>n(o),children:[e.jsx("span",{children:U(o.createdAt)}),o.createdBy&&e.jsx("span",{className:"ml-2 text-muted-foreground",children:g(o.createdBy)}),o.title&&e.jsx("span",{className:"ml-2 text-muted-foreground",children:o.title})]},`${o.createdAt}-${v}`))})})]})})})}const tn=Object.freeze(Object.defineProperty({__proto__:null,ContentEditPage:Ta},Symbol.toStringTag,{value:"Module"}));export{tn as C,Ae as F};
@@ -1 +0,0 @@
1
- import{j as s}from"./tanstack-Bs3zYPPV.js";import{u as Ce,f as Se,r as v}from"./react-vendor-C2CvUxFh.js";import{w as we,x as ke,B as F,P as re,v as b,z as ce,I as ie,X as V,A as ye,L as M,j as y,S as Te,a as _e,y as Ae}from"./index-Cir9tY_P.js";import{d as Ie,e as Pe,a as $e,b as Fe,c as Ve}from"./useContent-e8beBIuq.js";import{u as Be}from"./useTags-f7AVSLuj.js";import{u as De}from"./useDebouncedValue-C-cQUcLG.js";import{u as Le}from"./usePageTitle-BNSba9_L.js";import{u as Ue}from"./useFilterParams-DYdEuWPE.js";import{m as de}from"./media-url-DIg_vSyf.js";import{u as qe,F as Me}from"./FilterBar-DhRwTqFv.js";import{C as Re,c as ze}from"./card-hXVtlM0q.js";import{C as X}from"./checkbox-WGrS3sUr.js";import{P as Oe,a as Ee,b as He}from"./popover-D5_HjjUC.js";import{S as N,a as C,b as S,c as w,d}from"./select-_uJYxzeZ.js";import{T as Xe,a as Ze,b as oe,c as B,d as Ge,e as D}from"./table-DLoIbCQ5.js";import{a as R,f as ue}from"./format-C88SDH8g.js";import{g as he,a as xe}from"./contentStatus-BmaiYVOm.js";import{B as Qe}from"./BulkActionBar-TRiXXLQd.js";import"./radix-C1kb_NqW.js";import"./command-fvBFHye4.js";import"./useContentSearch-DOjveB9t.js";const z=3,me=[{value:"updated_desc",label:"Last updated"},{value:"updated_asc",label:"Oldest updated"},{value:"title_asc",label:"Title A–Z",requiresCollection:!0},{value:"title_desc",label:"Title Z–A",requiresCollection:!0},{value:"created_desc",label:"Newest created"},{value:"created_asc",label:"Oldest created"}],Z=[{value:"all",label:"All statuses"},{value:"draft",label:"Draft"},{value:"published",label:"Published"},{value:"changed",label:"Changed"},{value:"unpublished",label:"Unpublished"},{value:"scheduled",label:"Scheduled"}];function gs(){const{host:c,collection:t}=Ce(),T=Se(),{collections:je}=we(),[h,n]=Ue([{key:"q",defaultValue:""},{key:"search",defaultValue:"prefix"},{key:"tag",defaultValue:""},{key:"status",defaultValue:""},{key:"sort",defaultValue:"updated_desc"},{key:"relatedTo",defaultValue:""},{key:"relField",defaultValue:""}]),A=h.search,x=h.tag||void 0,m=h.status||void 0,_=h.sort,g=h.relatedTo,p=h.relField,[I,P]=v.useState(h.q),[fe,G]=v.useState(),[o,k]=v.useState(new Set),O=ke(),j=je.find(e=>e.name===t),L=j?.relationships??[],{data:Q}=qe(c,g||void 0),J=v.useMemo(()=>{if(!g||!p)return null;const e=L.find(r=>r.name===p);return{type:"relationship",relName:p,relLabel:e?.label??p,contentId:g,contentTitle:Q??"Loading..."}},[g,p,L,Q]);Le({title:j?.label??t??"",actions:j?.singleton?void 0:s.jsx(F,{size:"sm",onClick:()=>T(`/sites/${c}/content/${t}/new`),children:s.jsx(re,{className:"h-4 w-4"})})});const u=De(I,300);v.useEffect(()=>{u!==h.q&&n({q:u})},[u,h.q,n]);const a=v.useCallback(()=>G(void 0),[]),ge=v.useMemo(()=>{const e={};return u&&(e.q=u,e.search=A),x&&(e.tag=x),m&&(e.status=m),_!=="updated_desc"&&(e.sort=_),g&&(e.relatedTo=g),p&&(e.relField=p),e},[u,A,x,m,_,g,p]),{data:$,isLoading:pe}=Ie(c,t,ge,fe),E=Pe(c),K=$e(c),W=Fe(c),Y=Ve(c),{data:ee}=Be(c),U=v.useMemo(()=>ee?.map(e=>e.tag)??[],[ee]);if(j?.singleton&&$?.items.length===1)return T(`/sites/${c}/content/${t}/${$.items[0].contentId}`,{replace:!0}),null;const q=$?.items,H=q?.map(e=>e.contentId)??[],se=H.length>0&&H.every(e=>o.has(e));function le(e){k(r=>{const l=new Set(r);return l.has(e)?l.delete(e):l.add(e),l})}function ve(){k(se?new Set:new Set(H))}const ae=!!(u||x||m||g),te=!!u,ne=[A!=="prefix"?1:0,x?1:0,m?1:0,_!=="updated_desc"?1:0].reduce((e,r)=>e+r,0),be=K.isPending||W.isPending||Y.isPending;async function Ne(){try{const e=await E.mutateAsync({collection:t,title:j?.label??t});b.success("Singleton content recreated"),T(`/sites/${c}/content/${t}/${e.contentId}`)}catch(e){b.error("Failed to recreate singleton",{description:e instanceof Error?e.message:void 0})}}return s.jsxs("div",{children:[!O&&s.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[s.jsx("h1",{className:"text-2xl font-semibold",children:j?.label??t}),!j?.singleton&&s.jsxs(F,{onClick:()=>T(`/sites/${c}/content/${t}/new`),children:[s.jsx(re,{className:"mr-2 h-4 w-4"}),"New"]})]}),o.size>0?s.jsx(Qe,{selectedCount:o.size,onPublish:async()=>{const e=[...o],l=(await K.mutateAsync(e)).filter(i=>i.status==="rejected").length;l?b.error(`${l} of ${e.length} failed to publish`):b.success(`${e.length} item(s) published`),k(new Set)},onUnpublish:async()=>{const e=[...o],l=(await W.mutateAsync(e)).filter(i=>i.status==="rejected").length;l?b.error(`${l} of ${e.length} failed to unpublish`):b.success(`${e.length} item(s) unpublished`),k(new Set)},onDelete:async()=>{const e=[...o],l=(await Y.mutateAsync(e)).filter(i=>i.status==="rejected").length;l?b.error(`${l} of ${e.length} failed to delete`):b.success(`${e.length} item(s) deleted`),k(new Set)},onClear:()=>k(new Set),isPending:be}):O?s.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(ce,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),s.jsx(ie,{placeholder:"Search...",value:I,onChange:e=>{P(e.target.value),a()},className:"pl-8 pr-8"}),I&&s.jsx("button",{onClick:()=>{P(""),a()},className:"absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",children:s.jsx(V,{className:"h-4 w-4"})})]}),s.jsxs(Oe,{children:[s.jsx(Ee,{asChild:!0,children:s.jsxs(F,{variant:"outline",size:"icon",className:"relative shrink-0","aria-label":"Filters",children:[s.jsx(ye,{className:"h-4 w-4"}),ne>0&&s.jsx("span",{className:"absolute -right-1 -top-1 flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] text-primary-foreground",children:ne})]})}),s.jsxs(He,{className:"w-64 space-y-3",align:"end",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(M,{className:"text-xs font-medium",children:"Search Mode"}),s.jsxs(N,{value:A,onValueChange:e=>{n({search:e}),a()},children:[s.jsx(C,{children:s.jsx(S,{})}),s.jsxs(w,{children:[s.jsx(d,{value:"prefix",children:"Starts with"}),s.jsx(d,{value:"full",children:"Contains"})]})]})]}),U.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(M,{className:"text-xs font-medium",children:"Tag"}),s.jsxs(N,{value:x??"__all__",onValueChange:e=>{n({tag:e==="__all__"?"":e}),a()},children:[s.jsx(C,{children:s.jsx(S,{})}),s.jsxs(w,{children:[s.jsx(d,{value:"__all__",children:"All tags"}),U.map(e=>s.jsx(d,{value:e,children:e},e))]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(M,{className:"text-xs font-medium",children:"Status"}),s.jsxs(N,{value:m??"all",onValueChange:e=>{n({status:e==="all"?"":e}),a()},children:[s.jsx(C,{children:s.jsx(S,{})}),s.jsx(w,{children:Z.map(e=>s.jsx(d,{value:e.value??"all",children:e.label},e.value??"all"))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(M,{className:"text-xs font-medium",children:"Sort"}),s.jsxs(N,{value:_,onValueChange:e=>{n({sort:e}),a()},disabled:te,children:[s.jsx(C,{children:s.jsx(S,{})}),s.jsx(w,{children:me.map(e=>s.jsx(d,{value:e.value,disabled:e.requiresCollection&&!t,children:e.label},e.value))})]})]})]})]})]}):s.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"relative flex items-center",children:[s.jsx(ce,{className:"absolute left-2.5 h-4 w-4 text-muted-foreground"}),s.jsx(ie,{placeholder:"Search titles...",value:I,onChange:e=>{P(e.target.value),a()},className:"w-56 pl-8 pr-8"}),I&&s.jsx("button",{onClick:()=>{P(""),a()},className:"absolute right-2 text-muted-foreground hover:text-foreground",children:s.jsx(V,{className:"h-4 w-4"})})]}),s.jsxs(N,{value:A,onValueChange:e=>{n({search:e}),a()},children:[s.jsx(C,{className:"w-[130px]",children:s.jsx(S,{})}),s.jsxs(w,{children:[s.jsx(d,{value:"prefix",children:"Starts with"}),s.jsx(d,{value:"full",children:"Contains"})]})]}),U.length>0&&s.jsxs(N,{value:x??"__all__",onValueChange:e=>{n({tag:e==="__all__"?"":e}),a()},children:[s.jsx(C,{className:"w-[140px]",children:s.jsx(S,{placeholder:"Tag"})}),s.jsxs(w,{children:[s.jsx(d,{value:"__all__",children:"All tags"}),U.map(e=>s.jsx(d,{value:e,children:e},e))]})]}),s.jsxs(N,{value:m??"all",onValueChange:e=>{n({status:e==="all"?"":e}),a()},children:[s.jsx(C,{className:"w-[150px]",children:s.jsx(S,{})}),s.jsx(w,{children:Z.map(e=>s.jsx(d,{value:e.value??"all",children:e.label},e.value??"all"))})]}),s.jsx("div",{className:"ml-auto",children:s.jsxs(N,{value:_,onValueChange:e=>{n({sort:e}),a()},disabled:te,children:[s.jsx(C,{className:"w-[170px]",children:s.jsx(S,{})}),s.jsx(w,{children:me.map(e=>s.jsx(d,{value:e.value,disabled:e.requiresCollection&&!t,children:e.label},e.value))})]})})]}),L.length>0&&s.jsx("div",{className:"mb-3",children:s.jsx(Me,{relationships:L,activeFilters:J?[J]:[],onFilterAdd:e=>{n({relatedTo:e.contentId,relField:e.relName}),a()},onFilterRemove:()=>{n({relatedTo:"",relField:""}),a()}})}),ae&&o.size===0&&s.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-1.5",children:[u&&s.jsxs(y,{variant:"secondary",className:"gap-1",children:["Search: ",u,s.jsx("button",{onClick:()=>{P(""),a()},children:s.jsx(V,{className:"h-3 w-3"})})]}),x&&s.jsxs(y,{variant:"secondary",className:"gap-1",children:["Tag: ",x,s.jsx("button",{onClick:()=>{n({tag:""}),a()},children:s.jsx(V,{className:"h-3 w-3"})})]}),m&&s.jsxs(y,{variant:"secondary",className:"gap-1",children:["Status: ",Z.find(e=>e.value===m)?.label,s.jsx("button",{onClick:()=>{n({status:""}),a()},children:s.jsx(V,{className:"h-3 w-3"})})]})]}),pe?s.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((e,r)=>s.jsx(Te,{className:"h-12 w-full"},r))}):q?.length?s.jsxs(s.Fragment,{children:[O?s.jsx("div",{className:"grid gap-3 sm:grid-cols-2","data-testid":"content-card-view",children:q.map(e=>{const r=he(e.publishedAt,e.lastPublishedAt,e.publishedBlockId,e.lastDraftBlockId,e.scheduledAt,e.scheduledFailed),l=xe(r),i=e.tags??[];return s.jsx(Re,{className:Ae("cursor-pointer gap-0 overflow-hidden py-0 transition-shadow hover:shadow-md",o.has(e.contentId)&&"ring-2 ring-primary"),onClick:()=>T(`/sites/${c}/content/${t}/${e.contentId}`),children:s.jsxs(ze,{className:"p-3",children:[s.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[e.cover?.url&&s.jsx("img",{src:de(e.cover.url),alt:e.cover.alt??"",className:"h-12 w-12 rounded object-cover flex-shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"font-medium truncate",children:e.draftTitle||e.title||"Untitled"}),s.jsx(y,{variant:l.variant,className:"shrink-0",children:l.label})]}),(e.draftSlug||e.slug)&&s.jsxs("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:["/",e.draftSlug||e.slug]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e.lastDraftAt?R(e.lastDraftAt):"—"})]}),s.jsx(X,{checked:o.has(e.contentId),onCheckedChange:()=>le(e.contentId),onClick:f=>f.stopPropagation(),className:"mt-1"})]}),i.length>0&&s.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:i.slice(0,z).map(f=>s.jsx(y,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:f},f))})]})},e.contentId)})}):s.jsxs(Xe,{children:[s.jsx(Ze,{children:s.jsxs(oe,{children:[s.jsx(B,{className:"w-10",children:s.jsx(X,{checked:se,onCheckedChange:ve,"aria-label":"Select all"})}),s.jsx(B,{children:"Title"}),s.jsx(B,{children:"Slug"}),s.jsx(B,{children:"Status"}),s.jsx(B,{children:"Updated"})]})}),s.jsx(Ge,{children:q.map(e=>{const r=he(e.publishedAt,e.lastPublishedAt,e.publishedBlockId,e.lastDraftBlockId),l=xe(r),i=e.tags??[];return s.jsxs(oe,{className:"cursor-pointer",onClick:()=>T(`/sites/${c}/content/${t}/${e.contentId}`),children:[s.jsx(D,{onClick:f=>f.stopPropagation(),children:s.jsx(X,{checked:o.has(e.contentId),onCheckedChange:()=>le(e.contentId),"aria-label":`Select ${e.draftTitle||e.title||"Untitled"}`})}),s.jsx(D,{className:"font-medium",children:s.jsxs("div",{className:"flex items-center gap-3",children:[e.cover?.url&&s.jsx("img",{src:de(e.cover.url),alt:e.cover.alt??"",className:"h-8 w-8 rounded object-cover flex-shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{children:e.draftTitle||e.title||"Untitled"}),i.length>0&&s.jsxs("div",{className:"mt-0.5 flex flex-wrap gap-1",children:[i.slice(0,z).map(f=>s.jsx(y,{variant:"outline",className:"text-[10px] px-1.5 py-0 font-normal text-muted-foreground",children:f},f)),i.length>z&&s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",i.length-z," more"]})]})]})]})}),s.jsx(D,{className:"text-muted-foreground text-sm",children:e.draftSlug||e.slug||"—"}),s.jsx(D,{children:s.jsx(y,{variant:l.variant,children:l.label})}),s.jsx(D,{className:"text-muted-foreground",children:e.scheduledAt&&!e.publishedAt?s.jsxs("span",{title:ue(e.scheduledAt),children:["Scheduled ",R(e.scheduledAt)]}):e.publishedAt?s.jsx("span",{title:ue(e.publishedAt),children:R(e.publishedAt)}):e.lastDraftAt?R(e.lastDraftAt):"—"})]},e.contentId)})})]}),$?.hasMore&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(F,{variant:"outline",onClick:()=>G($.cursor??void 0),children:"Load More"})})]}):j?.singleton?s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-muted-foreground",children:"Singleton content is missing. Click below to recreate it."}),s.jsxs(F,{onClick:Ne,disabled:E.isPending,children:[E.isPending&&s.jsx(_e,{className:"mr-2 h-4 w-4 animate-spin"}),"Recreate ",j.label]})]}):s.jsx("p",{className:"text-muted-foreground",children:ae?"No content matches the current filters.":"No content yet."})]})}export{gs as ContentListPage};