emdash 1.3.0 → 1.3.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 (1451) hide show
  1. package/dist/action-token-B1ds4laA.mjs +26 -0
  2. package/dist/action-token-B1ds4laA.mjs.map +1 -0
  3. package/dist/activation-sGF9br3X.mjs +387 -0
  4. package/dist/activation-sGF9br3X.mjs.map +1 -0
  5. package/dist/adapters-BOMSX9PU.d.mts +173 -0
  6. package/dist/adapters-BOMSX9PU.d.mts.map +1 -0
  7. package/dist/allowed-origins-CovsTkm3.mjs +116 -0
  8. package/dist/allowed-origins-CovsTkm3.mjs.map +1 -0
  9. package/dist/api/route-utils.d.mts +4 -4
  10. package/dist/api/route-utils.mjs +59 -57
  11. package/dist/api/route-utils.mjs.map +1 -1
  12. package/dist/api/schemas/index.d.mts +1 -1
  13. package/dist/api/schemas/index.mjs +11 -11
  14. package/dist/api-C_LxFnOm.mjs +5077 -0
  15. package/dist/api-C_LxFnOm.mjs.map +1 -0
  16. package/dist/api-tokens-DQ9Ee-vP.mjs +173 -0
  17. package/dist/api-tokens-DQ9Ee-vP.mjs.map +1 -0
  18. package/dist/apply-CLjfxvyH.mjs +1758 -0
  19. package/dist/apply-CLjfxvyH.mjs.map +1 -0
  20. package/dist/approvals-ocK89i4H.mjs +460 -0
  21. package/dist/approvals-ocK89i4H.mjs.map +1 -0
  22. package/dist/artifact-fetch-CgvvpoWQ.mjs +659 -0
  23. package/dist/artifact-fetch-CgvvpoWQ.mjs.map +1 -0
  24. package/dist/artifacts-DwOYYBQm.mjs +323 -0
  25. package/dist/artifacts-DwOYYBQm.mjs.map +1 -0
  26. package/dist/astro/image-endpoint.mjs +12 -2
  27. package/dist/astro/image-endpoint.mjs.map +1 -1
  28. package/dist/astro/index.d.mts +14 -14
  29. package/dist/astro/index.mjs +23 -12
  30. package/dist/astro/index.mjs.map +1 -1
  31. package/dist/astro/middleware/auth.d.mts +12 -12
  32. package/dist/astro/middleware/auth.mjs +10 -10
  33. package/dist/astro/middleware/media-usage-write-fence.mjs +5 -5
  34. package/dist/astro/middleware/redirect.d.mts.map +1 -1
  35. package/dist/astro/middleware/redirect.mjs +128 -48
  36. package/dist/astro/middleware/redirect.mjs.map +1 -1
  37. package/dist/astro/middleware/request-context.d.mts.map +1 -1
  38. package/dist/astro/middleware/request-context.mjs +12 -8
  39. package/dist/astro/middleware/request-context.mjs.map +1 -1
  40. package/dist/astro/middleware/setup.mjs +1 -1
  41. package/dist/astro/middleware.d.mts +12 -12
  42. package/dist/astro/middleware.d.mts.map +1 -1
  43. package/dist/astro/middleware.mjs +134 -124
  44. package/dist/astro/middleware.mjs.map +1 -1
  45. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +16 -16
  46. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +16 -16
  47. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +6 -6
  48. package/dist/astro/routes/api/admin/api-tokens/index.mjs +7 -7
  49. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +7 -7
  50. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +19 -19
  51. package/dist/astro/routes/api/admin/byline-fields/index.mjs +19 -19
  52. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +19 -19
  53. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +29 -28
  54. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs.map +1 -1
  55. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +29 -28
  56. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs.map +1 -1
  57. package/dist/astro/routes/api/admin/bylines/index.mjs +29 -28
  58. package/dist/astro/routes/api/admin/bylines/index.mjs.map +1 -1
  59. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +21 -21
  60. package/dist/astro/routes/api/admin/comments/_id_.mjs +8 -8
  61. package/dist/astro/routes/api/admin/comments/bulk.mjs +20 -20
  62. package/dist/astro/routes/api/admin/comments/counts.mjs +8 -8
  63. package/dist/astro/routes/api/admin/comments/index.mjs +20 -20
  64. package/dist/astro/routes/api/admin/core-update.mjs +7 -7
  65. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +6 -6
  66. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +5 -5
  67. package/dist/astro/routes/api/admin/media-usage/activation.mjs +22 -22
  68. package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.mjs +23 -23
  69. package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.mjs +23 -23
  70. package/dist/astro/routes/api/admin/media-usage/progress.mjs +27 -26
  71. package/dist/astro/routes/api/admin/media-usage/progress.mjs.map +1 -1
  72. package/dist/astro/routes/api/admin/media-usage/repair.mjs +33 -32
  73. package/dist/astro/routes/api/admin/media-usage/repair.mjs.map +1 -1
  74. package/dist/astro/routes/api/admin/media-usage/work/index.mjs +23 -23
  75. package/dist/astro/routes/api/admin/media-usage/work/retry.mjs +23 -23
  76. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +6 -6
  77. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +6 -6
  78. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +8 -8
  79. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +8 -8
  80. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +81 -79
  81. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -1
  82. package/dist/astro/routes/api/admin/plugins/_id_/mcp.mjs +7 -7
  83. package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs +80 -78
  84. package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs.map +1 -1
  85. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +80 -78
  86. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -1
  87. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +91 -89
  88. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -1
  89. package/dist/astro/routes/api/admin/plugins/index.mjs +81 -79
  90. package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -1
  91. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +7 -7
  92. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +80 -78
  93. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -1
  94. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +90 -88
  95. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -1
  96. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +80 -78
  97. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -1
  98. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +80 -78
  99. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -1
  100. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +92 -90
  101. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -1
  102. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +9 -9
  103. package/dist/astro/routes/api/admin/plugins/registry/install.mjs +82 -80
  104. package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -1
  105. package/dist/astro/routes/api/admin/plugins/registry/publisher-handle.mjs +7 -7
  106. package/dist/astro/routes/api/admin/plugins/registry/verify.mjs +81 -79
  107. package/dist/astro/routes/api/admin/plugins/registry/verify.mjs.map +1 -1
  108. package/dist/astro/routes/api/admin/plugins/updates.mjs +80 -78
  109. package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -1
  110. package/dist/astro/routes/api/admin/scheduled-policy-rejections/_collection_/_id_.mjs +6 -6
  111. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +80 -78
  112. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -1
  113. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +7 -7
  114. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +80 -78
  115. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -1
  116. package/dist/astro/routes/api/admin/transfer/_...path_.mjs +4 -4
  117. package/dist/astro/routes/api/admin/transfer/approvals/_id_/approve.mjs +45 -43
  118. package/dist/astro/routes/api/admin/transfer/approvals/_id_/approve.mjs.map +1 -1
  119. package/dist/astro/routes/api/admin/transfer/approvals/_id_/deny.mjs +45 -43
  120. package/dist/astro/routes/api/admin/transfer/approvals/_id_/deny.mjs.map +1 -1
  121. package/dist/astro/routes/api/admin/transfer/approvals/index.mjs +47 -45
  122. package/dist/astro/routes/api/admin/transfer/approvals/index.mjs.map +1 -1
  123. package/dist/astro/routes/api/admin/transfer/capabilities.mjs +47 -45
  124. package/dist/astro/routes/api/admin/transfer/capabilities.mjs.map +1 -1
  125. package/dist/astro/routes/api/admin/transfer/exports/_id_/advance.mjs +47 -45
  126. package/dist/astro/routes/api/admin/transfer/exports/_id_/advance.mjs.map +1 -1
  127. package/dist/astro/routes/api/admin/transfer/exports/_id_/archive.mjs +48 -46
  128. package/dist/astro/routes/api/admin/transfer/exports/_id_/archive.mjs.map +1 -1
  129. package/dist/astro/routes/api/admin/transfer/exports/_id_/files/_...path_.mjs +48 -46
  130. package/dist/astro/routes/api/admin/transfer/exports/_id_/files/_...path_.mjs.map +1 -1
  131. package/dist/astro/routes/api/admin/transfer/exports/_id_/index.mjs +47 -45
  132. package/dist/astro/routes/api/admin/transfer/exports/_id_/index.mjs.map +1 -1
  133. package/dist/astro/routes/api/admin/transfer/exports/_id_/manifest.mjs +48 -46
  134. package/dist/astro/routes/api/admin/transfer/exports/_id_/manifest.mjs.map +1 -1
  135. package/dist/astro/routes/api/admin/transfer/exports/index.mjs +49 -47
  136. package/dist/astro/routes/api/admin/transfer/exports/index.mjs.map +1 -1
  137. package/dist/astro/routes/api/admin/transfer/imports/_id_/abandon.mjs +47 -45
  138. package/dist/astro/routes/api/admin/transfer/imports/_id_/abandon.mjs.map +1 -1
  139. package/dist/astro/routes/api/admin/transfer/imports/_id_/advance.mjs +47 -45
  140. package/dist/astro/routes/api/admin/transfer/imports/_id_/advance.mjs.map +1 -1
  141. package/dist/astro/routes/api/admin/transfer/imports/_id_/analyze.mjs +49 -47
  142. package/dist/astro/routes/api/admin/transfer/imports/_id_/analyze.mjs.map +1 -1
  143. package/dist/astro/routes/api/admin/transfer/imports/_id_/cancel.mjs +47 -45
  144. package/dist/astro/routes/api/admin/transfer/imports/_id_/cancel.mjs.map +1 -1
  145. package/dist/astro/routes/api/admin/transfer/imports/_id_/execute.mjs +49 -47
  146. package/dist/astro/routes/api/admin/transfer/imports/_id_/execute.mjs.map +1 -1
  147. package/dist/astro/routes/api/admin/transfer/imports/_id_/files/_...path_.mjs +47 -45
  148. package/dist/astro/routes/api/admin/transfer/imports/_id_/files/_...path_.mjs.map +1 -1
  149. package/dist/astro/routes/api/admin/transfer/imports/_id_/index.mjs +47 -45
  150. package/dist/astro/routes/api/admin/transfer/imports/_id_/index.mjs.map +1 -1
  151. package/dist/astro/routes/api/admin/transfer/imports/_id_/missing.mjs +49 -47
  152. package/dist/astro/routes/api/admin/transfer/imports/_id_/missing.mjs.map +1 -1
  153. package/dist/astro/routes/api/admin/transfer/imports/_id_/plan.mjs +47 -45
  154. package/dist/astro/routes/api/admin/transfer/imports/_id_/plan.mjs.map +1 -1
  155. package/dist/astro/routes/api/admin/transfer/imports/_id_/receipt.mjs +47 -45
  156. package/dist/astro/routes/api/admin/transfer/imports/_id_/receipt.mjs.map +1 -1
  157. package/dist/astro/routes/api/admin/transfer/imports/index.mjs +49 -47
  158. package/dist/astro/routes/api/admin/transfer/imports/index.mjs.map +1 -1
  159. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +5 -5
  160. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +4 -4
  161. package/dist/astro/routes/api/admin/users/_id_/index.mjs +17 -17
  162. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +6 -6
  163. package/dist/astro/routes/api/admin/users/index.mjs +16 -16
  164. package/dist/astro/routes/api/auth/dev-bypass.mjs +6 -6
  165. package/dist/astro/routes/api/auth/handover.mjs +6 -6
  166. package/dist/astro/routes/api/auth/invite/accept.mjs +4 -4
  167. package/dist/astro/routes/api/auth/invite/complete.mjs +21 -21
  168. package/dist/astro/routes/api/auth/invite/index.mjs +18 -18
  169. package/dist/astro/routes/api/auth/invite/register-options.mjs +19 -19
  170. package/dist/astro/routes/api/auth/logout.mjs +5 -5
  171. package/dist/astro/routes/api/auth/magic-link/send.mjs +20 -20
  172. package/dist/astro/routes/api/auth/magic-link/verify.mjs +17 -17
  173. package/dist/astro/routes/api/auth/me.mjs +17 -17
  174. package/dist/astro/routes/api/auth/mode.mjs +5 -5
  175. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +8 -8
  176. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
  177. package/dist/astro/routes/api/auth/passkey/_id_.mjs +16 -16
  178. package/dist/astro/routes/api/auth/passkey/index.mjs +4 -4
  179. package/dist/astro/routes/api/auth/passkey/options.mjs +21 -21
  180. package/dist/astro/routes/api/auth/passkey/register/options.mjs +19 -19
  181. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +20 -20
  182. package/dist/astro/routes/api/auth/passkey/verify.mjs +21 -21
  183. package/dist/astro/routes/api/auth/signup/complete.mjs +21 -21
  184. package/dist/astro/routes/api/auth/signup/request.mjs +19 -19
  185. package/dist/astro/routes/api/auth/signup/verify.mjs +4 -4
  186. package/dist/astro/routes/api/calendar.mjs +17 -17
  187. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +13 -13
  188. package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +21 -21
  189. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +5 -5
  190. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +20 -20
  191. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +5 -5
  192. package/dist/astro/routes/api/content/_collection_/_id_/lock.mjs +19 -19
  193. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +6 -6
  194. package/dist/astro/routes/api/content/_collection_/_id_/plugin-extensions/_pluginId_/_kind_/_extensionId_.mjs +12 -12
  195. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +36 -35
  196. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs.map +1 -1
  197. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +20 -20
  198. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs +40 -39
  199. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs.map +1 -1
  200. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs +40 -39
  201. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs.map +1 -1
  202. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +6 -6
  203. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +5 -5
  204. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +20 -20
  205. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.d.mts.map +1 -1
  206. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +40 -32
  207. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs.map +1 -1
  208. package/dist/astro/routes/api/content/_collection_/_id_/translations.d.mts.map +1 -1
  209. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +9 -5
  210. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs.map +1 -1
  211. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +20 -20
  212. package/dist/astro/routes/api/content/_collection_/_id_.mjs +20 -20
  213. package/dist/astro/routes/api/content/_collection_/authors.mjs +5 -5
  214. package/dist/astro/routes/api/content/_collection_/index.mjs +17 -17
  215. package/dist/astro/routes/api/content/_collection_/trash.mjs +17 -17
  216. package/dist/astro/routes/api/dashboard.mjs +21 -15
  217. package/dist/astro/routes/api/dashboard.mjs.map +1 -1
  218. package/dist/astro/routes/api/dev/emails.mjs +5 -5
  219. package/dist/astro/routes/api/dev/scheduled-tasks.mjs +119 -117
  220. package/dist/astro/routes/api/dev/scheduled-tasks.mjs.map +1 -1
  221. package/dist/astro/routes/api/health.mjs +6 -6
  222. package/dist/astro/routes/api/import/probe.d.mts +3 -3
  223. package/dist/astro/routes/api/import/probe.mjs +31 -29
  224. package/dist/astro/routes/api/import/probe.mjs.map +1 -1
  225. package/dist/astro/routes/api/import/wordpress/analyze.mjs +8 -8
  226. package/dist/astro/routes/api/import/wordpress/execute.d.mts +13 -13
  227. package/dist/astro/routes/api/import/wordpress/execute.mjs +31 -30
  228. package/dist/astro/routes/api/import/wordpress/execute.mjs.map +1 -1
  229. package/dist/astro/routes/api/import/wordpress/media.d.mts +12 -12
  230. package/dist/astro/routes/api/import/wordpress/media.mjs +21 -21
  231. package/dist/astro/routes/api/import/wordpress/prepare.mjs +22 -22
  232. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +13 -13
  233. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +32 -31
  234. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs.map +1 -1
  235. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
  236. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +31 -29
  237. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs.map +1 -1
  238. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +13 -13
  239. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +42 -40
  240. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs.map +1 -1
  241. package/dist/astro/routes/api/manifest.mjs +6 -6
  242. package/dist/astro/routes/api/mcp.mjs +117 -100
  243. package/dist/astro/routes/api/mcp.mjs.map +1 -1
  244. package/dist/astro/routes/api/media/_id_/confirm.mjs +21 -21
  245. package/dist/astro/routes/api/media/_id_/replace.mjs +18 -18
  246. package/dist/astro/routes/api/media/_id_/upload.mjs +9 -9
  247. package/dist/astro/routes/api/media/_id_/usage.mjs +35 -34
  248. package/dist/astro/routes/api/media/_id_/usage.mjs.map +1 -1
  249. package/dist/astro/routes/api/media/_id_.mjs +33 -32
  250. package/dist/astro/routes/api/media/_id_.mjs.map +1 -1
  251. package/dist/astro/routes/api/media/asset/_id_/_filename_.mjs +6 -6
  252. package/dist/astro/routes/api/media/file/_...key_.mjs +21 -13
  253. package/dist/astro/routes/api/media/file/_...key_.mjs.map +1 -1
  254. package/dist/astro/routes/api/media/folders/_id_.mjs +18 -18
  255. package/dist/astro/routes/api/media/folders/index.mjs +18 -18
  256. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +5 -5
  257. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +5 -5
  258. package/dist/astro/routes/api/media/providers/index.mjs +5 -5
  259. package/dist/astro/routes/api/media/upload-url.mjs +20 -20
  260. package/dist/astro/routes/api/media.mjs +37 -36
  261. package/dist/astro/routes/api/media.mjs.map +1 -1
  262. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +22 -21
  263. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs.map +1 -1
  264. package/dist/astro/routes/api/menus/_name_/items.mjs +22 -21
  265. package/dist/astro/routes/api/menus/_name_/items.mjs.map +1 -1
  266. package/dist/astro/routes/api/menus/_name_/reorder.mjs +22 -21
  267. package/dist/astro/routes/api/menus/_name_/reorder.mjs.map +1 -1
  268. package/dist/astro/routes/api/menus/_name_/translations.mjs +22 -21
  269. package/dist/astro/routes/api/menus/_name_/translations.mjs.map +1 -1
  270. package/dist/astro/routes/api/menus/_name_.mjs +22 -21
  271. package/dist/astro/routes/api/menus/_name_.mjs.map +1 -1
  272. package/dist/astro/routes/api/menus/index.mjs +22 -21
  273. package/dist/astro/routes/api/menus/index.mjs.map +1 -1
  274. package/dist/astro/routes/api/oauth/authorize.mjs +6 -6
  275. package/dist/astro/routes/api/oauth/device/authorize.mjs +8 -8
  276. package/dist/astro/routes/api/oauth/device/code.mjs +11 -11
  277. package/dist/astro/routes/api/oauth/device/token.mjs +10 -10
  278. package/dist/astro/routes/api/oauth/register.mjs +7 -7
  279. package/dist/astro/routes/api/oauth/token/refresh.mjs +8 -8
  280. package/dist/astro/routes/api/oauth/token/revoke.mjs +8 -8
  281. package/dist/astro/routes/api/oauth/token.mjs +8 -8
  282. package/dist/astro/routes/api/openapi.json.mjs +22 -22
  283. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +12 -12
  284. package/dist/astro/routes/api/redirects/404s/index.mjs +23 -22
  285. package/dist/astro/routes/api/redirects/404s/index.mjs.map +1 -1
  286. package/dist/astro/routes/api/redirects/404s/summary.mjs +23 -22
  287. package/dist/astro/routes/api/redirects/404s/summary.mjs.map +1 -1
  288. package/dist/astro/routes/api/redirects/_id_.mjs +24 -23
  289. package/dist/astro/routes/api/redirects/_id_.mjs.map +1 -1
  290. package/dist/astro/routes/api/redirects/index.mjs +24 -23
  291. package/dist/astro/routes/api/redirects/index.mjs.map +1 -1
  292. package/dist/astro/routes/api/relations/_id_/index.mjs +40 -39
  293. package/dist/astro/routes/api/relations/_id_/index.mjs.map +1 -1
  294. package/dist/astro/routes/api/relations/index.mjs +40 -39
  295. package/dist/astro/routes/api/relations/index.mjs.map +1 -1
  296. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +5 -5
  297. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +19 -19
  298. package/dist/astro/routes/api/schema/block-types/_slug_/index.mjs +80 -78
  299. package/dist/astro/routes/api/schema/block-types/_slug_/index.mjs.map +1 -1
  300. package/dist/astro/routes/api/schema/block-types/_slug_/versions/_version_/activate.mjs +80 -78
  301. package/dist/astro/routes/api/schema/block-types/_slug_/versions/_version_/activate.mjs.map +1 -1
  302. package/dist/astro/routes/api/schema/block-types/index.mjs +80 -78
  303. package/dist/astro/routes/api/schema/block-types/index.mjs.map +1 -1
  304. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +80 -78
  305. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -1
  306. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +80 -78
  307. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -1
  308. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +80 -78
  309. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -1
  310. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +80 -78
  311. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -1
  312. package/dist/astro/routes/api/schema/collections/index.mjs +80 -78
  313. package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -1
  314. package/dist/astro/routes/api/schema/collections/reorder.mjs +80 -78
  315. package/dist/astro/routes/api/schema/collections/reorder.mjs.map +1 -1
  316. package/dist/astro/routes/api/schema/index.mjs +20 -19
  317. package/dist/astro/routes/api/schema/index.mjs.map +1 -1
  318. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +80 -78
  319. package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -1
  320. package/dist/astro/routes/api/schema/orphans/index.mjs +80 -78
  321. package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -1
  322. package/dist/astro/routes/api/search/enable.mjs +23 -22
  323. package/dist/astro/routes/api/search/enable.mjs.map +1 -1
  324. package/dist/astro/routes/api/search/index.mjs +22 -21
  325. package/dist/astro/routes/api/search/index.mjs.map +1 -1
  326. package/dist/astro/routes/api/search/rebuild.mjs +23 -22
  327. package/dist/astro/routes/api/search/rebuild.mjs.map +1 -1
  328. package/dist/astro/routes/api/search/stats.mjs +12 -11
  329. package/dist/astro/routes/api/search/stats.mjs.map +1 -1
  330. package/dist/astro/routes/api/search/suggest.mjs +22 -21
  331. package/dist/astro/routes/api/search/suggest.mjs.map +1 -1
  332. package/dist/astro/routes/api/sections/_slug_.mjs +22 -21
  333. package/dist/astro/routes/api/sections/_slug_.mjs.map +1 -1
  334. package/dist/astro/routes/api/sections/index.mjs +22 -21
  335. package/dist/astro/routes/api/sections/index.mjs.map +1 -1
  336. package/dist/astro/routes/api/settings/backups/archives/_name_.mjs +7 -7
  337. package/dist/astro/routes/api/settings/backups/archives/index.mjs +7 -7
  338. package/dist/astro/routes/api/settings/backups/export.mjs +7 -7
  339. package/dist/astro/routes/api/settings/backups/index.mjs +8 -8
  340. package/dist/astro/routes/api/settings/domain-notify.mjs +9 -9
  341. package/dist/astro/routes/api/settings/domain.mjs +22 -20
  342. package/dist/astro/routes/api/settings/domain.mjs.map +1 -1
  343. package/dist/astro/routes/api/settings/email.mjs +6 -6
  344. package/dist/astro/routes/api/settings.mjs +29 -27
  345. package/dist/astro/routes/api/settings.mjs.map +1 -1
  346. package/dist/astro/routes/api/setup/admin-verify.mjs +23 -23
  347. package/dist/astro/routes/api/setup/admin.mjs +20 -20
  348. package/dist/astro/routes/api/setup/dev-bypass.mjs +52 -50
  349. package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -1
  350. package/dist/astro/routes/api/setup/dev-reset.mjs +4 -4
  351. package/dist/astro/routes/api/setup/index.mjs +58 -56
  352. package/dist/astro/routes/api/setup/index.mjs.map +1 -1
  353. package/dist/astro/routes/api/setup/status.mjs +6 -6
  354. package/dist/astro/routes/api/site/domain-proof.mjs +16 -14
  355. package/dist/astro/routes/api/site/domain-proof.mjs.map +1 -1
  356. package/dist/astro/routes/api/snapshot.mjs +8 -8
  357. package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs +30 -29
  358. package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs.map +1 -1
  359. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +30 -29
  360. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs.map +1 -1
  361. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +30 -29
  362. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs.map +1 -1
  363. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +30 -29
  364. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs.map +1 -1
  365. package/dist/astro/routes/api/taxonomies/_name_/translations.mjs +28 -27
  366. package/dist/astro/routes/api/taxonomies/_name_/translations.mjs.map +1 -1
  367. package/dist/astro/routes/api/taxonomies/_name_.mjs +30 -29
  368. package/dist/astro/routes/api/taxonomies/_name_.mjs.map +1 -1
  369. package/dist/astro/routes/api/taxonomies/bulk-tag.mjs +44 -43
  370. package/dist/astro/routes/api/taxonomies/bulk-tag.mjs.map +1 -1
  371. package/dist/astro/routes/api/taxonomies/index.mjs +30 -29
  372. package/dist/astro/routes/api/taxonomies/index.mjs.map +1 -1
  373. package/dist/astro/routes/api/themes/preview.mjs +6 -6
  374. package/dist/astro/routes/api/typegen.mjs +6 -6
  375. package/dist/astro/routes/api/visual-editing/action-token.mjs +6 -6
  376. package/dist/astro/routes/api/visual-editing/content/_collection_/_id_/publish.mjs +21 -21
  377. package/dist/astro/routes/api/visual-editing/toolbar-labels.mjs +4 -4
  378. package/dist/astro/routes/api/well-known/auth.mjs +1 -1
  379. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +2 -2
  380. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +2 -2
  381. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +19 -19
  382. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +24 -23
  383. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs.map +1 -1
  384. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +24 -23
  385. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs.map +1 -1
  386. package/dist/astro/routes/api/widget-areas/_name_.mjs +13 -12
  387. package/dist/astro/routes/api/widget-areas/_name_.mjs.map +1 -1
  388. package/dist/astro/routes/api/widget-areas/index.mjs +24 -23
  389. package/dist/astro/routes/api/widget-areas/index.mjs.map +1 -1
  390. package/dist/astro/routes/api/widget-components.mjs +5 -5
  391. package/dist/astro/routes/robots.txt.mjs +15 -13
  392. package/dist/astro/routes/robots.txt.mjs.map +1 -1
  393. package/dist/astro/routes/sitemap-_collection_.xml.mjs +19 -17
  394. package/dist/astro/routes/sitemap-_collection_.xml.mjs.map +1 -1
  395. package/dist/astro/routes/sitemap.xml.mjs +16 -14
  396. package/dist/astro/routes/sitemap.xml.mjs.map +1 -1
  397. package/dist/astro/types.d.mts +17 -17
  398. package/dist/audit-B8XE-0UV.mjs +127 -0
  399. package/dist/audit-B8XE-0UV.mjs.map +1 -0
  400. package/dist/auth/providers/github.d.mts +1 -1
  401. package/dist/auth/providers/google.d.mts +1 -1
  402. package/dist/auth/providers/microsoft.d.mts +1 -1
  403. package/dist/authoritative-records-LPtrIGOY.mjs +5183 -0
  404. package/dist/authoritative-records-LPtrIGOY.mjs.map +1 -0
  405. package/dist/authorize-CoDsRRp5.mjs +74 -0
  406. package/dist/authorize-CoDsRRp5.mjs.map +1 -0
  407. package/dist/backup-2Wj-hTCN.mjs +246 -0
  408. package/dist/backup-2Wj-hTCN.mjs.map +1 -0
  409. package/dist/block-types-C3gJEe7l.mjs +132 -0
  410. package/dist/block-types-C3gJEe7l.mjs.map +1 -0
  411. package/dist/block-values-CgbMtSGU.mjs +215 -0
  412. package/dist/block-values-CgbMtSGU.mjs.map +1 -0
  413. package/dist/byline-CzGZC2Zs.mjs +922 -0
  414. package/dist/byline-CzGZC2Zs.mjs.map +1 -0
  415. package/dist/byline-fields-B1qHvRps.mjs +280 -0
  416. package/dist/byline-fields-B1qHvRps.mjs.map +1 -0
  417. package/dist/byline-fields-vYd_4Q1e.mjs +123 -0
  418. package/dist/byline-fields-vYd_4Q1e.mjs.map +1 -0
  419. package/dist/byline-registry-BhzpO41z.mjs +406 -0
  420. package/dist/byline-registry-BhzpO41z.mjs.map +1 -0
  421. package/dist/bylines-BF555iIz.mjs +150 -0
  422. package/dist/bylines-BF555iIz.mjs.map +1 -0
  423. package/dist/bylines-DJx6IWWi.mjs +234 -0
  424. package/dist/bylines-DJx6IWWi.mjs.map +1 -0
  425. package/dist/cache-BWzswWB-.mjs +151 -0
  426. package/dist/cache-BWzswWB-.mjs.map +1 -0
  427. package/dist/canonical-DjF_z6GI.mjs +174 -0
  428. package/dist/canonical-DjF_z6GI.mjs.map +1 -0
  429. package/dist/capture-triggers-D7g3fOZj.mjs +362 -0
  430. package/dist/capture-triggers-D7g3fOZj.mjs.map +1 -0
  431. package/dist/challenge-store-Cfjdvw86.mjs +51 -0
  432. package/dist/challenge-store-Cfjdvw86.mjs.map +1 -0
  433. package/dist/checksum-BF4acJwn.mjs +162 -0
  434. package/dist/checksum-BF4acJwn.mjs.map +1 -0
  435. package/dist/chrome-tags-BDs29G3g.mjs +24 -0
  436. package/dist/chrome-tags-BDs29G3g.mjs.map +1 -0
  437. package/dist/chunks-CYBOL-zn.mjs +25 -0
  438. package/dist/chunks-CYBOL-zn.mjs.map +1 -0
  439. package/dist/cli/index.mjs +67 -65
  440. package/dist/cli/index.mjs.map +1 -1
  441. package/dist/client/cf-access.d.mts +1 -1
  442. package/dist/client/index.d.mts +48 -48
  443. package/dist/client/index.d.mts.map +1 -1
  444. package/dist/client/index.mjs +4 -3
  445. package/dist/client/index.mjs.map +1 -1
  446. package/dist/collection-slugs-cache-B2J5aESO.mjs +91 -0
  447. package/dist/collection-slugs-cache-B2J5aESO.mjs.map +1 -0
  448. package/dist/comment-DV7dybcs.mjs +335 -0
  449. package/dist/comment-DV7dybcs.mjs.map +1 -0
  450. package/dist/comment-reaction-CWwqiT6x.mjs +85 -0
  451. package/dist/comment-reaction-CWwqiT6x.mjs.map +1 -0
  452. package/dist/comments-DVjWJm8X.mjs +99 -0
  453. package/dist/comments-DVjWJm8X.mjs.map +1 -0
  454. package/dist/comments-Q-ILHCEI.mjs +195 -0
  455. package/dist/comments-Q-ILHCEI.mjs.map +1 -0
  456. package/dist/components-DnOmvvgg.mjs +112 -0
  457. package/dist/components-DnOmvvgg.mjs.map +1 -0
  458. package/dist/config-9IzA83_U.d.mts +6811 -0
  459. package/dist/config-9IzA83_U.d.mts.map +1 -0
  460. package/dist/config-BdQzFtmR.mjs +228 -0
  461. package/dist/config-BdQzFtmR.mjs.map +1 -0
  462. package/dist/config-Cs2RBkJ6.d.mts +41 -0
  463. package/dist/config-Cs2RBkJ6.d.mts.map +1 -0
  464. package/dist/config-Cs_AwWXI.mjs +106 -0
  465. package/dist/config-Cs_AwWXI.mjs.map +1 -0
  466. package/dist/connection-CiXgZyCY.mjs +36 -0
  467. package/dist/connection-CiXgZyCY.mjs.map +1 -0
  468. package/dist/content-Dt0Os_WQ.mjs +2109 -0
  469. package/dist/content-Dt0Os_WQ.mjs.map +1 -0
  470. package/dist/content-list-query-BK26u9Ly.d.mts +26 -0
  471. package/dist/content-list-query-BK26u9Ly.d.mts.map +1 -0
  472. package/dist/content-policy-BLDbNJOb.mjs +46 -0
  473. package/dist/content-policy-BLDbNJOb.mjs.map +1 -0
  474. package/dist/content-repair-CjwbLy4m.mjs +442 -0
  475. package/dist/content-repair-CjwbLy4m.mjs.map +1 -0
  476. package/dist/context-ErV7UdQY.mjs +2089 -0
  477. package/dist/context-ErV7UdQY.mjs.map +1 -0
  478. package/dist/credits-BRyjafiF.mjs +110 -0
  479. package/dist/credits-BRyjafiF.mjs.map +1 -0
  480. package/dist/cron-Bm5xa7tv.mjs +306 -0
  481. package/dist/cron-Bm5xa7tv.mjs.map +1 -0
  482. package/dist/dashboard-DVxQ5XiI.mjs +168 -0
  483. package/dist/dashboard-DVxQ5XiI.mjs.map +1 -0
  484. package/dist/database/migration-lock.mjs +1 -1
  485. package/dist/db/index.d.mts +3 -3
  486. package/dist/db/index.mjs +2 -2
  487. package/dist/db/libsql-migrations.d.mts +1 -1
  488. package/dist/db/libsql-migrations.mjs +5 -5
  489. package/dist/db/libsql.d.mts +1 -1
  490. package/dist/db/postgres-migrations.d.mts +1 -1
  491. package/dist/db/postgres-migrations.mjs +5 -5
  492. package/dist/db/postgres.d.mts +1 -1
  493. package/dist/db/sqlite-migrations.d.mts +1 -1
  494. package/dist/db/sqlite-migrations.mjs +5 -5
  495. package/dist/db/sqlite.d.mts +1 -1
  496. package/dist/db/sqlite.mjs +1 -1
  497. package/dist/db-errors-unnO6yiZ.mjs +65 -0
  498. package/dist/db-errors-unnO6yiZ.mjs.map +1 -0
  499. package/dist/default-B9Tf2n94.mjs +81 -0
  500. package/dist/default-B9Tf2n94.mjs.map +1 -0
  501. package/dist/deferred-tasks-CpPEqsga.d.mts +9 -0
  502. package/dist/deferred-tasks-CpPEqsga.d.mts.map +1 -0
  503. package/dist/destination-DR3IHjmy.mjs +18 -0
  504. package/dist/destination-DR3IHjmy.mjs.map +1 -0
  505. package/dist/dev-typegen-ZeWYV8Jp.mjs +29 -0
  506. package/dist/dev-typegen-ZeWYV8Jp.mjs.map +1 -0
  507. package/dist/device-flow-BbYNZ9Xi.mjs +521 -0
  508. package/dist/device-flow-BbYNZ9Xi.mjs.map +1 -0
  509. package/dist/digest-DlBa7kJl.mjs +194 -0
  510. package/dist/digest-DlBa7kJl.mjs.map +1 -0
  511. package/dist/direct-executor-5T8gkhvA.mjs +117 -0
  512. package/dist/direct-executor-5T8gkhvA.mjs.map +1 -0
  513. package/dist/dist-DY0aOmAP.mjs +810 -0
  514. package/dist/dist-DY0aOmAP.mjs.map +1 -0
  515. package/dist/email-console-v3OM8It-.mjs +50 -0
  516. package/dist/email-console-v3OM8It-.mjs.map +1 -0
  517. package/dist/email-locale-CoZo-oZx.mjs +25 -0
  518. package/dist/email-locale-CoZo-oZx.mjs.map +1 -0
  519. package/dist/emdash-runtime-DwezbIqQ.mjs +4392 -0
  520. package/dist/emdash-runtime-DwezbIqQ.mjs.map +1 -0
  521. package/dist/enrich-C3XIJi0O.mjs +194 -0
  522. package/dist/enrich-C3XIJi0O.mjs.map +1 -0
  523. package/dist/entry-lock-CY7XpdSw.d.mts +4568 -0
  524. package/dist/entry-lock-CY7XpdSw.d.mts.map +1 -0
  525. package/dist/entry-lock-DDuWaAiP.mjs +1211 -0
  526. package/dist/entry-lock-DDuWaAiP.mjs.map +1 -0
  527. package/dist/entry-lock-D_Og9Gy3.mjs +163 -0
  528. package/dist/entry-lock-D_Og9Gy3.mjs.map +1 -0
  529. package/dist/entry-locks-Cp8_BcQQ.mjs +167 -0
  530. package/dist/entry-locks-Cp8_BcQQ.mjs.map +1 -0
  531. package/dist/env-types-Br8uywYA.mjs +38 -0
  532. package/dist/env-types-Br8uywYA.mjs.map +1 -0
  533. package/dist/error-CT2SsX5S.mjs +90 -0
  534. package/dist/error-CT2SsX5S.mjs.map +1 -0
  535. package/dist/errors-BMaCpLeS.mjs +479 -0
  536. package/dist/errors-BMaCpLeS.mjs.map +1 -0
  537. package/dist/errors-DlJwot7q.mjs +120 -0
  538. package/dist/errors-DlJwot7q.mjs.map +1 -0
  539. package/dist/escape-BfbDyuQ-.mjs +9 -0
  540. package/dist/escape-BfbDyuQ-.mjs.map +1 -0
  541. package/dist/fence-BOD3SxZG.mjs +162 -0
  542. package/dist/fence-BOD3SxZG.mjs.map +1 -0
  543. package/dist/field-defs-cache-C7sR7ZeU.mjs +77 -0
  544. package/dist/field-defs-cache-C7sR7ZeU.mjs.map +1 -0
  545. package/dist/field-map-C_rDXfdJ.mjs +84 -0
  546. package/dist/field-map-C_rDXfdJ.mjs.map +1 -0
  547. package/dist/focal-point-CgCcr1Ca.mjs +23 -0
  548. package/dist/focal-point-CgCcr1Ca.mjs.map +1 -0
  549. package/dist/fts-manager-BzFo0xx6.mjs +483 -0
  550. package/dist/fts-manager-BzFo0xx6.mjs.map +1 -0
  551. package/dist/gc-B_c3DPpi.mjs +75 -0
  552. package/dist/gc-B_c3DPpi.mjs.map +1 -0
  553. package/dist/hash-A-o2ZX8O.mjs +37 -0
  554. package/dist/hash-A-o2ZX8O.mjs.map +1 -0
  555. package/dist/hook-result-f8t7hIuu.d.mts +31 -0
  556. package/dist/hook-result-f8t7hIuu.d.mts.map +1 -0
  557. package/dist/hreflang-BpUK9Lcu.mjs +105 -0
  558. package/dist/hreflang-BpUK9Lcu.mjs.map +1 -0
  559. package/dist/hreflang-D07R-RbI.d.mts +50 -0
  560. package/dist/hreflang-D07R-RbI.d.mts.map +1 -0
  561. package/dist/http-route-dispatch-C2Ep2Uf6.mjs +342 -0
  562. package/dist/http-route-dispatch-C2Ep2Uf6.mjs.map +1 -0
  563. package/dist/identity-BivQ8wkV.mjs +35 -0
  564. package/dist/identity-BivQ8wkV.mjs.map +1 -0
  565. package/dist/import-B4UvHNJz.mjs +2126 -0
  566. package/dist/import-B4UvHNJz.mjs.map +1 -0
  567. package/dist/index-C37Ty40w.d.mts +623 -0
  568. package/dist/index-C37Ty40w.d.mts.map +1 -0
  569. package/dist/index.d.mts +23 -23
  570. package/dist/index.mjs +112 -110
  571. package/dist/install-finalization-BbYaB4wj.mjs +58 -0
  572. package/dist/install-finalization-BbYaB4wj.mjs.map +1 -0
  573. package/dist/json-recordset-BjYIWFkV.mjs +12 -0
  574. package/dist/json-recordset-BjYIWFkV.mjs.map +1 -0
  575. package/dist/json-schema-Cde7le0s.mjs +15 -0
  576. package/dist/json-schema-Cde7le0s.mjs.map +1 -0
  577. package/dist/keys-CusTXpw-.mjs +61 -0
  578. package/dist/keys-CusTXpw-.mjs.map +1 -0
  579. package/dist/kinds-DogmNB6n.mjs +974 -0
  580. package/dist/kinds-DogmNB6n.mjs.map +1 -0
  581. package/dist/lifecycle-BLCoCz4T.mjs +25 -0
  582. package/dist/lifecycle-BLCoCz4T.mjs.map +1 -0
  583. package/dist/load-Dds3KhXr.mjs +28 -0
  584. package/dist/load-Dds3KhXr.mjs.map +1 -0
  585. package/dist/loader-D4w4XE7q.mjs +1420 -0
  586. package/dist/loader-D4w4XE7q.mjs.map +1 -0
  587. package/dist/loops-IYgzQdQu.mjs +205 -0
  588. package/dist/loops-IYgzQdQu.mjs.map +1 -0
  589. package/dist/manifest-builder-CGF5kujD.mjs +196 -0
  590. package/dist/manifest-builder-CGF5kujD.mjs.map +1 -0
  591. package/dist/manifest-schema-B0BxPSjB.mjs +497 -0
  592. package/dist/manifest-schema-B0BxPSjB.mjs.map +1 -0
  593. package/dist/marketplace-DNvEGLqU.mjs +257 -0
  594. package/dist/marketplace-DNvEGLqU.mjs.map +1 -0
  595. package/dist/media/image-endpoint.d.mts +3 -2
  596. package/dist/media/image-endpoint.d.mts.map +1 -1
  597. package/dist/media/image-endpoint.mjs +17 -8
  598. package/dist/media/image-endpoint.mjs.map +1 -1
  599. package/dist/media/index.d.mts +1 -1
  600. package/dist/media/index.mjs +7 -6
  601. package/dist/media/index.mjs.map +1 -1
  602. package/dist/media/local-runtime.d.mts +14 -14
  603. package/dist/media/local-runtime.d.mts.map +1 -1
  604. package/dist/media/local-runtime.mjs +18 -13
  605. package/dist/media/local-runtime.mjs.map +1 -1
  606. package/dist/media-BL9MRrSG.mjs +294 -0
  607. package/dist/media-BL9MRrSG.mjs.map +1 -0
  608. package/dist/media-B_x5B9EA.mjs +373 -0
  609. package/dist/media-B_x5B9EA.mjs.map +1 -0
  610. package/dist/media-allowlist-CpmqBbIQ.mjs +45 -0
  611. package/dist/media-allowlist-CpmqBbIQ.mjs.map +1 -0
  612. package/dist/media-folders-CNs_A_B-.mjs +210 -0
  613. package/dist/media-folders-CNs_A_B-.mjs.map +1 -0
  614. package/dist/media-qTTHVkls.mjs +416 -0
  615. package/dist/media-qTTHVkls.mjs.map +1 -0
  616. package/dist/media-url-GJboA1fl.mjs +43 -0
  617. package/dist/media-url-GJboA1fl.mjs.map +1 -0
  618. package/dist/media-usage-ClWgrX0d.mjs +282 -0
  619. package/dist/media-usage-ClWgrX0d.mjs.map +1 -0
  620. package/dist/media-usage-activation-B8Fjtq0h.mjs +78 -0
  621. package/dist/media-usage-activation-B8Fjtq0h.mjs.map +1 -0
  622. package/dist/media-usage-work-L8-Au4j-.mjs +1036 -0
  623. package/dist/media-usage-work-L8-Au4j-.mjs.map +1 -0
  624. package/dist/media-usage-work-LXgze5j9.mjs +151 -0
  625. package/dist/media-usage-work-LXgze5j9.mjs.map +1 -0
  626. package/dist/menus-BAxcbsbv.mjs +818 -0
  627. package/dist/menus-BAxcbsbv.mjs.map +1 -0
  628. package/dist/menus-BI6oBXco.mjs +92 -0
  629. package/dist/menus-BI6oBXco.mjs.map +1 -0
  630. package/dist/menus-fvGFd4m6.mjs +3725 -0
  631. package/dist/menus-fvGFd4m6.mjs.map +1 -0
  632. package/dist/migrations/index.d.mts +1 -1
  633. package/dist/migrations/index.mjs +4 -4
  634. package/dist/mime-DwhtRyUt.mjs +81 -0
  635. package/dist/mime-DwhtRyUt.mjs.map +1 -0
  636. package/dist/mode-DIDSUwuN.mjs +23 -0
  637. package/dist/mode-DIDSUwuN.mjs.map +1 -0
  638. package/dist/node-sqlite-compat-Ddr_mlR9.mjs +63 -0
  639. package/dist/node-sqlite-compat-Ddr_mlR9.mjs.map +1 -0
  640. package/dist/normalize-Ip_hFAm8.mjs +216 -0
  641. package/dist/normalize-Ip_hFAm8.mjs.map +1 -0
  642. package/dist/oauth-authorization-CcMgeT8R.mjs +274 -0
  643. package/dist/oauth-authorization-CcMgeT8R.mjs.map +1 -0
  644. package/dist/oauth-clients-C_osi0PU.mjs +266 -0
  645. package/dist/oauth-clients-C_osi0PU.mjs.map +1 -0
  646. package/dist/oauth-state-store-DGLP-6CK.mjs +50 -0
  647. package/dist/oauth-state-store-DGLP-6CK.mjs.map +1 -0
  648. package/dist/oauth-user-lookup-z77Ee0Hm.mjs +26 -0
  649. package/dist/oauth-user-lookup-z77Ee0Hm.mjs.map +1 -0
  650. package/dist/object-cache/memory.d.mts +1 -1
  651. package/dist/object-cache-EjasjtoQ.mjs +586 -0
  652. package/dist/object-cache-EjasjtoQ.mjs.map +1 -0
  653. package/dist/options-CmUpkyKW.d.mts +81 -0
  654. package/dist/options-CmUpkyKW.d.mts.map +1 -0
  655. package/dist/ownership-DCk5NutQ.mjs +12 -0
  656. package/dist/ownership-DCk5NutQ.mjs.map +1 -0
  657. package/dist/page/index.d.mts +2 -2
  658. package/dist/page/index.mjs +14 -12
  659. package/dist/page/index.mjs.map +1 -1
  660. package/dist/parse-2W-E2f7w.mjs +81 -0
  661. package/dist/parse-2W-E2f7w.mjs.map +1 -0
  662. package/dist/parse-6pN8Xqg5.d.mts +176 -0
  663. package/dist/parse-6pN8Xqg5.d.mts.map +1 -0
  664. package/dist/passkey-config-DTTZB6EI.mjs +46 -0
  665. package/dist/passkey-config-DTTZB6EI.mjs.map +1 -0
  666. package/dist/paths-CQA62503.mjs +77 -0
  667. package/dist/paths-CQA62503.mjs.map +1 -0
  668. package/dist/patterns-CryGz_EV.mjs +159 -0
  669. package/dist/patterns-CryGz_EV.mjs.map +1 -0
  670. package/dist/placeholder-BlfXkucE.d.mts +313 -0
  671. package/dist/placeholder-BlfXkucE.d.mts.map +1 -0
  672. package/dist/plan-B95eiwnF.mjs +135 -0
  673. package/dist/plan-B95eiwnF.mjs.map +1 -0
  674. package/dist/plugin-test-runtime.d.mts +14 -14
  675. package/dist/plugin-test-runtime.d.mts.map +1 -1
  676. package/dist/plugin-test-runtime.mjs +121 -119
  677. package/dist/plugin-tool-name-BDA7m4Xa.mjs +27 -0
  678. package/dist/plugin-tool-name-BDA7m4Xa.mjs.map +1 -0
  679. package/dist/plugin-types.d.mts +2 -2
  680. package/dist/plugin-utils.d.mts +12 -12
  681. package/dist/plugins/adapt-sandbox-entry.d.mts +12 -12
  682. package/dist/plugins/adapt-sandbox-entry.mjs +4 -4
  683. package/dist/plugins/host.d.mts +5 -5
  684. package/dist/plugins/host.mjs +57 -55
  685. package/dist/plugins-BhxLJ008.mjs +261 -0
  686. package/dist/plugins-BhxLJ008.mjs.map +1 -0
  687. package/dist/policy-DOJ2sPqB.mjs +53 -0
  688. package/dist/policy-DOJ2sPqB.mjs.map +1 -0
  689. package/dist/portable-text-RCMpCj47.mjs +311 -0
  690. package/dist/portable-text-RCMpCj47.mjs.map +1 -0
  691. package/dist/preview-DFwL5APO.mjs +107 -0
  692. package/dist/preview-DFwL5APO.mjs.map +1 -0
  693. package/dist/protocol-B-ztxp_y.d.mts +65 -0
  694. package/dist/protocol-B-ztxp_y.d.mts.map +1 -0
  695. package/dist/public-plugin-api-routes-ik4fPZMv.mjs +316 -0
  696. package/dist/public-plugin-api-routes-ik4fPZMv.mjs.map +1 -0
  697. package/dist/public-submission-C5JZIykp.mjs +251 -0
  698. package/dist/public-submission-C5JZIykp.mjs.map +1 -0
  699. package/dist/public-url-CQwzRljH.mjs +101 -0
  700. package/dist/public-url-CQwzRljH.mjs.map +1 -0
  701. package/dist/query-BFHjCzSh.mjs +37 -0
  702. package/dist/query-BFHjCzSh.mjs.map +1 -0
  703. package/dist/query-DuwyFr5Z.mjs +41 -0
  704. package/dist/query-DuwyFr5Z.mjs.map +1 -0
  705. package/dist/query-eR_Nz70M.mjs +1157 -0
  706. package/dist/query-eR_Nz70M.mjs.map +1 -0
  707. package/dist/range-BQWPjWgQ.mjs +51 -0
  708. package/dist/range-BQWPjWgQ.mjs.map +1 -0
  709. package/dist/rate-limit-mPKeQ3sm.mjs +127 -0
  710. package/dist/rate-limit-mPKeQ3sm.mjs.map +1 -0
  711. package/dist/receipt-CmUpyuW5.mjs +43 -0
  712. package/dist/receipt-CmUpyuW5.mjs.map +1 -0
  713. package/dist/redirect-BtiMkehU.mjs +19 -0
  714. package/dist/redirect-BtiMkehU.mjs.map +1 -0
  715. package/dist/redirect-DcmNMvOs.mjs +423 -0
  716. package/dist/redirect-DcmNMvOs.mjs.map +1 -0
  717. package/dist/redirect-paths-K5i3xYfR.mjs +36 -0
  718. package/dist/redirect-paths-K5i3xYfR.mjs.map +1 -0
  719. package/dist/redirects-BA_TvtuH.mjs +148 -0
  720. package/dist/redirects-BA_TvtuH.mjs.map +1 -0
  721. package/dist/redirects-BIrRvgn4.mjs +446 -0
  722. package/dist/redirects-BIrRvgn4.mjs.map +1 -0
  723. package/dist/registry/testing.mjs +3 -3
  724. package/dist/registry-DymfZkAN.mjs +8374 -0
  725. package/dist/registry-DymfZkAN.mjs.map +1 -0
  726. package/dist/relations-DrEs3Sc1.mjs +789 -0
  727. package/dist/relations-DrEs3Sc1.mjs.map +1 -0
  728. package/dist/request-cache-5z2WzWmh.mjs +104 -0
  729. package/dist/request-cache-5z2WzWmh.mjs.map +1 -0
  730. package/dist/request-context.d.mts +12 -1
  731. package/dist/request-context.d.mts.map +1 -1
  732. package/dist/request-context.mjs.map +1 -1
  733. package/dist/request-meta-o8RIf9pa.mjs +141 -0
  734. package/dist/request-meta-o8RIf9pa.mjs.map +1 -0
  735. package/dist/resolve-CVy9xgy_.mjs +102 -0
  736. package/dist/resolve-CVy9xgy_.mjs.map +1 -0
  737. package/dist/resolve-DdNXBJSr.mjs +199 -0
  738. package/dist/resolve-DdNXBJSr.mjs.map +1 -0
  739. package/dist/revision-Dx7Uth1X.mjs +374 -0
  740. package/dist/revision-Dx7Uth1X.mjs.map +1 -0
  741. package/dist/route-cache-DAG5dPhh.mjs +20 -0
  742. package/dist/route-cache-DAG5dPhh.mjs.map +1 -0
  743. package/dist/route-wire-Xbsu8Vih.mjs +197 -0
  744. package/dist/route-wire-Xbsu8Vih.mjs.map +1 -0
  745. package/dist/routes-YQkSOsws.mjs +272 -0
  746. package/dist/routes-YQkSOsws.mjs.map +1 -0
  747. package/dist/runner-CLorw5vo.mjs +6669 -0
  748. package/dist/runner-CLorw5vo.mjs.map +1 -0
  749. package/dist/runner-g1A9P-wD.d.mts +73 -0
  750. package/dist/runner-g1A9P-wD.d.mts.map +1 -0
  751. package/dist/runtime.d.mts +13 -13
  752. package/dist/runtime.mjs +6 -5
  753. package/dist/runtime.mjs.map +1 -1
  754. package/dist/schema/project-env-types.mjs +49 -47
  755. package/dist/schema/project-env-types.mjs.map +1 -1
  756. package/dist/schema-Bss8qImF.mjs +13 -0
  757. package/dist/schema-Bss8qImF.mjs.map +1 -0
  758. package/dist/schema-C036pqEw.mjs +815 -0
  759. package/dist/schema-C036pqEw.mjs.map +1 -0
  760. package/dist/scopes-C_SoYl9x.mjs +34 -0
  761. package/dist/scopes-C_SoYl9x.mjs.map +1 -0
  762. package/dist/search-uNqCgePJ.mjs +450 -0
  763. package/dist/search-uNqCgePJ.mjs.map +1 -0
  764. package/dist/sections-BLusMa96.mjs +346 -0
  765. package/dist/sections-BLusMa96.mjs.map +1 -0
  766. package/dist/seed/index.d.mts +2 -2
  767. package/dist/seed/index.mjs +47 -45
  768. package/dist/seo/index.d.mts +3 -3
  769. package/dist/seo/index.mjs +32 -30
  770. package/dist/seo/index.mjs.map +1 -1
  771. package/dist/seo-BodxIpws.mjs +188 -0
  772. package/dist/seo-BodxIpws.mjs.map +1 -0
  773. package/dist/seo-DaMYIQY8.mjs +133 -0
  774. package/dist/seo-DaMYIQY8.mjs.map +1 -0
  775. package/dist/service-BuM1BRsA.mjs +150 -0
  776. package/dist/service-BuM1BRsA.mjs.map +1 -0
  777. package/dist/session-user-2DpQDMKw.mjs +61 -0
  778. package/dist/session-user-2DpQDMKw.mjs.map +1 -0
  779. package/dist/settings-B3ZmPF_8.mjs +73 -0
  780. package/dist/settings-B3ZmPF_8.mjs.map +1 -0
  781. package/dist/settings-P5hwPX6_.mjs +66 -0
  782. package/dist/settings-P5hwPX6_.mjs.map +1 -0
  783. package/dist/settings-yIqoN-Ok.mjs +519 -0
  784. package/dist/settings-yIqoN-Ok.mjs.map +1 -0
  785. package/dist/setup-complete-eu6MUQnt.mjs +65 -0
  786. package/dist/setup-complete-eu6MUQnt.mjs.map +1 -0
  787. package/dist/setup-nonce-CyPOapqY.mjs +25 -0
  788. package/dist/setup-nonce-CyPOapqY.mjs.map +1 -0
  789. package/dist/site-domain-8lEJl_0U.mjs +131 -0
  790. package/dist/site-domain-8lEJl_0U.mjs.map +1 -0
  791. package/dist/site-settings-uPkW0e6o.mjs +50 -0
  792. package/dist/site-settings-uPkW0e6o.mjs.map +1 -0
  793. package/dist/site-url-25SGVXwL.mjs +45 -0
  794. package/dist/site-url-25SGVXwL.mjs.map +1 -0
  795. package/dist/sitemap-name-DTK7CYnY.mjs +26 -0
  796. package/dist/sitemap-name-DTK7CYnY.mjs.map +1 -0
  797. package/dist/slug-BEDl2IJY.mjs +16 -0
  798. package/dist/slug-BEDl2IJY.mjs.map +1 -0
  799. package/dist/slugify-BDEG9pLk.mjs +22 -0
  800. package/dist/slugify-BDEG9pLk.mjs.map +1 -0
  801. package/dist/snapshot-CvkIBRLY.mjs +414 -0
  802. package/dist/snapshot-CvkIBRLY.mjs.map +1 -0
  803. package/dist/ssrf-mcCKMH6B.mjs +406 -0
  804. package/dist/ssrf-mcCKMH6B.mjs.map +1 -0
  805. package/dist/stage-BQfGzGOy.mjs +662 -0
  806. package/dist/stage-BQfGzGOy.mjs.map +1 -0
  807. package/dist/staged-B5vQGeSf.mjs +686 -0
  808. package/dist/staged-B5vQGeSf.mjs.map +1 -0
  809. package/dist/state-dO6t6OxV.mjs +178 -0
  810. package/dist/state-dO6t6OxV.mjs.map +1 -0
  811. package/dist/status-DSURZwKS.mjs +30 -0
  812. package/dist/status-DSURZwKS.mjs.map +1 -0
  813. package/dist/storage/local.d.mts +1 -1
  814. package/dist/storage/local.mjs +2 -2
  815. package/dist/storage/s3.d.mts +1 -1
  816. package/dist/storage/s3.mjs +1 -1
  817. package/dist/storage-query-Cy0SZ8iG.d.mts +1619 -0
  818. package/dist/storage-query-Cy0SZ8iG.d.mts.map +1 -0
  819. package/dist/tar-DWzcUZ_Q.mjs +449 -0
  820. package/dist/tar-DWzcUZ_Q.mjs.map +1 -0
  821. package/dist/target-C9htUbrT.mjs +27 -0
  822. package/dist/target-C9htUbrT.mjs.map +1 -0
  823. package/dist/taxonomies-By2aGvq2.mjs +729 -0
  824. package/dist/taxonomies-By2aGvq2.mjs.map +1 -0
  825. package/dist/taxonomies-CVRd_jz0.mjs +937 -0
  826. package/dist/taxonomies-CVRd_jz0.mjs.map +1 -0
  827. package/dist/taxonomy-BG_xu2Qf.mjs +563 -0
  828. package/dist/taxonomy-BG_xu2Qf.mjs.map +1 -0
  829. package/dist/tokens-U5vzgSrM.mjs +171 -0
  830. package/dist/tokens-U5vzgSrM.mjs.map +1 -0
  831. package/dist/transaction-CkoQ5wqQ.mjs +29 -0
  832. package/dist/transaction-CkoQ5wqQ.mjs.map +1 -0
  833. package/dist/transfer-DA0OSfaT.mjs +8873 -0
  834. package/dist/transfer-DA0OSfaT.mjs.map +1 -0
  835. package/dist/transfer-Pyf3d7ka.mjs +166 -0
  836. package/dist/transfer-Pyf3d7ka.mjs.map +1 -0
  837. package/dist/transfer-download-cX7SuWEy.mjs +33 -0
  838. package/dist/transfer-download-cX7SuWEy.mjs.map +1 -0
  839. package/dist/transformations-DczubD4j.mjs +196 -0
  840. package/dist/transformations-DczubD4j.mjs.map +1 -0
  841. package/dist/transport-Dm5QzpT_.d.mts +42 -0
  842. package/dist/transport-Dm5QzpT_.d.mts.map +1 -0
  843. package/dist/transport-DtIrjEFO.mjs +137 -0
  844. package/dist/transport-DtIrjEFO.mjs.map +1 -0
  845. package/dist/trusted-proxy-CDRd5Kmw.mjs +51 -0
  846. package/dist/trusted-proxy-CDRd5Kmw.mjs.map +1 -0
  847. package/dist/turnstile-Ct5YuFNY.mjs +58 -0
  848. package/dist/turnstile-Ct5YuFNY.mjs.map +1 -0
  849. package/dist/types-Bgujop4S.d.mts +374 -0
  850. package/dist/types-Bgujop4S.d.mts.map +1 -0
  851. package/dist/types-BirHUEXt.mjs +18 -0
  852. package/dist/types-BirHUEXt.mjs.map +1 -0
  853. package/dist/types-BqJgTL_y.d.mts +293 -0
  854. package/dist/types-BqJgTL_y.d.mts.map +1 -0
  855. package/dist/types-C-lrOt9T.d.mts +87 -0
  856. package/dist/types-C-lrOt9T.d.mts.map +1 -0
  857. package/dist/types-CCEHAhOv.d.mts +916 -0
  858. package/dist/types-CCEHAhOv.d.mts.map +1 -0
  859. package/dist/types-CLVwYRBr.d.mts +227 -0
  860. package/dist/types-CLVwYRBr.d.mts.map +1 -0
  861. package/dist/types-C_asjp1J.mjs +201 -0
  862. package/dist/types-C_asjp1J.mjs.map +1 -0
  863. package/dist/types-CadaL_k8.d.mts +366 -0
  864. package/dist/types-CadaL_k8.d.mts.map +1 -0
  865. package/dist/types-DVbTb4Hk.mjs +77 -0
  866. package/dist/types-DVbTb4Hk.mjs.map +1 -0
  867. package/dist/types-Ddku19Zw.d.mts +209 -0
  868. package/dist/types-Ddku19Zw.d.mts.map +1 -0
  869. package/dist/types-DwhEvIVb.mjs +133 -0
  870. package/dist/types-DwhEvIVb.mjs.map +1 -0
  871. package/dist/types-FIiGQ3PE.mjs +16 -0
  872. package/dist/types-FIiGQ3PE.mjs.map +1 -0
  873. package/dist/types-OauzCOY0.mjs +37 -0
  874. package/dist/types-OauzCOY0.mjs.map +1 -0
  875. package/dist/types-mQGTpP-4.d.mts +1741 -0
  876. package/dist/types-mQGTpP-4.d.mts.map +1 -0
  877. package/dist/types-nbjz3Mgm.d.mts +125 -0
  878. package/dist/types-nbjz3Mgm.d.mts.map +1 -0
  879. package/dist/update-check-hW32-0pf.mjs +161 -0
  880. package/dist/update-check-hW32-0pf.mjs.map +1 -0
  881. package/dist/upload-attempts-Bpik1TLF.mjs +32 -0
  882. package/dist/upload-attempts-Bpik1TLF.mjs.map +1 -0
  883. package/dist/url-DTfGDJhI.mjs +104 -0
  884. package/dist/url-DTfGDJhI.mjs.map +1 -0
  885. package/dist/url-pattern-CJeCyNij.mjs +41 -0
  886. package/dist/url-pattern-CJeCyNij.mjs.map +1 -0
  887. package/dist/user-nQInBZbE.mjs +171 -0
  888. package/dist/user-nQInBZbE.mjs.map +1 -0
  889. package/dist/utils-govudc_U.mjs +442 -0
  890. package/dist/utils-govudc_U.mjs.map +1 -0
  891. package/dist/validate-BxLvcDYh.mjs +524 -0
  892. package/dist/validate-BxLvcDYh.mjs.map +1 -0
  893. package/dist/validate-mnoVfASU.d.mts +468 -0
  894. package/dist/validate-mnoVfASU.d.mts.map +1 -0
  895. package/dist/validation-DQDEvh87.mjs +221 -0
  896. package/dist/validation-DQDEvh87.mjs.map +1 -0
  897. package/dist/version-BOFfLiVT.mjs +49 -0
  898. package/dist/version-BOFfLiVT.mjs.map +1 -0
  899. package/dist/version-Dcvx_C9g.mjs +7 -0
  900. package/dist/version-Dcvx_C9g.mjs.map +1 -0
  901. package/dist/version-DzTJ3gD7.mjs +9 -0
  902. package/dist/version-DzTJ3gD7.mjs.map +1 -0
  903. package/dist/video-BX7AI5nJ.mjs +54 -0
  904. package/dist/video-BX7AI5nJ.mjs.map +1 -0
  905. package/dist/virtual-modules-CU29aip9.mjs +515 -0
  906. package/dist/virtual-modules-CU29aip9.mjs.map +1 -0
  907. package/dist/widgets-HIeFmZxt.mjs +121 -0
  908. package/dist/widgets-HIeFmZxt.mjs.map +1 -0
  909. package/dist/wxr-taxonomies-Dy2i2ON3.d.mts +34 -0
  910. package/dist/wxr-taxonomies-Dy2i2ON3.d.mts.map +1 -0
  911. package/dist/wxr-taxonomies-DyOGhl8W.mjs +454 -0
  912. package/dist/wxr-taxonomies-DyOGhl8W.mjs.map +1 -0
  913. package/dist/zod-generator-VxCPVDpo.mjs +425 -0
  914. package/dist/zod-generator-VxCPVDpo.mjs.map +1 -0
  915. package/package.json +5 -5
  916. package/src/api/handlers/bulk-tag.ts +11 -3
  917. package/src/api/handlers/bylines.ts +6 -2
  918. package/src/api/handlers/content.ts +107 -7
  919. package/src/api/handlers/dashboard.ts +13 -6
  920. package/src/api/handlers/menus.ts +24 -10
  921. package/src/api/handlers/relations.ts +15 -1
  922. package/src/api/handlers/taxonomies.ts +27 -17
  923. package/src/astro/image-endpoint.ts +23 -2
  924. package/src/astro/integration/vite-config.ts +16 -8
  925. package/src/astro/middleware/redirect.ts +158 -63
  926. package/src/astro/middleware/request-context.ts +1 -0
  927. package/src/astro/middleware.ts +17 -4
  928. package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +4 -1
  929. package/src/astro/routes/api/content/[collection]/[id]/translations.ts +14 -1
  930. package/src/astro/routes/api/dashboard.ts +2 -0
  931. package/src/astro/routes/api/media/file/[...key].ts +13 -3
  932. package/src/auth/types.ts +6 -0
  933. package/src/cli/commands/export-seed.ts +6 -4
  934. package/src/cli/commands/login.ts +2 -4
  935. package/src/client/index.ts +1 -0
  936. package/src/client/transport.ts +11 -7
  937. package/src/components/EmDashImage.astro +14 -2
  938. package/src/components/InlinePortableTextEditor.tsx +4 -1
  939. package/src/database/migrations/content-sized.ts +82 -0
  940. package/src/database/migrations/policy.ts +28 -2
  941. package/src/database/migrations/runner.ts +48 -0
  942. package/src/database/repositories/byline.ts +73 -17
  943. package/src/database/repositories/comment.ts +17 -7
  944. package/src/database/repositories/content.ts +79 -19
  945. package/src/database/repositories/menu.ts +77 -11
  946. package/src/database/repositories/taxonomy-def.ts +9 -2
  947. package/src/database/repositories/taxonomy.ts +47 -14
  948. package/src/database/repositories/types.ts +11 -0
  949. package/src/emdash-runtime.ts +37 -10
  950. package/src/fields/image.ts +1 -0
  951. package/src/i18n/config.ts +58 -10
  952. package/src/i18n/normalize.ts +16 -2
  953. package/src/i18n/query.ts +47 -0
  954. package/src/i18n/resolve.ts +8 -3
  955. package/src/import/wxr-taxonomies.ts +3 -2
  956. package/src/loader.ts +80 -22
  957. package/src/mcp/server.ts +28 -1
  958. package/src/media/caption.ts +30 -0
  959. package/src/media/image-endpoint.ts +13 -6
  960. package/src/media/local-runtime.ts +3 -0
  961. package/src/media/normalize.ts +15 -8
  962. package/src/media/responsive.ts +12 -2
  963. package/src/media/types.ts +16 -3
  964. package/src/menus/index.ts +21 -11
  965. package/src/migrations/manifest.ts +1 -0
  966. package/src/plugins/byline-access.ts +3 -1
  967. package/src/plugins/context.ts +1 -2
  968. package/src/plugins/storage-indexes.ts +7 -3
  969. package/src/query.ts +23 -13
  970. package/src/redirects/artifacts.ts +39 -5
  971. package/src/references/field-map.ts +6 -4
  972. package/src/request-context.ts +8 -0
  973. package/src/schema/collection-slugs-cache.ts +31 -17
  974. package/src/schema/registry.ts +9 -0
  975. package/src/schema/zod-generator.ts +2 -1
  976. package/src/search/fts-manager.ts +98 -28
  977. package/src/search/query.ts +31 -64
  978. package/src/seed/apply.ts +191 -87
  979. package/src/seed/types.ts +3 -1
  980. package/src/settings/index.ts +135 -35
  981. package/src/settings/version.ts +54 -0
  982. package/src/taxonomies/index.ts +95 -52
  983. package/src/taxonomies/term-counts.ts +2 -1
  984. package/src/utils/db-errors.ts +15 -0
  985. package/src/virtual-modules.d.ts +1 -0
  986. package/dist/action-token-SK8zyN7w.mjs +0 -26
  987. package/dist/action-token-SK8zyN7w.mjs.map +0 -1
  988. package/dist/activation-Dim4YMM7.mjs +0 -387
  989. package/dist/activation-Dim4YMM7.mjs.map +0 -1
  990. package/dist/adapters-F_xorvWv.d.mts +0 -173
  991. package/dist/adapters-F_xorvWv.d.mts.map +0 -1
  992. package/dist/allowed-origins-CEug-p0t.mjs +0 -116
  993. package/dist/allowed-origins-CEug-p0t.mjs.map +0 -1
  994. package/dist/api-D-7BNHoz.mjs +0 -5025
  995. package/dist/api-D-7BNHoz.mjs.map +0 -1
  996. package/dist/api-tokens-Bx38ZCQp.mjs +0 -173
  997. package/dist/api-tokens-Bx38ZCQp.mjs.map +0 -1
  998. package/dist/apply-T7ATgzCh.mjs +0 -1702
  999. package/dist/apply-T7ATgzCh.mjs.map +0 -1
  1000. package/dist/approvals-D-m6wvGl.mjs +0 -460
  1001. package/dist/approvals-D-m6wvGl.mjs.map +0 -1
  1002. package/dist/artifact-fetch-DIh7iyOV.mjs +0 -659
  1003. package/dist/artifact-fetch-DIh7iyOV.mjs.map +0 -1
  1004. package/dist/artifacts-htGyfCSt.mjs +0 -307
  1005. package/dist/artifacts-htGyfCSt.mjs.map +0 -1
  1006. package/dist/audit-_gieLVGU.mjs +0 -127
  1007. package/dist/audit-_gieLVGU.mjs.map +0 -1
  1008. package/dist/authoritative-records-CQlB3JzE.mjs +0 -5183
  1009. package/dist/authoritative-records-CQlB3JzE.mjs.map +0 -1
  1010. package/dist/authorize-DPFBGbE6.mjs +0 -74
  1011. package/dist/authorize-DPFBGbE6.mjs.map +0 -1
  1012. package/dist/backup-3FgVxiDJ.mjs +0 -246
  1013. package/dist/backup-3FgVxiDJ.mjs.map +0 -1
  1014. package/dist/block-types-CYcG56JB.mjs +0 -132
  1015. package/dist/block-types-CYcG56JB.mjs.map +0 -1
  1016. package/dist/block-values-gCX4HBSl.mjs +0 -215
  1017. package/dist/block-values-gCX4HBSl.mjs.map +0 -1
  1018. package/dist/byline-BR1qhyiw.mjs +0 -909
  1019. package/dist/byline-BR1qhyiw.mjs.map +0 -1
  1020. package/dist/byline-fields-4ClDC88c.mjs +0 -123
  1021. package/dist/byline-fields-4ClDC88c.mjs.map +0 -1
  1022. package/dist/byline-fields-BLXZnX7N.mjs +0 -280
  1023. package/dist/byline-fields-BLXZnX7N.mjs.map +0 -1
  1024. package/dist/byline-registry-dvt4N3xV.mjs +0 -406
  1025. package/dist/byline-registry-dvt4N3xV.mjs.map +0 -1
  1026. package/dist/bylines-CVOvRUL7.mjs +0 -234
  1027. package/dist/bylines-CVOvRUL7.mjs.map +0 -1
  1028. package/dist/bylines-DxOs9B7z.mjs +0 -150
  1029. package/dist/bylines-DxOs9B7z.mjs.map +0 -1
  1030. package/dist/cache-CEU9wo_h.mjs +0 -151
  1031. package/dist/cache-CEU9wo_h.mjs.map +0 -1
  1032. package/dist/canonical-BudtH-Fx.mjs +0 -174
  1033. package/dist/canonical-BudtH-Fx.mjs.map +0 -1
  1034. package/dist/capture-triggers-CT6dK9zd.mjs +0 -362
  1035. package/dist/capture-triggers-CT6dK9zd.mjs.map +0 -1
  1036. package/dist/challenge-store-C17BYx2-.mjs +0 -51
  1037. package/dist/challenge-store-C17BYx2-.mjs.map +0 -1
  1038. package/dist/checksum-CEqvfxGX.mjs +0 -162
  1039. package/dist/checksum-CEqvfxGX.mjs.map +0 -1
  1040. package/dist/chrome-tags-BIKBMZYO.mjs +0 -24
  1041. package/dist/chrome-tags-BIKBMZYO.mjs.map +0 -1
  1042. package/dist/chunks-xC4UD5-S.mjs +0 -25
  1043. package/dist/chunks-xC4UD5-S.mjs.map +0 -1
  1044. package/dist/collection-slugs-cache-e09QeJQt.mjs +0 -85
  1045. package/dist/collection-slugs-cache-e09QeJQt.mjs.map +0 -1
  1046. package/dist/comment-UvIWDKcW.mjs +0 -325
  1047. package/dist/comment-UvIWDKcW.mjs.map +0 -1
  1048. package/dist/comment-reaction-dGp6_FRo.mjs +0 -85
  1049. package/dist/comment-reaction-dGp6_FRo.mjs.map +0 -1
  1050. package/dist/comments-pej-_BUO.mjs +0 -195
  1051. package/dist/comments-pej-_BUO.mjs.map +0 -1
  1052. package/dist/comments-yiRFx3w5.mjs +0 -99
  1053. package/dist/comments-yiRFx3w5.mjs.map +0 -1
  1054. package/dist/components-Brp__9xo.mjs +0 -112
  1055. package/dist/components-Brp__9xo.mjs.map +0 -1
  1056. package/dist/config-Bsm_u_oE.d.mts +0 -6799
  1057. package/dist/config-Bsm_u_oE.d.mts.map +0 -1
  1058. package/dist/config-CFMojMFK.d.mts +0 -39
  1059. package/dist/config-CFMojMFK.d.mts.map +0 -1
  1060. package/dist/config-CvmjJcVw.mjs +0 -73
  1061. package/dist/config-CvmjJcVw.mjs.map +0 -1
  1062. package/dist/config-DBU6iUQB.mjs +0 -228
  1063. package/dist/config-DBU6iUQB.mjs.map +0 -1
  1064. package/dist/connection-BtEN_lP9.mjs +0 -36
  1065. package/dist/connection-BtEN_lP9.mjs.map +0 -1
  1066. package/dist/content-DQSRZTVw.mjs +0 -2075
  1067. package/dist/content-DQSRZTVw.mjs.map +0 -1
  1068. package/dist/content-list-query-CYKcY6Vi.d.mts +0 -26
  1069. package/dist/content-list-query-CYKcY6Vi.d.mts.map +0 -1
  1070. package/dist/content-policy-Dm32n9C6.mjs +0 -46
  1071. package/dist/content-policy-Dm32n9C6.mjs.map +0 -1
  1072. package/dist/content-repair-DNh5--x5.mjs +0 -442
  1073. package/dist/content-repair-DNh5--x5.mjs.map +0 -1
  1074. package/dist/context-BYptmCN0.mjs +0 -2090
  1075. package/dist/context-BYptmCN0.mjs.map +0 -1
  1076. package/dist/credits-B9iORdWB.mjs +0 -110
  1077. package/dist/credits-B9iORdWB.mjs.map +0 -1
  1078. package/dist/cron-D7obTIfk.mjs +0 -306
  1079. package/dist/cron-D7obTIfk.mjs.map +0 -1
  1080. package/dist/dashboard-D0jcgBD7.mjs +0 -167
  1081. package/dist/dashboard-D0jcgBD7.mjs.map +0 -1
  1082. package/dist/db-errors-CBD5yMro.mjs +0 -55
  1083. package/dist/db-errors-CBD5yMro.mjs.map +0 -1
  1084. package/dist/default-C0W-PhAp.mjs +0 -81
  1085. package/dist/default-C0W-PhAp.mjs.map +0 -1
  1086. package/dist/deferred-tasks-ZvUECSzI.d.mts +0 -9
  1087. package/dist/deferred-tasks-ZvUECSzI.d.mts.map +0 -1
  1088. package/dist/destination-r2zIAZ2S.mjs +0 -18
  1089. package/dist/destination-r2zIAZ2S.mjs.map +0 -1
  1090. package/dist/dev-typegen-EBni_pOQ.mjs +0 -29
  1091. package/dist/dev-typegen-EBni_pOQ.mjs.map +0 -1
  1092. package/dist/device-flow-BkFKBoAn.mjs +0 -521
  1093. package/dist/device-flow-BkFKBoAn.mjs.map +0 -1
  1094. package/dist/digest-DJ1tHCgy.mjs +0 -194
  1095. package/dist/digest-DJ1tHCgy.mjs.map +0 -1
  1096. package/dist/direct-executor-Cbxzg4qe.mjs +0 -117
  1097. package/dist/direct-executor-Cbxzg4qe.mjs.map +0 -1
  1098. package/dist/dist-Cfu8mMBs.mjs +0 -810
  1099. package/dist/dist-Cfu8mMBs.mjs.map +0 -1
  1100. package/dist/email-console-FFVJWb9N.mjs +0 -50
  1101. package/dist/email-console-FFVJWb9N.mjs.map +0 -1
  1102. package/dist/email-locale-BJ8DjTzZ.mjs +0 -25
  1103. package/dist/email-locale-BJ8DjTzZ.mjs.map +0 -1
  1104. package/dist/emdash-runtime-DVi7vtXC.mjs +0 -4379
  1105. package/dist/emdash-runtime-DVi7vtXC.mjs.map +0 -1
  1106. package/dist/enrich-Duu4sV3a.mjs +0 -194
  1107. package/dist/enrich-Duu4sV3a.mjs.map +0 -1
  1108. package/dist/entry-lock-C7VX0NGK.d.mts +0 -4568
  1109. package/dist/entry-lock-C7VX0NGK.d.mts.map +0 -1
  1110. package/dist/entry-lock-DLxCffFW.mjs +0 -163
  1111. package/dist/entry-lock-DLxCffFW.mjs.map +0 -1
  1112. package/dist/entry-lock-Df6-XhIu.mjs +0 -1211
  1113. package/dist/entry-lock-Df6-XhIu.mjs.map +0 -1
  1114. package/dist/entry-locks-DJAqVweV.mjs +0 -167
  1115. package/dist/entry-locks-DJAqVweV.mjs.map +0 -1
  1116. package/dist/env-types-C3FCVBWe.mjs +0 -38
  1117. package/dist/env-types-C3FCVBWe.mjs.map +0 -1
  1118. package/dist/error-CVWeIOku.mjs +0 -90
  1119. package/dist/error-CVWeIOku.mjs.map +0 -1
  1120. package/dist/errors-B4f4It-2.mjs +0 -120
  1121. package/dist/errors-B4f4It-2.mjs.map +0 -1
  1122. package/dist/errors-BOYNdIo3.mjs +0 -479
  1123. package/dist/errors-BOYNdIo3.mjs.map +0 -1
  1124. package/dist/escape-lsNq38PP.mjs +0 -9
  1125. package/dist/escape-lsNq38PP.mjs.map +0 -1
  1126. package/dist/fence-C3MUitUN.mjs +0 -162
  1127. package/dist/fence-C3MUitUN.mjs.map +0 -1
  1128. package/dist/field-defs-cache-Dez5iWJJ.mjs +0 -77
  1129. package/dist/field-defs-cache-Dez5iWJJ.mjs.map +0 -1
  1130. package/dist/field-map-Bft9LKak.mjs +0 -83
  1131. package/dist/field-map-Bft9LKak.mjs.map +0 -1
  1132. package/dist/focal-point-JX8kcOTQ.mjs +0 -23
  1133. package/dist/focal-point-JX8kcOTQ.mjs.map +0 -1
  1134. package/dist/fts-manager-Beg3e4bI.mjs +0 -443
  1135. package/dist/fts-manager-Beg3e4bI.mjs.map +0 -1
  1136. package/dist/gc-ByyAYiYE.mjs +0 -75
  1137. package/dist/gc-ByyAYiYE.mjs.map +0 -1
  1138. package/dist/hash-BJaeek87.mjs +0 -37
  1139. package/dist/hash-BJaeek87.mjs.map +0 -1
  1140. package/dist/hook-result-BrdLyOdI.d.mts +0 -31
  1141. package/dist/hook-result-BrdLyOdI.d.mts.map +0 -1
  1142. package/dist/hreflang-C8Jb-hrf.mjs +0 -105
  1143. package/dist/hreflang-C8Jb-hrf.mjs.map +0 -1
  1144. package/dist/hreflang-CY_F5OjF.d.mts +0 -50
  1145. package/dist/hreflang-CY_F5OjF.d.mts.map +0 -1
  1146. package/dist/http-route-dispatch-CyeW6iPv.mjs +0 -342
  1147. package/dist/http-route-dispatch-CyeW6iPv.mjs.map +0 -1
  1148. package/dist/identity-Cael5uTT.mjs +0 -35
  1149. package/dist/identity-Cael5uTT.mjs.map +0 -1
  1150. package/dist/import-BUXjdZUn.mjs +0 -2126
  1151. package/dist/import-BUXjdZUn.mjs.map +0 -1
  1152. package/dist/index-BB9sVisO.d.mts +0 -623
  1153. package/dist/index-BB9sVisO.d.mts.map +0 -1
  1154. package/dist/install-finalization-3JX5qQEA.mjs +0 -58
  1155. package/dist/install-finalization-3JX5qQEA.mjs.map +0 -1
  1156. package/dist/json-recordset-BUjxhr77.mjs +0 -12
  1157. package/dist/json-recordset-BUjxhr77.mjs.map +0 -1
  1158. package/dist/json-schema-v_D_pPNG.mjs +0 -15
  1159. package/dist/json-schema-v_D_pPNG.mjs.map +0 -1
  1160. package/dist/keys-CifIkT0N.mjs +0 -61
  1161. package/dist/keys-CifIkT0N.mjs.map +0 -1
  1162. package/dist/kinds-B_Qcl5pz.mjs +0 -974
  1163. package/dist/kinds-B_Qcl5pz.mjs.map +0 -1
  1164. package/dist/lifecycle-7vUJeFRe.mjs +0 -25
  1165. package/dist/lifecycle-7vUJeFRe.mjs.map +0 -1
  1166. package/dist/load-CdAG9wz-.mjs +0 -28
  1167. package/dist/load-CdAG9wz-.mjs.map +0 -1
  1168. package/dist/loader-CswroUbe.mjs +0 -1380
  1169. package/dist/loader-CswroUbe.mjs.map +0 -1
  1170. package/dist/loops-uA4iTOzd.mjs +0 -205
  1171. package/dist/loops-uA4iTOzd.mjs.map +0 -1
  1172. package/dist/manifest-builder-B8zjuH3f.mjs +0 -189
  1173. package/dist/manifest-builder-B8zjuH3f.mjs.map +0 -1
  1174. package/dist/manifest-schema-DNb4XmTS.mjs +0 -497
  1175. package/dist/manifest-schema-DNb4XmTS.mjs.map +0 -1
  1176. package/dist/marketplace-CqbgeIa7.mjs +0 -257
  1177. package/dist/marketplace-CqbgeIa7.mjs.map +0 -1
  1178. package/dist/media--dJRU6i2.mjs +0 -294
  1179. package/dist/media--dJRU6i2.mjs.map +0 -1
  1180. package/dist/media-1WC65OCB.mjs +0 -416
  1181. package/dist/media-1WC65OCB.mjs.map +0 -1
  1182. package/dist/media-Bws9f18T.mjs +0 -373
  1183. package/dist/media-Bws9f18T.mjs.map +0 -1
  1184. package/dist/media-allowlist-BJB7MFx6.mjs +0 -45
  1185. package/dist/media-allowlist-BJB7MFx6.mjs.map +0 -1
  1186. package/dist/media-folders-Dn3C16B8.mjs +0 -210
  1187. package/dist/media-folders-Dn3C16B8.mjs.map +0 -1
  1188. package/dist/media-url-BQgKvpQ5.mjs +0 -43
  1189. package/dist/media-url-BQgKvpQ5.mjs.map +0 -1
  1190. package/dist/media-usage-CF0WVcLO.mjs +0 -282
  1191. package/dist/media-usage-CF0WVcLO.mjs.map +0 -1
  1192. package/dist/media-usage-activation-C9HwVw5w.mjs +0 -78
  1193. package/dist/media-usage-activation-C9HwVw5w.mjs.map +0 -1
  1194. package/dist/media-usage-work-CkLa5-nc.mjs +0 -1036
  1195. package/dist/media-usage-work-CkLa5-nc.mjs.map +0 -1
  1196. package/dist/media-usage-work-m3AWTmmC.mjs +0 -151
  1197. package/dist/media-usage-work-m3AWTmmC.mjs.map +0 -1
  1198. package/dist/menus-BCVSSp1z.mjs +0 -753
  1199. package/dist/menus-BCVSSp1z.mjs.map +0 -1
  1200. package/dist/menus-BSzwObhV.mjs +0 -92
  1201. package/dist/menus-BSzwObhV.mjs.map +0 -1
  1202. package/dist/menus-Cl4kwdt7.mjs +0 -3721
  1203. package/dist/menus-Cl4kwdt7.mjs.map +0 -1
  1204. package/dist/mime-B5M9R53H.mjs +0 -81
  1205. package/dist/mime-B5M9R53H.mjs.map +0 -1
  1206. package/dist/mode-C-D3qICy.mjs +0 -23
  1207. package/dist/mode-C-D3qICy.mjs.map +0 -1
  1208. package/dist/node-sqlite-compat-CrKzRr0J.mjs +0 -63
  1209. package/dist/node-sqlite-compat-CrKzRr0J.mjs.map +0 -1
  1210. package/dist/normalize-BuWa0lvd.mjs +0 -191
  1211. package/dist/normalize-BuWa0lvd.mjs.map +0 -1
  1212. package/dist/oauth-authorization-TpEJrYB7.mjs +0 -274
  1213. package/dist/oauth-authorization-TpEJrYB7.mjs.map +0 -1
  1214. package/dist/oauth-clients-BT0Pg-MO.mjs +0 -266
  1215. package/dist/oauth-clients-BT0Pg-MO.mjs.map +0 -1
  1216. package/dist/oauth-state-store-CHMn_mwc.mjs +0 -50
  1217. package/dist/oauth-state-store-CHMn_mwc.mjs.map +0 -1
  1218. package/dist/oauth-user-lookup-BDgF6IVG.mjs +0 -26
  1219. package/dist/oauth-user-lookup-BDgF6IVG.mjs.map +0 -1
  1220. package/dist/object-cache-Bo6DGaC9.mjs +0 -586
  1221. package/dist/object-cache-Bo6DGaC9.mjs.map +0 -1
  1222. package/dist/options-DJWaq3Ie.d.mts +0 -81
  1223. package/dist/options-DJWaq3Ie.d.mts.map +0 -1
  1224. package/dist/ownership-MiyA7qKO.mjs +0 -12
  1225. package/dist/ownership-MiyA7qKO.mjs.map +0 -1
  1226. package/dist/parse-CWHOFc6z.d.mts +0 -176
  1227. package/dist/parse-CWHOFc6z.d.mts.map +0 -1
  1228. package/dist/parse-DgQ2NABT.mjs +0 -81
  1229. package/dist/parse-DgQ2NABT.mjs.map +0 -1
  1230. package/dist/passkey-config-D0kdzEao.mjs +0 -46
  1231. package/dist/passkey-config-D0kdzEao.mjs.map +0 -1
  1232. package/dist/paths-biDzFTY2.mjs +0 -77
  1233. package/dist/paths-biDzFTY2.mjs.map +0 -1
  1234. package/dist/patterns-CMNnYCgf.mjs +0 -159
  1235. package/dist/patterns-CMNnYCgf.mjs.map +0 -1
  1236. package/dist/placeholder-D41vk11_.d.mts +0 -306
  1237. package/dist/placeholder-D41vk11_.d.mts.map +0 -1
  1238. package/dist/plan-CCoqxNoU.mjs +0 -135
  1239. package/dist/plan-CCoqxNoU.mjs.map +0 -1
  1240. package/dist/plugin-tool-name-DDUgN_0p.mjs +0 -27
  1241. package/dist/plugin-tool-name-DDUgN_0p.mjs.map +0 -1
  1242. package/dist/plugins-COJ2L49n.mjs +0 -261
  1243. package/dist/plugins-COJ2L49n.mjs.map +0 -1
  1244. package/dist/policy-DLQ--Hnm.mjs +0 -45
  1245. package/dist/policy-DLQ--Hnm.mjs.map +0 -1
  1246. package/dist/portable-text-BH4zgkSm.mjs +0 -311
  1247. package/dist/portable-text-BH4zgkSm.mjs.map +0 -1
  1248. package/dist/preview-DLexxwp3.mjs +0 -107
  1249. package/dist/preview-DLexxwp3.mjs.map +0 -1
  1250. package/dist/protocol-79kUO7jP.d.mts +0 -65
  1251. package/dist/protocol-79kUO7jP.d.mts.map +0 -1
  1252. package/dist/public-plugin-api-routes-BuAMJ8nN.mjs +0 -316
  1253. package/dist/public-plugin-api-routes-BuAMJ8nN.mjs.map +0 -1
  1254. package/dist/public-submission-Di3TsgzX.mjs +0 -251
  1255. package/dist/public-submission-Di3TsgzX.mjs.map +0 -1
  1256. package/dist/public-url-Bt98vysr.mjs +0 -101
  1257. package/dist/public-url-Bt98vysr.mjs.map +0 -1
  1258. package/dist/query-CpnRlBh8.mjs +0 -1156
  1259. package/dist/query-CpnRlBh8.mjs.map +0 -1
  1260. package/dist/query-haKvLAWl.mjs +0 -41
  1261. package/dist/query-haKvLAWl.mjs.map +0 -1
  1262. package/dist/range-CYfeXgGK.mjs +0 -51
  1263. package/dist/range-CYfeXgGK.mjs.map +0 -1
  1264. package/dist/rate-limit-Xp4d0NBY.mjs +0 -127
  1265. package/dist/rate-limit-Xp4d0NBY.mjs.map +0 -1
  1266. package/dist/receipt-BUsQCOeM.mjs +0 -43
  1267. package/dist/receipt-BUsQCOeM.mjs.map +0 -1
  1268. package/dist/redirect-CQAV7mCo.mjs +0 -19
  1269. package/dist/redirect-CQAV7mCo.mjs.map +0 -1
  1270. package/dist/redirect-DiS_3mA4.mjs +0 -423
  1271. package/dist/redirect-DiS_3mA4.mjs.map +0 -1
  1272. package/dist/redirect-paths-CNYq7w80.mjs +0 -36
  1273. package/dist/redirect-paths-CNYq7w80.mjs.map +0 -1
  1274. package/dist/redirects-BEVSRMa2.mjs +0 -148
  1275. package/dist/redirects-BEVSRMa2.mjs.map +0 -1
  1276. package/dist/redirects-BHpy-VsZ.mjs +0 -446
  1277. package/dist/redirects-BHpy-VsZ.mjs.map +0 -1
  1278. package/dist/registry-TUVaid9Z.mjs +0 -8369
  1279. package/dist/registry-TUVaid9Z.mjs.map +0 -1
  1280. package/dist/relations-CA_QuMTU.mjs +0 -776
  1281. package/dist/relations-CA_QuMTU.mjs.map +0 -1
  1282. package/dist/request-cache-C4CIo5ad.mjs +0 -104
  1283. package/dist/request-cache-C4CIo5ad.mjs.map +0 -1
  1284. package/dist/request-meta-bwZ_NsvU.mjs +0 -141
  1285. package/dist/request-meta-bwZ_NsvU.mjs.map +0 -1
  1286. package/dist/resolve-D-kqyKns.mjs +0 -199
  1287. package/dist/resolve-D-kqyKns.mjs.map +0 -1
  1288. package/dist/resolve-DwNM-CXl.mjs +0 -101
  1289. package/dist/resolve-DwNM-CXl.mjs.map +0 -1
  1290. package/dist/revision-BVp8S0e_.mjs +0 -374
  1291. package/dist/revision-BVp8S0e_.mjs.map +0 -1
  1292. package/dist/route-cache-QSOyDEw0.mjs +0 -20
  1293. package/dist/route-cache-QSOyDEw0.mjs.map +0 -1
  1294. package/dist/route-wire-Ca_HWCZ5.mjs +0 -197
  1295. package/dist/route-wire-Ca_HWCZ5.mjs.map +0 -1
  1296. package/dist/routes-BerZFrvV.mjs +0 -272
  1297. package/dist/routes-BerZFrvV.mjs.map +0 -1
  1298. package/dist/runner-BObHz5FC.d.mts +0 -68
  1299. package/dist/runner-BObHz5FC.d.mts.map +0 -1
  1300. package/dist/runner-C5NeAkBQ.mjs +0 -6595
  1301. package/dist/runner-C5NeAkBQ.mjs.map +0 -1
  1302. package/dist/schema-C4OBuv6Z.mjs +0 -13
  1303. package/dist/schema-C4OBuv6Z.mjs.map +0 -1
  1304. package/dist/schema-DJRfvM_o.mjs +0 -815
  1305. package/dist/schema-DJRfvM_o.mjs.map +0 -1
  1306. package/dist/scopes-BU03K7Uo.mjs +0 -34
  1307. package/dist/scopes-BU03K7Uo.mjs.map +0 -1
  1308. package/dist/search-DfVzks89.mjs +0 -450
  1309. package/dist/search-DfVzks89.mjs.map +0 -1
  1310. package/dist/sections-BMy4JVUz.mjs +0 -346
  1311. package/dist/sections-BMy4JVUz.mjs.map +0 -1
  1312. package/dist/seo-ClB-dw9w.mjs +0 -188
  1313. package/dist/seo-ClB-dw9w.mjs.map +0 -1
  1314. package/dist/seo-VZYOEy8f.mjs +0 -133
  1315. package/dist/seo-VZYOEy8f.mjs.map +0 -1
  1316. package/dist/service-Bo_usgSk.mjs +0 -150
  1317. package/dist/service-Bo_usgSk.mjs.map +0 -1
  1318. package/dist/session-user-DlpPdf8L.mjs +0 -61
  1319. package/dist/session-user-DlpPdf8L.mjs.map +0 -1
  1320. package/dist/settings-CWb84sDm.mjs +0 -452
  1321. package/dist/settings-CWb84sDm.mjs.map +0 -1
  1322. package/dist/settings-DS914jjE.mjs +0 -66
  1323. package/dist/settings-DS914jjE.mjs.map +0 -1
  1324. package/dist/settings-Dd1uivmQ.mjs +0 -73
  1325. package/dist/settings-Dd1uivmQ.mjs.map +0 -1
  1326. package/dist/setup-complete-BuNxAUiN.mjs +0 -65
  1327. package/dist/setup-complete-BuNxAUiN.mjs.map +0 -1
  1328. package/dist/setup-nonce-BnEAX0iy.mjs +0 -25
  1329. package/dist/setup-nonce-BnEAX0iy.mjs.map +0 -1
  1330. package/dist/site-domain-Bq5j5bVg.mjs +0 -131
  1331. package/dist/site-domain-Bq5j5bVg.mjs.map +0 -1
  1332. package/dist/site-settings-DRHfX7bq.mjs +0 -50
  1333. package/dist/site-settings-DRHfX7bq.mjs.map +0 -1
  1334. package/dist/site-url-MB685I5X.mjs +0 -45
  1335. package/dist/site-url-MB685I5X.mjs.map +0 -1
  1336. package/dist/sitemap-name-BTg2NJJv.mjs +0 -26
  1337. package/dist/sitemap-name-BTg2NJJv.mjs.map +0 -1
  1338. package/dist/slug-aVnUV4SL.mjs +0 -16
  1339. package/dist/slug-aVnUV4SL.mjs.map +0 -1
  1340. package/dist/slugify-bu2-jKia.mjs +0 -22
  1341. package/dist/slugify-bu2-jKia.mjs.map +0 -1
  1342. package/dist/snapshot-DYsG4uOq.mjs +0 -414
  1343. package/dist/snapshot-DYsG4uOq.mjs.map +0 -1
  1344. package/dist/ssrf-BcYjyM4M.mjs +0 -406
  1345. package/dist/ssrf-BcYjyM4M.mjs.map +0 -1
  1346. package/dist/stage-D8DWgPcO.mjs +0 -662
  1347. package/dist/stage-D8DWgPcO.mjs.map +0 -1
  1348. package/dist/staged-CD_imitH.mjs +0 -686
  1349. package/dist/staged-CD_imitH.mjs.map +0 -1
  1350. package/dist/state-CFbGZziM.mjs +0 -178
  1351. package/dist/state-CFbGZziM.mjs.map +0 -1
  1352. package/dist/status-BFNdxzKc.mjs +0 -30
  1353. package/dist/status-BFNdxzKc.mjs.map +0 -1
  1354. package/dist/storage-query-DRyu3bSU.d.mts +0 -1615
  1355. package/dist/storage-query-DRyu3bSU.d.mts.map +0 -1
  1356. package/dist/tar-DFjExb9X.mjs +0 -449
  1357. package/dist/tar-DFjExb9X.mjs.map +0 -1
  1358. package/dist/target-CWZs2-o6.mjs +0 -27
  1359. package/dist/target-CWZs2-o6.mjs.map +0 -1
  1360. package/dist/taxonomies-ChnU7Mc8.mjs +0 -697
  1361. package/dist/taxonomies-ChnU7Mc8.mjs.map +0 -1
  1362. package/dist/taxonomies-Dd9JJv_a.mjs +0 -939
  1363. package/dist/taxonomies-Dd9JJv_a.mjs.map +0 -1
  1364. package/dist/taxonomy-C_C_LBAU.mjs +0 -550
  1365. package/dist/taxonomy-C_C_LBAU.mjs.map +0 -1
  1366. package/dist/tokens-BnhSnGwJ.mjs +0 -171
  1367. package/dist/tokens-BnhSnGwJ.mjs.map +0 -1
  1368. package/dist/transaction-BVYIo_yu.mjs +0 -29
  1369. package/dist/transaction-BVYIo_yu.mjs.map +0 -1
  1370. package/dist/transfer-ClH6w6BV.mjs +0 -8873
  1371. package/dist/transfer-ClH6w6BV.mjs.map +0 -1
  1372. package/dist/transfer-WmWiR3xf.mjs +0 -166
  1373. package/dist/transfer-WmWiR3xf.mjs.map +0 -1
  1374. package/dist/transfer-download--ofRj9Cw.mjs +0 -33
  1375. package/dist/transfer-download--ofRj9Cw.mjs.map +0 -1
  1376. package/dist/transformations-Bx4lYY0Y.mjs +0 -196
  1377. package/dist/transformations-Bx4lYY0Y.mjs.map +0 -1
  1378. package/dist/transport-BjbqNiPI.mjs +0 -136
  1379. package/dist/transport-BjbqNiPI.mjs.map +0 -1
  1380. package/dist/transport-DxiXnbXk.d.mts +0 -42
  1381. package/dist/transport-DxiXnbXk.d.mts.map +0 -1
  1382. package/dist/trusted-proxy-BU3Nx9g1.mjs +0 -51
  1383. package/dist/trusted-proxy-BU3Nx9g1.mjs.map +0 -1
  1384. package/dist/turnstile-CJwvsOqw.mjs +0 -58
  1385. package/dist/turnstile-CJwvsOqw.mjs.map +0 -1
  1386. package/dist/types-BA3ey2QH.d.mts +0 -87
  1387. package/dist/types-BA3ey2QH.d.mts.map +0 -1
  1388. package/dist/types-BGmQ0uXs.mjs +0 -201
  1389. package/dist/types-BGmQ0uXs.mjs.map +0 -1
  1390. package/dist/types-Bwpzb5o6.d.mts +0 -227
  1391. package/dist/types-Bwpzb5o6.d.mts.map +0 -1
  1392. package/dist/types-CNB-dj6F.d.mts +0 -289
  1393. package/dist/types-CNB-dj6F.d.mts.map +0 -1
  1394. package/dist/types-CgfFGfO5.mjs +0 -16
  1395. package/dist/types-CgfFGfO5.mjs.map +0 -1
  1396. package/dist/types-Cj0_yZkn.mjs +0 -18
  1397. package/dist/types-Cj0_yZkn.mjs.map +0 -1
  1398. package/dist/types-D2NEXtgB.mjs +0 -127
  1399. package/dist/types-D2NEXtgB.mjs.map +0 -1
  1400. package/dist/types-DCFavOii.d.mts +0 -916
  1401. package/dist/types-DCFavOii.d.mts.map +0 -1
  1402. package/dist/types-DHO7Pd25.d.mts +0 -366
  1403. package/dist/types-DHO7Pd25.d.mts.map +0 -1
  1404. package/dist/types-DvqVxZXa.d.mts +0 -125
  1405. package/dist/types-DvqVxZXa.d.mts.map +0 -1
  1406. package/dist/types-QoPHm-2w.d.mts +0 -1741
  1407. package/dist/types-QoPHm-2w.d.mts.map +0 -1
  1408. package/dist/types-RLgeIpnF.d.mts +0 -374
  1409. package/dist/types-RLgeIpnF.d.mts.map +0 -1
  1410. package/dist/types-qHVygneX.mjs +0 -77
  1411. package/dist/types-qHVygneX.mjs.map +0 -1
  1412. package/dist/types-sUHaH7lC.mjs +0 -37
  1413. package/dist/types-sUHaH7lC.mjs.map +0 -1
  1414. package/dist/types-slSqujQL.d.mts +0 -204
  1415. package/dist/types-slSqujQL.d.mts.map +0 -1
  1416. package/dist/update-check-BxNg9T6N.mjs +0 -161
  1417. package/dist/update-check-BxNg9T6N.mjs.map +0 -1
  1418. package/dist/upload-attempts-DPFC4COv.mjs +0 -32
  1419. package/dist/upload-attempts-DPFC4COv.mjs.map +0 -1
  1420. package/dist/url-Dn3IStq8.mjs +0 -104
  1421. package/dist/url-Dn3IStq8.mjs.map +0 -1
  1422. package/dist/url-pattern-QATUE_rv.mjs +0 -41
  1423. package/dist/url-pattern-QATUE_rv.mjs.map +0 -1
  1424. package/dist/user-BlCTKVAm.mjs +0 -171
  1425. package/dist/user-BlCTKVAm.mjs.map +0 -1
  1426. package/dist/utils-TPt7w2cS.mjs +0 -442
  1427. package/dist/utils-TPt7w2cS.mjs.map +0 -1
  1428. package/dist/validate-DxYhJQA-.mjs +0 -524
  1429. package/dist/validate-DxYhJQA-.mjs.map +0 -1
  1430. package/dist/validate-emKxGC5F.d.mts +0 -468
  1431. package/dist/validate-emKxGC5F.d.mts.map +0 -1
  1432. package/dist/validation-Ckq4vsVg.mjs +0 -220
  1433. package/dist/validation-Ckq4vsVg.mjs.map +0 -1
  1434. package/dist/version-BZj18Q7G.mjs +0 -9
  1435. package/dist/version-BZj18Q7G.mjs.map +0 -1
  1436. package/dist/version-DHmGpcch.mjs +0 -7
  1437. package/dist/version-DHmGpcch.mjs.map +0 -1
  1438. package/dist/video-DytCnw3L.mjs +0 -54
  1439. package/dist/video-DytCnw3L.mjs.map +0 -1
  1440. package/dist/virtual-modules-DO954n7P.mjs +0 -515
  1441. package/dist/virtual-modules-DO954n7P.mjs.map +0 -1
  1442. package/dist/widgets-DA5XmvVC.mjs +0 -121
  1443. package/dist/widgets-DA5XmvVC.mjs.map +0 -1
  1444. package/dist/wxr-taxonomies-CrMonejI.d.mts +0 -34
  1445. package/dist/wxr-taxonomies-CrMonejI.d.mts.map +0 -1
  1446. package/dist/wxr-taxonomies-RgRG0d5e.mjs +0 -453
  1447. package/dist/wxr-taxonomies-RgRG0d5e.mjs.map +0 -1
  1448. package/dist/zod-generator-D0JKy94C.mjs +0 -424
  1449. package/dist/zod-generator-D0JKy94C.mjs.map +0 -1
  1450. /package/dist/{api-tokens-CdP49zVF.mjs → api-tokens-C7l0GUAF.mjs} +0 -0
  1451. /package/dist/{ssrf-DM0E-D_8.mjs → ssrf-BBXcxG-f.mjs} +0 -0
@@ -0,0 +1,1758 @@
1
+ import { f as __exportAll } from "./runner-CLorw5vo.mjs";
2
+ import { c as executeAtomicBatchIfSupported, u as isPostgres } from "./dialect-helpers-7_IqPdh9.mjs";
3
+ import { l as resolveConfiguredLocale, o as getLocaleRank, r as getI18nConfig } from "./config-Cs_AwWXI.mjs";
4
+ import { t as OptionsRepository } from "./options-DhrI7eMv.mjs";
5
+ import { t as ContentRepository } from "./content-Dt0Os_WQ.mjs";
6
+ import { n as localeMatches, r as localeOrder } from "./query-BFHjCzSh.mjs";
7
+ import { d as invalidateMenuObjectCache, r as coalesceObjectCacheWrites } from "./object-cache-EjasjtoQ.mjs";
8
+ import { n as chunks, t as SQL_BATCH_SIZE } from "./chunks-CYBOL-zn.mjs";
9
+ import { t as RevisionRepository } from "./revision-Dx7Uth1X.mjs";
10
+ import { t as withTransaction } from "./transaction-CkoQ5wqQ.mjs";
11
+ import { t as MediaRepository } from "./media-B_x5B9EA.mjs";
12
+ import { t as TaxonomyRepository } from "./taxonomy-BG_xu2Qf.mjs";
13
+ import { t as RedirectRepository } from "./redirect-DcmNMvOs.mjs";
14
+ import { t as BylineRepository } from "./byline-CzGZC2Zs.mjs";
15
+ import { t as INTERNAL_MEDIA_PREFIX } from "./normalize-Ip_hFAm8.mjs";
16
+ import { t as imageSize } from "./dist-DY0aOmAP.mjs";
17
+ import { t as FTSManager } from "./fts-manager-BzFo0xx6.mjs";
18
+ import { h as saveTaxonomyStructure, p as findTaxonomyStructure } from "./loader-D4w4XE7q.mjs";
19
+ import { L as BlockTypeRegistry, U as markContentMediaUsageCollectionStaleSafely, n as SchemaRegistry, t as SchemaError } from "./registry-DymfZkAN.mjs";
20
+ import { n as computeContentHash } from "./hash-A-o2ZX8O.mjs";
21
+ import { a as resolveBlockTypes, i as normalizeBlocksData } from "./block-values-CgbMtSGU.mjs";
22
+ import { m as setReferenceSelection } from "./relations-DrEs3Sc1.mjs";
23
+ import { n as createFieldRelation, t as bindReferenceField } from "./schema-C036pqEw.mjs";
24
+ import { c as invalidateSiteSettingsCache, d as setSiteSettings } from "./settings-yIqoN-Ok.mjs";
25
+ import { a as ssrfSafeFetch, s as validateExternalUrl } from "./ssrf-mcCKMH6B.mjs";
26
+ import { n as validateSeed, t as findTaxonomyStructureSource } from "./validate-BxLvcDYh.mjs";
27
+ import { ulid } from "ulidx";
28
+ import mime from "mime/lite";
29
+
30
+ //#region src/media/url.ts
31
+ /**
32
+ * Build the internal file route URL for a storage key, encoding each path
33
+ * segment so `?`, `#` and `%` stay inside the path. A key with an empty, `.` or
34
+ * `..` segment is encoded whole, because the URL parser would collapse those
35
+ * segments and move the request off the route. Mirrors the admin's
36
+ * `localMediaFileUrl`.
37
+ */
38
+ function localMediaFileUrl(key) {
39
+ const segments = key.split("/");
40
+ if (segments.some((segment) => segment === "" || segment === "." || segment === "..")) return `${INTERNAL_MEDIA_PREFIX}${encodeURIComponent(key)}`;
41
+ return `${INTERNAL_MEDIA_PREFIX}${segments.map(encodeURIComponent).join("/")}`;
42
+ }
43
+ /**
44
+ * Resolve the public URL for a locally stored media key. Returns an empty
45
+ * string when no key is given. When a storage adapter is supplied, defers to
46
+ * `storage.getPublicUrl()`; otherwise returns the internal proxy route.
47
+ */
48
+ function resolvePublicMediaUrl(storage, storageKey) {
49
+ if (!storageKey) return "";
50
+ if (storage) return storage.getPublicUrl(storageKey);
51
+ return `/_emdash/api/media/file/${storageKey}`;
52
+ }
53
+ /**
54
+ * Build the `getPublicMediaUrl` closure attached to `Astro.locals.emdash`.
55
+ * Shared by the anonymous fast path and the full-runtime path in middleware.
56
+ *
57
+ * @internal
58
+ */
59
+ function createPublicMediaUrlResolver(storage) {
60
+ return (key) => resolvePublicMediaUrl(storage, key);
61
+ }
62
+
63
+ //#endregion
64
+ //#region src/content/converters/gallery.ts
65
+ /**
66
+ * Shared sanitization for gallery block images and image media, used by both
67
+ * converters so the editor round-trip and the stored shape stay in lockstep.
68
+ */
69
+ /**
70
+ * Read an image's media reference, alt text, and dimensions. Accepts the
71
+ * reference shape (`_ref`, `url`) and the MediaValue that seeded `$media`
72
+ * stores instead (`id`, `src`, `meta.storageKey`, dimensions). The image's own
73
+ * `alt`, `width`, and `height` take precedence over the asset's.
74
+ */
75
+ function resolveImageMedia(image) {
76
+ const record = isRecord(image) ? image : {};
77
+ const asset = isRecord(record.asset) ? record.asset : {};
78
+ const storageKey = isRecord(asset.meta) ? nonEmptyString(asset.meta.storageKey) : void 0;
79
+ const url = nonEmptyString(asset.url) ?? nonEmptyString(asset.src) ?? (storageKey ? localMediaFileUrl(storageKey) : void 0);
80
+ const provider = nonEmptyString(asset.provider);
81
+ const alt = nonEmptyString(record.alt) ?? nonEmptyString(asset.alt);
82
+ const width = typeof record.width === "number" ? record.width : asset.width;
83
+ const height = typeof record.height === "number" ? record.height : asset.height;
84
+ const media = { asset: {
85
+ _type: "reference",
86
+ _ref: nonEmptyString(asset._ref) ?? nonEmptyString(asset.id) ?? "",
87
+ ...url ? { url } : {},
88
+ ...provider ? { provider } : {}
89
+ } };
90
+ if (alt) media.alt = alt;
91
+ if (typeof width === "number") media.width = width;
92
+ if (typeof height === "number") media.height = height;
93
+ return media;
94
+ }
95
+ /**
96
+ * Normalize an untrusted `images` value into well-formed gallery images.
97
+ * Non-object entries and entries without an asset object are dropped.
98
+ * Missing `_key`s are filled via `generateKey` when provided (PM → PT);
99
+ * left empty otherwise (PT → PM keeps whatever the block carried).
100
+ */
101
+ function sanitizeGalleryImages(value, generateKey) {
102
+ if (!Array.isArray(value)) return [];
103
+ const images = [];
104
+ for (const entry of value) {
105
+ if (!isRecord(entry)) continue;
106
+ const record = entry;
107
+ if (!isRecord(record.asset)) continue;
108
+ const { asset, alt, width, height } = resolveImageMedia(record);
109
+ const image = {
110
+ _type: "image",
111
+ _key: typeof record._key === "string" && record._key ? record._key : generateKey ? generateKey() : "",
112
+ asset
113
+ };
114
+ if (alt) image.alt = alt;
115
+ if (typeof record.caption === "string" && record.caption) image.caption = record.caption;
116
+ if (width !== void 0) image.width = width;
117
+ if (height !== void 0) image.height = height;
118
+ if (typeof record.focalX === "number") image.focalX = record.focalX;
119
+ if (typeof record.focalY === "number") image.focalY = record.focalY;
120
+ if (typeof record.blurhash === "string" && record.blurhash) image.blurhash = record.blurhash;
121
+ if (typeof record.dominantColor === "string" && record.dominantColor) image.dominantColor = record.dominantColor;
122
+ images.push(image);
123
+ }
124
+ return images;
125
+ }
126
+ function nonEmptyString(value) {
127
+ return typeof value === "string" && value ? value : void 0;
128
+ }
129
+ function isRecord(value) {
130
+ return typeof value === "object" && value !== null && !Array.isArray(value);
131
+ }
132
+
133
+ //#endregion
134
+ //#region src/seed/apply.ts
135
+ /**
136
+ * Seed engine - applies seed files to database
137
+ *
138
+ * This is the core implementation that bootstraps an EmDash site from a seed file.
139
+ * Apply order is critical for foreign keys and references.
140
+ */
141
+ var apply_exports = /* @__PURE__ */ __exportAll({
142
+ applySeed: () => applySeed,
143
+ applySeedWithinBudget: () => applySeedWithinBudget
144
+ });
145
+ const SEED_MENU_ITEM_INSERT_BATCH_SIZE = 6;
146
+ const SEED_WIDGET_INSERT_BATCH_SIZE = 10;
147
+ async function replaceSeedChildren(db, parentTable, parentIds, buildStatements) {
148
+ if (parentIds.length === 0) return;
149
+ if (await executeAtomicBatchIfSupported(db, buildStatements(db)) !== null) return;
150
+ await withTransaction(db, async (trx) => {
151
+ if (isPostgres(trx)) await trx.selectFrom(parentTable).select("id").where("id", "in", parentIds).orderBy("id").forUpdate().execute();
152
+ for (const statement of buildStatements(trx)) await statement.execute();
153
+ });
154
+ }
155
+ async function applySiteSettings(db, settings, onConflict, result) {
156
+ const entries = Object.entries(settings).filter(([, value]) => value !== void 0);
157
+ if (entries.length === 0) return;
158
+ if (onConflict === "update") {
159
+ await setSiteSettings(settings, db);
160
+ result.settings.applied += entries.length;
161
+ return;
162
+ }
163
+ const options = new OptionsRepository(db);
164
+ let applied = 0;
165
+ try {
166
+ for (const [key, value] of entries) {
167
+ const write = await options.compareAndSet(`site:${key}`, null, value);
168
+ if (!write.applied && onConflict === "error") throw new Error(`Conflict: site setting "site:${key}" already exists`);
169
+ if (write.applied) applied++;
170
+ }
171
+ } finally {
172
+ if (applied > 0) {
173
+ result.settings.applied += applied;
174
+ invalidateSiteSettingsCache();
175
+ }
176
+ }
177
+ }
178
+ /**
179
+ * Set a collection's `titleField`/`dateField`: a separate write run after the
180
+ * fields exist, so `updateCollection` can validate them. No-op when neither is set.
181
+ */
182
+ async function applyDisplayDateFields(registry, collection) {
183
+ if (collection.titleField === void 0 && collection.dateField === void 0) return;
184
+ await registry.updateCollection(collection.slug, {
185
+ titleField: collection.titleField,
186
+ dateField: collection.dateField
187
+ });
188
+ }
189
+ const FILE_EXTENSION_PATTERN = /\.([a-z0-9]+)(?:\?|$)/i;
190
+ const SEED_RELATION_NAME_MAX_ATTEMPTS = 5;
191
+ const SEED_RELATION_INSERT_BATCH_SIZE = 10;
192
+ /** Pattern to remove file extensions */
193
+ const EXTENSION_PATTERN = /\.[^.]+$/;
194
+ /** Pattern to remove query parameters */
195
+ const QUERY_PARAM_PATTERN = /\?.*$/;
196
+ /** Pattern to remove non-alphanumeric characters (except dash and underscore) */
197
+ const SANITIZE_PATTERN = /[^a-zA-Z0-9_-]/g;
198
+ /** Pattern to collapse multiple hyphens */
199
+ const MULTIPLE_HYPHENS_PATTERN = /-+/g;
200
+ /** The `category` and `tag` defs that migrations insert on every new database. */
201
+ const BUILT_IN_TAXONOMY_DEFS = new Map([["taxdef_category", {
202
+ label: "Categories",
203
+ label_singular: "Category",
204
+ hierarchical: 1,
205
+ collections: "[\"posts\"]"
206
+ }], ["taxdef_tag", {
207
+ label: "Tags",
208
+ label_singular: "Tag",
209
+ hierarchical: 0,
210
+ collections: "[\"posts\"]"
211
+ }]]);
212
+ /** Whether `def` is a built-in `category`/`tag` definition still holding its migration defaults. */
213
+ function isUntouchedBuiltInTaxonomyDef(def) {
214
+ const builtIn = BUILT_IN_TAXONOMY_DEFS.get(def.id);
215
+ return builtIn !== void 0 && def.label === builtIn.label && def.label_singular === builtIn.label_singular && def.hierarchical === builtIn.hierarchical && def.collections === builtIn.collections;
216
+ }
217
+ /**
218
+ * Apply a seed file to the database
219
+ *
220
+ * This function is idempotent - safe to run multiple times.
221
+ *
222
+ * @param db - Kysely database instance
223
+ * @param seed - Seed file to apply
224
+ * @param options - Application options
225
+ * @returns Result summary
226
+ */
227
+ async function applySeed(db, seed, options = {}) {
228
+ const { result } = await coalesceObjectCacheWrites(() => applySeedWrites(db, seed, options, null));
229
+ return result;
230
+ }
231
+ /**
232
+ * Apply a seed over several calls, for a platform that caps the queries or
233
+ * fetches of one request.
234
+ *
235
+ * The limits are thresholds, checked before each taxonomy term, byline and
236
+ * content entry is created and before the phases that follow content. Schema,
237
+ * taxonomy definitions and settings are applied in every call, the item that
238
+ * crosses a threshold finishes, and the phases after content (menus,
239
+ * redirects, widgets, sections) run in one call, so set the limits well below
240
+ * the platform's. A call that stops returns `complete: false`; applying the
241
+ * same seed again continues with the first item not yet created. A call
242
+ * creates at least one item before it stops, so repeated calls finish. A
243
+ * `$media` URL used by entries in different calls is still downloaded each time
244
+ * so its content hash can be computed, but the resulting media row is reused
245
+ * when an existing ready row has the same hash. Requires
246
+ * `onConflict: "skip"`.
247
+ */
248
+ async function applySeedWithinBudget(db, seed, options, limits) {
249
+ const budget = new SeedBudget(limits);
250
+ return coalesceObjectCacheWrites(() => applySeedWrites(db.withPlugin(budget), seed, options, budget));
251
+ }
252
+ /**
253
+ * Counts what a budgeted call spends. As a Kysely plugin it sees every query
254
+ * the call runs, including those inside transactions.
255
+ */
256
+ var SeedBudget = class {
257
+ #queries = 0;
258
+ #mediaDownloads = 0;
259
+ constructor(limits) {
260
+ this.limits = limits;
261
+ }
262
+ transformQuery(args) {
263
+ this.#queries++;
264
+ return args.node;
265
+ }
266
+ transformResult(args) {
267
+ return Promise.resolve(args.result);
268
+ }
269
+ countMediaDownload() {
270
+ this.#mediaDownloads++;
271
+ }
272
+ isSpent() {
273
+ const { queries, mediaDownloads } = this.limits;
274
+ return queries !== void 0 && this.#queries >= queries || mediaDownloads !== void 0 && this.#mediaDownloads >= mediaDownloads;
275
+ }
276
+ };
277
+ async function applySeedWrites(db, seed, options, budget) {
278
+ const validation = validateSeed(seed);
279
+ if (!validation.valid) throw new Error(`Invalid seed file:\n${validation.errors.join("\n")}`);
280
+ const { includeContent = false, storage, skipMediaDownload = false, onConflict = "skip" } = options;
281
+ if (budget && onConflict !== "skip") throw new Error("A seed budget requires onConflict: \"skip\"");
282
+ const result = {
283
+ blockTypes: {
284
+ created: 0,
285
+ skipped: 0,
286
+ updated: 0
287
+ },
288
+ collections: {
289
+ created: 0,
290
+ skipped: 0,
291
+ updated: 0
292
+ },
293
+ fields: {
294
+ created: 0,
295
+ skipped: 0,
296
+ updated: 0
297
+ },
298
+ relations: {
299
+ created: 0,
300
+ skipped: 0,
301
+ updated: 0
302
+ },
303
+ taxonomies: {
304
+ created: 0,
305
+ skipped: 0,
306
+ terms: 0
307
+ },
308
+ bylines: {
309
+ created: 0,
310
+ skipped: 0,
311
+ updated: 0
312
+ },
313
+ menus: {
314
+ created: 0,
315
+ items: 0
316
+ },
317
+ redirects: {
318
+ created: 0,
319
+ skipped: 0,
320
+ updated: 0
321
+ },
322
+ widgetAreas: {
323
+ created: 0,
324
+ widgets: 0
325
+ },
326
+ sections: {
327
+ created: 0,
328
+ skipped: 0,
329
+ updated: 0
330
+ },
331
+ settings: { applied: 0 },
332
+ content: {
333
+ created: 0,
334
+ skipped: 0,
335
+ updated: 0
336
+ },
337
+ media: {
338
+ created: 0,
339
+ skipped: 0
340
+ }
341
+ };
342
+ let complete = true;
343
+ const progress = {
344
+ done: 0,
345
+ total: countSeedItems(seed, includeContent)
346
+ };
347
+ const mayCreateItem = () => !budget || result.taxonomies.terms + result.bylines.created + result.content.created === 0 || !budget.isSpent();
348
+ const mediaContext = {
349
+ db,
350
+ storage: storage ?? null,
351
+ skipMediaDownload,
352
+ mediaCache: /* @__PURE__ */ new Map(),
353
+ budget
354
+ };
355
+ const seedIdMap = /* @__PURE__ */ new Map();
356
+ const seedBylineIdMap = /* @__PURE__ */ new Map();
357
+ const staleMarkedContentCollections = /* @__PURE__ */ new Set();
358
+ const failedStaleContentCollections = /* @__PURE__ */ new Set();
359
+ const defaultLocale = getI18nConfig()?.defaultLocale ?? seed.defaultLocale ?? "en";
360
+ const markSeedContentCollectionStale = async (collectionSlug) => {
361
+ if (staleMarkedContentCollections.has(collectionSlug)) return;
362
+ if (await markContentMediaUsageCollectionStaleSafely(db, collectionSlug, "CONTENT_USAGE_STALE")) {
363
+ staleMarkedContentCollections.add(collectionSlug);
364
+ failedStaleContentCollections.delete(collectionSlug);
365
+ } else failedStaleContentCollections.add(collectionSlug);
366
+ };
367
+ const retryFailedSeedContentStaleMarks = async () => {
368
+ for (const collectionSlug of failedStaleContentCollections) if (await markContentMediaUsageCollectionStaleSafely(db, collectionSlug, "CONTENT_USAGE_STALE")) {
369
+ staleMarkedContentCollections.add(collectionSlug);
370
+ failedStaleContentCollections.delete(collectionSlug);
371
+ }
372
+ };
373
+ if (seed.settings) await applySiteSettings(db, seed.settings, onConflict, result);
374
+ if (seed.relations) await applySeedRelations(db, seed.relations, seed.collections ?? [], onConflict, result);
375
+ if (seed.blockTypes) {
376
+ const registry = new BlockTypeRegistry(db);
377
+ for (const blockType of seed.blockTypes) {
378
+ const existing = await registry.getBlockType(blockType.slug);
379
+ await registry.applySeedBlockType(blockType, onConflict);
380
+ if (!existing) result.blockTypes.created++;
381
+ else if (onConflict === "update") result.blockTypes.updated++;
382
+ else result.blockTypes.skipped++;
383
+ }
384
+ }
385
+ if (seed.collections) {
386
+ const registry = new SchemaRegistry(db);
387
+ const seedCollectionSlugs = new Set(seed.collections.map((collection) => collection.slug));
388
+ const knownRelations = await readRelationEnds(db);
389
+ const relationSlugs = new Set(knownRelations.keys());
390
+ const externalTargetExists = /* @__PURE__ */ new Map();
391
+ const pendingRelations = [];
392
+ for (const collection of seed.collections) {
393
+ if (await registry.getCollection(collection.slug)) {
394
+ if (onConflict === "error") throw new Error(`Conflict: collection "${collection.slug}" already exists`);
395
+ if (onConflict === "update") {
396
+ await registry.updateCollection(collection.slug, {
397
+ label: collection.label,
398
+ labelSingular: collection.labelSingular,
399
+ description: collection.description,
400
+ icon: collection.icon,
401
+ admin: collection.admin,
402
+ supports: collection.supports || [],
403
+ urlPattern: collection.urlPattern,
404
+ routable: collection.routable,
405
+ hidden: collection.hidden,
406
+ sortOrder: collection.sortOrder,
407
+ group: collection.group,
408
+ commentsEnabled: collection.commentsEnabled,
409
+ editLocking: collection.editLocking
410
+ });
411
+ result.collections.updated++;
412
+ for (const field of collection.fields) {
413
+ const existingField = await registry.getField(collection.slug, field.slug);
414
+ await upsertSeedField(db, collection.slug, field, existingField, knownRelations);
415
+ if (existingField) result.fields.updated++;
416
+ else result.fields.created++;
417
+ }
418
+ await applyDisplayDateFields(registry, collection);
419
+ continue;
420
+ }
421
+ result.collections.skipped++;
422
+ result.fields.skipped += collection.fields.length;
423
+ continue;
424
+ }
425
+ const fields = [];
426
+ for (const field of collection.fields) {
427
+ let fieldValidation = field.validation;
428
+ const bound = resolveSeedFieldRelation(collection.slug, field, knownRelations);
429
+ const targetCollection = !bound && field.type === "reference" && typeof fieldValidation?.targetCollection === "string" ? fieldValidation.targetCollection : void 0;
430
+ if (bound) fieldValidation = {
431
+ ...fieldValidation,
432
+ ...bound
433
+ };
434
+ if (targetCollection) {
435
+ let targetExists = seedCollectionSlugs.has(targetCollection);
436
+ if (!targetExists) {
437
+ targetExists = externalTargetExists.get(targetCollection) ?? false;
438
+ if (!externalTargetExists.has(targetCollection)) {
439
+ targetExists = Boolean(await registry.getCollection(targetCollection));
440
+ externalTargetExists.set(targetCollection, targetExists);
441
+ }
442
+ }
443
+ if (!targetExists) throw new SchemaError(`Target collection "${targetCollection}" not found`, "COLLECTION_NOT_FOUND");
444
+ const relationId = ulid();
445
+ const relationSlug = allocateSeedRelationName(collection.slug, field.slug, relationSlugs);
446
+ pendingRelations.push({
447
+ id: relationId,
448
+ slug: relationSlug,
449
+ parent_collection: collection.slug,
450
+ child_collection: targetCollection,
451
+ parent_label: collection.label,
452
+ parent_label_singular: collection.labelSingular ?? null,
453
+ child_label: field.label,
454
+ max_children_per_parent: fieldValidation?.multiple ? null : 1
455
+ });
456
+ fieldValidation = {
457
+ ...fieldValidation,
458
+ relation: relationSlug,
459
+ relationSide: "parent"
460
+ };
461
+ }
462
+ fields.push({
463
+ slug: field.slug,
464
+ label: field.label,
465
+ type: field.type,
466
+ required: field.required || false,
467
+ unique: field.unique || false,
468
+ searchable: field.searchable || false,
469
+ indexed: field.indexed || false,
470
+ translatable: field.translatable,
471
+ defaultValue: field.defaultValue,
472
+ validation: fieldValidation,
473
+ widget: field.widget,
474
+ options: field.options
475
+ });
476
+ }
477
+ await registry.createSeedCollection({
478
+ slug: collection.slug,
479
+ label: collection.label,
480
+ labelSingular: collection.labelSingular,
481
+ description: collection.description,
482
+ icon: collection.icon,
483
+ admin: collection.admin,
484
+ supports: collection.supports || [],
485
+ urlPattern: collection.urlPattern,
486
+ routable: collection.routable,
487
+ hidden: collection.hidden,
488
+ sortOrder: collection.sortOrder,
489
+ group: collection.group,
490
+ commentsEnabled: collection.commentsEnabled,
491
+ editLocking: collection.editLocking
492
+ }, fields);
493
+ await applyDisplayDateFields(registry, collection);
494
+ result.collections.created++;
495
+ result.fields.created += collection.fields.length;
496
+ }
497
+ for (const relationBatch of chunks(pendingRelations, SEED_RELATION_INSERT_BATCH_SIZE)) await db.insertInto("_emdash_relations").values(relationBatch).execute();
498
+ }
499
+ if (seed.taxonomies) {
500
+ const termSeedIdMap = /* @__PURE__ */ new Map();
501
+ const taxonomiesBySeedId = /* @__PURE__ */ new Map();
502
+ for (const taxonomy of seed.taxonomies) if (taxonomy.id) taxonomiesBySeedId.set(taxonomy.id, taxonomy);
503
+ const untouchedBuiltInDefIds = new Set((await db.selectFrom("_emdash_taxonomy_defs").select([
504
+ "id",
505
+ "label",
506
+ "label_singular",
507
+ "hierarchical",
508
+ "collections"
509
+ ]).where("id", "in", [...BUILT_IN_TAXONOMY_DEFS.keys()]).execute()).filter(isUntouchedBuiltInTaxonomyDef).map((def) => def.id));
510
+ const declaresOwnStructure = (taxonomy) => findTaxonomyStructureSource(taxonomy, taxonomiesBySeedId) === taxonomy;
511
+ const orderedTaxonomies = [...seed.taxonomies.filter(declaresOwnStructure), ...seed.taxonomies.filter((taxonomy) => !declaresOwnStructure(taxonomy))];
512
+ for (const taxonomy of orderedTaxonomies) {
513
+ const defLocale = resolveConfiguredLocale(taxonomy.locale ?? defaultLocale);
514
+ const defsOfName = await db.selectFrom("_emdash_taxonomy_defs").select(["id", "locale"]).where("name", "=", taxonomy.name).execute();
515
+ const existingDef = defsOfName.filter((def) => resolveConfiguredLocale(def.locale) === defLocale).toSorted((a, b) => getLocaleRank(a.locale, defLocale) - getLocaleRank(b.locale, defLocale) || a.id.localeCompare(b.id))[0];
516
+ const unclaimed = existingDef !== void 0 && untouchedBuiltInDefIds.has(existingDef.id);
517
+ if (existingDef && onConflict === "error" && !unclaimed) throw new Error(`Conflict: taxonomy "${taxonomy.name}" (${defLocale}) already exists`);
518
+ const replacesDef = onConflict === "update" || unclaimed;
519
+ const existingStructure = await findTaxonomyStructure(db, taxonomy.name);
520
+ const replacesStructure = replacesDef || defsOfName.every((def) => untouchedBuiltInDefIds.has(def.id));
521
+ const writesStructure = !existingStructure || replacesStructure && !taxonomy.translationOf;
522
+ const structure = existingStructure && !writesStructure ? existingStructure : {
523
+ hierarchical: taxonomy.hierarchical ?? existingStructure?.hierarchical ?? false,
524
+ collections: taxonomy.collections ?? existingStructure?.collections ?? []
525
+ };
526
+ const defId = existingDef?.id ?? ulid();
527
+ const translationGroup = writesStructure ? await saveTaxonomyStructure(db, taxonomy.name, existingStructure?.id ?? defId, structure) : existingStructure.id;
528
+ if (existingDef) if (replacesDef) await db.updateTable("_emdash_taxonomy_defs").set({
529
+ label: taxonomy.label,
530
+ label_singular: taxonomy.labelSingular ?? null
531
+ }).where("id", "=", existingDef.id).execute();
532
+ else result.taxonomies.skipped++;
533
+ else {
534
+ await db.insertInto("_emdash_taxonomy_defs").values({
535
+ id: defId,
536
+ name: taxonomy.name,
537
+ label: taxonomy.label,
538
+ label_singular: taxonomy.labelSingular ?? null,
539
+ hierarchical: structure.hierarchical ? 1 : 0,
540
+ collections: JSON.stringify(structure.collections),
541
+ locale: defLocale,
542
+ translation_group: translationGroup
543
+ }).execute();
544
+ result.taxonomies.created++;
545
+ }
546
+ if (includeContent && taxonomy.terms && taxonomy.terms.length > 0) {
547
+ const termRepo = new TaxonomyRepository(db);
548
+ const existingTerms = await findExistingSeedTerms(db, taxonomy.name, taxonomy.terms);
549
+ if (structure.hierarchical) {
550
+ const applied = await applyHierarchicalTerms(termRepo, taxonomy.name, defLocale, taxonomy.terms, existingTerms, termSeedIdMap, result, onConflict, mayCreateItem);
551
+ progress.done += applied.processed;
552
+ complete = applied.complete;
553
+ } else for (const term of taxonomy.terms) {
554
+ const termLocale = resolveConfiguredLocale(term.locale ?? defLocale);
555
+ const termKey = seedTermKey(termLocale, term.slug);
556
+ const existingId = existingTerms.get(termKey);
557
+ if (existingId) {
558
+ if (onConflict === "error") throw new Error(`Conflict: taxonomy term "${term.slug}" in "${taxonomy.name}" (${termLocale}) already exists`);
559
+ if (onConflict === "update") {
560
+ await termRepo.update(existingId, {
561
+ label: term.label,
562
+ data: term.description ? { description: term.description } : {}
563
+ });
564
+ result.taxonomies.terms++;
565
+ }
566
+ if (term.id) termSeedIdMap.set(term.id, existingId);
567
+ progress.done++;
568
+ } else {
569
+ if (!mayCreateItem()) {
570
+ complete = false;
571
+ break;
572
+ }
573
+ const translationOf = term.translationOf ? termSeedIdMap.get(term.translationOf) : void 0;
574
+ const created = await termRepo.create({
575
+ name: taxonomy.name,
576
+ slug: term.slug,
577
+ label: term.label,
578
+ data: term.description ? { description: term.description } : void 0,
579
+ locale: termLocale,
580
+ translationOf
581
+ });
582
+ existingTerms.set(termKey, created.id);
583
+ if (term.id) termSeedIdMap.set(term.id, created.id);
584
+ result.taxonomies.terms++;
585
+ progress.done++;
586
+ }
587
+ }
588
+ }
589
+ if (!complete) break;
590
+ }
591
+ const { invalidateTaxonomyDefsCache } = await import("./taxonomies-By2aGvq2.mjs").then((n) => n.f);
592
+ invalidateTaxonomyDefsCache();
593
+ }
594
+ if (complete && includeContent && seed.bylines) {
595
+ const bylineRepo = new BylineRepository(db);
596
+ const existingBylines = await findExistingSeedBylines(db, seed.bylines.map((byline) => byline.slug));
597
+ for (const byline of seed.bylines) {
598
+ const existingId = existingBylines.get(byline.slug);
599
+ if (existingId) {
600
+ if (onConflict === "error") throw new Error(`Conflict: byline "${byline.slug}" already exists`);
601
+ if (onConflict === "update") {
602
+ const avatar = byline.avatar ? await resolveSeedBylineAvatar(db, byline.avatar) : null;
603
+ try {
604
+ if (!await bylineRepo.update(existingId, {
605
+ displayName: byline.displayName,
606
+ bio: byline.bio ?? null,
607
+ websiteUrl: byline.websiteUrl ?? null,
608
+ isGuest: byline.isGuest,
609
+ ...avatar ? { avatarMediaId: avatar.id } : {}
610
+ })) throw new Error(`Byline "${byline.slug}" disappeared during update`);
611
+ } catch (error) {
612
+ if (avatar?.created) await deleteMediaRow(db, avatar.id);
613
+ throw error;
614
+ }
615
+ seedBylineIdMap.set(byline.id, existingId);
616
+ result.bylines.updated++;
617
+ if (avatar?.created) result.media.created++;
618
+ progress.done++;
619
+ continue;
620
+ }
621
+ seedBylineIdMap.set(byline.id, existingId);
622
+ result.bylines.skipped++;
623
+ progress.done++;
624
+ continue;
625
+ }
626
+ if (!mayCreateItem()) {
627
+ complete = false;
628
+ break;
629
+ }
630
+ const avatar = byline.avatar ? await resolveSeedBylineAvatar(db, byline.avatar) : null;
631
+ let createdId;
632
+ try {
633
+ createdId = (await bylineRepo.create({
634
+ slug: byline.slug,
635
+ displayName: byline.displayName,
636
+ bio: byline.bio ?? null,
637
+ websiteUrl: byline.websiteUrl ?? null,
638
+ isGuest: byline.isGuest,
639
+ avatarMediaId: avatar?.id ?? null
640
+ })).id;
641
+ } catch (error) {
642
+ if (avatar?.created) await deleteMediaRow(db, avatar.id);
643
+ throw error;
644
+ }
645
+ existingBylines.set(byline.slug, createdId);
646
+ seedBylineIdMap.set(byline.id, createdId);
647
+ result.bylines.created++;
648
+ if (avatar?.created) result.media.created++;
649
+ progress.done++;
650
+ }
651
+ }
652
+ if (complete && includeContent && seed.content) {
653
+ const contentRepo = new ContentRepository(db);
654
+ const schemaRegistry = new SchemaRegistry(db);
655
+ const datetimeContexts = /* @__PURE__ */ new Map();
656
+ try {
657
+ for (const [collectionSlug, entries] of Object.entries(seed.content)) {
658
+ const collectionInfo = await schemaRegistry.getCollectionWithFields(collectionSlug);
659
+ const collectionRoutable = collectionInfo?.routable !== false;
660
+ const referenceFields = referenceFieldsOf(collectionInfo);
661
+ const resolvedBlockTypes = collectionInfo?.fields.some((field) => field.type === "blocks") ? await resolveBlockTypes(db) : void 0;
662
+ const existingEntries = await findExistingSeedEntries(contentRepo, collectionSlug, entries, defaultLocale);
663
+ const trashedEntries = await findExistingSeedEntries(contentRepo, collectionSlug, entries.filter((entry) => {
664
+ const { slug, locale } = seedEntryIdentity(entry, defaultLocale);
665
+ return !existingEntries.has(seedEntryKey(entry, slug, locale));
666
+ }), defaultLocale, true);
667
+ for (const entry of entries) {
668
+ const { slug: entrySlug, locale: entryLocale } = seedEntryIdentity(entry, defaultLocale);
669
+ const entryKey = seedEntryKey(entry, entrySlug, entryLocale);
670
+ const existing = existingEntries.get(entryKey);
671
+ if (!existing) {
672
+ if (trashedEntries.get(entryKey)) {
673
+ if (onConflict === "error") throw new Error(`Conflict: content "${entrySlug ?? entry.id}" in "${collectionSlug}" already exists (in trash)`);
674
+ console.warn(`content.${collectionSlug}: "${entrySlug ?? entry.id}" (${entryLocale}) exists in the trash — skipping`);
675
+ result.content.skipped++;
676
+ progress.done++;
677
+ continue;
678
+ }
679
+ }
680
+ if (existing) {
681
+ if (onConflict === "error") throw new Error(`Conflict: content "${entrySlug ?? entry.id}" in "${collectionSlug}" already exists`);
682
+ if (onConflict === "update") {
683
+ let resolvedData = await resolveReferences(entry.data, seedIdMap, mediaContext, result);
684
+ if (collectionInfo) resolvedData = await normalizeBlocksData(db, collectionInfo, resolvedData, existing.data, { restoreBlocks: true }, false, resolvedBlockTypes);
685
+ const { columnData, edges } = splitReferenceFields(collectionSlug, referenceFields, resolvedData);
686
+ const status = entry.status || "published";
687
+ let contentMutated = false;
688
+ try {
689
+ await withTransaction(db, async (trx) => {
690
+ const trxContentRepo = new ContentRepository(trx, datetimeContexts);
691
+ const trxBylineRepo = new BylineRepository(trx);
692
+ const trxRevisionRepo = new RevisionRepository(trx, datetimeContexts);
693
+ await trxContentRepo.update(collectionSlug, existing.id, {
694
+ status,
695
+ data: columnData
696
+ });
697
+ contentMutated = true;
698
+ await applyContentBylines(trxBylineRepo, collectionSlug, existing.id, entry, seedBylineIdMap, true);
699
+ await applyContentTaxonomies(trx, collectionSlug, existing.id, entry, true);
700
+ await applyContentReferences(trx, collectionSlug, existing.id, edges);
701
+ if (status === "published") {
702
+ const draft = await trxRevisionRepo.create({
703
+ collection: collectionSlug,
704
+ entryId: existing.id,
705
+ data: columnData
706
+ });
707
+ try {
708
+ await trxContentRepo.setDraftRevision(collectionSlug, existing.id, draft.id);
709
+ await trxContentRepo.publish(collectionSlug, existing.id, void 0, false, void 0, true, collectionRoutable);
710
+ } catch (error) {
711
+ try {
712
+ await trxRevisionRepo.deleteIfUnreferenced(collectionSlug, existing.id, draft.id);
713
+ } catch (cleanupError) {
714
+ console.error(`[seed] Failed to clean up unstaged revision ${draft.id}:`, cleanupError);
715
+ }
716
+ throw error;
717
+ }
718
+ }
719
+ });
720
+ } catch (error) {
721
+ if (contentMutated) await markSeedContentCollectionStale(collectionSlug);
722
+ throw error;
723
+ }
724
+ seedIdMap.set(entry.id, existing.id);
725
+ result.content.updated++;
726
+ progress.done++;
727
+ await markSeedContentCollectionStale(collectionSlug);
728
+ continue;
729
+ }
730
+ result.content.skipped++;
731
+ seedIdMap.set(entry.id, existing.id);
732
+ progress.done++;
733
+ continue;
734
+ }
735
+ if (!mayCreateItem()) {
736
+ complete = false;
737
+ break;
738
+ }
739
+ let resolvedData = await resolveReferences(entry.data, seedIdMap, mediaContext, result);
740
+ if (collectionInfo) resolvedData = await normalizeBlocksData(db, collectionInfo, resolvedData, {}, { restoreBlocks: true }, false, resolvedBlockTypes);
741
+ const { columnData, edges } = splitReferenceFields(collectionSlug, referenceFields, resolvedData);
742
+ let translationOf;
743
+ if (entry.translationOf) {
744
+ const sourceId = seedIdMap.get(entry.translationOf);
745
+ if (!sourceId) console.warn(`content.${collectionSlug}: translationOf "${entry.translationOf}" not found (not yet created or missing). Skipping translation link.`);
746
+ else translationOf = sourceId;
747
+ }
748
+ const status = entry.status || "published";
749
+ let contentMutated = false;
750
+ let created;
751
+ try {
752
+ created = await withTransaction(db, async (trx) => {
753
+ const trxContentRepo = new ContentRepository(trx, datetimeContexts);
754
+ const trxBylineRepo = new BylineRepository(trx);
755
+ const item = await trxContentRepo.create({
756
+ ...entrySlug ? {} : { id: entry.id },
757
+ type: collectionSlug,
758
+ slug: entrySlug,
759
+ status,
760
+ data: columnData,
761
+ locale: entryLocale,
762
+ translationOf,
763
+ publishedAt: status === "published" ? (/* @__PURE__ */ new Date()).toISOString() : null
764
+ });
765
+ contentMutated = true;
766
+ await applyContentBylines(trxBylineRepo, collectionSlug, item.id, entry, seedBylineIdMap);
767
+ await applyContentTaxonomies(trx, collectionSlug, item.id, entry, false);
768
+ await applyContentReferences(trx, collectionSlug, item.id, edges);
769
+ if (status === "published") await trxContentRepo.publish(collectionSlug, item.id, void 0, false, void 0, true, collectionRoutable);
770
+ return item;
771
+ });
772
+ } catch (error) {
773
+ if (contentMutated) await markSeedContentCollectionStale(collectionSlug);
774
+ throw error;
775
+ }
776
+ seedIdMap.set(entry.id, created.id);
777
+ existingEntries.set(entryKey, created);
778
+ result.content.created++;
779
+ progress.done++;
780
+ await markSeedContentCollectionStale(collectionSlug);
781
+ }
782
+ if (!complete) break;
783
+ }
784
+ } finally {
785
+ await retryFailedSeedContentStaleMarks();
786
+ }
787
+ }
788
+ if (complete && !mayCreateItem()) complete = false;
789
+ if (!complete) {
790
+ await invalidateSeedCaches();
791
+ return {
792
+ result,
793
+ complete,
794
+ progress
795
+ };
796
+ }
797
+ if (seed.menus) {
798
+ const menuSeedIdMap = /* @__PURE__ */ new Map();
799
+ const itemSeedIdMap = /* @__PURE__ */ new Map();
800
+ const menuIds = [];
801
+ const itemRows = [];
802
+ try {
803
+ for (const menu of seed.menus) {
804
+ const locale = resolveConfiguredLocale(menu.locale ?? defaultLocale);
805
+ let lookup = db.selectFrom("_emdash_menus").selectAll().where("name", "=", menu.name).where(localeMatches("locale", locale)).orderBy(localeOrder("locale", locale), "asc").orderBy("id", "asc");
806
+ const existingMenu = await lookup.executeTakeFirst();
807
+ let menuId;
808
+ let translationGroup;
809
+ if (existingMenu) {
810
+ menuId = existingMenu.id;
811
+ translationGroup = existingMenu.translation_group ?? existingMenu.id;
812
+ } else {
813
+ menuId = ulid();
814
+ translationGroup = menuId;
815
+ if (menu.translationOf) {
816
+ const source = menuSeedIdMap.get(menu.translationOf);
817
+ if (source) translationGroup = source.translationGroup;
818
+ else console.warn(`menu "${menu.name}" (${locale}): translationOf "${menu.translationOf}" not found yet; minting a fresh group.`);
819
+ }
820
+ if (await db.insertInto("_emdash_menus").values({
821
+ id: menuId,
822
+ name: menu.name,
823
+ label: menu.label,
824
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
825
+ updated_at: (/* @__PURE__ */ new Date()).toISOString(),
826
+ locale,
827
+ translation_group: translationGroup
828
+ }).onConflict((conflict) => conflict.columns(["name", "locale"]).doNothing()).returning("id").executeTakeFirst()) result.menus.created++;
829
+ else {
830
+ const concurrentMenu = await lookup.executeTakeFirstOrThrow();
831
+ menuId = concurrentMenu.id;
832
+ translationGroup = concurrentMenu.translation_group ?? concurrentMenu.id;
833
+ }
834
+ }
835
+ if (menu.id) menuSeedIdMap.set(menu.id, {
836
+ id: menuId,
837
+ translationGroup
838
+ });
839
+ menuIds.push(menuId);
840
+ const itemCount = collectMenuItems(itemRows, menuId, existingMenu?.locale ?? locale, menu.items, null, 0, seedIdMap, itemSeedIdMap);
841
+ result.menus.items += itemCount;
842
+ }
843
+ const buildStatements = (target) => [...menuIds.map((id) => target.deleteFrom("_emdash_menu_items").where("menu_id", "=", id)), ...chunks(itemRows, SEED_MENU_ITEM_INSERT_BATCH_SIZE).map((rows) => target.insertInto("_emdash_menu_items").values(rows))];
844
+ await replaceSeedChildren(db, "_emdash_menus", menuIds, buildStatements);
845
+ } finally {
846
+ invalidateMenuObjectCache();
847
+ }
848
+ }
849
+ if (seed.redirects) {
850
+ const redirectRepo = new RedirectRepository(db);
851
+ for (const redirect of seed.redirects) {
852
+ const existing = await redirectRepo.findBySource(redirect.source);
853
+ if (existing) {
854
+ if (onConflict === "error") throw new Error(`Conflict: redirect "${redirect.source}" already exists`);
855
+ if (onConflict === "update") {
856
+ await redirectRepo.update(existing.id, {
857
+ destination: redirect.destination,
858
+ type: redirect.type,
859
+ enabled: redirect.enabled,
860
+ groupName: redirect.groupName
861
+ });
862
+ result.redirects.updated++;
863
+ continue;
864
+ }
865
+ result.redirects.skipped++;
866
+ continue;
867
+ }
868
+ await redirectRepo.create({
869
+ source: redirect.source,
870
+ destination: redirect.destination,
871
+ type: redirect.type,
872
+ enabled: redirect.enabled,
873
+ groupName: redirect.groupName
874
+ });
875
+ result.redirects.created++;
876
+ }
877
+ }
878
+ if (seed.widgetAreas) {
879
+ const areaIds = [];
880
+ const widgetRows = [];
881
+ for (const area of seed.widgetAreas) {
882
+ const lookup = db.selectFrom("_emdash_widget_areas").selectAll().where("name", "=", area.name);
883
+ const existingArea = await lookup.executeTakeFirst();
884
+ let areaId;
885
+ if (existingArea) areaId = existingArea.id;
886
+ else {
887
+ areaId = ulid();
888
+ if (await db.insertInto("_emdash_widget_areas").values({
889
+ id: areaId,
890
+ name: area.name,
891
+ label: area.label,
892
+ description: area.description ?? null
893
+ }).onConflict((conflict) => conflict.column("name").doNothing()).returning("id").executeTakeFirst()) result.widgetAreas.created++;
894
+ else areaId = (await lookup.executeTakeFirstOrThrow()).id;
895
+ }
896
+ areaIds.push(areaId);
897
+ for (let i = 0; i < area.widgets.length; i++) {
898
+ const widget = area.widgets[i];
899
+ widgetRows.push(createSeedWidgetRow(areaId, widget, i));
900
+ result.widgetAreas.widgets++;
901
+ }
902
+ }
903
+ await replaceSeedChildren(db, "_emdash_widget_areas", areaIds, (target) => [...areaIds.map((id) => target.deleteFrom("_emdash_widgets").where("area_id", "=", id)), ...chunks(widgetRows, SEED_WIDGET_INSERT_BATCH_SIZE).map((rows) => target.insertInto("_emdash_widgets").values(rows))]);
904
+ }
905
+ if (seed.sections) for (const section of seed.sections) {
906
+ const existing = await db.selectFrom("_emdash_sections").select("id").where("slug", "=", section.slug).executeTakeFirst();
907
+ if (existing) {
908
+ if (onConflict === "error") throw new Error(`Conflict: section "${section.slug}" already exists`);
909
+ if (onConflict === "update") {
910
+ await db.updateTable("_emdash_sections").set({
911
+ title: section.title,
912
+ description: section.description ?? null,
913
+ keywords: section.keywords ? JSON.stringify(section.keywords) : null,
914
+ content: JSON.stringify(section.content),
915
+ source: section.source || "theme",
916
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
917
+ }).where("id", "=", existing.id).execute();
918
+ result.sections.updated++;
919
+ continue;
920
+ }
921
+ result.sections.skipped++;
922
+ continue;
923
+ }
924
+ const id = ulid();
925
+ const now = (/* @__PURE__ */ new Date()).toISOString();
926
+ await db.insertInto("_emdash_sections").values({
927
+ id,
928
+ slug: section.slug,
929
+ title: section.title,
930
+ description: section.description ?? null,
931
+ keywords: section.keywords ? JSON.stringify(section.keywords) : null,
932
+ content: JSON.stringify(section.content),
933
+ preview_media_id: null,
934
+ source: section.source || "theme",
935
+ theme_id: section.source === "theme" ? section.slug : null,
936
+ created_at: now,
937
+ updated_at: now
938
+ }).execute();
939
+ result.sections.created++;
940
+ }
941
+ if (seed.collections) {
942
+ const ftsManager = new FTSManager(db);
943
+ for (const collection of seed.collections) if (collection.supports?.includes("search")) {
944
+ if ((await ftsManager.getSearchableFields(collection.slug)).length > 0) try {
945
+ await ftsManager.enableSearch(collection.slug);
946
+ } catch (err) {
947
+ console.warn(`Failed to enable search for ${collection.slug}:`, err);
948
+ }
949
+ }
950
+ }
951
+ if (result.redirects.created + result.redirects.updated > 0) {
952
+ const { publishRedirectChanges } = await import("./artifacts-DwOYYBQm.mjs").then((n) => n.t);
953
+ await publishRedirectChanges(db);
954
+ }
955
+ await invalidateSeedCaches();
956
+ return {
957
+ result,
958
+ complete,
959
+ progress
960
+ };
961
+ }
962
+ function countSeedItems(seed, includeContent) {
963
+ if (!includeContent) return 0;
964
+ const terms = (seed.taxonomies ?? []).reduce((total, taxonomy) => total + (taxonomy.terms?.length ?? 0), 0);
965
+ const entries = Object.values(seed.content ?? {}).reduce((total, collectionEntries) => total + collectionEntries.length, 0);
966
+ return terms + (seed.bylines?.length ?? 0) + entries;
967
+ }
968
+ function seedTermKey(locale, slug) {
969
+ return `${locale}::${slug}`;
970
+ }
971
+ /**
972
+ * Find which of a taxonomy's seed terms already exist, as term ids keyed by
973
+ * `seedTermKey`. Each query covers a batch of slugs.
974
+ */
975
+ async function findExistingSeedTerms(db, taxonomyName, terms) {
976
+ const selected = /* @__PURE__ */ new Map();
977
+ for (const batch of chunks([...new Set(terms.map((term) => term.slug))], SQL_BATCH_SIZE)) {
978
+ const rows = await db.selectFrom("taxonomies").select([
979
+ "id",
980
+ "slug",
981
+ "locale"
982
+ ]).where("name", "=", taxonomyName).where("slug", "in", batch).execute();
983
+ for (const row of rows) {
984
+ const canonicalLocale = resolveConfiguredLocale(row.locale);
985
+ const key = seedTermKey(canonicalLocale, row.slug);
986
+ const previous = selected.get(key);
987
+ if (previous === void 0 || getLocaleRank(row.locale, canonicalLocale) < getLocaleRank(previous.locale, canonicalLocale) || getLocaleRank(row.locale, canonicalLocale) === getLocaleRank(previous.locale, canonicalLocale) && row.id.localeCompare(previous.id) < 0) selected.set(key, {
988
+ id: row.id,
989
+ locale: row.locale
990
+ });
991
+ }
992
+ }
993
+ return new Map(Array.from(selected, ([key, value]) => [key, value.id]));
994
+ }
995
+ /**
996
+ * Match seed bylines by slug, preferring a path over its stored code aliases.
997
+ * Across different configured locales, keep the lowest-locale selection.
998
+ */
999
+ async function findExistingSeedBylines(db, slugs) {
1000
+ const existing = /* @__PURE__ */ new Map();
1001
+ for (const batch of chunks([...new Set(slugs)], SQL_BATCH_SIZE)) {
1002
+ const rows = await db.selectFrom("_emdash_bylines").select([
1003
+ "id",
1004
+ "slug",
1005
+ "locale"
1006
+ ]).where("slug", "in", batch).orderBy("locale", "asc").orderBy("id", "asc").execute();
1007
+ for (const row of rows) {
1008
+ const previous = existing.get(row.slug);
1009
+ const locale = resolveConfiguredLocale(row.locale);
1010
+ if (!previous || resolveConfiguredLocale(previous.locale) === locale && getLocaleRank(row.locale, locale) < getLocaleRank(previous.locale, locale)) existing.set(row.slug, row);
1011
+ }
1012
+ }
1013
+ return new Map(Array.from(existing, ([slug, row]) => [slug, row.id]));
1014
+ }
1015
+ /**
1016
+ * Invalidate caches that may have been affected by seed data.
1017
+ * Seed creates bylines, redirects, and collections, all of which
1018
+ * have module-level caches in the hot path.
1019
+ */
1020
+ async function invalidateSeedCaches() {
1021
+ const { invalidateBylineCache } = await import("./bylines-BF555iIz.mjs").then((n) => n.t);
1022
+ const { invalidateRedirectCache } = await import("./cache-BWzswWB-.mjs").then((n) => n.t);
1023
+ const { invalidateUrlPatternCache } = await import("./query-eR_Nz70M.mjs").then((n) => n.s);
1024
+ invalidateBylineCache();
1025
+ invalidateRedirectCache();
1026
+ invalidateUrlPatternCache();
1027
+ }
1028
+ function seedEntryIdentity(entry, defaultLocale) {
1029
+ return {
1030
+ slug: typeof entry.slug === "string" && entry.slug.trim().length > 0 ? entry.slug : null,
1031
+ locale: resolveConfiguredLocale(entry.locale ?? defaultLocale)
1032
+ };
1033
+ }
1034
+ async function readRelationEnds(db) {
1035
+ const rows = await db.selectFrom("_emdash_relations").select([
1036
+ "slug",
1037
+ "parent_collection",
1038
+ "child_collection"
1039
+ ]).execute();
1040
+ return new Map(rows.map((row) => [row.slug, {
1041
+ parentCollection: row.parent_collection,
1042
+ childCollection: row.child_collection
1043
+ }]));
1044
+ }
1045
+ /**
1046
+ * Resolve the relation a seed reference field names, and which end of it this
1047
+ * collection sits on.
1048
+ *
1049
+ * `relationSide` is only needed for a self-referential relation, where both ends
1050
+ * are this collection; otherwise the side follows from which end matches.
1051
+ * `targetCollection` is the collection at the other end, derived rather than
1052
+ * trusted, so a seed cannot declare a target the relation disagrees with.
1053
+ */
1054
+ function resolveSeedFieldRelation(collectionSlug, field, knownRelations) {
1055
+ if (field.type !== "reference") return null;
1056
+ const named = field.validation?.relation;
1057
+ if (typeof named !== "string" || named.length === 0) return null;
1058
+ const relation = knownRelations.get(named);
1059
+ if (!relation) throw new SchemaError(`Relation "${named}" not found`, "RELATION_NOT_FOUND");
1060
+ const declared = field.validation?.relationSide;
1061
+ const side = declared === "parent" || declared === "child" ? declared : relation.parentCollection === collectionSlug ? "parent" : "child";
1062
+ if ((side === "parent" ? relation.parentCollection : relation.childCollection) !== collectionSlug) throw new SchemaError(`Relation "${named}" has no ${side} end on collection "${collectionSlug}"`, "VALIDATION_ERROR");
1063
+ return {
1064
+ relation: named,
1065
+ relationSide: side,
1066
+ targetCollection: side === "parent" ? relation.childCollection : relation.parentCollection
1067
+ };
1068
+ }
1069
+ /**
1070
+ * Create or update the relations a seed declares, before the fields that name
1071
+ * them.
1072
+ *
1073
+ * A relation's two collections are fixed once it exists: changing one would
1074
+ * leave its links pointing into a collection that is no longer an end of it, so
1075
+ * a seed that names different ones fails rather than rewriting the row. Labels
1076
+ * and limits are updated under `onConflict: "update"`.
1077
+ */
1078
+ async function applySeedRelations(db, relations, seedCollections, onConflict, result) {
1079
+ const existing = await readRelationEnds(db);
1080
+ const known = new Set(seedCollections.map((collection) => collection.slug));
1081
+ for (const row of await db.selectFrom("_emdash_collections").select("slug").execute()) known.add(row.slug);
1082
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1083
+ for (const relation of relations) {
1084
+ for (const end of [relation.parentCollection, relation.childCollection]) if (!known.has(end)) throw new SchemaError(`Relation "${relation.slug}" names collection "${end}", which does not exist`, "COLLECTION_NOT_FOUND");
1085
+ const current = existing.get(relation.slug);
1086
+ if (current) {
1087
+ if (current.parentCollection !== relation.parentCollection || current.childCollection !== relation.childCollection) throw new SchemaError(`Relation "${relation.slug}" joins ${current.parentCollection} to ${current.childCollection}; a relation's collections cannot change`, "RELATION_COLLECTIONS_IMMUTABLE");
1088
+ if (onConflict === "error") throw new Error(`Conflict: relation "${relation.slug}" already exists`);
1089
+ if (onConflict !== "update") {
1090
+ result.relations.skipped++;
1091
+ continue;
1092
+ }
1093
+ await db.updateTable("_emdash_relations").set({
1094
+ parent_label: relation.parentLabel,
1095
+ parent_label_singular: relation.parentLabelSingular ?? null,
1096
+ child_label: relation.childLabel,
1097
+ child_label_singular: relation.childLabelSingular ?? null,
1098
+ max_children_per_parent: relation.maxChildrenPerParent ?? null,
1099
+ max_parents_per_child: relation.maxParentsPerChild ?? null,
1100
+ updated_at: now
1101
+ }).where("slug", "=", relation.slug).execute();
1102
+ result.relations.updated++;
1103
+ continue;
1104
+ }
1105
+ await db.insertInto("_emdash_relations").values({
1106
+ id: ulid(),
1107
+ slug: relation.slug,
1108
+ parent_collection: relation.parentCollection,
1109
+ child_collection: relation.childCollection,
1110
+ parent_label: relation.parentLabel,
1111
+ parent_label_singular: relation.parentLabelSingular ?? null,
1112
+ child_label: relation.childLabel,
1113
+ child_label_singular: relation.childLabelSingular ?? null,
1114
+ max_children_per_parent: relation.maxChildrenPerParent ?? null,
1115
+ max_parents_per_child: relation.maxParentsPerChild ?? null,
1116
+ created_at: now,
1117
+ updated_at: now
1118
+ }).execute();
1119
+ existing.set(relation.slug, {
1120
+ parentCollection: relation.parentCollection,
1121
+ childCollection: relation.childCollection
1122
+ });
1123
+ result.relations.created++;
1124
+ }
1125
+ }
1126
+ function allocateSeedRelationName(collectionSlug, fieldSlug, usedNames) {
1127
+ const baseName = `${collectionSlug}_${fieldSlug}`.slice(0, 63);
1128
+ for (let attempt = 0; attempt < SEED_RELATION_NAME_MAX_ATTEMPTS; attempt++) {
1129
+ const suffix = attempt === 0 ? "" : `_${attempt + 1}`;
1130
+ const name = attempt === 0 ? baseName : `${baseName.slice(0, 63 - suffix.length)}${suffix}`;
1131
+ if (!usedNames.has(name)) {
1132
+ usedNames.add(name);
1133
+ return name;
1134
+ }
1135
+ }
1136
+ throw new SchemaError("Could not allocate a unique relation name", "RELATION_NAME_CONFLICT");
1137
+ }
1138
+ /**
1139
+ * Slugful entries use the existing locale-aware key. Slugless seed entries
1140
+ * persist their seed ID, which keeps re-application idempotent.
1141
+ */
1142
+ function seedEntryKey(entry, slug, locale) {
1143
+ return slug === null ? `id:${entry.id}` : `slug:${locale}:${slug}`;
1144
+ }
1145
+ /**
1146
+ * Find which of a collection's seed entries already exist, keyed by
1147
+ * `seedEntryKey`. Each query covers a batch of entries.
1148
+ */
1149
+ async function findExistingSeedEntries(repo, collectionSlug, entries, defaultLocale, includeTrashed = false) {
1150
+ const identities = entries.map((entry) => ({
1151
+ entry,
1152
+ ...seedEntryIdentity(entry, defaultLocale)
1153
+ }));
1154
+ const slugsByLocale = /* @__PURE__ */ new Map();
1155
+ for (const { slug, locale } of identities) {
1156
+ if (slug === null) continue;
1157
+ const slugs = slugsByLocale.get(locale);
1158
+ if (slugs) slugs.push(slug);
1159
+ else slugsByLocale.set(locale, [slug]);
1160
+ }
1161
+ const bySlug = /* @__PURE__ */ new Map();
1162
+ for (const [locale, slugs] of slugsByLocale) bySlug.set(locale, await repo.findManyBySlugsInLocale(collectionSlug, slugs, locale, { includeTrashed }));
1163
+ const byId = await repo.findManyByIds(collectionSlug, identities.filter(({ slug }) => slug === null).map(({ entry }) => entry.id), { includeTrashed });
1164
+ const existing = /* @__PURE__ */ new Map();
1165
+ for (const { entry, slug, locale } of identities) {
1166
+ const item = slug === null ? byId.get(entry.id) : bySlug.get(locale)?.get(slug);
1167
+ if (item) existing.set(seedEntryKey(entry, slug, locale), item);
1168
+ }
1169
+ return existing;
1170
+ }
1171
+ /**
1172
+ * Apply hierarchical taxonomy terms (parents before children). Stops before
1173
+ * creating a term once `mayCreate` returns false, and returns how many terms
1174
+ * were found or created.
1175
+ */
1176
+ async function applyHierarchicalTerms(termRepo, taxonomyName, defLocale, terms, existingTerms, termSeedIdMap, result, onConflict, mayCreate) {
1177
+ let processed = 0;
1178
+ const slugToId = /* @__PURE__ */ new Map();
1179
+ const resolveTermLocale = (term) => resolveConfiguredLocale(term.locale ?? defLocale);
1180
+ let remaining = [...terms];
1181
+ let maxPasses = 10;
1182
+ while (remaining.length > 0 && maxPasses > 0) {
1183
+ const processedThisPass = [];
1184
+ for (const term of remaining) {
1185
+ const termLocale = resolveTermLocale(term);
1186
+ const parentReady = !term.parent || slugToId.has(`${termLocale}::${term.parent}`);
1187
+ const translationReady = !term.translationOf || termSeedIdMap.has(term.translationOf);
1188
+ if (!parentReady || !translationReady) continue;
1189
+ const parentId = term.parent ? slugToId.get(`${termLocale}::${term.parent}`) : void 0;
1190
+ const translationOf = term.translationOf ? termSeedIdMap.get(term.translationOf) : void 0;
1191
+ const termKey = seedTermKey(termLocale, term.slug);
1192
+ const existingId = existingTerms.get(termKey);
1193
+ if (existingId) {
1194
+ if (onConflict === "error") throw new Error(`Conflict: taxonomy term "${term.slug}" in "${taxonomyName}" (${termLocale}) already exists`);
1195
+ if (onConflict === "update") {
1196
+ await termRepo.update(existingId, {
1197
+ label: term.label,
1198
+ parentId,
1199
+ data: term.description ? { description: term.description } : {}
1200
+ });
1201
+ result.taxonomies.terms++;
1202
+ }
1203
+ slugToId.set(termKey, existingId);
1204
+ if (term.id) termSeedIdMap.set(term.id, existingId);
1205
+ } else {
1206
+ if (!mayCreate()) return {
1207
+ processed,
1208
+ complete: false
1209
+ };
1210
+ const created = await termRepo.create({
1211
+ name: taxonomyName,
1212
+ slug: term.slug,
1213
+ label: term.label,
1214
+ parentId,
1215
+ data: term.description ? { description: term.description } : void 0,
1216
+ locale: termLocale,
1217
+ translationOf
1218
+ });
1219
+ existingTerms.set(termKey, created.id);
1220
+ slugToId.set(termKey, created.id);
1221
+ if (term.id) termSeedIdMap.set(term.id, created.id);
1222
+ result.taxonomies.terms++;
1223
+ }
1224
+ processed++;
1225
+ processedThisPass.push(term.slug + "::" + termLocale);
1226
+ }
1227
+ remaining = remaining.filter((term) => !processedThisPass.includes(term.slug + "::" + resolveTermLocale(term)));
1228
+ maxPasses--;
1229
+ }
1230
+ if (remaining.length > 0) console.warn(`Could not process ${remaining.length} terms due to missing parents/translations`);
1231
+ return {
1232
+ processed,
1233
+ complete: true
1234
+ };
1235
+ }
1236
+ /**
1237
+ * Apply byline credits to a content entry.
1238
+ * In update mode, clears existing credits even if the seed has none.
1239
+ */
1240
+ async function applyContentBylines(bylineRepo, collectionSlug, contentId, entry, seedBylineIdMap, isUpdate = false) {
1241
+ if (!entry.bylines || entry.bylines.length === 0) {
1242
+ if (isUpdate) await bylineRepo.setContentBylines(collectionSlug, contentId, []);
1243
+ return;
1244
+ }
1245
+ const credits = entry.bylines.map((credit) => {
1246
+ const bylineId = seedBylineIdMap.get(credit.byline);
1247
+ if (!bylineId) return null;
1248
+ return {
1249
+ bylineId,
1250
+ roleLabel: credit.roleLabel ?? null
1251
+ };
1252
+ }).filter((credit) => Boolean(credit));
1253
+ if (credits.length !== entry.bylines.length) console.warn(`content.${collectionSlug}.${entry.slug ?? entry.id}: one or more byline refs could not be resolved`);
1254
+ if (credits.length > 0 || isUpdate) await bylineRepo.setContentBylines(collectionSlug, contentId, credits);
1255
+ }
1256
+ /**
1257
+ * Apply taxonomy term assignments to a content entry.
1258
+ * In update mode, clears existing assignments before re-attaching.
1259
+ */
1260
+ /**
1261
+ * Create or update a field from a seed.
1262
+ *
1263
+ * A reference field bound to a relation is storage-less: it persists no column
1264
+ * and its edges live in `_emdash_content_references`. Seeds create fields
1265
+ * through the registry (not the schema handler that owns the relation
1266
+ * lifecycle), so this mirrors the handler — it creates the relation on first
1267
+ * insert (field + relation in one transaction) and preserves the
1268
+ * server-assigned `validation.relation`/`targetCollection` on re-apply, since a
1269
+ * seed's field validation omits them and would otherwise orphan the relation. A
1270
+ * reference field with no `targetCollection` cannot form a relation, so it is
1271
+ * created column-backed, holding a plain entry id.
1272
+ */
1273
+ async function upsertSeedField(db, collectionSlug, field, existing, knownRelations) {
1274
+ const bound = resolveSeedFieldRelation(collectionSlug, field, knownRelations);
1275
+ if (existing) {
1276
+ const update = {
1277
+ label: field.label,
1278
+ type: field.type,
1279
+ required: field.required || false,
1280
+ unique: field.unique || false,
1281
+ searchable: field.searchable || false,
1282
+ indexed: field.indexed || false,
1283
+ translatable: field.translatable,
1284
+ defaultValue: field.defaultValue,
1285
+ widget: field.widget,
1286
+ options: field.options
1287
+ };
1288
+ if (!bound && field.type === "reference" && !existing.validation?.relation && typeof field.validation?.targetCollection === "string") {
1289
+ await bindReferenceField(db, collectionSlug, existing, {
1290
+ ...update,
1291
+ validation: field.validation
1292
+ }, field.validation.targetCollection);
1293
+ return;
1294
+ }
1295
+ const validation = bound ? {
1296
+ ...field.validation,
1297
+ ...bound
1298
+ } : field.type === "reference" && existing.validation?.relation ? {
1299
+ ...field.validation,
1300
+ relation: existing.validation.relation,
1301
+ relationSide: existing.validation.relationSide,
1302
+ targetCollection: existing.validation.targetCollection
1303
+ } : field.validation;
1304
+ await new SchemaRegistry(db).updateField(collectionSlug, field.slug, {
1305
+ ...update,
1306
+ validation
1307
+ });
1308
+ return;
1309
+ }
1310
+ const input = {
1311
+ slug: field.slug,
1312
+ label: field.label,
1313
+ type: field.type,
1314
+ required: field.required || false,
1315
+ unique: field.unique || false,
1316
+ searchable: field.searchable || false,
1317
+ indexed: field.indexed || false,
1318
+ translatable: field.translatable,
1319
+ defaultValue: field.defaultValue,
1320
+ validation: field.validation,
1321
+ widget: field.widget,
1322
+ options: field.options
1323
+ };
1324
+ if (bound) {
1325
+ await new SchemaRegistry(db).createField(collectionSlug, {
1326
+ ...input,
1327
+ validation: {
1328
+ ...field.validation,
1329
+ ...bound
1330
+ }
1331
+ });
1332
+ return;
1333
+ }
1334
+ const targetCollection = field.type === "reference" && typeof field.validation?.targetCollection === "string" ? field.validation.targetCollection : void 0;
1335
+ if (targetCollection) {
1336
+ await withTransaction(db, async (trx) => {
1337
+ const relation = await createFieldRelation(trx, collectionSlug, field.slug, field.label, targetCollection, field.validation?.multiple ? null : 1);
1338
+ await new SchemaRegistry(trx).createField(collectionSlug, {
1339
+ ...input,
1340
+ validation: {
1341
+ ...field.validation,
1342
+ relation: relation.slug,
1343
+ relationSide: "parent"
1344
+ }
1345
+ });
1346
+ });
1347
+ return;
1348
+ }
1349
+ await new SchemaRegistry(db).createField(collectionSlug, input);
1350
+ }
1351
+ /**
1352
+ * Split resolved content `data` into the plain column data and the reference
1353
+ * edge writes. A reference field bound to a relation is storage-less, so its key
1354
+ * left in `data` would hit the column writer (and `syncDataColumns` on publish)
1355
+ * and throw "no such column". Its `$ref:`-resolved value — a child entry id or
1356
+ * an array of them — is captured as an edge write instead, keyed by the field's
1357
+ * relation. A reference field with no relation still owns its column, so its
1358
+ * resolved id is written there like any other string.
1359
+ */
1360
+ /** One collection's reference fields by slug, read once per collection: the
1361
+ * schema phase has finished by the time content is applied. */
1362
+ function referenceFieldsOf(collection) {
1363
+ return new Map((collection?.fields ?? []).filter((f) => f.type === "reference").map((f) => [f.slug, f]));
1364
+ }
1365
+ function splitReferenceFields(collectionSlug, referenceFields, data) {
1366
+ if (referenceFields.size === 0) return {
1367
+ columnData: data,
1368
+ edges: []
1369
+ };
1370
+ const columnData = {};
1371
+ const edges = [];
1372
+ for (const [key, value] of Object.entries(data)) {
1373
+ if (!referenceFields.get(key)?.validation?.relation) {
1374
+ columnData[key] = value;
1375
+ continue;
1376
+ }
1377
+ const childIds = [];
1378
+ for (const candidate of Array.isArray(value) ? value : [value]) {
1379
+ if (typeof candidate !== "string" || candidate.length === 0) continue;
1380
+ if (candidate.startsWith("$ref:")) {
1381
+ console.warn(`content.${collectionSlug}: reference "${candidate}" in field "${key}" did not resolve (not yet created or missing). Skipping.`);
1382
+ continue;
1383
+ }
1384
+ childIds.push(candidate);
1385
+ }
1386
+ edges.push({
1387
+ fieldSlug: key,
1388
+ childIds
1389
+ });
1390
+ }
1391
+ return {
1392
+ columnData,
1393
+ edges
1394
+ };
1395
+ }
1396
+ /**
1397
+ * Write reference edges for a content entry, replacing any existing set per
1398
+ * relation (so re-applying a seed is idempotent). Throws to abort the enclosing
1399
+ * transaction if a child entry cannot be resolved — a half-written entry is
1400
+ * worse than a failed apply.
1401
+ */
1402
+ async function applyContentReferences(trx, collectionSlug, contentId, edges) {
1403
+ for (const { fieldSlug, childIds } of edges) {
1404
+ const result = await setReferenceSelection(trx, collectionSlug, contentId, fieldSlug, childIds);
1405
+ if (!result.success) throw new Error(`content.${collectionSlug}: failed to write references for "${contentId}": ${result.error.message}`);
1406
+ }
1407
+ }
1408
+ async function applyContentTaxonomies(db, collectionSlug, contentId, entry, isUpdate) {
1409
+ const termRepo = new TaxonomyRepository(db);
1410
+ if (isUpdate) await termRepo.clearEntryTerms(collectionSlug, contentId);
1411
+ if (!entry.taxonomies) {
1412
+ if (isUpdate) {
1413
+ const { invalidateTermCache } = await import("./taxonomies-By2aGvq2.mjs").then((n) => n.f);
1414
+ invalidateTermCache();
1415
+ }
1416
+ return;
1417
+ }
1418
+ for (const [taxonomyName, termSlugs] of Object.entries(entry.taxonomies)) for (const termSlug of termSlugs) {
1419
+ const term = await termRepo.findBySlug(taxonomyName, termSlug);
1420
+ if (term) await termRepo.attachToEntry(collectionSlug, contentId, term.id);
1421
+ }
1422
+ const { invalidateTermCache } = await import("./taxonomies-By2aGvq2.mjs").then((n) => n.f);
1423
+ invalidateTermCache();
1424
+ }
1425
+ /**
1426
+ * Collect menu item rows recursively.
1427
+ *
1428
+ * When a `SeedMenuItem` carries `id`/`translationOf`, the import resolves the
1429
+ * source item's `translation_group` so cross-locale "same nav entry" links
1430
+ * survive export → apply. Items without `translationOf` get a fresh group
1431
+ * (= their own id).
1432
+ */
1433
+ function collectMenuItems(rows, menuId, locale, items, parentId, startOrder, seedIdMap, itemSeedIdMap) {
1434
+ let count = 0;
1435
+ let order = startOrder;
1436
+ for (const item of items) {
1437
+ const itemId = ulid();
1438
+ const itemLocale = item.locale ?? locale;
1439
+ let referenceId = null;
1440
+ let referenceCollection = null;
1441
+ if (item.type !== "custom" && item.type !== "taxonomy") {
1442
+ const collection = item.collection || (item.type === "page" || item.type === "post" ? `${item.type}s` : null);
1443
+ if (item.ref) {
1444
+ const resolved = seedIdMap.get(item.ref);
1445
+ if (resolved && collection) {
1446
+ referenceId = resolved;
1447
+ referenceCollection = collection;
1448
+ }
1449
+ } else referenceCollection = collection;
1450
+ }
1451
+ let translationGroup = itemId;
1452
+ if (item.translationOf) {
1453
+ const source = itemSeedIdMap.get(item.translationOf);
1454
+ if (source) translationGroup = source.translationGroup;
1455
+ else console.warn(`menu item "${item.label ?? item.url ?? item.ref ?? "(unlabeled)"}" (${itemLocale}): translationOf "${item.translationOf}" not found yet; minting a fresh group.`);
1456
+ }
1457
+ rows.push({
1458
+ id: itemId,
1459
+ menu_id: menuId,
1460
+ parent_id: parentId,
1461
+ sort_order: order,
1462
+ type: item.type,
1463
+ reference_collection: referenceCollection,
1464
+ reference_id: referenceId,
1465
+ custom_url: item.url ?? null,
1466
+ label: item.label || "",
1467
+ title_attr: item.titleAttr ?? null,
1468
+ target: item.target ?? null,
1469
+ css_classes: item.cssClasses ?? null,
1470
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
1471
+ locale: itemLocale,
1472
+ translation_group: translationGroup
1473
+ });
1474
+ if (item.id) itemSeedIdMap.set(item.id, {
1475
+ id: itemId,
1476
+ translationGroup
1477
+ });
1478
+ count++;
1479
+ order++;
1480
+ if (item.children && item.children.length > 0) {
1481
+ const childCount = collectMenuItems(rows, menuId, itemLocale, item.children, itemId, 0, seedIdMap, itemSeedIdMap);
1482
+ count += childCount;
1483
+ }
1484
+ }
1485
+ return count;
1486
+ }
1487
+ /**
1488
+ * Build a widget row
1489
+ */
1490
+ function createSeedWidgetRow(areaId, widget, sortOrder) {
1491
+ return {
1492
+ id: ulid(),
1493
+ area_id: areaId,
1494
+ sort_order: sortOrder,
1495
+ type: widget.type,
1496
+ title: widget.title ?? null,
1497
+ content: widget.content ? JSON.stringify(widget.content) : null,
1498
+ menu_name: widget.menuName ?? null,
1499
+ component_id: widget.componentId ?? null,
1500
+ component_props: widget.props ? JSON.stringify(widget.props) : null
1501
+ };
1502
+ }
1503
+ /**
1504
+ * Type guard for $media reference
1505
+ */
1506
+ function isSeedMediaReference(value) {
1507
+ if (typeof value !== "object" || value === null || !("$media" in value)) return false;
1508
+ const media = value.$media;
1509
+ return typeof media === "object" && media !== null && "url" in media && typeof media.url === "string";
1510
+ }
1511
+ /**
1512
+ * Resolve $ref: and $media references in content data
1513
+ */
1514
+ async function resolveReferences(data, seedIdMap, mediaContext, result) {
1515
+ const resolved = {};
1516
+ for (const [key, value] of Object.entries(data)) resolved[key] = await resolveValue(value, seedIdMap, mediaContext, result);
1517
+ return resolved;
1518
+ }
1519
+ /**
1520
+ * Resolve a single value recursively
1521
+ */
1522
+ async function resolveValue(value, seedIdMap, mediaContext, result) {
1523
+ if (typeof value === "string" && value.startsWith("$ref:")) {
1524
+ const seedId = value.slice(5);
1525
+ return seedIdMap.get(seedId) ?? value;
1526
+ }
1527
+ if (isSeedMediaReference(value)) return resolveMedia(value, mediaContext, result);
1528
+ if (Array.isArray(value)) return Promise.all(value.map((item) => resolveValue(item, seedIdMap, mediaContext, result)));
1529
+ if (typeof value === "object" && value !== null) {
1530
+ const resolved = {};
1531
+ for (const [k, v] of Object.entries(value)) resolved[k] = await resolveValue(v, seedIdMap, mediaContext, result);
1532
+ if (resolved._type === "gallery" && Array.isArray(resolved.images)) resolved.images = sanitizeGalleryImages(resolved.images, ulid);
1533
+ else if (resolved._type === "image" && "asset" in value && isSeedMediaReference(value.asset)) {
1534
+ const [image] = sanitizeGalleryImages([resolved], ulid);
1535
+ if (image) Object.assign(resolved, image);
1536
+ }
1537
+ return resolved;
1538
+ }
1539
+ return value;
1540
+ }
1541
+ /**
1542
+ * Resolve a seeded byline avatar to a `media` row id. The file is assumed to
1543
+ * already exist in storage (the caller supplies its `storageKey`), so nothing
1544
+ * is downloaded or uploaded.
1545
+ *
1546
+ * Idempotent: if a media row with the same `storageKey` already exists it is
1547
+ * reused rather than duplicated, so re-applying a seed in `update` mode does
1548
+ * not leak rows. `created` reports whether a new row was inserted, so the
1549
+ * caller can both account for it and delete it if the subsequent byline write
1550
+ * fails (the only cross-dialect way to avoid an orphan — `withTransaction`
1551
+ * is a no-op on D1).
1552
+ */
1553
+ async function resolveSeedBylineAvatar(db, avatar) {
1554
+ const existing = await db.selectFrom("media").select("id").where("storage_key", "=", avatar.storageKey).orderBy("id", "asc").executeTakeFirst();
1555
+ if (existing) return {
1556
+ id: existing.id,
1557
+ created: false
1558
+ };
1559
+ const basename = avatar.storageKey.split("/").pop();
1560
+ const filename = avatar.filename ?? (basename && basename.length > 0 ? basename : avatar.storageKey);
1561
+ return {
1562
+ id: (await new MediaRepository(db).create({
1563
+ filename,
1564
+ mimeType: avatar.mimeType ?? "image/jpeg",
1565
+ storageKey: avatar.storageKey,
1566
+ alt: avatar.alt,
1567
+ width: avatar.width,
1568
+ height: avatar.height,
1569
+ status: "ready"
1570
+ })).id,
1571
+ created: true
1572
+ };
1573
+ }
1574
+ /**
1575
+ * Delete a media row by id. Best-effort cleanup for a failed byline write: a
1576
+ * failure here must not mask the original error that triggered the cleanup, so
1577
+ * it is logged and swallowed rather than thrown.
1578
+ */
1579
+ async function deleteMediaRow(db, id) {
1580
+ try {
1581
+ await db.deleteFrom("media").where("id", "=", id).execute();
1582
+ } catch (error) {
1583
+ console.warn(`[seed] failed to clean up orphaned avatar media ${id}:`, error);
1584
+ }
1585
+ }
1586
+ /**
1587
+ * Resolve a $media reference by downloading and uploading the media
1588
+ */
1589
+ async function resolveMedia(ref, ctx, result) {
1590
+ const { url, alt, filename, caption, libraryCaption } = ref.$media;
1591
+ const cached = ctx.mediaCache.get(url);
1592
+ if (cached) {
1593
+ result.media.skipped++;
1594
+ return {
1595
+ ...cached,
1596
+ alt: alt ?? cached.alt,
1597
+ caption: caption ?? cached.caption
1598
+ };
1599
+ }
1600
+ if (ctx.skipMediaDownload) {
1601
+ const defaultCaption = libraryCaption ?? void 0;
1602
+ const mediaValue = {
1603
+ provider: "external",
1604
+ id: ulid(),
1605
+ src: url,
1606
+ alt: alt ?? void 0,
1607
+ caption: caption ?? defaultCaption,
1608
+ filename: filename ?? void 0
1609
+ };
1610
+ ctx.mediaCache.set(url, {
1611
+ ...mediaValue,
1612
+ caption: defaultCaption
1613
+ });
1614
+ result.media.skipped++;
1615
+ return mediaValue;
1616
+ }
1617
+ if (!ctx.storage) {
1618
+ console.warn(`Skipping $media reference (no storage configured): ${url}`);
1619
+ result.media.skipped++;
1620
+ return null;
1621
+ }
1622
+ try {
1623
+ validateExternalUrl(url);
1624
+ console.log(` 📥 Downloading: ${url}`);
1625
+ ctx.budget?.countMediaDownload();
1626
+ const response = await ssrfSafeFetch(url, { headers: { "User-Agent": "EmDash-CMS/1.0" } });
1627
+ if (!response.ok) {
1628
+ console.warn(` ⚠️ Failed to download ${url}: ${response.status}`);
1629
+ result.media.skipped++;
1630
+ return null;
1631
+ }
1632
+ const contentType = response.headers.get("content-type") || "application/octet-stream";
1633
+ const ext = getExtensionFromContentType(contentType) || getExtensionFromUrl(url) || ".bin";
1634
+ const arrayBuffer = await response.arrayBuffer();
1635
+ const body = new Uint8Array(arrayBuffer);
1636
+ const contentHash = await computeContentHash(body);
1637
+ const mediaRepo = new MediaRepository(ctx.db);
1638
+ const existing = await mediaRepo.findByContentHash(contentHash);
1639
+ if (existing) {
1640
+ const mediaValue = {
1641
+ provider: "local",
1642
+ id: existing.id,
1643
+ alt: alt ?? existing.alt ?? void 0,
1644
+ caption: caption ?? existing.caption ?? void 0,
1645
+ width: existing.width ?? void 0,
1646
+ height: existing.height ?? void 0,
1647
+ mimeType: existing.mimeType,
1648
+ filename: existing.filename,
1649
+ meta: { storageKey: existing.storageKey }
1650
+ };
1651
+ ctx.mediaCache.set(url, {
1652
+ ...mediaValue,
1653
+ caption: existing.caption ?? void 0
1654
+ });
1655
+ result.media.skipped++;
1656
+ console.log(` ✅ Reused: ${existing.filename}`);
1657
+ return mediaValue;
1658
+ }
1659
+ const storageId = ulid();
1660
+ const finalFilename = filename || generateFilename(url, ext);
1661
+ const storageKey = `${storageId}${ext}`;
1662
+ let width;
1663
+ let height;
1664
+ if (contentType.startsWith("image/")) {
1665
+ const dimensions = getImageDimensions(body);
1666
+ width = dimensions?.width;
1667
+ height = dimensions?.height;
1668
+ }
1669
+ await ctx.storage.upload({
1670
+ key: storageKey,
1671
+ body,
1672
+ contentType
1673
+ });
1674
+ const media = await mediaRepo.create({
1675
+ filename: finalFilename,
1676
+ mimeType: contentType,
1677
+ size: body.length,
1678
+ width,
1679
+ height,
1680
+ alt,
1681
+ caption: (libraryCaption === void 0 ? caption : libraryCaption) ?? void 0,
1682
+ storageKey,
1683
+ contentHash,
1684
+ status: "ready"
1685
+ });
1686
+ const mediaValue = {
1687
+ provider: "local",
1688
+ id: media.id,
1689
+ alt: alt ?? void 0,
1690
+ caption: caption ?? media.caption ?? void 0,
1691
+ width,
1692
+ height,
1693
+ mimeType: contentType,
1694
+ filename: finalFilename,
1695
+ meta: { storageKey }
1696
+ };
1697
+ ctx.mediaCache.set(url, {
1698
+ ...mediaValue,
1699
+ caption: media.caption ?? void 0
1700
+ });
1701
+ result.media.created++;
1702
+ console.log(` ✅ Uploaded: ${finalFilename}`);
1703
+ return mediaValue;
1704
+ } catch (error) {
1705
+ console.warn(` ⚠️ Error processing $media ${url}:`, error instanceof Error ? error.message : error);
1706
+ result.media.skipped++;
1707
+ return null;
1708
+ }
1709
+ }
1710
+ /**
1711
+ * Get file extension from content type
1712
+ */
1713
+ function getExtensionFromContentType(contentType) {
1714
+ const baseMime = contentType.split(";")[0].trim();
1715
+ const ext = mime.getExtension(baseMime);
1716
+ return ext ? `.${ext}` : null;
1717
+ }
1718
+ /**
1719
+ * Get file extension from URL
1720
+ */
1721
+ function getExtensionFromUrl(url) {
1722
+ try {
1723
+ const match = new URL(url).pathname.match(FILE_EXTENSION_PATTERN);
1724
+ return match ? `.${match[1]}` : null;
1725
+ } catch {
1726
+ return null;
1727
+ }
1728
+ }
1729
+ /**
1730
+ * Generate a filename from URL
1731
+ */
1732
+ function generateFilename(url, ext) {
1733
+ try {
1734
+ return `${(new URL(url).pathname.split("/").pop() || "media").replace(EXTENSION_PATTERN, "").replace(QUERY_PARAM_PATTERN, "").replace(SANITIZE_PATTERN, "-").replace(MULTIPLE_HYPHENS_PATTERN, "-") || "media"}${ext}`;
1735
+ } catch {
1736
+ return `media${ext}`;
1737
+ }
1738
+ }
1739
+ /**
1740
+ * Get image dimensions from buffer using image-size.
1741
+ * Supports PNG, JPEG, GIF, WebP, AVIF, SVG, TIFF, and more.
1742
+ */
1743
+ function getImageDimensions(buffer) {
1744
+ try {
1745
+ const result = imageSize(buffer);
1746
+ if (result.width != null && result.height != null) return {
1747
+ width: result.width,
1748
+ height: result.height
1749
+ };
1750
+ return null;
1751
+ } catch {
1752
+ return null;
1753
+ }
1754
+ }
1755
+
1756
+ //#endregion
1757
+ export { sanitizeGalleryImages as a, resolveImageMedia as i, applySeedWithinBudget as n, createPublicMediaUrlResolver as o, apply_exports as r, applySeed as t };
1758
+ //# sourceMappingURL=apply-CLjfxvyH.mjs.map