headroom-cms 0.1.1

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 (237) hide show
  1. package/README.md +282 -0
  2. package/admin/assets/AdminsPage-CnrQqwKA.js +1 -0
  3. package/admin/assets/AllContentPage-ByN1h3PP.js +1 -0
  4. package/admin/assets/ApiKeysPage-FgNHZPBS.js +1 -0
  5. package/admin/assets/AuditPage-DAPpo-sj.js +1 -0
  6. package/admin/assets/BlockEditor-CZTwex-o.js +179 -0
  7. package/admin/assets/BlockEditor-Cp_wZ2xN.css +1 -0
  8. package/admin/assets/BlockTypeEditPage-Buuwbx1P.js +1 -0
  9. package/admin/assets/BlockTypesPage-Dj0qmsqX.js +1 -0
  10. package/admin/assets/BulkActionBar-BMcUBJSH.js +1 -0
  11. package/admin/assets/CollectionEditPage-CLgQu2HS.js +1 -0
  12. package/admin/assets/CollectionsPage-BnCaxALz.js +1 -0
  13. package/admin/assets/ContentCreatePage-CJI326o-.js +1 -0
  14. package/admin/assets/ContentEditPage-A4i8P2Jd.js +3 -0
  15. package/admin/assets/ContentListPage-Bc4mBIkB.js +1 -0
  16. package/admin/assets/CustomBlockPreview-CCssn6vF.js +479 -0
  17. package/admin/assets/FieldBuilder-YJGSk0nY.js +3 -0
  18. package/admin/assets/LoginPage-Jrne8-Wr.js +1 -0
  19. package/admin/assets/MediaPage-DfPQBmNf.css +1 -0
  20. package/admin/assets/MediaPage-_qNXqsZg.js +1 -0
  21. package/admin/assets/SiteSettingsPage-CoZnavij.js +1 -0
  22. package/admin/assets/SitesPage-ETqFT3nO.js +1 -0
  23. package/admin/assets/TagsPage-BGpp0XZM.js +1 -0
  24. package/admin/assets/UsersPage-CKRJpAb6.js +1 -0
  25. package/admin/assets/WebhookEditPage-BOcLe5OJ.js +1 -0
  26. package/admin/assets/WebhooksPage-Czco583Y.js +1 -0
  27. package/admin/assets/badge-0Z1nL6DI.js +1 -0
  28. package/admin/assets/card-D1-S-QZ6.js +1 -0
  29. package/admin/assets/check-BGA0ADyt.js +1 -0
  30. package/admin/assets/checkbox-BPqrj_XS.js +1 -0
  31. package/admin/assets/command-ChD319uJ.js +1 -0
  32. package/admin/assets/contentStatus-DfWHjFVB.js +1 -0
  33. package/admin/assets/copy-BqH9rXYM.js +1 -0
  34. package/admin/assets/core.esm-Csvubn5Q.js +5 -0
  35. package/admin/assets/format-CZ9bpk32.js +1 -0
  36. package/admin/assets/index-DOqKbrpW.css +1 -0
  37. package/admin/assets/index-Ds50UTAc.js +18 -0
  38. package/admin/assets/lib-BrI1UB_t.js +38 -0
  39. package/admin/assets/media-url-DIg_vSyf.js +1 -0
  40. package/admin/assets/module-RjUF93sV.js +716 -0
  41. package/admin/assets/native-48B9X9Wg.js +1 -0
  42. package/admin/assets/plus-BgHSYWJN.js +1 -0
  43. package/admin/assets/radix-DQ3amgxj.js +51 -0
  44. package/admin/assets/react-vendor-DNVhVxD7.js +4 -0
  45. package/admin/assets/search-DIzcfCVh.js +1 -0
  46. package/admin/assets/select-CJXZv4wv.js +1 -0
  47. package/admin/assets/sortable.esm-Zh-9QRSf.js +1 -0
  48. package/admin/assets/table-B3EHrN_H.js +1 -0
  49. package/admin/assets/tanstack-BO6c-AOu.js +1 -0
  50. package/admin/assets/trash-2-Gny2Upn-.js +1 -0
  51. package/admin/assets/useAdminResolver-BsQc_N4z.js +1 -0
  52. package/admin/assets/useContent-CSobIico.js +1 -0
  53. package/admin/assets/useDebouncedValue-Bf8UizjU.js +1 -0
  54. package/admin/assets/useMedia-CQnmMz4N.js +1 -0
  55. package/admin/assets/useTags-CYqbj5cK.js +1 -0
  56. package/admin/assets/useWebhooks-DXgtQ3aU.js +1 -0
  57. package/admin/index.html +21 -0
  58. package/admin/vite.svg +1 -0
  59. package/dist/admin-site.d.ts +30 -0
  60. package/dist/admin-site.d.ts.map +1 -0
  61. package/dist/admin-site.js +80 -0
  62. package/dist/admin-site.js.map +1 -0
  63. package/dist/api.d.ts +26 -0
  64. package/dist/api.d.ts.map +1 -0
  65. package/dist/api.js +91 -0
  66. package/dist/api.js.map +1 -0
  67. package/dist/auth.d.ts +27 -0
  68. package/dist/auth.d.ts.map +1 -0
  69. package/dist/auth.js +86 -0
  70. package/dist/auth.js.map +1 -0
  71. package/dist/cdn.d.ts +27 -0
  72. package/dist/cdn.d.ts.map +1 -0
  73. package/dist/cdn.js +382 -0
  74. package/dist/cdn.js.map +1 -0
  75. package/dist/image.d.ts +21 -0
  76. package/dist/image.d.ts.map +1 -0
  77. package/dist/image.js +48 -0
  78. package/dist/image.js.map +1 -0
  79. package/dist/index.d.ts +85 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +124 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/storage.d.ts +21 -0
  84. package/dist/storage.d.ts.map +1 -0
  85. package/dist/storage.js +125 -0
  86. package/dist/storage.js.map +1 -0
  87. package/dist/webhooks.d.ts +23 -0
  88. package/dist/webhooks.d.ts.map +1 -0
  89. package/dist/webhooks.js +91 -0
  90. package/dist/webhooks.js.map +1 -0
  91. package/lambda/api/bootstrap +0 -0
  92. package/lambda/api/resource.enc +0 -0
  93. package/lambda/functions/custom-message/index.mjs +112 -0
  94. package/lambda/functions/custom-message/resource.enc +1 -0
  95. package/lambda/image-lambda/index.mjs +188 -0
  96. package/lambda/image-lambda/node_modules/.package-lock.json +160 -0
  97. package/lambda/image-lambda/node_modules/@img/sharp-libvips-linux-arm64/README.md +46 -0
  98. package/lambda/image-lambda/node_modules/@img/sharp-libvips-linux-arm64/lib/glib-2.0/include/glibconfig.h +220 -0
  99. package/lambda/image-lambda/node_modules/@img/sharp-libvips-linux-arm64/lib/index.js +1 -0
  100. package/lambda/image-lambda/node_modules/@img/sharp-libvips-linux-arm64/lib/libvips-cpp.so.42 +0 -0
  101. package/lambda/image-lambda/node_modules/@img/sharp-libvips-linux-arm64/package.json +42 -0
  102. package/lambda/image-lambda/node_modules/@img/sharp-libvips-linux-arm64/versions.json +30 -0
  103. package/lambda/image-lambda/node_modules/@img/sharp-linux-arm64/LICENSE +191 -0
  104. package/lambda/image-lambda/node_modules/@img/sharp-linux-arm64/README.md +18 -0
  105. package/lambda/image-lambda/node_modules/@img/sharp-linux-arm64/lib/sharp-linux-arm64.node +0 -0
  106. package/lambda/image-lambda/node_modules/@img/sharp-linux-arm64/package.json +46 -0
  107. package/lambda/image-lambda/node_modules/color/LICENSE +21 -0
  108. package/lambda/image-lambda/node_modules/color/README.md +123 -0
  109. package/lambda/image-lambda/node_modules/color/index.js +496 -0
  110. package/lambda/image-lambda/node_modules/color/package.json +47 -0
  111. package/lambda/image-lambda/node_modules/color-convert/CHANGELOG.md +54 -0
  112. package/lambda/image-lambda/node_modules/color-convert/LICENSE +21 -0
  113. package/lambda/image-lambda/node_modules/color-convert/README.md +68 -0
  114. package/lambda/image-lambda/node_modules/color-convert/conversions.js +839 -0
  115. package/lambda/image-lambda/node_modules/color-convert/index.js +81 -0
  116. package/lambda/image-lambda/node_modules/color-convert/package.json +48 -0
  117. package/lambda/image-lambda/node_modules/color-convert/route.js +97 -0
  118. package/lambda/image-lambda/node_modules/color-name/LICENSE +8 -0
  119. package/lambda/image-lambda/node_modules/color-name/README.md +11 -0
  120. package/lambda/image-lambda/node_modules/color-name/index.js +152 -0
  121. package/lambda/image-lambda/node_modules/color-name/package.json +28 -0
  122. package/lambda/image-lambda/node_modules/color-string/LICENSE +21 -0
  123. package/lambda/image-lambda/node_modules/color-string/README.md +62 -0
  124. package/lambda/image-lambda/node_modules/color-string/index.js +242 -0
  125. package/lambda/image-lambda/node_modules/color-string/package.json +39 -0
  126. package/lambda/image-lambda/node_modules/detect-libc/LICENSE +201 -0
  127. package/lambda/image-lambda/node_modules/detect-libc/README.md +163 -0
  128. package/lambda/image-lambda/node_modules/detect-libc/index.d.ts +14 -0
  129. package/lambda/image-lambda/node_modules/detect-libc/lib/detect-libc.js +313 -0
  130. package/lambda/image-lambda/node_modules/detect-libc/lib/elf.js +39 -0
  131. package/lambda/image-lambda/node_modules/detect-libc/lib/filesystem.js +51 -0
  132. package/lambda/image-lambda/node_modules/detect-libc/lib/process.js +24 -0
  133. package/lambda/image-lambda/node_modules/detect-libc/package.json +44 -0
  134. package/lambda/image-lambda/node_modules/is-arrayish/LICENSE +21 -0
  135. package/lambda/image-lambda/node_modules/is-arrayish/README.md +16 -0
  136. package/lambda/image-lambda/node_modules/is-arrayish/index.js +9 -0
  137. package/lambda/image-lambda/node_modules/is-arrayish/package.json +45 -0
  138. package/lambda/image-lambda/node_modules/semver/LICENSE +15 -0
  139. package/lambda/image-lambda/node_modules/semver/README.md +665 -0
  140. package/lambda/image-lambda/node_modules/semver/bin/semver.js +191 -0
  141. package/lambda/image-lambda/node_modules/semver/classes/comparator.js +143 -0
  142. package/lambda/image-lambda/node_modules/semver/classes/index.js +7 -0
  143. package/lambda/image-lambda/node_modules/semver/classes/range.js +557 -0
  144. package/lambda/image-lambda/node_modules/semver/classes/semver.js +333 -0
  145. package/lambda/image-lambda/node_modules/semver/functions/clean.js +8 -0
  146. package/lambda/image-lambda/node_modules/semver/functions/cmp.js +54 -0
  147. package/lambda/image-lambda/node_modules/semver/functions/coerce.js +62 -0
  148. package/lambda/image-lambda/node_modules/semver/functions/compare-build.js +9 -0
  149. package/lambda/image-lambda/node_modules/semver/functions/compare-loose.js +5 -0
  150. package/lambda/image-lambda/node_modules/semver/functions/compare.js +7 -0
  151. package/lambda/image-lambda/node_modules/semver/functions/diff.js +60 -0
  152. package/lambda/image-lambda/node_modules/semver/functions/eq.js +5 -0
  153. package/lambda/image-lambda/node_modules/semver/functions/gt.js +5 -0
  154. package/lambda/image-lambda/node_modules/semver/functions/gte.js +5 -0
  155. package/lambda/image-lambda/node_modules/semver/functions/inc.js +21 -0
  156. package/lambda/image-lambda/node_modules/semver/functions/lt.js +5 -0
  157. package/lambda/image-lambda/node_modules/semver/functions/lte.js +5 -0
  158. package/lambda/image-lambda/node_modules/semver/functions/major.js +5 -0
  159. package/lambda/image-lambda/node_modules/semver/functions/minor.js +5 -0
  160. package/lambda/image-lambda/node_modules/semver/functions/neq.js +5 -0
  161. package/lambda/image-lambda/node_modules/semver/functions/parse.js +18 -0
  162. package/lambda/image-lambda/node_modules/semver/functions/patch.js +5 -0
  163. package/lambda/image-lambda/node_modules/semver/functions/prerelease.js +8 -0
  164. package/lambda/image-lambda/node_modules/semver/functions/rcompare.js +5 -0
  165. package/lambda/image-lambda/node_modules/semver/functions/rsort.js +5 -0
  166. package/lambda/image-lambda/node_modules/semver/functions/satisfies.js +12 -0
  167. package/lambda/image-lambda/node_modules/semver/functions/sort.js +5 -0
  168. package/lambda/image-lambda/node_modules/semver/functions/valid.js +8 -0
  169. package/lambda/image-lambda/node_modules/semver/index.js +91 -0
  170. package/lambda/image-lambda/node_modules/semver/internal/constants.js +37 -0
  171. package/lambda/image-lambda/node_modules/semver/internal/debug.js +11 -0
  172. package/lambda/image-lambda/node_modules/semver/internal/identifiers.js +29 -0
  173. package/lambda/image-lambda/node_modules/semver/internal/lrucache.js +42 -0
  174. package/lambda/image-lambda/node_modules/semver/internal/parse-options.js +17 -0
  175. package/lambda/image-lambda/node_modules/semver/internal/re.js +223 -0
  176. package/lambda/image-lambda/node_modules/semver/package.json +78 -0
  177. package/lambda/image-lambda/node_modules/semver/preload.js +4 -0
  178. package/lambda/image-lambda/node_modules/semver/range.bnf +16 -0
  179. package/lambda/image-lambda/node_modules/semver/ranges/gtr.js +6 -0
  180. package/lambda/image-lambda/node_modules/semver/ranges/intersects.js +9 -0
  181. package/lambda/image-lambda/node_modules/semver/ranges/ltr.js +6 -0
  182. package/lambda/image-lambda/node_modules/semver/ranges/max-satisfying.js +27 -0
  183. package/lambda/image-lambda/node_modules/semver/ranges/min-satisfying.js +26 -0
  184. package/lambda/image-lambda/node_modules/semver/ranges/min-version.js +63 -0
  185. package/lambda/image-lambda/node_modules/semver/ranges/outside.js +82 -0
  186. package/lambda/image-lambda/node_modules/semver/ranges/simplify.js +49 -0
  187. package/lambda/image-lambda/node_modules/semver/ranges/subset.js +249 -0
  188. package/lambda/image-lambda/node_modules/semver/ranges/to-comparators.js +10 -0
  189. package/lambda/image-lambda/node_modules/semver/ranges/valid.js +13 -0
  190. package/lambda/image-lambda/node_modules/sharp/LICENSE +191 -0
  191. package/lambda/image-lambda/node_modules/sharp/README.md +118 -0
  192. package/lambda/image-lambda/node_modules/sharp/install/check.js +41 -0
  193. package/lambda/image-lambda/node_modules/sharp/lib/channel.js +174 -0
  194. package/lambda/image-lambda/node_modules/sharp/lib/colour.js +180 -0
  195. package/lambda/image-lambda/node_modules/sharp/lib/composite.js +210 -0
  196. package/lambda/image-lambda/node_modules/sharp/lib/constructor.js +452 -0
  197. package/lambda/image-lambda/node_modules/sharp/lib/index.d.ts +1754 -0
  198. package/lambda/image-lambda/node_modules/sharp/lib/index.js +16 -0
  199. package/lambda/image-lambda/node_modules/sharp/lib/input.js +658 -0
  200. package/lambda/image-lambda/node_modules/sharp/lib/is.js +169 -0
  201. package/lambda/image-lambda/node_modules/sharp/lib/libvips.js +203 -0
  202. package/lambda/image-lambda/node_modules/sharp/lib/operation.js +958 -0
  203. package/lambda/image-lambda/node_modules/sharp/lib/output.js +1587 -0
  204. package/lambda/image-lambda/node_modules/sharp/lib/resize.js +587 -0
  205. package/lambda/image-lambda/node_modules/sharp/lib/sharp.js +114 -0
  206. package/lambda/image-lambda/node_modules/sharp/lib/utility.js +296 -0
  207. package/lambda/image-lambda/node_modules/sharp/package.json +222 -0
  208. package/lambda/image-lambda/node_modules/sharp/src/binding.gyp +280 -0
  209. package/lambda/image-lambda/node_modules/sharp/src/common.cc +1091 -0
  210. package/lambda/image-lambda/node_modules/sharp/src/common.h +393 -0
  211. package/lambda/image-lambda/node_modules/sharp/src/metadata.cc +320 -0
  212. package/lambda/image-lambda/node_modules/sharp/src/metadata.h +85 -0
  213. package/lambda/image-lambda/node_modules/sharp/src/operations.cc +475 -0
  214. package/lambda/image-lambda/node_modules/sharp/src/operations.h +125 -0
  215. package/lambda/image-lambda/node_modules/sharp/src/pipeline.cc +1758 -0
  216. package/lambda/image-lambda/node_modules/sharp/src/pipeline.h +393 -0
  217. package/lambda/image-lambda/node_modules/sharp/src/sharp.cc +40 -0
  218. package/lambda/image-lambda/node_modules/sharp/src/stats.cc +183 -0
  219. package/lambda/image-lambda/node_modules/sharp/src/stats.h +59 -0
  220. package/lambda/image-lambda/node_modules/sharp/src/utilities.cc +269 -0
  221. package/lambda/image-lambda/node_modules/sharp/src/utilities.h +19 -0
  222. package/lambda/image-lambda/node_modules/simple-swizzle/LICENSE +21 -0
  223. package/lambda/image-lambda/node_modules/simple-swizzle/README.md +43 -0
  224. package/lambda/image-lambda/node_modules/simple-swizzle/index.js +29 -0
  225. package/lambda/image-lambda/node_modules/simple-swizzle/package.json +36 -0
  226. package/lambda/webhook-worker/bootstrap +0 -0
  227. package/lambda/webhook-worker/resource.enc +0 -0
  228. package/package.json +50 -0
  229. package/src/admin-site.ts +108 -0
  230. package/src/api.ts +113 -0
  231. package/src/auth.ts +110 -0
  232. package/src/cdn.ts +449 -0
  233. package/src/image.ts +62 -0
  234. package/src/index.ts +216 -0
  235. package/src/sst-env.d.ts +143 -0
  236. package/src/storage.ts +138 -0
  237. package/src/webhooks.ts +114 -0
@@ -0,0 +1 @@
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}
@@ -0,0 +1 @@
1
+ import{j as e}from"./tanstack-BO6c-AOu.js";import{u as A,e as H,r as o}from"./react-vendor-DNVhVxD7.js";import{L as d,I as b,O as C,Z as R,S as k,$ as U,a0 as V,a1 as Z,B as h,a as _,D as z,h as G,i as J,j as K,k as M,l as Q,m as W,s as j}from"./index-Ds50UTAc.js";import{I as X,F as Y}from"./FieldBuilder-YJGSk0nY.js";import{i as ee}from"./format-CZ9bpk32.js";import{T as ae,C as se,b as te,c as le}from"./sortable.esm-Zh-9QRSf.js";import{C as ie,a as ne,b as re,c as oe}from"./card-D1-S-QZ6.js";import{C as ce}from"./CustomBlockPreview-CCssn6vF.js";import{u as T}from"./useDebouncedValue-Bf8UizjU.js";import{b as de}from"./core.esm-Csvubn5Q.js";import{T as me}from"./trash-2-Gny2Upn-.js";import"./radix-DQ3amgxj.js";import"./select-CJXZv4wv.js";import"./check-BGA0ADyt.js";import"./checkbox-BPqrj_XS.js";import"./plus-BgHSYWJN.js";function pe({fields:s,previewTemplate:t,previewData:a,onPreviewDataChange:n,blockTypeName:c,blockTypeLabel:m,blockTypeIcon:f}){const r=T(t,300),y=T(a,300);return e.jsxs("div",{className:"space-y-4",children:[s.map(i=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs",children:i.label}),e.jsx(b,{value:String(a[i.name]??""),onChange:v=>n({...a,[i.name]:v.target.value}),placeholder:`Sample ${i.label}...`})]},i.name)),e.jsx(C,{}),e.jsx("div",{className:"rounded-md border p-4",children:e.jsx(ce,{blockType:{name:c,label:m,icon:f,fields:s,previewTemplate:r},props:y})})]})}function Se(){const{host:s,name:t}=A(),a=t==="new",{data:n,isLoading:c}=R(s,a?"":t);return!a&&c?e.jsxs("div",{className:"space-y-4",children:[e.jsx(k,{className:"h-8 w-64"}),e.jsx(k,{className:"h-64 w-full"})]}):a?e.jsx(B,{host:s,isNew:!0}):n?e.jsx(B,{host:s,isNew:!1,blockType:n},n.name):e.jsx("p",{className:"text-muted-foreground",children:"Block type not found."})}function B({host:s,isNew:t,blockType:a}){const n=H(),c=U(s),m=V(s,a?.name??""),f=Z(s,a?.name??""),[r,y]=o.useState(a?.name??""),[i,v]=o.useState(a?.label??""),[g,D]=o.useState(a?.icon??""),[S,F]=o.useState(!t),P=new Set((a?.fields??[]).map(l=>l.name).filter(Boolean)),[p,L]=o.useState(a?.fields??[]),[u,E]=o.useState(a?.previewTemplate??""),[x,I]=o.useState(a?.previewData??{}),[O,w]=o.useState(!1);async function $(l){l.preventDefault();try{t?(await c.mutateAsync({name:r,label:i,icon:g,fields:p,previewTemplate:u||void 0,previewData:Object.keys(x).length>0?x:void 0}),j.success("Block type created"),n(`/sites/${s}/settings/block-types/${r}`)):(await m.mutateAsync({label:i,icon:g,fields:p,previewTemplate:u||void 0,previewData:Object.keys(x).length>0?x:void 0}),j.success("Block type updated"))}catch(N){j.error(t?"Failed to create":"Failed to update",{description:N instanceof Error?N.message:void 0})}}async function q(){try{await f.mutateAsync(),j.success("Block type deleted"),n(`/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??r}`}),e.jsxs(ie,{children:[e.jsx(ne,{children:e.jsx(re,{children:"Block Type Settings"})}),e.jsx(oe,{children:e.jsxs("form",{onSubmit:$,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"name",children:"Name"}),e.jsx(X,{id:"name",value:r,onChange:y,onBlur:()=>{r&&!S&&v(ee(r))},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(b,{id:"label",value:i,onChange:l=>{v(l.target.value),F(!0)},required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"icon",children:"Icon"}),e.jsx(b,{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(Y,{fields:p,onChange:L,existingFieldNames:P})]}),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(ae,{id:"preview-template",value:u,onChange:l=>E(l.target.value),rows:6,placeholder:'<div class="p-4">{{ title }}</div>',className:"font-mono text-sm"})]}),(u||p.length>0)&&e.jsxs(se,{children:[e.jsxs(te,{className:"flex w-full items-center gap-2 text-sm font-medium",children:[e.jsx(de,{className:"h-4 w-4 transition-transform [[data-state=open]>&]:rotate-90"}),"Preview"]}),e.jsx(le,{className:"mt-2",children:e.jsx(pe,{fields:p,previewTemplate:u,previewData:x,onPreviewDataChange:I,blockTypeName:r,blockTypeLabel:i,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(_,{className:"mr-2 h-4 w-4 animate-spin"}),t?"Create":"Save"]}),e.jsx(h,{type:"button",variant:"outline",onClick:()=>n(`/sites/${s}/settings/block-types`),children:"Cancel"})]})]})})]}),!t&&e.jsx("div",{className:"mt-6",children:e.jsxs(z,{open:O,onOpenChange:w,children:[e.jsx(G,{asChild:!0,children:e.jsxs(h,{variant:"destructive",children:[e.jsx(me,{className:"mr-2 h-4 w-4"}),"Delete Block Type"]})}),e.jsxs(J,{children:[e.jsxs(K,{children:[e.jsx(M,{children:"Delete block type?"}),e.jsx(Q,{children:"This will permanently delete this block type."})]}),e.jsxs(W,{children:[e.jsx(h,{variant:"outline",onClick:()=>w(!1),children:"Cancel"}),e.jsx(h,{variant:"destructive",onClick:q,children:"Delete"})]})]})]})})]})}export{Se as BlockTypeEditPage};
@@ -0,0 +1 @@
1
+ import{j as e}from"./tanstack-BO6c-AOu.js";import{u as m,e as d}from"./react-vendor-DNVhVxD7.js";import{Y as x,B as h,S as j}from"./index-Ds50UTAc.js";import{T as p,a as f,b as c,c as a,d as u,e as l}from"./table-B3EHrN_H.js";import{P as N}from"./plus-BgHSYWJN.js";import"./radix-DQ3amgxj.js";function w(){const{host:n}=m(),i=d(),{data:r,isLoading:o}=x(n);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Block Types"}),e.jsxs(h,{onClick:()=>i(`/sites/${n}/settings/block-types/new`),children:[e.jsx(N,{className:"mr-2 h-4 w-4"}),"New Block Type"]})]}),o?e.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((s,t)=>e.jsx(j,{className:"h-12 w-full"},t))}):r?.items.length?e.jsxs(p,{children:[e.jsx(f,{children:e.jsxs(c,{children:[e.jsx(a,{children:"Name"}),e.jsx(a,{children:"Label"}),e.jsx(a,{children:"Icon"}),e.jsx(a,{children:"Fields"})]})}),e.jsx(u,{children:r.items.map(s=>e.jsxs(c,{className:"cursor-pointer",onClick:()=>i(`/sites/${n}/settings/block-types/${s.name}`),children:[e.jsx(l,{className:"font-mono text-sm",children:s.name}),e.jsx(l,{children:s.label}),e.jsx(l,{children:s.icon}),e.jsx(l,{className:"text-muted-foreground",children:s.fields?.length??0})]},s.name))})]}):e.jsx("p",{className:"text-muted-foreground",children:"No block types defined."})]})}export{w as BlockTypesPage};
@@ -0,0 +1 @@
1
+ import{j as e}from"./tanstack-BO6c-AOu.js";import{r as m}from"./react-vendor-DNVhVxD7.js";import{B as a,a as t,X as x,D as h,i as j,j as p,k as u,l as D,m as b}from"./index-Ds50UTAc.js";function k({selectedCount:i,onPublish:n,onUnpublish:r,onDelete:c,onClear:o,isPending:s}){const[d,l]=m.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-md border bg-muted/50 px-4 py-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:[i," selected"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{size:"sm",variant:"outline",onClick:n,disabled:s,children:[s&&e.jsx(t,{className:"mr-1 h-3 w-3 animate-spin"}),"Publish"]}),e.jsx(a,{size:"sm",variant:"outline",onClick:r,disabled:s,children:"Unpublish"}),e.jsx(a,{size:"sm",variant:"destructive",onClick:()=>l(!0),disabled:s,children:"Delete"})]}),e.jsx(a,{size:"sm",variant:"ghost",onClick:o,className:"ml-auto",disabled:s,children:e.jsx(x,{className:"h-4 w-4"})})]}),e.jsx(h,{open:d,onOpenChange:l,children:e.jsxs(j,{children:[e.jsxs(p,{children:[e.jsxs(u,{children:["Delete ",i," item",i!==1?"s":"","?"]}),e.jsx(D,{children:"This action cannot be undone. The selected content items will be permanently deleted."})]}),e.jsxs(b,{children:[e.jsx(a,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsxs(a,{variant:"destructive",onClick:async()=>{l(!1),await c()},disabled:s,children:[s&&e.jsx(t,{className:"mr-1 h-3 w-3 animate-spin"}),"Delete"]})]})]})})]})}export{k as B};
@@ -0,0 +1 @@
1
+ import{j as e}from"./tanstack-BO6c-AOu.js";import{r as c,u as X,e as Y}from"./react-vendor-DNVhVxD7.js";import{n as Z,x as ee,B as C,I as E,Q as se,S as B,t as te,R as ae,V as le,W as ne,L as f,O as T,a as ie,D as re,h as oe,i as ce,j as de,k as me,l as ue,m as xe,s as D}from"./index-Ds50UTAc.js";import{I as P,F as he}from"./FieldBuilder-YJGSk0nY.js";import{i as $,c as ge}from"./format-CZ9bpk32.js";import{C as A}from"./checkbox-BPqrj_XS.js";import{C as je,a as pe,b as fe,c as Ce}from"./card-D1-S-QZ6.js";import{C as be,G as ve,b as Se,u as Ne,a as ye,P as De,D as Ee,c as ke}from"./core.esm-Csvubn5Q.js";import{u as Fe,C as we,b as Le,c as Re,S as Ie,v as Be,a as Te}from"./sortable.esm-Zh-9QRSf.js";import{S as Oe,a as Pe,b as $e,c as Ae,d as _e}from"./select-CJXZv4wv.js";import{T as _}from"./trash-2-Gny2Upn-.js";import{P as qe}from"./plus-BgHSYWJN.js";import"./radix-DQ3amgxj.js";import"./check-BGA0ADyt.js";const Ve=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ze=Z("arrow-right",Ve);function Ge({id:t,relationship:s,onChange:a,onRemove:d,collections:x,readOnlyName:u,defaultExpanded:g}){const[b,m]=c.useState(g??!1),[N,j]=c.useState(!!s.label),{attributes:v,listeners:r,setNodeRef:n,transform:o,transition:S}=Fe({id:t}),h={transform:be.Transform.toString(o),transition:S};function p(i){a({...s,...i})}const k=x.find(i=>i.name===s.targetCollection)?.label??s.targetCollection;return e.jsx("div",{ref:n,style:h,className:"rounded-md border bg-card",children:e.jsxs(we,{open:b,onOpenChange:m,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,...r,children:e.jsx(ve,{className:"h-4 w-4"})}),e.jsx(Le,{asChild:!0,children:e.jsx("button",{type:"button",className:"flex items-center",children:e.jsx(Se,{className:ee("h-4 w-4 transition-transform",b&&"rotate-90")})})}),e.jsx("span",{className:"min-w-[80px] text-sm font-mono",children:s.name||"unnamed"}),e.jsx(ze,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:k}),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:d,className:"text-destructive",children:e.jsx(_,{className:"h-3 w-3"})})]}),e.jsx(Re,{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(P,{value:s.name,onChange:i=>p({name:i}),onBlur:()=>{s.name&&!N&&p({label:$(s.name)})},readOnly:u,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:i=>{p({label:i.target.value}),j(!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(Oe,{value:s.targetCollection,onValueChange:i=>p({targetCollection:i}),children:[e.jsx(Pe,{className:"h-8 text-sm",children:e.jsx($e,{placeholder:"Select collection..."})}),e.jsx(Ae,{children:x.map(i=>e.jsx(_e,{value:i.name,children:i.label},i.name))})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{id:`${t}-multiple`,checked:s.multiple,onCheckedChange:i=>p({multiple:!!i})}),e.jsx("label",{htmlFor:`${t}-multiple`,className:"text-sm",children:"Allow multiple"})]})]})})]})})}function He({relationships:t,onChange:s,collections:a,existingRelNames:d}){const x=Ne(ye(De)),u=t.map((r,n)=>`rel-${n}`),[g,b]=c.useState(null);function m(){b(t.length),s([...t,{name:"",label:"",targetCollection:"",multiple:!1}])}function N(r,n){const o=[...t];o[r]=n,s(o)}function j(r){s(t.filter((n,o)=>o!==r))}function v(r){const{active:n,over:o}=r;if(o&&n.id!==o.id){const S=u.indexOf(String(n.id)),h=u.indexOf(String(o.id));s(Te(t,S,h))}}return e.jsx(Ee,{sensors:x,collisionDetection:ke,onDragEnd:v,children:e.jsx(Ie,{items:u,strategy:Be,children:e.jsxs("div",{className:"space-y-2",children:[t.map((r,n)=>e.jsx(Ge,{id:`rel-${n}`,relationship:r,onChange:o=>N(n,o),onRemove:()=>j(n),collections:a,readOnlyName:!!(d?.has(r.name)&&r.name),defaultExpanded:n===g},`rel-${n}`)),e.jsxs(C,{type:"button",variant:"outline",size:"sm",onClick:m,children:[e.jsx(qe,{className:"mr-2 h-3 w-3"})," Add Relationship"]})]})})})}function ns(){const{host:t,name:s}=X(),a=s==="new",{data:d,isLoading:x}=se(t,a?"":s);return!a&&x?e.jsxs("div",{className:"space-y-4",children:[e.jsx(B,{className:"h-8 w-64"}),e.jsx(B,{className:"h-64 w-full"})]}):a?e.jsx(O,{host:t,isNew:!0}):d?e.jsx(O,{host:t,isNew:!1,collection:d},d.name):e.jsx("p",{className:"text-muted-foreground",children:"Collection not found."})}function O({host:t,isNew:s,collection:a}){const d=Y(),{collections:x}=te(),u=ae(t),g=le(t,a?.name??""),b=ne(t,a?.name??""),[m,N]=c.useState(a?.name??""),[j,v]=c.useState(a?.label??""),[r,n]=c.useState(a?.labelSingular??""),[o,S]=c.useState(a?.slug??""),[h,p]=c.useState(a?.singleton??!1),[k,i]=c.useState(!s),[q,V]=c.useState(!s),[z,G]=c.useState(!s),H=new Set((a?.fields??[]).map(l=>l.name).filter(Boolean)),L=[{name:"blocks",label:"Blocks",type:"blocks",options:{}}],[F,R]=c.useState(a?.fields??(s&&!h?L:[])),[w,M]=c.useState(a?.relationships??[]),Q=new Set((a?.relationships??[]).map(l=>l.name).filter(Boolean)),[U,I]=c.useState(!1);function W(){if(!m)return;const l=$(m);k||v(l),q||n(ge(l)),z||S(m.replace(/_/g,"-"))}async function J(l){l.preventDefault();try{s?(await u.mutateAsync({name:m,label:j,labelSingular:r,slug:o,singleton:h,fields:F,relationships:w}),D.success("Collection created"),d(`/sites/${t}/settings/collections/${m}`)):(await g.mutateAsync({label:j,labelSingular:r,slug:o,singleton:h,fields:F,relationships:w}),D.success("Collection updated"))}catch(y){D.error(s?"Failed to create":"Failed to update",{description:y instanceof Error?y.message:void 0})}}async function K(){try{await b.mutateAsync(),D.success("Collection deleted"),d(`/sites/${t}/settings/collections`)}catch(l){D.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:s?"New Collection":`Edit: ${a?.label??m}`}),e.jsxs(je,{children:[e.jsx(pe,{children:e.jsx(fe,{children:"Collection Settings"})}),e.jsx(Ce,{children:e.jsxs("form",{onSubmit:J,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"name",children:"Name"}),e.jsx(P,{id:"name",value:m,onChange:N,onBlur:W,readOnly:!s,placeholder:"e.g. blog_posts",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"label",children:"Label"}),e.jsx(E,{id:"label",value:j,onChange:l=>{v(l.target.value),i(!0)},required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"label-singular",children:"Label Singular"}),e.jsx(E,{id:"label-singular",value:r,onChange:l=>{n(l.target.value),V(!0)},required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"slug",children:"Slug"}),e.jsx(E,{id:"slug",value:o,onChange:l=>{S(l.target.value),G(!0)},required:!0})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{id:"singleton",checked:h,onCheckedChange:l=>{const y=!!l;p(y),s&&R(y?[]:L)},disabled:!s}),e.jsx(f,{htmlFor:"singleton",children:"Singleton (single entry, no list)"})]}),e.jsx(T,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{children:"Fields"}),e.jsx(he,{fields:F,onChange:R,existingFieldNames:H})]}),e.jsx(T,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{children:"Relationships"}),e.jsx(He,{relationships:w,onChange:M,collections:x,existingRelNames:Q})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{type:"submit",disabled:u.isPending||g.isPending,children:[(u.isPending||g.isPending)&&e.jsx(ie,{className:"mr-2 h-4 w-4 animate-spin"}),s?"Create":"Save"]}),e.jsx(C,{type:"button",variant:"outline",onClick:()=>d(`/sites/${t}/settings/collections`),children:"Cancel"})]})]})})]}),!s&&e.jsx("div",{className:"mt-6",children:e.jsxs(re,{open:U,onOpenChange:I,children:[e.jsx(oe,{asChild:!0,children:e.jsxs(C,{variant:"destructive",children:[e.jsx(_,{className:"mr-2 h-4 w-4"}),"Delete Collection"]})}),e.jsxs(ce,{children:[e.jsxs(de,{children:[e.jsx(me,{children:"Delete collection?"}),e.jsx(ue,{children:"This will permanently delete the collection and all its content."})]}),e.jsxs(xe,{children:[e.jsx(C,{variant:"outline",onClick:()=>I(!1),children:"Cancel"}),e.jsx(C,{variant:"destructive",onClick:K,children:"Delete"})]})]})]})})]})}export{ns as CollectionEditPage};
@@ -0,0 +1 @@
1
+ import{j as e}from"./tanstack-BO6c-AOu.js";import{u as m,e as x}from"./react-vendor-DNVhVxD7.js";import{P as h,B as j,S as f}from"./index-Ds50UTAc.js";import{B as o}from"./badge-0Z1nL6DI.js";import{T as u,a as p,b as r,c as l,d as g,e as n}from"./table-B3EHrN_H.js";import{P as N}from"./plus-BgHSYWJN.js";import"./radix-DQ3amgxj.js";function P(){const{host:a}=m(),i=x(),{data:t,isLoading:c}=h(a);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Collections"}),e.jsxs(j,{onClick:()=>i(`/sites/${a}/settings/collections/new`),children:[e.jsx(N,{className:"mr-2 h-4 w-4"}),"New Collection"]})]}),c?e.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((s,d)=>e.jsx(f,{className:"h-12 w-full"},d))}):t?.items.length?e.jsxs(u,{children:[e.jsx(p,{children:e.jsxs(r,{children:[e.jsx(l,{children:"Name"}),e.jsx(l,{children:"Label"}),e.jsx(l,{children:"Type"}),e.jsx(l,{children:"Fields"})]})}),e.jsx(g,{children:t.items.map(s=>e.jsxs(r,{className:"cursor-pointer",onClick:()=>i(`/sites/${a}/settings/collections/${s.name}`),children:[e.jsx(n,{className:"font-mono text-sm",children:s.name}),e.jsx(n,{children:s.label}),e.jsx(n,{children:s.singleton?e.jsx(o,{variant:"secondary",children:"Singleton"}):e.jsx(o,{variant:"outline",children:"Collection"})}),e.jsx(n,{className:"text-muted-foreground",children:s.fields?.length??0})]},s.name))})]}):e.jsx("p",{className:"text-muted-foreground",children:"No collections defined."})]})}export{P as CollectionsPage};
@@ -0,0 +1 @@
1
+ import{j as e}from"./tanstack-BO6c-AOu.js";import{u as y,e as $,r as i,N as E}from"./react-vendor-DNVhVxD7.js";import{t as w,L as g,I as h,B as f,a as I,s as p,v as F}from"./index-Ds50UTAc.js";import{e as P}from"./useContent-CSobIico.js";import{C as T,a as A,b as L,c as B}from"./card-D1-S-QZ6.js";import{s as D}from"./format-CZ9bpk32.js";import"./radix-DQ3amgxj.js";function K(){const{host:n,collection:s}=y(),c=$(),{collections:C}=w(),o=P(n),[l,j]=i.useState(""),[u,d]=i.useState(""),[v,N]=i.useState(!1),[m,x]=i.useState(null),r=C.find(t=>t.name===s);if(r?.singleton){const t=r.singletonContentId?`/sites/${n}/content/${s}/${r.singletonContentId}`:`/sites/${n}/content/${s}`;return e.jsx(E,{to:t,replace:!0})}function S(t){j(t),v||d(D(t))}async function b(t){t.preventDefault(),x(null);try{const a=await o.mutateAsync({collection:s,title:l,slug:u||void 0});p.success("Content created"),c(`/sites/${n}/content/${s}/${a.contentId}`)}catch(a){a instanceof F&&a.status===409?x("A content item with this slug already exists. Choose a different slug."):p.error("Failed to create content",{description:a instanceof Error?a.message:void 0})}}return e.jsxs("div",{className:"mx-auto max-w-2xl",children:[e.jsxs("h1",{className:"mb-6 text-2xl font-semibold",children:["New ",r?.labelSingular??s]}),e.jsxs(T,{children:[e.jsx(A,{children:e.jsx(L,{children:"Details"})}),e.jsx(B,{children:e.jsxs("form",{onSubmit:b,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"title",children:"Title"}),e.jsx(h,{id:"title",value:l,onChange:t=>S(t.target.value),required:!0,autoFocus:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"slug",children:"Slug"}),e.jsx(h,{id:"slug",value:u,onChange:t=>{d(t.target.value),N(!0)}})]}),m&&e.jsx("p",{className:"text-sm text-destructive",children:m}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(f,{type:"submit",disabled:!l||o.isPending,children:[o.isPending&&e.jsx(I,{className:"mr-2 h-4 w-4 animate-spin"}),"Create"]}),e.jsx(f,{type:"button",variant:"outline",onClick:()=>c(-1),children:"Cancel"})]})]})})]})]})}export{K as ContentCreatePage};
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BlockEditor-CZTwex-o.js","assets/tanstack-BO6c-AOu.js","assets/react-vendor-DNVhVxD7.js","assets/index-Ds50UTAc.js","assets/radix-DQ3amgxj.js","assets/index-DOqKbrpW.css","assets/command-ChD319uJ.js","assets/search-DIzcfCVh.js","assets/badge-0Z1nL6DI.js","assets/media-url-DIg_vSyf.js","assets/CustomBlockPreview-CCssn6vF.js","assets/useContent-CSobIico.js","assets/useAdminResolver-BsQc_N4z.js","assets/select-CJXZv4wv.js","assets/check-BGA0ADyt.js","assets/format-CZ9bpk32.js","assets/sortable.esm-Zh-9QRSf.js","assets/core.esm-Csvubn5Q.js","assets/card-D1-S-QZ6.js","assets/useMedia-CQnmMz4N.js","assets/useTags-CYqbj5cK.js","assets/useDebouncedValue-Bf8UizjU.js","assets/plus-BgHSYWJN.js","assets/checkbox-BPqrj_XS.js","assets/trash-2-Gny2Upn-.js","assets/contentStatus-DfWHjFVB.js","assets/BlockEditor-Cp_wZ2xN.css"])))=>i.map(i=>d[i]);
2
+ import{j as e,u as ds}from"./tanstack-BO6c-AOu.js";import{r as p,u as me,e as us,L as hs}from"./react-vendor-DNVhVxD7.js";import{f as ms,g as ft,h as ps,i as gt,j as xs,k as fs,l as gs,m as js,n as vs,o as jt}from"./useContent-CSobIico.js";import{n as vt,v as bt,w as bs,X as G,x as R,S as O,T as yt,y as Nt,z as de,A as ue,D as ke,i as Ie,j as Pe,k as De,l as Ae,I as Z,B as S,a as Y,C as Te,s as M,E as Ct,F as J,G as ys,_ as Ns,L as ce,t as Cs,J as Ss,K as ws,M as ks,N as ht,m as St,O as Is,h as Ps}from"./index-Ds50UTAc.js";import{u as Ds}from"./useAdminResolver-BsQc_N4z.js";import{c as As,e as Ts,f as Ls,g as _s,h as Ms,O as Os}from"./radix-DQ3amgxj.js";import{S as Le,a as _e,b as Me,c as Oe,d as B,e as Rs,f as Es,g as Fs}from"./select-CJXZv4wv.js";import{f as Re,a as ve}from"./format-CZ9bpk32.js";import{u as wt,S as Ee,v as Fe,a as $e,T as kt,C as It,b as Pt,c as Dt}from"./sortable.esm-Zh-9QRSf.js";import{B as ee}from"./badge-0Z1nL6DI.js";import{C as $,a as Ne,b as Ce,c as V}from"./card-D1-S-QZ6.js";import{u as $s,a as Us,b as Vs,c as Bs,U as zs,F as Hs,d as At,T as Ws,E as qs,A as Ks,e as Js,f as Gs,g as Qs,h as Ys,i as Xs,j as Zs,k as en}from"./useMedia-CQnmMz4N.js";import{u as tn}from"./useTags-CYqbj5cK.js";import{m as Ue}from"./media-url-DIg_vSyf.js";import{C as Tt,G as Lt,u as Ve,a as Be,P as ze,D as He,c as We,b as _t}from"./core.esm-Csvubn5Q.js";import{P as sn,a as nn,b as an,C as rn,c as ln,d as on,e as cn,f as dn,g as un}from"./command-ChD319uJ.js";import{u as hn}from"./useDebouncedValue-Bf8UizjU.js";import{P as qe}from"./plus-BgHSYWJN.js";import{C as mn}from"./checkbox-BPqrj_XS.js";import{T as Mt}from"./trash-2-Gny2Upn-.js";import{g as pn,a as xn,b as fn}from"./contentStatus-DfWHjFVB.js";import{C as gn}from"./check-BGA0ADyt.js";const jn=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],vn=vt("eye",jn);const bn=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],yn=vt("rotate-ccw",bn),Nn=3e3,Cn="__HEADROOM_API_URL__".replace(/\/+$/,"");function Sn(i,t,s,n){const a=ms(i,t),r=p.useRef(null),l=p.useRef(s?JSON.stringify(s):""),o=p.useRef(void 0),[u,c]=p.useState(null),[m,N]=p.useState(null),h=p.useRef(!1),x=p.useCallback(g=>{JSON.stringify(g)!==l.current&&(r.current=g,clearTimeout(o.current),o.current=window.setTimeout(()=>{if(r.current){const C=r.current,y=JSON.stringify(C);r.current=null,a.mutate(C,{onSuccess:I=>{if(h.current){h.current=!1;return}l.current=y,c(Date.now()),I?.blockId&&N(I.blockId)},onError:I=>{I instanceof bt&&I.code==="SLUG_TAKEN"&&n?.()}})}},Nn))},[a,n]),f=p.useCallback(async g=>{if(clearTimeout(o.current),r.current){const b={...r.current};g?.createVersion&&(b.createVersion=!0);const C=JSON.stringify(r.current);r.current=null;const y=await a.mutateAsync(b);l.current=C,c(Date.now()),y?.blockId&&N(y.blockId)}else if(g?.createVersion&&l.current){const C={...JSON.parse(l.current),createVersion:!0},y=await a.mutateAsync(C);c(Date.now()),y?.blockId&&N(y.blockId)}},[a]),v=p.useCallback(()=>{clearTimeout(o.current),r.current=null},[]),w=p.useCallback(g=>{l.current=JSON.stringify(g)},[]),k=p.useCallback(()=>{clearTimeout(o.current),r.current=null,h.current=!0,N(null)},[]);return p.useEffect(()=>()=>{if(clearTimeout(o.current),r.current){const g=JSON.stringify(r.current),b=bs(),C=`${Cn}/v1/admin/sites/${i}/content/${t}/draft`;fetch(C,{method:"PUT",body:g,headers:{"Content-Type":"application/json",...b?{Authorization:`Bearer ${b}`}:{}},keepalive:!0}).catch(()=>{}),r.current=null}},[i,t]),{schedule:x,flush:f,cancel:v,resetBaseline:w,discard:k,isSaving:a.isPending,lastSavedAt:u,lastSavedBlockId:m}}const be=768;function wn(){const[i,t]=p.useState(void 0);return p.useEffect(()=>{const s=window.matchMedia(`(max-width: ${be-1}px)`),n=()=>{t(window.innerWidth<be)};return s.addEventListener("change",n),t(window.innerWidth<be),()=>s.removeEventListener("change",n)},[]),!!i}function kn({...i}){return e.jsx(As,{"data-slot":"sheet",...i})}function In({...i}){return e.jsx(Ms,{"data-slot":"sheet-portal",...i})}function Pn({className:i,...t}){return e.jsx(Os,{"data-slot":"sheet-overlay",className:R("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",i),...t})}function Dn({className:i,children:t,side:s="right",showCloseButton:n=!0,...a}){return e.jsxs(In,{children:[e.jsx(Pn,{}),e.jsxs(Ts,{"data-slot":"sheet-content",className:R("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",s==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",s==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",s==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",s==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",i),...a,children:[t,n&&e.jsxs(Ls,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[e.jsx(G,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function An({className:i,...t}){return e.jsx("div",{"data-slot":"sheet-header",className:R("flex flex-col gap-1.5 p-4",i),...t})}function Tn({className:i,...t}){return e.jsx(_s,{"data-slot":"sheet-title",className:R("text-foreground font-semibold",i),...t})}function Ln({lines:i}){return e.jsx("div",{className:"font-mono text-sm leading-relaxed",children:i.map((t,s)=>e.jsx("div",{style:{paddingLeft:`${t.indent*1.5}rem`},className:R("min-h-[1.5em]",t.type==="label"&&"text-muted-foreground font-semibold mt-1",t.type==="heading"&&"font-bold",t.type==="empty"&&"h-2"),children:t.text},s))})}class _n{diff(t,s,n={}){let a;typeof n=="function"?(a=n,n={}):"callback"in n&&(a=n.callback);const r=this.castInput(t,n),l=this.castInput(s,n),o=this.removeEmpty(this.tokenize(r,n)),u=this.removeEmpty(this.tokenize(l,n));return this.diffWithOptionsObj(o,u,n,a)}diffWithOptionsObj(t,s,n,a){var r;const l=g=>{if(g=this.postProcess(g,n),a){setTimeout(function(){a(g)},0);return}else return g},o=s.length,u=t.length;let c=1,m=o+u;n.maxEditLength!=null&&(m=Math.min(m,n.maxEditLength));const N=(r=n.timeout)!==null&&r!==void 0?r:1/0,h=Date.now()+N,x=[{oldPos:-1,lastComponent:void 0}];let f=this.extractCommon(x[0],s,t,0,n);if(x[0].oldPos+1>=u&&f+1>=o)return l(this.buildValues(x[0].lastComponent,s,t));let v=-1/0,w=1/0;const k=()=>{for(let g=Math.max(v,-c);g<=Math.min(w,c);g+=2){let b;const C=x[g-1],y=x[g+1];C&&(x[g-1]=void 0);let I=!1;if(y){const T=y.oldPos-g;I=y&&0<=T&&T<o}const D=C&&C.oldPos+1<u;if(!I&&!D){x[g]=void 0;continue}if(!D||I&&C.oldPos<y.oldPos?b=this.addToPath(y,!0,!1,0,n):b=this.addToPath(C,!1,!0,1,n),f=this.extractCommon(b,s,t,g,n),b.oldPos+1>=u&&f+1>=o)return l(this.buildValues(b.lastComponent,s,t))||!0;x[g]=b,b.oldPos+1>=u&&(w=Math.min(w,g-1)),f+1>=o&&(v=Math.max(v,g+1))}c++};if(a)(function g(){setTimeout(function(){if(c>m||Date.now()>h)return a(void 0);k()||g()},0)})();else for(;c<=m&&Date.now()<=h;){const g=k();if(g)return g}}addToPath(t,s,n,a,r){const l=t.lastComponent;return l&&!r.oneChangePerToken&&l.added===s&&l.removed===n?{oldPos:t.oldPos+a,lastComponent:{count:l.count+1,added:s,removed:n,previousComponent:l.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:s,removed:n,previousComponent:l}}}extractCommon(t,s,n,a,r){const l=s.length,o=n.length;let u=t.oldPos,c=u-a,m=0;for(;c+1<l&&u+1<o&&this.equals(n[u+1],s[c+1],r);)c++,u++,m++,r.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return m&&!r.oneChangePerToken&&(t.lastComponent={count:m,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=u,c}equals(t,s,n){return n.comparator?n.comparator(t,s):t===s||!!n.ignoreCase&&t.toLowerCase()===s.toLowerCase()}removeEmpty(t){const s=[];for(let n=0;n<t.length;n++)t[n]&&s.push(t[n]);return s}castInput(t,s){return t}tokenize(t,s){return Array.from(t)}join(t){return t.join("")}postProcess(t,s){return t}get useLongestToken(){return!1}buildValues(t,s,n){const a=[];let r;for(;t;)a.push(t),r=t.previousComponent,delete t.previousComponent,t=r;a.reverse();const l=a.length;let o=0,u=0,c=0;for(;o<l;o++){const m=a[o];if(m.removed)m.value=this.join(n.slice(c,c+m.count)),c+=m.count;else{if(!m.added&&this.useLongestToken){let N=s.slice(u,u+m.count);N=N.map(function(h,x){const f=n[c+x];return f.length>h.length?f:h}),m.value=this.join(N)}else m.value=this.join(s.slice(u,u+m.count));u+=m.count,m.added||(c+=m.count)}}return a}}class Mn extends _n{tokenize(t){return t.slice()}join(t){return t}removeEmpty(t){return t}}const On=new Mn;function Ot(i,t,s){return On.diff(i,t,s)}const Rn=5;function En({published:i,draft:t,leftLabel:s="Published",rightLabel:n="Draft"}){const a=p.useMemo(()=>Un(i,t),[i,t]),r=p.useMemo(()=>Vn(a),[a]);return a.every(l=>l.type==="unchanged")?e.jsxs("p",{className:"text-sm text-muted-foreground italic py-4",children:["No changes between ",s," and ",n," versions."]}):e.jsxs("div",{className:"font-mono text-xs leading-relaxed border rounded-md overflow-hidden",children:[e.jsxs("div",{className:"grid grid-cols-2 border-b bg-muted/50 text-muted-foreground text-[10px] font-semibold",children:[e.jsx("div",{className:"px-3 py-1.5",children:s}),e.jsx("div",{className:"px-3 py-1.5 border-l",children:n})]}),e.jsx("div",{children:r.map((l,o)=>e.jsx(Fn,{segment:l},o))})]})}function Fn({segment:i}){const[t,s]=p.useState(!1);return i.type==="collapsed"&&!t?e.jsxs("button",{onClick:()=>s(!0),className:"w-full grid grid-cols-2 text-[10px] text-muted-foreground bg-muted/30 hover:bg-muted/50 transition-colors cursor-pointer",children:[e.jsxs("div",{className:"px-3 py-1 text-center border-b",children:["... ",i.count," unchanged lines ..."]}),e.jsxs("div",{className:"px-3 py-1 text-center border-l border-b",children:["... ",i.count," unchanged lines ..."]})]}):i.type==="collapsed"?null:e.jsx(e.Fragment,{children:i.rows.map((n,a)=>e.jsx($n,{row:n},a))})}function $n({row:i}){return e.jsxs("div",{className:"grid grid-cols-2 border-b last:border-b-0",children:[e.jsx("div",{className:R("px-3 py-0.5 min-h-[1.5em]",i.type==="removed"&&"bg-red-50 dark:bg-red-950/30"),style:i.left?{paddingLeft:`calc(0.75rem + ${i.left.indent*1}rem)`}:void 0,children:e.jsx("span",{className:R(i.left?.type==="label"&&"text-muted-foreground font-semibold",i.left?.type==="heading"&&"font-bold"),children:i.left?.text??""})}),e.jsx("div",{className:R("px-3 py-0.5 min-h-[1.5em] border-l",i.type==="added"&&"bg-green-50 dark:bg-green-950/30"),style:i.right?{paddingLeft:`calc(0.75rem + ${i.right.indent*1}rem)`}:void 0,children:e.jsx("span",{className:R(i.right?.type==="label"&&"text-muted-foreground font-semibold",i.right?.type==="heading"&&"font-bold"),children:i.right?.text??""})})]})}function Un(i,t){const s=Ot(i,t,{comparator:(a,r)=>a.text===r.text&&a.indent===r.indent&&a.type===r.type}),n=[];for(const a of s)if(a.added)for(const r of a.value)n.push({type:"added",right:r});else if(a.removed)for(const r of a.value)n.push({type:"removed",left:r});else for(const r of a.value)n.push({type:"unchanged",left:r,right:r});return n}function Vn(i){const t=[];let s=[];function n(){if(s.length!==0){if(s.length>Rn){const l=s.slice(0,2),o=s.slice(-2),u=s.length-4;t.push({type:"rows",rows:l}),u>0&&t.push({type:"collapsed",count:u}),t.push({type:"rows",rows:o})}else t.push({type:"rows",rows:s});s=[]}}let a=[];function r(){a.length!==0&&(t.push({type:"rows",rows:a}),a=[])}for(const l of i)l.type==="unchanged"?(r(),s.push(l)):(n(),a.push(l));return r(),n(),t}function Se(i){switch(i.kind){case"draft":return"Draft";case"published":return"Published";case"history":return Re(i.createdAt)}}function he(i){switch(i.kind){case"draft":return"draft";case"published":return"published";case"history":return`history:${i.blockId}`}}function mt({value:i,onChange:t,isPublished:s,versions:n,exclude:a,size:r}){const l=a?he(a):null;function o(u){if(u==="draft")t({kind:"draft"});else if(u==="published")t({kind:"published"});else if(u.startsWith("history:")){const c=u.slice(8),m=n.find(N=>N.blockId===c);m&&t({kind:"history",blockId:m.blockId,createdAt:m.createdAt,title:m.title})}}return e.jsxs(Le,{value:he(i),onValueChange:o,children:[e.jsx(_e,{size:r,children:e.jsx(Me,{children:Se(i)})}),e.jsxs(Oe,{position:"popper",children:[l!=="draft"&&e.jsx(B,{value:"draft",children:"Draft"}),s&&l!=="published"&&e.jsx(B,{value:"published",children:"Published"}),n.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Rs,{}),e.jsxs(Es,{children:[e.jsx(Fs,{children:"Version History"}),n.map(u=>{const c=`history:${u.blockId}`;return c===l?null:e.jsx(B,{value:c,children:Re(u.createdAt)},c)})]})]})]})]})}function Rt(i,t){if(t==null||t==="")return[{text:"(empty)",indent:0,type:"value"}];switch(i.type){case"text":case"url":case"email":case"date":case"number":case"select":return[{text:String(t),indent:0,type:"value"}];case"textarea":return String(t).split(`
3
+ `).map(s=>({text:s,indent:0,type:"value"}));case"boolean":return[{text:t?"Yes":"No",indent:0,type:"value"}];case"media":return[{text:`[Media: ${t}]`,indent:0,type:"value"}];case"blocks":return we(t);case"array":return Hn(i,t);default:return[{text:String(t),indent:0,type:"value"}]}}function X(i,t,s,n){const a=[];s&&(s.title!==void 0&&(a.push({text:"Title",indent:0,type:"label"}),a.push({text:s.title||"(empty)",indent:0,type:"value"}),a.push({text:"",indent:0,type:"empty"})),s.slug!==void 0&&(a.push({text:"Slug",indent:0,type:"label"}),a.push({text:s.slug||"(empty)",indent:0,type:"value"}),a.push({text:"",indent:0,type:"empty"})),s.snippet!==void 0&&(a.push({text:"Snippet",indent:0,type:"label"}),a.push({text:s.snippet||"(empty)",indent:0,type:"value"}),a.push({text:"",indent:0,type:"empty"})),s.tags!==void 0&&(a.push({text:"Tags",indent:0,type:"label"}),a.push({text:s.tags.length>0?s.tags.join(", "):"(empty)",indent:0,type:"value"}),a.push({text:"",indent:0,type:"empty"})));for(const r of i){a.push({text:r.label,indent:0,type:"label"});const l=Rt(r,t[r.name]);a.push(...l),a.push({text:"",indent:0,type:"empty"})}if(n&&n.defs.length>0)for(const r of n.defs){a.push({text:r.label,indent:0,type:"label"});const l=n.values[r.name]??[];l.length===0?a.push({text:"(empty)",indent:0,type:"value"}):a.push({text:l.map(o=>o.title).join(", "),indent:0,type:"value"}),a.push({text:"",indent:0,type:"empty"})}return a.length>0&&a[a.length-1].type==="empty"&&a.pop(),a}const Bn=[["bold","**","**"],["italic","_","_"],["underline","__","__"],["strike","~~","~~"],["code","`","`"]];function zn(i,t){if(!t||!i)return i;let s=i;for(const[n,a,r]of Bn)t[n]===!0&&(s=a+s+r);return s}function K(i){return Array.isArray(i)?i.map(t=>typeof t.text=="string"?zn(t.text,t.styles):t.type==="link"&&Array.isArray(t.content)?`[${K(t.content)}](${t.href??""})`:"").join(""):""}function we(i,t=0){if(!Array.isArray(i))return[{text:"(empty)",indent:0,type:"value"}];if(i.length===0)return[{text:"(empty)",indent:0,type:"value"}];const s=[];let n=0;for(const a of i){if(typeof a!="object"||a===null)continue;const r=a,l=r.type??"";switch(l!=="numberedListItem"&&(n=0),l){case"paragraph":{const o=K(r.content);s.push({text:o||"",indent:t,type:"value"});break}case"heading":{const o=r.props?.level??1,u="#".repeat(Math.min(o,6))+" ",c=K(r.content);s.push({text:u+c,indent:t,type:"heading"});break}case"bulletListItem":{const o=K(r.content);s.push({text:`- ${o}`,indent:t,type:"list-item"});break}case"numberedListItem":{n++;const o=K(r.content);s.push({text:`${n}. ${o}`,indent:t,type:"list-item"});break}case"image":case"HeadroomImage":{const o=r.props?.alt,u=r.props?.mediaId,c=o||u||"image";s.push({text:`[Image: ${c}]`,indent:t,type:"value"});break}default:{if(r.props&&typeof r.props=="object"){const o=r.props,u=Object.entries(o).filter(([c])=>!["textAlignment","level"].includes(c));if(u.length>0){s.push({text:`[${l}]`,indent:t,type:"label"});for(const[c,m]of u)m==null||m===""||(Array.isArray(m)?(s.push({text:`${c}:`,indent:t+1,type:"label"}),s.push(...we(m,t+2))):s.push({text:`${c}: ${String(m)}`,indent:t+1,type:"value"}))}else s.push({text:`[${l}]`,indent:t,type:"value"})}else{const o=K(r.content);o&&s.push({text:o,indent:t,type:"value"})}break}}Array.isArray(r.children)&&r.children.length>0&&s.push(...we(r.children,t+1))}return s}function Hn(i,t){if(!Array.isArray(t)||t.length===0)return[{text:"(empty)",indent:0,type:"value"}];const n=i.options?.itemFields??[],a=[];for(let r=0;r<t.length;r++){a.push({text:`${r+1}.`,indent:0,type:"list-item"});const l=t[r];if(n.length>0)for(const o of n){a.push({text:o.label+":",indent:1,type:"label"});const u=Rt(o,l[o.name]);a.push(...u.map(c=>({...c,indent:c.indent+1})))}else a.push({text:JSON.stringify(l,null,2),indent:1,type:"value"})}return a}function pt({ref:i,host:t,contentId:s,collectionFields:n,isSingleton:a,draftBody:r,draftMetadata:l,collectionRelationships:o,draftRelationships:u}){const c=i?.kind==="published",m=i?.kind==="history",N=m?i.blockId:null,{data:h,isLoading:x}=ft(t,s,c),{data:f,isLoading:v}=ps(t,s,m?N:null),w=p.useMemo(()=>(o??[]).map(b=>({name:b.name,label:b.label})),[o]);function k(b){if(w.length!==0)return{defs:w,values:b??{}}}const g=p.useMemo(()=>{if(!i)return[];if(i.kind==="draft")return r?X(n,r,a?void 0:l,k(u)):[];if(i.kind==="published"){if(!h)return[];const y=a?void 0:{title:h.title,slug:h.slug,snippet:h.snippet,tags:h.tags},I=h.relationships;return X(n,h.body??{},y,k(I))}if(!f)return[];const b=a?void 0:{title:f.title,slug:f.slug,snippet:f.snippet,tags:f.tags},C=f.relationships;return X(n,f.body??{},b,k(C))},[i,r,l,u,h,f,n,a,w]);return i?i.kind==="draft"?{lines:g,isLoading:!1,hasData:!!r}:i.kind==="published"?{lines:g,isLoading:x,hasData:!!h}:{lines:g,isLoading:v,hasData:!!f}:{lines:[],isLoading:!1,hasData:!1}}function Wn({open:i,onOpenChange:t,host:s,contentId:n,collectionFields:a,isSingleton:r,isPublished:l,draftBody:o,draftMetadata:u,initialVersion:c,collectionRelationships:m,draftRelationships:N}){const[h,x]=p.useState(c??{kind:"published"}),[f,v]=p.useState({kind:"draft"}),[w,k]=p.useState(i),[g,b]=p.useState(c);if((i!==w||c!==g)&&(k(i),b(c),i)){const L=c??{kind:"published"};x(L),v(L.kind==="draft"?{kind:"published"}:{kind:"draft"})}he(h)===he(f)&&(h.kind!=="draft"?v({kind:"draft"}):l&&v({kind:"published"}));const{data:C}=gt(s,n),y=C?.items??[],I={host:s,contentId:n,collectionFields:a,isSingleton:r,draftBody:o,draftMetadata:u,collectionRelationships:m,draftRelationships:N},D=pt({ref:h,...I}),T=pt({ref:f,...I}),j=D.isLoading;return e.jsx(kn,{open:i,onOpenChange:t,children:e.jsxs(Dn,{className:"sm:max-w-2xl overflow-y-auto",children:[e.jsx(An,{children:e.jsxs(Tn,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground text-sm font-normal",children:"Viewing"}),e.jsx(mt,{value:h,onChange:x,isPublished:l,versions:y,size:"sm"})]})}),j&&e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(O,{className:"h-6 w-48"}),e.jsx(O,{className:"h-4 w-full"}),e.jsx(O,{className:"h-4 w-full"}),e.jsx(O,{className:"h-4 w-2/3"})]}),!j&&!D.hasData&&e.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"No data available for this version."}),!j&&D.hasData&&e.jsx("div",{className:"p-4",children:e.jsxs(yt,{defaultValue:"changes",children:[e.jsxs(Nt,{variant:"line",className:"mb-4",children:[e.jsx(de,{value:"content",children:"Content"}),e.jsx(de,{value:"changes",children:"Changes"})]}),e.jsx(ue,{value:"content",children:e.jsx(Ln,{lines:D.lines})}),e.jsxs(ue,{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(mt,{value:f,onChange:v,isPublished:l,versions:y,exclude:h,size:"sm"})]}),T.isLoading?e.jsxs("div",{className:"space-y-4",children:[e.jsx(O,{className:"h-4 w-full"}),e.jsx(O,{className:"h-4 w-full"}),e.jsx(O,{className:"h-4 w-2/3"})]}):T.hasData?e.jsx(En,{published:D.lines,draft:T.lines,leftLabel:Se(h),rightLabel:Se(f)}):e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No data available for comparison."})]})]})})]})})}function Et({open:i,onSelect:t,onClose:s,allowedTypes:n}){const{host:a}=me(),[r,l]=p.useState(""),[o,u]=p.useState("__all__"),c=p.useRef(null),m=$s(a),N=Us(a),{data:h}=Vs(a),x=h?.items??[],f=o==="__all__"?void 0:o==="__unfiled__"?"":o,{data:v,fetchNextPage:w,hasNextPage:k,isFetchingNextPage:g}=Bs(a,{folderId:f}),[b,C]=p.useState(!1),I=(v?.pages.flatMap(j=>j.items)??[]).filter(j=>n&&!n.some(A=>A.endsWith("/*")?j.mimeType.startsWith(A.slice(0,-1)):j.mimeType===A)?!1:r?j.filename.toLowerCase().includes(r.toLowerCase())||j.alt?.toLowerCase().includes(r.toLowerCase()):!0);async function D(j){C(!0);try{const{uploadUrl:L,mediaId:A}=await m.mutateAsync({filename:j.name,contentType:j.type,size:j.size});await fetch(L,{method:"PUT",body:j,headers:{"Content-Type":j.type}});const te=await N.mutateAsync({mediaId:A,filename:j.name});t(te),s()}catch(L){M.error("Upload failed",{description:L instanceof Error?L.message:void 0})}finally{C(!1)}}function T(j){return j.startsWith("image/")}return e.jsx(ke,{open:i,onOpenChange:()=>s(),children:e.jsxs(Ie,{className:"max-w-3xl",children:[e.jsxs(Pe,{children:[e.jsx(De,{children:"Select Media"}),e.jsx(Ae,{className:"sr-only",children:"Browse and select media files"})]}),e.jsxs("div",{className:"mb-4 flex justify-between gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Z,{placeholder:"Search by filename...",value:r,onChange:j=>l(j.target.value),className:"max-w-xs"}),x.length>0&&e.jsxs(Le,{value:o,onValueChange:u,children:[e.jsx(_e,{className:"w-[150px]",children:e.jsx(Me,{})}),e.jsxs(Oe,{children:[e.jsx(B,{value:"__all__",children:"All folders"}),x.map(j=>e.jsx(B,{value:j.folderId,children:j.name},j.folderId)),e.jsx(B,{value:"__unfiled__",children:"Unfiled"})]})]})]}),e.jsxs("div",{children:[e.jsx("input",{ref:c,type:"file",className:"hidden",accept:n?.join(",")??void 0,onChange:j=>j.target.files?.[0]&&D(j.target.files[0])}),e.jsxs(S,{variant:"outline",onClick:()=>c.current?.click(),disabled:b,children:[b?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(zs,{className:"mr-2 h-4 w-4"}),"Upload New"]})]})]}),e.jsx("div",{className:"grid max-h-96 grid-cols-4 gap-3 overflow-y-auto",children:I.map(j=>e.jsxs($,{className:"cursor-pointer overflow-hidden hover:ring-2 hover:ring-primary",onClick:()=>{t(j),s()},children:[e.jsx("div",{className:"flex aspect-square items-center justify-center bg-muted",children:T(j.mimeType)?e.jsx("img",{src:Ue(j.urls?.thumb_md??j.url),alt:j.alt??j.filename,className:"h-full w-full object-cover"}):e.jsxs("div",{className:"flex flex-col items-center gap-1 p-2",children:[j.mimeType.startsWith("image/")?e.jsx(Te,{className:"h-8 w-8 text-muted-foreground"}):e.jsx(Hs,{className:"h-8 w-8 text-muted-foreground"}),e.jsx("span",{className:"max-w-full truncate text-xs text-muted-foreground",children:j.filename})]})}),e.jsx("div",{className:"p-1.5",children:e.jsx("p",{className:"truncate text-xs",children:j.filename})})]},j.mediaId))}),I.length===0&&e.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No media found."}),k&&e.jsxs(S,{variant:"ghost",className:"mt-2 w-full",onClick:()=>w(),disabled:g,children:[g?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Load More"]})]})})}function qn(i,t,s){const n=Ct(),a=s?.length===1?s[0]:void 0,r=new URLSearchParams;return t?(r.set("q",t),r.set("search","full")):r.set("limit","5"),a&&r.set("collection",a),ds({queryKey:["sites",i,"content-search",t,s??[]],queryFn:async()=>{const l=await n.apiFetch(`/v1/admin/sites/${i}/content?${r.toString()}`);return s&&s.length>1?{...l,items:l.items.filter(o=>s.includes(o.collection))}:l},enabled:!!i,staleTime:3e4})}function Kn({field:i,value:t,onChange:s}){const{host:n}=me(),a=i.options,r=!!a?.multiple,l=a?.collections;return r?e.jsx(Gn,{host:n,collections:l,value:t??[],onChange:s}):e.jsx(Jn,{host:n,collections:l,value:t,onChange:s})}function Jn({host:i,collections:t,value:s,onChange:n}){const[a,r]=p.useState(!1),l=s?[s.contentId]:[];function o(u){n(u),r(!1)}return e.jsx("div",{children:s?e.jsxs("div",{className:"flex items-center gap-3 rounded-md border p-2",children:[e.jsx(J,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"flex-1 truncate text-sm",children:s.title}),e.jsx(ee,{variant:"secondary",children:s.collection}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:()=>n(null),children:e.jsx(G,{className:"h-3 w-3"})})]}):e.jsx(pe,{host:i,collections:t,selectedIds:l,open:a,onOpenChange:r,onSelect:o,trigger:e.jsxs(S,{type:"button",variant:"outline",children:[e.jsx(J,{className:"mr-2 h-4 w-4"}),"Select Content"]})})})}function Gn({host:i,collections:t,value:s,onChange:n}){const a=Ve(Be(ze)),[r,l]=p.useState(!1),o=s??[],u=o.map(x=>x.contentId),c=o.map(x=>x.contentId);function m(x){n([...o,x]),l(!1)}function N(x){n(o.filter((f,v)=>v!==x))}function h(x){const{active:f,over:v}=x;if(v&&f.id!==v.id){const w=o.findIndex(g=>g.contentId===String(f.id)),k=o.findIndex(g=>g.contentId===String(v.id));w!==-1&&k!==-1&&n($e(o,w,k))}}return e.jsx(He,{sensors:a,collisionDetection:We,onDragEnd:h,children:e.jsx(Ee,{items:u,strategy:Fe,children:e.jsxs("div",{className:"space-y-2",children:[o.map(x=>e.jsx(Ft,{id:x.contentId,contentRef:x,onRemove:()=>N(o.indexOf(x))},x.contentId)),e.jsx(pe,{host:i,collections:t,selectedIds:c,open:r,onOpenChange:l,onSelect:m,trigger:e.jsxs(S,{type:"button",variant:"outline",size:"sm",children:[e.jsx(qe,{className:"mr-2 h-3 w-3"}),"Add Content"]})})]})})})}function Ft({id:i,contentRef:t,onRemove:s}){const{attributes:n,listeners:a,setNodeRef:r,transform:l,transition:o}=wt({id:i}),u={transform:Tt.Transform.toString(l),transition:o};return e.jsxs("div",{ref:r,style:u,className:"flex items-center gap-2 rounded-md border p-2",children:[e.jsx("button",{type:"button",className:"cursor-grab touch-none text-muted-foreground hover:text-foreground",...n,...a,children:e.jsx(Lt,{className:"h-4 w-4"})}),e.jsx(J,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"flex-1 truncate text-sm",children:t.title}),e.jsx(ee,{variant:"secondary",children:t.collection}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:s,className:"text-destructive",children:e.jsx(G,{className:"h-3 w-3"})})]})}function pe({host:i,collections:t,selectedIds:s,open:n,onOpenChange:a,onSelect:r,trigger:l}){const[o,u]=p.useState(""),c=hn(o,300),{data:m,isLoading:N}=qn(i,c,t);return e.jsxs(sn,{open:n,onOpenChange:a,children:[e.jsx(nn,{asChild:!0,children:l}),e.jsx(an,{className:"w-80 p-0",align:"start",children:e.jsxs(rn,{shouldFilter:!1,children:[e.jsx(ln,{placeholder:"Search content...",value:o,onValueChange:u}),e.jsx(on,{children:N?e.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching..."}):e.jsxs(e.Fragment,{children:[e.jsx(cn,{children:"No content found."}),e.jsx(dn,{heading:c.length===0?"Recent":void 0,children:m?.items.map(h=>{const x=s.includes(h.contentId);return e.jsxs(un,{value:h.contentId,disabled:x,onSelect:()=>r({contentId:h.contentId,collection:h.collection,slug:h.slug??"",title:h.title}),children:[e.jsx(J,{className:"h-4 w-4"}),e.jsx("span",{className:"flex-1 truncate",children:h.title}),e.jsx(ee,{variant:"outline",className:"text-xs",children:h.collection})]},h.contentId)})})]})})]})})]})}function Qn({relationships:i,values:t,onChange:s,host:n}){return e.jsxs($,{children:[e.jsx(Ne,{children:e.jsx(Ce,{children:"Relationships"})}),e.jsx(V,{className:"space-y-4",children:i.map(a=>a.multiple?e.jsx(Xn,{rel:a,items:t[a.name]??[],host:n,onChange:r=>s({...t,[a.name]:r})},a.name):e.jsx(Yn,{rel:a,value:t[a.name]?.[0]??null,host:n,onChange:r=>s({...t,[a.name]:r?[r]:[]})},a.name))})]})}function Yn({rel:i,value:t,host:s,onChange:n}){const[a,r]=p.useState(!1),l=t?[t.contentId]:[];return e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:i.label}),t?e.jsxs("div",{className:"flex items-center gap-3 rounded-md border p-2",children:[e.jsx(J,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"flex-1 truncate text-sm",children:t.title}),e.jsx(ee,{variant:"secondary",children:t.collection}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:()=>n(null),children:e.jsx(G,{className:"h-3 w-3"})})]}):e.jsx(pe,{host:s,collections:[i.targetCollection],selectedIds:l,open:a,onOpenChange:r,onSelect:o=>{n(o),r(!1)},trigger:e.jsxs(S,{type:"button",variant:"outline",size:"sm",children:[e.jsx(J,{className:"mr-2 h-4 w-4"}),"Select ",i.label]})})]})}function Xn({rel:i,items:t,host:s,onChange:n}){const a=Ve(Be(ze)),[r,l]=p.useState(!1),o=t.map(h=>h.contentId),u=t.map(h=>h.contentId);function c(h){n([...t,h]),l(!1)}function m(h){n(t.filter((x,f)=>f!==h))}function N(h){const{active:x,over:f}=h;if(f&&x.id!==f.id){const v=t.findIndex(k=>k.contentId===String(x.id)),w=t.findIndex(k=>k.contentId===String(f.id));v!==-1&&w!==-1&&n($e(t,v,w))}}return e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:i.label}),e.jsx(He,{sensors:a,collisionDetection:We,onDragEnd:N,children:e.jsx(Ee,{items:o,strategy:Fe,children:e.jsxs("div",{className:"space-y-2",children:[t.map(h=>e.jsx(Ft,{id:h.contentId,contentRef:h,onRemove:()=>m(t.indexOf(h))},h.contentId)),e.jsx(pe,{host:s,collections:[i.targetCollection],selectedIds:u,open:r,onOpenChange:l,onSelect:c,trigger:e.jsxs(S,{type:"button",variant:"outline",size:"sm",children:[e.jsx(qe,{className:"mr-2 h-3 w-3"}),"Add ",i.label]})})]})})})]})}function ye({field:i,value:t,onChange:s}){const n=i.options;return e.jsx(Z,{value:t??"",onChange:a=>s(a.target.value),placeholder:n?.placeholder,maxLength:n?.maxLength,required:!!n?.required,type:i.type==="url"?"url":i.type==="email"?"email":"text"})}function Zn({field:i,value:t,onChange:s}){const n=i.options;return e.jsx(kt,{value:t??"",onChange:a=>s(a.target.value),placeholder:n?.placeholder,maxLength:n?.maxLength,required:!!n?.required,rows:4})}function ea({field:i,value:t,onChange:s}){const n=i.options;return e.jsx(Z,{type:"number",value:t??"",onChange:a=>s(a.target.value===""?void 0:Number(a.target.value)),min:n?.min,max:n?.max,step:n?.step,required:!!n?.required})}function ta({field:i,value:t,onChange:s}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(mn,{id:`field-${i.name}`,checked:!!t,onCheckedChange:n=>s(!!n)}),e.jsx("label",{htmlFor:`field-${i.name}`,className:"text-sm text-muted-foreground",children:i.label})]})}function sa({field:i,value:t,onChange:s}){const a=i.options?.choices??[];return e.jsxs(Le,{value:t??"",onValueChange:r=>s(r),children:[e.jsx(_e,{children:e.jsx(Me,{placeholder:"Select..."})}),e.jsx(Oe,{children:a.map(r=>e.jsx(B,{value:r,children:r},r))})]})}function na({field:i,value:t,onChange:s}){const{host:n}=me(),[a,r]=p.useState(!1),o=i.options?.allowedTypes,u=typeof t=="string"?t:t?.mediaId??"",{data:c}=At(n,u);return e.jsxs("div",{children:[u?e.jsxs("div",{className:"flex items-center gap-3 rounded-md border p-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>r(!0),children:[c?.url&&e.jsx("img",{src:Ue(c.urls?.thumb_sm??c.url),alt:c?.filename??"",className:"h-10 w-10 rounded object-cover bg-muted"}),e.jsx("span",{className:"flex-1 truncate text-sm",children:c?.filename??"Loading..."}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:m=>{m.stopPropagation(),s("")},children:e.jsx(G,{className:"h-3 w-3"})})]}):e.jsxs(S,{type:"button",variant:"outline",onClick:()=>r(!0),children:[e.jsx(Te,{className:"mr-2 h-4 w-4"}),"Select Media"]}),e.jsx(Et,{open:a,onClose:()=>r(!1),onSelect:m=>{s({mediaId:m.mediaId,url:m.url,width:m.width??0,height:m.height??0,filename:m.filename}),r(!1)},allowedTypes:o})]})}function aa({field:i,value:t,onChange:s}){const n=Ve(Be(ze)),a=t??[],l=i.options?.itemFields??[],o=a.map((h,x)=>`item-${x}`);function u(){s([...a,{}])}function c(h){s(a.filter((x,f)=>f!==h))}function m(h,x){const f=[...a];f[h]=x,s(f)}function N(h){const{active:x,over:f}=h;if(f&&x.id!==f.id){const v=o.indexOf(String(x.id)),w=o.indexOf(String(f.id));s($e(a,v,w))}}return e.jsx(He,{sensors:n,collisionDetection:We,onDragEnd:N,children:e.jsx(Ee,{items:o,strategy:Fe,children:e.jsxs("div",{className:"space-y-3",children:[a.map((h,x)=>e.jsx(ia,{id:`item-${x}`,itemFields:l,item:h,onUpdate:f=>m(x,f),onRemove:()=>c(x)},`item-${x}`)),e.jsxs(S,{type:"button",variant:"outline",size:"sm",onClick:u,children:[e.jsx(qe,{className:"mr-2 h-3 w-3"})," Add Item"]})]})})})}function ia({id:i,itemFields:t,item:s,onUpdate:n,onRemove:a}){const{attributes:r,listeners:l,setNodeRef:o,transform:u,transition:c}=wt({id:i}),m={transform:Tt.Transform.toString(u),transition:c};return e.jsx($,{ref:o,style:m,children:e.jsxs(V,{className:"flex gap-2 p-3",children:[e.jsx("button",{type:"button",className:"cursor-grab touch-none text-muted-foreground hover:text-foreground",...r,...l,children:e.jsx(Lt,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1",children:e.jsx($t,{fields:t,values:s,onChange:n})}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:a,className:"text-destructive",children:e.jsx(Mt,{className:"h-3 w-3"})})]})})}const ra=p.lazy(()=>Ns(()=>import("./BlockEditor-CZTwex-o.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]))),la=2,xt=p.createContext(0);function oa({value:i,onChange:t,compact:s=!0}){const n=p.useContext(xt),r=ys()?.blockTypes??[];return n>=la?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(xt.Provider,{value:n+1,children:e.jsx("div",{className:"rounded-md border",children:e.jsx(p.Suspense,{fallback:e.jsx(O,{className:"h-48"}),children:e.jsx(ra,{initialBlocks:i??[],onChange:t,blockTypes:r,compact:s})})})})}function $t({fields:i,values:t,onChange:s}){function n(a,r){s({...t,[a]:r})}return e.jsx("div",{className:"space-y-4",children:i.map(a=>e.jsxs("div",{className:"space-y-2",children:[a.type!=="boolean"&&e.jsx(ce,{children:a.label}),ca(a,t[a.name],r=>n(a.name,r))]},a.name))})}function ca(i,t,s){switch(i.type){case"text":case"url":case"email":return e.jsx(ye,{field:i,value:t,onChange:s});case"textarea":return e.jsx(Zn,{field:i,value:t,onChange:s});case"number":return e.jsx(ea,{field:i,value:t,onChange:s});case"boolean":return e.jsx(ta,{field:i,value:t,onChange:s});case"select":return e.jsx(sa,{field:i,value:t,onChange:s});case"media":return e.jsx(na,{field:i,value:t,onChange:s});case"content":return e.jsx(Kn,{field:i,value:t,onChange:s});case"blocks":return e.jsx(oa,{field:i,value:t,onChange:s});case"array":return e.jsx(aa,{field:i,value:t,onChange:s});case"date":return e.jsx(ye,{field:{...i,type:"text"},value:t,onChange:s});default:return e.jsx(ye,{field:i,value:t,onChange:s})}}function da(){const{host:i,collection:t,id:s}=me(),{data:n,isLoading:a}=xs(i,s);return a?e.jsxs("div",{className:"space-y-4",children:[e.jsx(O,{className:"h-8 w-64"}),e.jsx(O,{className:"h-64 w-full"})]}):n?.content?e.jsx(ua,{host:i,collection:t,contentId:s,content:n.content,draft:n.draft,publishedBlockId:n.publishedBlockId}):e.jsx("p",{className:"text-muted-foreground",children:"Content not found."})}function ua({host:i,collection:t,contentId:s,content:n,draft:a,publishedBlockId:r}){const l=us(),o=Ct(),{collections:u}=Cs(),c=fs(i,s),m=gs(i,s),N=js(i,s),h=a?{title:a.title??n.title,slug:a.slug??n.slug??"",snippet:a.snippet??n.snippet??"",tags:a.tags??n.tags??[],coverUrl:a.coverUrl??n.coverUrl??"",coverMediaId:a.coverMediaId??n.coverMediaId??"",coverWidth:a.coverWidth??n.coverWidth??0,coverHeight:a.coverHeight??n.coverHeight??0,body:a.body??{},relationships:a.relationships??{}}:void 0,[x,f]=p.useState(null),v=Sn(i,s,h,()=>{f("This slug is already in use by another item in this collection")}),{data:w}=tn(i),k=w?.map(d=>d.tag),g=u.find(d=>d.name===t),b=p.useMemo(()=>g?.fields??[],[g?.fields]),C=p.useMemo(()=>g?.relationships??[],[g?.relationships]),y=g?.singleton??!1,I=wn(),[D,T]=p.useState(a?.title??n.title),[j,L]=p.useState(a?.slug??n.slug??""),[A,te]=p.useState(a?.snippet??n.snippet??""),Ke=a?.autoSnippet??"",[z,Je]=p.useState(a?.tags??n.tags??[]),[xe,Ge]=p.useState(a?.coverUrl??n.coverUrl??""),[se,Qe]=p.useState(a?.coverMediaId??n.coverMediaId??""),[Ye,Xe]=p.useState(a?.coverWidth??n.coverWidth??0),[Ze,et]=p.useState(a?.coverHeight??n.coverHeight??0),[H,tt]=p.useState(a?.body??{}),[W,st]=p.useState(a?.relationships??{}),[Ut,Vt]=p.useState(0),[Bt,zt]=p.useState(!1),[Ht,ne]=p.useState(!1),[Wt,Q]=p.useState(!1),[qt,ae]=p.useState(null),[fe,ie]=p.useState(!1),[Kt,re]=p.useState(!1),nt=vs(i,s),{data:at}=At(i,se),U=p.useCallback(()=>({title:D,slug:j,snippet:A,tags:z,coverUrl:xe,coverMediaId:se,coverWidth:Ye,coverHeight:Ze,body:H,relationships:W}),[D,j,A,z,xe,se,Ye,Ze,H,W]);function Jt(d){T(d),setTimeout(()=>v.schedule({...U(),title:d}),0)}function Gt(d){L(d),f(null),setTimeout(()=>v.schedule({...U(),slug:d}),0)}function Qt(d){te(d),setTimeout(()=>v.schedule({...U(),snippet:d}),0)}function Yt(d){Je(d),setTimeout(()=>v.schedule({...U(),tags:d}),0)}function it(d,P,q,oe){Ge(d),Qe(P),Xe(q),et(oe),setTimeout(()=>v.schedule({...U(),coverUrl:d,coverMediaId:P,coverWidth:q,coverHeight:oe}),0)}function Xt(d){tt(d),setTimeout(()=>v.schedule({...U(),body:d}),0)}function Zt(d){st(d),setTimeout(()=>v.schedule({...U(),relationships:d}),0)}const es=v.lastSavedBlockId??a?.blockId,le=pn(n.publishedAt,n.lastPublishedAt,r,es),rt=xn(le),lt=fn(le),{data:F}=ft(i,s,!!n.publishedAt),E=p.useMemo(()=>{if(!fe||!F)return null;const d=y?void 0:{title:F.title,slug:F.slug,snippet:F.snippet,tags:F.tags},P=C.map(_=>({name:_.name,label:_.label})),q=F.relationships,oe=P.length>0?{defs:P,values:q??{}}:void 0,is=X(b,F.body??{},d,oe),rs=y?void 0:{title:D,slug:j,snippet:A,tags:z},ls=P.length>0?{defs:P,values:W}:void 0,os=X(b,H,rs,ls),cs=Ot(is,os,{comparator:(_,je)=>_.text===je.text&&_.indent===je.indent&&_.type===je.type});let dt=0,ut=0;for(const _ of cs)_.added?dt+=_.count??0:_.removed&&(ut+=_.count??0);return{added:dt,removed:ut}},[fe,F,b,C,y,D,j,A,z,H,W]);function ts(){if(n.publishedAt&&n.slug&&j!==n.slug){re(!0);return}le==="published-changes"?ie(!0):ge()}async function ge(){try{v.cancel(),await v.flush({createVersion:!0}),await c.mutateAsync(),M.success("Content published")}catch(d){if(d instanceof bt&&d.code==="SLUG_TAKEN"){f("This slug is already in use by another item in this collection"),M.error("Slug already in use",{description:"Please choose a different slug before publishing."});return}M.error("Failed to publish",{description:d instanceof Error?d.message:void 0})}}async function ss(){try{await m.mutateAsync(),Q(!1),M.success("Content unpublished")}catch(d){M.error("Failed to unpublish",{description:d instanceof Error?d.message:void 0})}}async function ns(){try{v.discard();const d=await o.apiFetch(`/v1/admin/sites/${i}/content/${s}/published`);await nt.mutateAsync();const P={title:d.title??"",slug:d.slug??"",snippet:d.snippet??"",tags:d.tags??[],coverUrl:d.coverUrl??"",coverMediaId:d.coverMediaId??"",coverWidth:d.coverWidth??0,coverHeight:d.coverHeight??0,body:d.body??{},relationships:d.relationships??{}};T(P.title),L(P.slug),te(P.snippet),Je(P.tags),Ge(P.coverUrl),Qe(P.coverMediaId),Xe(P.coverWidth),et(P.coverHeight),tt(P.body),st(P.relationships),Vt(q=>q+1),v.resetBaseline(P),M.success("Changes discarded")}catch(d){M.error("Failed to discard changes",{description:d instanceof Error?d.message:void 0})}}async function as(){try{await N.mutateAsync(),M.success("Content deleted"),l(`/sites/${i}/content/${t}`)}catch(d){M.error("Failed to delete",{description:d instanceof Error?d.message:void 0})}}const ot=e.jsx("div",{className:"space-y-6",children:b.length>0?e.jsx($t,{fields:b,values:H,onChange:Xt},Ut):e.jsx($,{children:e.jsx(V,{className:"py-8 text-center",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["No fields defined for this collection."," ",e.jsx(hs,{to:`/sites/${i}/settings/collections/${t}`,className:"underline",children:"Configure fields"})]})})})}),ct=e.jsxs("div",{className:"space-y-6",children:[!y&&e.jsx($,{children:e.jsxs(V,{className:"space-y-4 pt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"title",children:"Title"}),e.jsx(Z,{id:"title",value:D,onChange:d=>Jt(d.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"slug",children:"Slug"}),e.jsx(Z,{id:"slug",value:j,onChange:d=>Gt(d.target.value),className:x?"border-destructive":""}),x&&e.jsx("p",{className:"text-sm text-destructive",children:x})]}),e.jsxs(It,{defaultOpen:!!A,children:[e.jsxs(Pt,{className:"flex w-full items-center gap-2 text-sm font-medium",children:[e.jsx(_t,{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(Dt,{className:"mt-2 space-y-2",children:[e.jsx(kt,{id:"snippet",value:A,onChange:d=>Qt(d.target.value),rows:3,placeholder:"Brief summary of this content..."}),!A&&Ke&&e.jsxs("p",{className:"text-xs italic text-muted-foreground",children:["Auto-generated: ",Ke]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Cover Image"}),se?e.jsxs("div",{className:"flex items-center gap-3 rounded-md border p-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>ne(!0),children:[e.jsx("img",{src:Ue(xe),alt:at?.filename??"",className:"h-10 w-10 rounded object-cover bg-muted"}),e.jsx("span",{className:"flex-1 truncate text-sm",children:at?.filename??"Loading..."}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:d=>{d.stopPropagation(),it("","",0,0)},children:e.jsx(G,{className:"h-3 w-3"})})]}):e.jsxs(S,{type:"button",variant:"outline",className:"w-full",onClick:()=>ne(!0),children:[e.jsx(Te,{className:"mr-2 h-4 w-4"}),"Select Image"]}),e.jsx(Et,{open:Ht,onClose:()=>ne(!1),onSelect:d=>{it(d.url,d.mediaId,d.width??0,d.height??0),ne(!1)},allowedTypes:["image/*"]})]})]})}),!y&&e.jsxs($,{children:[e.jsx(Ne,{children:e.jsx(Ce,{children:"Tags"})}),e.jsx(V,{children:e.jsx(Ws,{tags:z,onChange:Yt,suggestions:k})})]}),C.length>0&&e.jsx(Qn,{relationships:C,values:W,onChange:Zt,host:i}),e.jsxs($,{children:[e.jsx(Ne,{children:e.jsx(Ce,{children:"Info"})}),e.jsxs(V,{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:n.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:n.contentId})]}),n.publishedAt?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"First published"}),e.jsx("span",{children:ve(n.publishedAt)})]}),n.lastPublishedAt&&n.lastPublishedAt!==n.publishedAt&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Last published"}),e.jsx("span",{children:ve(n.lastPublishedAt)})]})]}):n.lastPublishedAt?e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Last published"}),e.jsx("span",{children:ve(n.lastPublishedAt)})]}):null,n.publishedAt&&e.jsxs(S,{variant:"outline",size:"sm",className:"w-full mt-2",onClick:()=>{ae({kind:"published"}),Q(!0)},children:[e.jsx(vn,{className:"mr-2 h-4 w-4"}),"View published"]})]})]}),e.jsx(pa,{host:i,contentId:s,onViewVersion:d=>{ae({kind:"history",blockId:d.blockId,createdAt:d.createdAt,title:d.title}),Q(!0)}}),!y&&e.jsx(ma,{deleteOpen:Bt,setDeleteOpen:zt,onDelete:as,host:i,contentId:s})]});return e.jsxs("div",{className:"mx-auto max-w-6xl",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:y?g?.label??t:D||"Untitled"}),e.jsx(ee,{variant:rt.variant,children:rt.label}),v.isSaving&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Y,{className:"h-3 w-3 animate-spin"}),"Saving..."]}),!v.isSaving&&v.lastSavedAt&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(gn,{className:"h-3 w-3"}),"Saved"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(S,{variant:"outline",onClick:()=>v.flush({createVersion:!0}),disabled:v.isSaving,children:[v.isSaving&&e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}),"Save Draft"]}),lt&&e.jsxs(S,{onClick:ts,disabled:c.isPending,children:[c.isPending&&e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}),lt]}),n.publishedAt&&e.jsxs(Ss,{children:[e.jsx(ws,{asChild:!0,children:e.jsx(S,{variant:"outline",size:"icon",children:e.jsx(qs,{className:"h-4 w-4"})})}),e.jsxs(ks,{align:"end",children:[le==="published-changes"&&e.jsxs(ht,{onClick:ns,disabled:nt.isPending,children:[e.jsx(yn,{className:"mr-2 h-4 w-4"}),"Discard Changes"]}),e.jsx(ht,{onClick:ss,className:"text-destructive focus:text-destructive",children:"Unpublish"})]})]})]})]}),I?e.jsxs(yt,{defaultValue:"content",children:[e.jsxs(Nt,{variant:"line",className:"mb-4",children:[e.jsx(de,{value:"content",children:"Content"}),e.jsx(de,{value:"info",children:"Info"})]}),e.jsx(ue,{value:"content",children:ot}),e.jsx(ue,{value:"info",children:ct})]}):e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsx("div",{className:"lg:col-span-2",children:ot}),e.jsx("div",{children:ct})]}),e.jsx(Wn,{open:Wt,onOpenChange:d=>{Q(d),d||ae(null)},host:i,contentId:s,collectionFields:b,isSingleton:y,isPublished:!!n.publishedAt,draftBody:H,draftMetadata:y?void 0:{title:D,slug:j,snippet:A,tags:z},initialVersion:qt,collectionRelationships:C,draftRelationships:W}),e.jsx(Ks,{open:fe,onOpenChange:ie,children:e.jsxs(Js,{children:[e.jsxs(Gs,{children:[e.jsx(Qs,{children:"Publish changes?"}),e.jsx(Ys,{children:E?e.jsxs(e.Fragment,{children:[E.added>0&&e.jsxs("span",{className:"text-green-600",children:["+",E.added," added"]}),E.added>0&&E.removed>0&&", ",E.removed>0&&e.jsxs("span",{className:"text-red-600",children:["-",E.removed," removed"]}),E.added===0&&E.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(S,{variant:"link",className:"p-0 h-auto text-sm",onClick:()=>{ie(!1),ae({kind:"published"}),Q(!0)},children:"View full diff"})}),e.jsxs(Xs,{children:[e.jsx(Zs,{children:"Cancel"}),e.jsx(en,{onClick:()=>{ie(!1),ge()},children:"Publish Update"})]})]})}),e.jsx(ke,{open:Kt,onOpenChange:re,children:e.jsxs(Ie,{children:[e.jsxs(Pe,{children:[e.jsx(De,{children:"Slug change detected"}),e.jsxs(Ae,{children:["You are changing the slug from “",n.slug,"” to “",j,"”. This may break external bookmarks and SEO links."]})]}),e.jsx(ha,{host:i,contentId:s}),e.jsxs(St,{children:[e.jsx(S,{variant:"outline",onClick:()=>re(!1),children:"Cancel"}),e.jsx(S,{onClick:()=>{re(!1),ge()},children:"Publish Anyway"})]})]})})]})}function ha({host:i,contentId:t}){const{data:s}=jt(i,t,!0);return!s||s.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 ",s.count," other"," ",s.count===1?"item":"items",":"]}),e.jsxs("ul",{className:"mt-1 list-disc pl-5 text-yellow-700 dark:text-yellow-300",children:[s.items.slice(0,5).map(n=>e.jsxs("li",{children:[n.title," (",n.collection,")"]},`${n.contentId}-${n.fieldName}`)),s.items.length>5&&e.jsxs("li",{children:["and ",s.items.length-5," more..."]})]})]})}function ma({deleteOpen:i,setDeleteOpen:t,onDelete:s,host:n,contentId:a}){const{data:r}=jt(n,a,i);return e.jsxs(e.Fragment,{children:[e.jsx(Is,{}),e.jsxs(ke,{open:i,onOpenChange:t,children:[e.jsx(Ps,{asChild:!0,children:e.jsxs(S,{variant:"destructive",className:"w-full",children:[e.jsx(Mt,{className:"mr-2 h-4 w-4"}),"Delete"]})}),e.jsxs(Ie,{children:[e.jsxs(Pe,{children:[e.jsx(De,{children:"Delete content?"}),e.jsx(Ae,{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(l=>e.jsxs("li",{children:[l.title," (",l.collection,")"]},`${l.contentId}-${l.fieldName}`)),r.items.length>5&&e.jsxs("li",{children:["and ",r.items.length-5," more..."]})]})]}),e.jsxs(St,{children:[e.jsx(S,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(S,{variant:"destructive",onClick:s,children:"Delete"})]})]})]})]})}function pa({host:i,contentId:t,onViewVersion:s}){const{data:n}=gt(i,t),[a,r]=p.useState(!1),l=n?.items??[],o=l.map(c=>c.createdBy).filter(Boolean),{resolve:u}=Ds(o);return l.length===0?null:e.jsx($,{children:e.jsx(V,{className:"pt-4",children:e.jsxs(It,{open:a,onOpenChange:r,children:[e.jsxs(Pt,{className:"flex w-full items-center gap-2 text-sm font-medium",children:[e.jsx(_t,{className:R("h-4 w-4 transition",a&&"rotate-90")}),"Version History (",l.length,")"]}),e.jsx(Dt,{className:"mt-2",children:e.jsx("div",{className:"space-y-1",children:l.map((c,m)=>e.jsxs("button",{className:"py-1 text-sm hover:bg-muted rounded px-1 -mx-1 transition-colors w-full text-left",onClick:()=>s(c),children:[e.jsx("span",{children:Re(c.createdAt)}),c.createdBy&&e.jsx("span",{className:"ml-2 text-muted-foreground",children:u(c.createdBy)}),c.title&&e.jsx("span",{className:"ml-2 text-muted-foreground",children:c.title})]},`${c.createdAt}-${m}`))})})]})})})}const Ea=Object.freeze(Object.defineProperty({__proto__:null,ContentEditPage:da},Symbol.toStringTag,{value:"Module"}));export{pe as C,$t as F,Et as M,Ea as a};
@@ -0,0 +1 @@
1
+ import{j as e}from"./tanstack-BO6c-AOu.js";import{u as re,e as ie,r as c}from"./react-vendor-DNVhVxD7.js";import{t as oe,B as D,s as d,I as de,X as w,S as ue,a as he}from"./index-Ds50UTAc.js";import{d as me,e as xe,a as ge,b as je,c as fe}from"./useContent-CSobIico.js";import{u as pe}from"./useTags-CYqbj5cK.js";import{u as be}from"./useDebouncedValue-Bf8UizjU.js";import{m as ve}from"./media-url-DIg_vSyf.js";import{B as p}from"./badge-0Z1nL6DI.js";import{C as Z}from"./checkbox-BPqrj_XS.js";import{S as k,a as _,b as T,c as y,d as j}from"./select-CJXZv4wv.js";import{T as Se,a as Ne,b as G,c as b,d as Ce,e as v}from"./table-B3EHrN_H.js";import{a as we}from"./format-CZ9bpk32.js";import{g as ke,a as _e}from"./contentStatus-DfWHjFVB.js";import{B as Te}from"./BulkActionBar-BMcUBJSH.js";import{P as ye}from"./plus-BgHSYWJN.js";import{S as Ae}from"./search-DIzcfCVh.js";import"./radix-DQ3amgxj.js";import"./check-BGA0ADyt.js";const V=3,Ie=[{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"}],Q=[{value:"all",label:"All statuses"},{value:"draft",label:"Draft"},{value:"published",label:"Published"},{value:"changed",label:"Changed"},{value:"unpublished",label:"Unpublished"}];function Qe(){const{host:l,collection:a}=re(),S=ie(),{collections:J}=oe(),[A,I]=c.useState(""),[$,K]=c.useState("prefix"),[u,L]=c.useState(),[h,M]=c.useState(),[N,W]=c.useState("updated_desc"),[Y,O]=c.useState(),[i,m]=c.useState(new Set),x=be(A,300),r=c.useCallback(()=>O(void 0),[]),ee=c.useMemo(()=>{const s={};return x&&(s.q=x,s.search=$),u&&(s.tag=u),h&&(s.status=h),N!=="updated_desc"&&(s.sort=N),s},[x,$,u,h,N]),g=J.find(s=>s.name===a),{data:f,isLoading:se}=me(l,a,ee,Y),P=xe(l),R=ge(l),q=je(l),E=fe(l),{data:z}=pe(l),F=c.useMemo(()=>z?.map(s=>s.tag)??[],[z]);if(g?.singleton&&f?.items.length===1)return S(`/sites/${l}/content/${a}/${f.items[0].contentId}`,{replace:!0}),null;const B=f?.items,U=B?.map(s=>s.contentId)??[],H=U.length>0&&U.every(s=>i.has(s));function te(s){m(o=>{const t=new Set(o);return t.has(s)?t.delete(s):t.add(s),t})}function le(){m(H?new Set:new Set(U))}const X=!!(x||u||h),ae=!!x,ne=R.isPending||q.isPending||E.isPending;async function ce(){try{const s=await P.mutateAsync({collection:a,title:g?.label??a});d.success("Singleton content recreated"),S(`/sites/${l}/content/${a}/${s.contentId}`)}catch(s){d.error("Failed to recreate singleton",{description:s instanceof Error?s.message:void 0})}}return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:g?.label??a}),!g?.singleton&&e.jsxs(D,{onClick:()=>S(`/sites/${l}/content/${a}/new`),children:[e.jsx(ye,{className:"mr-2 h-4 w-4"}),"New"]})]}),i.size>0?e.jsx(Te,{selectedCount:i.size,onPublish:async()=>{const s=[...i],t=(await R.mutateAsync(s)).filter(n=>n.status==="rejected").length;t?d.error(`${t} of ${s.length} failed to publish`):d.success(`${s.length} item(s) published`),m(new Set)},onUnpublish:async()=>{const s=[...i],t=(await q.mutateAsync(s)).filter(n=>n.status==="rejected").length;t?d.error(`${t} of ${s.length} failed to unpublish`):d.success(`${s.length} item(s) unpublished`),m(new Set)},onDelete:async()=>{const s=[...i],t=(await E.mutateAsync(s)).filter(n=>n.status==="rejected").length;t?d.error(`${t} of ${s.length} failed to delete`):d.success(`${s.length} item(s) deleted`),m(new Set)},onClear:()=>m(new Set),isPending:ne}):e.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:"relative flex items-center",children:[e.jsx(Ae,{className:"absolute left-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(de,{placeholder:"Search titles...",value:A,onChange:s=>{I(s.target.value),r()},className:"w-56 pl-8 pr-8"}),A&&e.jsx("button",{onClick:()=>{I(""),r()},className:"absolute right-2 text-muted-foreground hover:text-foreground",children:e.jsx(w,{className:"h-4 w-4"})})]}),e.jsxs(k,{value:$,onValueChange:s=>{K(s),r()},children:[e.jsx(_,{className:"w-[130px]",children:e.jsx(T,{})}),e.jsxs(y,{children:[e.jsx(j,{value:"prefix",children:"Starts with"}),e.jsx(j,{value:"full",children:"Contains"})]})]}),F.length>0&&e.jsxs(k,{value:u??"__all__",onValueChange:s=>{L(s==="__all__"?void 0:s),r()},children:[e.jsx(_,{className:"w-[140px]",children:e.jsx(T,{placeholder:"Tag"})}),e.jsxs(y,{children:[e.jsx(j,{value:"__all__",children:"All tags"}),F.map(s=>e.jsx(j,{value:s,children:s},s))]})]}),e.jsxs(k,{value:h??"all",onValueChange:s=>{M(s==="all"?void 0:s),r()},children:[e.jsx(_,{className:"w-[150px]",children:e.jsx(T,{})}),e.jsx(y,{children:Q.map(s=>e.jsx(j,{value:s.value??"all",children:s.label},s.value??"all"))})]}),e.jsx("div",{className:"ml-auto",children:e.jsxs(k,{value:N,onValueChange:s=>{W(s),r()},disabled:ae,children:[e.jsx(_,{className:"w-[170px]",children:e.jsx(T,{})}),e.jsx(y,{children:Ie.map(s=>e.jsx(j,{value:s.value,disabled:s.requiresCollection&&!a,children:s.label},s.value))})]})})]}),X&&i.size===0&&e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-1.5",children:[x&&e.jsxs(p,{variant:"secondary",className:"gap-1",children:["Search: ",x,e.jsx("button",{onClick:()=>{I(""),r()},children:e.jsx(w,{className:"h-3 w-3"})})]}),u&&e.jsxs(p,{variant:"secondary",className:"gap-1",children:["Tag: ",u,e.jsx("button",{onClick:()=>{L(void 0),r()},children:e.jsx(w,{className:"h-3 w-3"})})]}),h&&e.jsxs(p,{variant:"secondary",className:"gap-1",children:["Status: ",Q.find(s=>s.value===h)?.label,e.jsx("button",{onClick:()=>{M(void 0),r()},children:e.jsx(w,{className:"h-3 w-3"})})]})]}),se?e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((s,o)=>e.jsx(ue,{className:"h-12 w-full"},o))}):B?.length?e.jsxs(e.Fragment,{children:[e.jsxs(Se,{children:[e.jsx(Ne,{children:e.jsxs(G,{children:[e.jsx(b,{className:"w-10",children:e.jsx(Z,{checked:H,onCheckedChange:le,"aria-label":"Select all"})}),e.jsx(b,{children:"Title"}),e.jsx(b,{children:"Slug"}),e.jsx(b,{children:"Status"}),e.jsx(b,{children:"Updated"})]})}),e.jsx(Ce,{children:B.map(s=>{const o=ke(s.publishedAt,s.lastPublishedAt,s.publishedBlockId,s.lastDraftBlockId),t=_e(o),n=s.tags??[];return e.jsxs(G,{className:"cursor-pointer",onClick:()=>S(`/sites/${l}/content/${a}/${s.contentId}`),children:[e.jsx(v,{onClick:C=>C.stopPropagation(),children:e.jsx(Z,{checked:i.has(s.contentId),onCheckedChange:()=>te(s.contentId),"aria-label":`Select ${s.title||"Untitled"}`})}),e.jsx(v,{className:"font-medium",children:e.jsxs("div",{className:"flex items-center gap-3",children:[s.coverUrl&&e.jsx("img",{src:ve(s.coverUrl),alt:"",className:"h-8 w-8 rounded object-cover flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{children:s.title||"Untitled"}),n.length>0&&e.jsxs("div",{className:"mt-0.5 flex flex-wrap gap-1",children:[n.slice(0,V).map(C=>e.jsx(p,{variant:"outline",className:"text-[10px] px-1.5 py-0 font-normal text-muted-foreground",children:C},C)),n.length>V&&e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",n.length-V," more"]})]})]})]})}),e.jsx(v,{className:"text-muted-foreground text-sm",children:s.slug||"—"}),e.jsx(v,{children:e.jsx(p,{variant:t.variant,children:t.label})}),e.jsx(v,{className:"text-muted-foreground",children:s.lastDraftAt?we(s.lastDraftAt):"—"})]},s.contentId)})})]}),f?.hasMore&&e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx(D,{variant:"outline",onClick:()=>O(f.cursor??void 0),children:"Load More"})})]}):g?.singleton?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-muted-foreground",children:"Singleton content is missing. Click below to recreate it."}),e.jsxs(D,{onClick:ce,disabled:P.isPending,children:[P.isPending&&e.jsx(he,{className:"mr-2 h-4 w-4 animate-spin"}),"Recreate ",g.label]})]}):e.jsx("p",{className:"text-muted-foreground",children:X?"No content matches the current filters.":"No content yet."})]})}export{Qe as ContentListPage};