emdash 0.35.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activation-K0kGBWuJ.mjs +382 -0
- package/dist/activation-K0kGBWuJ.mjs.map +1 -0
- package/dist/{adapters-Bb1vG41D.d.mts → adapters-BDQwg236.d.mts} +6 -4
- package/dist/{adapters-Bb1vG41D.d.mts.map → adapters-BDQwg236.d.mts.map} +1 -1
- package/dist/{allowed-origins-DW7sYyqg.mjs → allowed-origins-BGglilcs.mjs} +2 -2
- package/dist/{allowed-origins-DW7sYyqg.mjs.map → allowed-origins-BGglilcs.mjs.map} +1 -1
- package/dist/api/route-utils.d.mts +3 -3
- package/dist/api/route-utils.mjs +23 -21
- package/dist/api/route-utils.mjs.map +1 -1
- package/dist/api/schemas/index.d.mts +2 -2
- package/dist/api/schemas/index.mjs +5 -5
- package/dist/api-Dz6rgoa3.mjs +10040 -0
- package/dist/api-Dz6rgoa3.mjs.map +1 -0
- package/dist/{api-tokens-KO24G1Fd.mjs → api-tokens-BSsQACNe.mjs} +2 -2
- package/dist/{api-tokens-KO24G1Fd.mjs.map → api-tokens-BSsQACNe.mjs.map} +1 -1
- package/dist/{apply-kUDt80-G.mjs → apply-B4SIOxR1.mjs} +34 -35
- package/dist/{apply-kUDt80-G.mjs.map → apply-B4SIOxR1.mjs.map} +1 -1
- package/dist/astro/image-endpoint.mjs +2 -2
- package/dist/astro/image-endpoint.mjs.map +1 -1
- package/dist/astro/index.d.mts +12 -12
- package/dist/astro/index.d.mts.map +1 -1
- package/dist/astro/index.mjs +128 -44
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/middleware/auth.d.mts +10 -10
- package/dist/astro/middleware/auth.d.mts.map +1 -1
- package/dist/astro/middleware/auth.mjs +10 -7
- package/dist/astro/middleware/auth.mjs.map +1 -1
- package/dist/astro/middleware/media-usage-write-fence.mjs +2 -2
- package/dist/astro/middleware/redirect.mjs +4 -4
- package/dist/astro/middleware/request-context.mjs +3 -3
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.d.mts +11 -12
- package/dist/astro/middleware.d.mts.map +1 -1
- package/dist/astro/middleware.mjs +237 -1412
- package/dist/astro/middleware.mjs.map +1 -1
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +6 -6
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +6 -6
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +3 -3
- package/dist/astro/routes/api/admin/api-tokens/index.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +5 -5
- package/dist/astro/routes/api/admin/api-tokens/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +4 -4
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +9 -9
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +9 -9
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +9 -9
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +16 -16
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +16 -16
- package/dist/astro/routes/api/admin/bylines/index.mjs +16 -16
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +13 -13
- package/dist/astro/routes/api/admin/comments/_id_.mjs +5 -5
- package/dist/astro/routes/api/admin/comments/bulk.mjs +10 -10
- package/dist/astro/routes/api/admin/comments/counts.mjs +5 -5
- package/dist/astro/routes/api/admin/comments/index.mjs +10 -10
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +4 -4
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +3 -3
- package/dist/astro/routes/api/admin/media-usage/activation.d.mts +9 -0
- package/dist/astro/routes/api/admin/media-usage/activation.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/activation.mjs +46 -0
- package/dist/astro/routes/api/admin/media-usage/activation.mjs.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.mjs +14 -13
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.mjs +14 -13
- package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.mjs.map +1 -1
- package/dist/astro/routes/api/admin/media-usage/progress.d.mts +9 -0
- package/dist/astro/routes/api/admin/media-usage/progress.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/progress.mjs +44 -0
- package/dist/astro/routes/api/admin/media-usage/progress.mjs.map +1 -0
- package/dist/astro/routes/api/admin/media-usage/repair.mjs +16 -11
- package/dist/astro/routes/api/admin/media-usage/repair.mjs.map +1 -1
- package/dist/astro/routes/api/admin/media-usage/work/index.mjs +14 -13
- package/dist/astro/routes/api/admin/media-usage/work/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/media-usage/work/retry.mjs +14 -13
- package/dist/astro/routes/api/admin/media-usage/work/retry.mjs.map +1 -1
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +4 -4
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +4 -4
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +55 -49
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +55 -49
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +53 -47
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/mcp.mjs +4 -4
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs +53 -47
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +54 -48
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +54 -48
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/index.mjs +53 -47
- package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +53 -47
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +54 -48
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +53 -47
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +54 -48
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +60 -50
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/artifact.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +179 -139
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/install.d.mts.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs +61 -51
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/verify.d.mts +8 -0
- package/dist/astro/routes/api/admin/plugins/registry/verify.d.mts.map +1 -0
- package/dist/astro/routes/api/admin/plugins/registry/verify.mjs +93 -0
- package/dist/astro/routes/api/admin/plugins/registry/verify.mjs.map +1 -0
- package/dist/astro/routes/api/admin/plugins/updates.mjs +53 -47
- package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +53 -47
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +53 -47
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +2 -2
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +1 -1
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +7 -7
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +3 -3
- package/dist/astro/routes/api/admin/users/index.mjs +6 -6
- package/dist/astro/routes/api/auth/dev-bypass.mjs +3 -3
- package/dist/astro/routes/api/auth/invite/accept.mjs +1 -1
- package/dist/astro/routes/api/auth/invite/complete.mjs +11 -11
- package/dist/astro/routes/api/auth/invite/index.mjs +8 -8
- package/dist/astro/routes/api/auth/invite/register-options.mjs +10 -10
- package/dist/astro/routes/api/auth/logout.mjs +2 -2
- package/dist/astro/routes/api/auth/magic-link/send.mjs +10 -10
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/me.d.mts.map +1 -1
- package/dist/astro/routes/api/auth/me.mjs +19 -9
- package/dist/astro/routes/api/auth/me.mjs.map +1 -1
- package/dist/astro/routes/api/auth/mode.mjs +2 -2
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +4 -4
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +6 -6
- package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
- package/dist/astro/routes/api/auth/passkey/options.mjs +12 -12
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +10 -10
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +11 -11
- package/dist/astro/routes/api/auth/passkey/verify.mjs +11 -11
- package/dist/astro/routes/api/auth/signup/complete.mjs +11 -11
- package/dist/astro/routes/api/auth/signup/request.mjs +10 -10
- package/dist/astro/routes/api/auth/signup/verify.mjs +1 -1
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +14 -14
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +13 -13
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.d.mts.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +14 -5
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +11 -11
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +13 -10
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs +17 -15
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs +17 -15
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +8 -8
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +14 -14
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.d.mts.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +14 -5
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +8 -8
- package/dist/astro/routes/api/content/_collection_/authors.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/index.mjs +8 -8
- package/dist/astro/routes/api/content/_collection_/trash.mjs +7 -7
- package/dist/astro/routes/api/dashboard.mjs +8 -8
- package/dist/astro/routes/api/dev/emails.mjs +2 -2
- package/dist/astro/routes/api/import/probe.d.mts +3 -3
- package/dist/astro/routes/api/import/probe.mjs +17 -17
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +2 -2
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +11 -11
- package/dist/astro/routes/api/import/wordpress/execute.mjs +13 -13
- package/dist/astro/routes/api/import/wordpress/media.d.mts +10 -10
- package/dist/astro/routes/api/import/wordpress/media.mjs +11 -11
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +9 -9
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +11 -11
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +12 -10
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +17 -17
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +11 -11
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +27 -27
- package/dist/astro/routes/api/manifest.mjs +4 -4
- package/dist/astro/routes/api/manifest.mjs.map +1 -1
- package/dist/astro/routes/api/mcp.mjs +188 -65
- package/dist/astro/routes/api/mcp.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_/confirm.mjs +11 -11
- package/dist/astro/routes/api/media/_id_/replace.d.mts +8 -0
- package/dist/astro/routes/api/media/_id_/replace.d.mts.map +1 -0
- package/dist/astro/routes/api/media/_id_/replace.mjs +91 -0
- package/dist/astro/routes/api/media/_id_/replace.mjs.map +1 -0
- package/dist/astro/routes/api/media/_id_/upload.mjs +6 -6
- package/dist/astro/routes/api/media/_id_/usage.mjs +18 -13
- package/dist/astro/routes/api/media/_id_/usage.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_.d.mts.map +1 -1
- package/dist/astro/routes/api/media/_id_.mjs +21 -13
- package/dist/astro/routes/api/media/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/media/file/_...key_.d.mts.map +1 -1
- package/dist/astro/routes/api/media/file/_...key_.mjs +3 -2
- package/dist/astro/routes/api/media/file/_...key_.mjs.map +1 -1
- package/dist/astro/routes/api/media/folders/_id_.d.mts +10 -0
- package/dist/astro/routes/api/media/folders/_id_.d.mts.map +1 -0
- package/dist/astro/routes/api/media/folders/_id_.mjs +52 -0
- package/dist/astro/routes/api/media/folders/_id_.mjs.map +1 -0
- package/dist/astro/routes/api/media/folders/index.d.mts +9 -0
- package/dist/astro/routes/api/media/folders/index.d.mts.map +1 -0
- package/dist/astro/routes/api/media/folders/index.mjs +41 -0
- package/dist/astro/routes/api/media/folders/index.mjs.map +1 -0
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +2 -2
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +2 -2
- package/dist/astro/routes/api/media/providers/index.mjs +2 -2
- package/dist/astro/routes/api/media/upload-url.mjs +16 -14
- package/dist/astro/routes/api/media/upload-url.mjs.map +1 -1
- package/dist/astro/routes/api/media.d.mts.map +1 -1
- package/dist/astro/routes/api/media.mjs +59 -27
- package/dist/astro/routes/api/media.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/items/_id_.d.mts.map +1 -1
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +20 -13
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/items.d.mts.map +1 -1
- package/dist/astro/routes/api/menus/_name_/items.mjs +15 -11
- package/dist/astro/routes/api/menus/_name_/items.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/reorder.d.mts.map +1 -1
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +15 -11
- package/dist/astro/routes/api/menus/_name_/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/translations.d.mts.map +1 -1
- package/dist/astro/routes/api/menus/_name_/translations.mjs +16 -12
- package/dist/astro/routes/api/menus/_name_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_.d.mts.map +1 -1
- package/dist/astro/routes/api/menus/_name_.mjs +21 -14
- package/dist/astro/routes/api/menus/_name_.mjs.map +1 -1
- package/dist/astro/routes/api/menus/index.d.mts.map +1 -1
- package/dist/astro/routes/api/menus/index.mjs +15 -11
- package/dist/astro/routes/api/menus/index.mjs.map +1 -1
- package/dist/astro/routes/api/oauth/authorize.mjs +6 -6
- package/dist/astro/routes/api/oauth/device/authorize.mjs +5 -5
- package/dist/astro/routes/api/oauth/device/code.mjs +8 -8
- package/dist/astro/routes/api/oauth/device/token.mjs +7 -7
- package/dist/astro/routes/api/oauth/register.mjs +2 -2
- package/dist/astro/routes/api/oauth/token/refresh.mjs +5 -5
- package/dist/astro/routes/api/oauth/token/revoke.mjs +5 -5
- package/dist/astro/routes/api/oauth/token.mjs +5 -5
- package/dist/astro/routes/api/openapi.json.mjs +253 -40
- package/dist/astro/routes/api/openapi.json.mjs.map +1 -1
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +4 -4
- package/dist/astro/routes/api/redirects/404s/index.mjs +10 -10
- package/dist/astro/routes/api/redirects/404s/summary.mjs +10 -10
- package/dist/astro/routes/api/redirects/_id_.mjs +11 -11
- package/dist/astro/routes/api/redirects/index.mjs +11 -11
- package/dist/astro/routes/api/relations/_id_/index.mjs +17 -15
- package/dist/astro/routes/api/relations/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/relations/_id_/translations.mjs +12 -10
- package/dist/astro/routes/api/relations/_id_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/relations/index.mjs +17 -15
- package/dist/astro/routes/api/relations/index.mjs.map +1 -1
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +2 -2
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +3 -3
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +53 -47
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +53 -47
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +53 -47
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +53 -47
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/index.mjs +53 -47
- package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/reorder.mjs +53 -47
- package/dist/astro/routes/api/schema/collections/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/schema/index.mjs +10 -8
- package/dist/astro/routes/api/schema/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +53 -47
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/schema/orphans/index.mjs +53 -47
- package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -1
- package/dist/astro/routes/api/search/enable.mjs +10 -10
- package/dist/astro/routes/api/search/index.mjs +9 -9
- package/dist/astro/routes/api/search/rebuild.mjs +10 -10
- package/dist/astro/routes/api/search/stats.mjs +5 -5
- package/dist/astro/routes/api/search/suggest.mjs +9 -9
- package/dist/astro/routes/api/sections/_slug_.mjs +9 -9
- package/dist/astro/routes/api/sections/index.mjs +9 -9
- package/dist/astro/routes/api/settings/backups/archives/_name_.mjs +6 -6
- package/dist/astro/routes/api/settings/backups/archives/index.mjs +5 -5
- package/dist/astro/routes/api/settings/backups/export.mjs +6 -6
- package/dist/astro/routes/api/settings/backups/index.mjs +7 -7
- package/dist/astro/routes/api/settings/email.mjs +5 -5
- package/dist/astro/routes/api/settings/email.mjs.map +1 -1
- package/dist/astro/routes/api/settings.d.mts.map +1 -1
- package/dist/astro/routes/api/settings.mjs +20 -16
- package/dist/astro/routes/api/settings.mjs.map +1 -1
- package/dist/astro/routes/api/setup/admin-verify.mjs +12 -12
- package/dist/astro/routes/api/setup/admin.mjs +11 -11
- package/dist/astro/routes/api/setup/dev-bypass.d.mts.map +1 -1
- package/dist/astro/routes/api/setup/dev-bypass.mjs +35 -28
- package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -1
- package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
- package/dist/astro/routes/api/setup/index.mjs +32 -30
- package/dist/astro/routes/api/setup/index.mjs.map +1 -1
- package/dist/astro/routes/api/setup/status.mjs +3 -3
- package/dist/astro/routes/api/snapshot.mjs +7 -7
- package/dist/astro/routes/api/taxonomies/_name_/reorder.d.mts.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs +20 -16
- package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.d.mts.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +21 -17
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.d.mts.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +25 -18
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.d.mts.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +20 -16
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/translations.mjs +14 -14
- package/dist/astro/routes/api/taxonomies/_name_.d.mts.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_.mjs +26 -19
- package/dist/astro/routes/api/taxonomies/_name_.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/index.d.mts.map +1 -1
- package/dist/astro/routes/api/taxonomies/index.mjs +20 -16
- package/dist/astro/routes/api/taxonomies/index.mjs.map +1 -1
- package/dist/astro/routes/api/themes/preview.mjs +5 -5
- package/dist/astro/routes/api/typegen.mjs +4 -4
- package/dist/astro/routes/api/well-known/auth.mjs +2 -2
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +2 -2
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +2 -2
- package/dist/astro/routes/api/widget-areas/_name_/reorder.d.mts.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +10 -8
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.d.mts.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +17 -13
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_/widgets.d.mts.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +15 -12
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_.d.mts.map +1 -1
- package/dist/astro/routes/api/widget-areas/_name_.mjs +8 -6
- package/dist/astro/routes/api/widget-areas/_name_.mjs.map +1 -1
- package/dist/astro/routes/api/widget-areas/index.d.mts.map +1 -1
- package/dist/astro/routes/api/widget-areas/index.mjs +15 -12
- package/dist/astro/routes/api/widget-areas/index.mjs.map +1 -1
- package/dist/astro/routes/api/widget-components.mjs +2 -2
- package/dist/astro/routes/robots.txt.mjs +7 -7
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +10 -10
- package/dist/astro/routes/sitemap.xml.mjs +8 -8
- package/dist/astro/types.d.mts +37 -17
- package/dist/astro/types.d.mts.map +1 -1
- package/dist/auth/providers/github.d.mts +1 -1
- package/dist/auth/providers/google.d.mts +1 -1
- package/dist/{authorize-DUElxgOQ.mjs → authorize-Bkf_UHhD.mjs} +2 -2
- package/dist/{authorize-DUElxgOQ.mjs.map → authorize-Bkf_UHhD.mjs.map} +1 -1
- package/dist/{backup-DWYpJlLj.mjs → backup-rwVAl9NI.mjs} +5 -5
- package/dist/{backup-DWYpJlLj.mjs.map → backup-rwVAl9NI.mjs.map} +1 -1
- package/dist/{bundle-vn56sLos.mjs → bundle-C8S2Zl6U.mjs} +4 -4
- package/dist/{bundle-vn56sLos.mjs.map → bundle-C8S2Zl6U.mjs.map} +1 -1
- package/dist/{byline-yjvWq4ip.mjs → byline-DuhF7NWl.mjs} +27 -14
- package/dist/byline-DuhF7NWl.mjs.map +1 -0
- package/dist/{byline-fields-txaLGoME.mjs → byline-fields-BovY4KYM.mjs} +2 -2
- package/dist/{byline-fields-txaLGoME.mjs.map → byline-fields-BovY4KYM.mjs.map} +1 -1
- package/dist/{byline-registry-DDun8sxh.mjs → byline-registry-Bpu9-MVs.mjs} +2 -2
- package/dist/{byline-registry-DDun8sxh.mjs.map → byline-registry-Bpu9-MVs.mjs.map} +1 -1
- package/dist/{bylines-DjXS5p0P.mjs → bylines-CJ5nd6Lw.mjs} +7 -7
- package/dist/{bylines-DjXS5p0P.mjs.map → bylines-CJ5nd6Lw.mjs.map} +1 -1
- package/dist/{bylines-Bu7pchQ4.mjs → bylines-RwBAeOF1.mjs} +3 -3
- package/dist/{bylines-Bu7pchQ4.mjs.map → bylines-RwBAeOF1.mjs.map} +1 -1
- package/dist/{cache-C46-3Irl.mjs → cache-BF5Kvn59.mjs} +4 -4
- package/dist/{cache-C46-3Irl.mjs.map → cache-BF5Kvn59.mjs.map} +1 -1
- package/dist/capture-triggers-CNW1q3HK.mjs +362 -0
- package/dist/capture-triggers-CNW1q3HK.mjs.map +1 -0
- package/dist/{challenge-store-SIL5DsF2.mjs → challenge-store-DQN_Yrck.mjs} +5 -3
- package/dist/challenge-store-DQN_Yrck.mjs.map +1 -0
- package/dist/chrome-tags-D8fiZG94.mjs +24 -0
- package/dist/chrome-tags-D8fiZG94.mjs.map +1 -0
- package/dist/{chunks-fiZ8G9RJ.mjs → chunks-C4szrD8o.mjs} +2 -2
- package/dist/{chunks-fiZ8G9RJ.mjs.map → chunks-C4szrD8o.mjs.map} +1 -1
- package/dist/cli/index.mjs +37 -53
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/cf-access.d.mts +1 -1
- package/dist/client/index.d.mts +74 -4
- package/dist/client/index.d.mts.map +1 -1
- package/dist/client/index.mjs +54 -2
- package/dist/client/index.mjs.map +1 -1
- package/dist/{collection-deletion-DQPvMD8R.mjs → collection-deletion-Bj07NHbj.mjs} +13 -356
- package/dist/collection-deletion-Bj07NHbj.mjs.map +1 -0
- package/dist/{comment-reaction-D-2J84UE.mjs → comment-reaction-BhrvSHml.mjs} +2 -2
- package/dist/{comment-reaction-D-2J84UE.mjs.map → comment-reaction-BhrvSHml.mjs.map} +1 -1
- package/dist/{comment-Dxlep6cE.mjs → comment-vxOzWbZN.mjs} +2 -2
- package/dist/{comment-Dxlep6cE.mjs.map → comment-vxOzWbZN.mjs.map} +1 -1
- package/dist/{comments-CTfZtLmM.mjs → comments-Ct4ensnf.mjs} +2 -2
- package/dist/{comments-CTfZtLmM.mjs.map → comments-Ct4ensnf.mjs.map} +1 -1
- package/dist/{components-CQy3lh9x.mjs → components-DJbo1z0S.mjs} +1 -1
- package/dist/{components-CQy3lh9x.mjs.map → components-DJbo1z0S.mjs.map} +1 -1
- package/dist/{config-COQzTe5Q.d.mts → config-B9eZ340f.d.mts} +1 -1
- package/dist/{config-COQzTe5Q.d.mts.map → config-B9eZ340f.d.mts.map} +1 -1
- package/dist/config-it29yDLA.mjs +1163 -0
- package/dist/config-it29yDLA.mjs.map +1 -0
- package/dist/{content-ZHCc1ngN.mjs → content-DjvM0T92.mjs} +86 -45
- package/dist/content-DjvM0T92.mjs.map +1 -0
- package/dist/{content-list-query-wJ2WN8Vp.d.mts → content-list-query-Btqd4uV2.d.mts} +1 -1
- package/dist/{content-list-query-wJ2WN8Vp.d.mts.map → content-list-query-Btqd4uV2.d.mts.map} +1 -1
- package/dist/{content-refresh-B_8SJzuU.mjs → content-refresh-Bwp-8yGy.mjs} +1139 -111
- package/dist/content-refresh-Bwp-8yGy.mjs.map +1 -0
- package/dist/{media-usage-BZCydfvu.mjs → content-repair-Czdp7jz5.mjs} +5 -196
- package/dist/content-repair-Czdp7jz5.mjs.map +1 -0
- package/dist/{context-ZldbZcle.mjs → context-CX6gxOLW.mjs} +55 -20
- package/dist/context-CX6gxOLW.mjs.map +1 -0
- package/dist/{cron-Y9aLtgrA.mjs → cron-C6o7VppJ.mjs} +1 -1
- package/dist/{cron-Y9aLtgrA.mjs.map → cron-C6o7VppJ.mjs.map} +1 -1
- package/dist/{dashboard-DvHbk_cv.mjs → dashboard-C2kTeeRI.mjs} +5 -5
- package/dist/{dashboard-DvHbk_cv.mjs.map → dashboard-C2kTeeRI.mjs.map} +1 -1
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +3 -3
- package/dist/db/index.mjs.map +1 -1
- package/dist/db/libsql-migrations.d.mts +1 -1
- package/dist/db/libsql-migrations.mjs +4 -4
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/postgres-migrations.d.mts +1 -1
- package/dist/db/postgres-migrations.mjs +4 -4
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/postgres.d.mts.map +1 -1
- package/dist/db/postgres.mjs +19 -3
- package/dist/db/postgres.mjs.map +1 -1
- package/dist/db/sqlite-migrations.d.mts +1 -1
- package/dist/db/sqlite-migrations.mjs +4 -4
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/db/sqlite.mjs +3 -3
- package/dist/db/sqlite.mjs.map +1 -1
- package/dist/{default-DdDl3fxv.mjs → default-Clra32mw.mjs} +1 -1
- package/dist/{default-DdDl3fxv.mjs.map → default-Clra32mw.mjs.map} +1 -1
- package/dist/{deferred-tasks-SDWxrgzJ.d.mts → deferred-tasks-CvDETTJO.d.mts} +1 -1
- package/dist/{deferred-tasks-SDWxrgzJ.d.mts.map → deferred-tasks-CvDETTJO.d.mts.map} +1 -1
- package/dist/dev-typegen-DzOPfsNj.mjs +29 -0
- package/dist/dev-typegen-DzOPfsNj.mjs.map +1 -0
- package/dist/{device-flow-C0GdD_z8.mjs → device-flow-D2oCWvLJ.mjs} +5 -5
- package/dist/{device-flow-C0GdD_z8.mjs.map → device-flow-D2oCWvLJ.mjs.map} +1 -1
- package/dist/{direct-executor-CDXeJCSs.mjs → direct-executor-Bfa5_ToE.mjs} +3 -3
- package/dist/{direct-executor-CDXeJCSs.mjs.map → direct-executor-Bfa5_ToE.mjs.map} +1 -1
- package/dist/{dist-D_6CKR8z.mjs → dist-89xCrGqi.mjs} +1 -1
- package/dist/{dist-D_6CKR8z.mjs.map → dist-89xCrGqi.mjs.map} +1 -1
- package/dist/{email-console-BHNjIwiB.mjs → email-console-Dzb6uGYa.mjs} +1 -1
- package/dist/{email-console-BHNjIwiB.mjs.map → email-console-Dzb6uGYa.mjs.map} +1 -1
- package/dist/{enrich-_ySMEvEE.mjs → enrich-BX0IDp4z.mjs} +3 -3
- package/dist/{enrich-_ySMEvEE.mjs.map → enrich-BX0IDp4z.mjs.map} +1 -1
- package/dist/{error-DupyJZE2.mjs → error-DFrQjppn.mjs} +2 -2
- package/dist/{error-DupyJZE2.mjs.map → error-DFrQjppn.mjs.map} +1 -1
- package/dist/{errors-CLUPm7aD.mjs → errors-DsVoDUjJ.mjs} +24 -2
- package/dist/errors-DsVoDUjJ.mjs.map +1 -0
- package/dist/{escape-DUY2r2Zs.mjs → escape-HmHTC1Is.mjs} +1 -1
- package/dist/{escape-DUY2r2Zs.mjs.map → escape-HmHTC1Is.mjs.map} +1 -1
- package/dist/{field-defs-cache-BzwBlJrR.mjs → field-defs-cache-BM4SIRqH.mjs} +5 -5
- package/dist/{field-defs-cache-BzwBlJrR.mjs.map → field-defs-cache-BM4SIRqH.mjs.map} +1 -1
- package/dist/focal-point-BeWFo6Xx.mjs +23 -0
- package/dist/focal-point-BeWFo6Xx.mjs.map +1 -0
- package/dist/{fts-manager-DyZEohZC.mjs → fts-manager-Do1BlW2r.mjs} +3 -3
- package/dist/{fts-manager-DyZEohZC.mjs.map → fts-manager-Do1BlW2r.mjs.map} +1 -1
- package/dist/{hash-Cg0TXJPV.mjs → hash-3JJPlHF2.mjs} +1 -1
- package/dist/{hash-Cg0TXJPV.mjs.map → hash-3JJPlHF2.mjs.map} +1 -1
- package/dist/hook-result-DCh2WUpe.d.mts +31 -0
- package/dist/hook-result-DCh2WUpe.d.mts.map +1 -0
- package/dist/{hreflang-DwT2E0Sa.d.mts → hreflang-B6hbAuuO.d.mts} +2 -2
- package/dist/{hreflang-DwT2E0Sa.d.mts.map → hreflang-B6hbAuuO.d.mts.map} +1 -1
- package/dist/{hreflang-BBe83kKa.mjs → hreflang-DQbPZliA.mjs} +7 -7
- package/dist/{hreflang-BBe83kKa.mjs.map → hreflang-DQbPZliA.mjs.map} +1 -1
- package/dist/{identity-Ys6Dlc9C.mjs → identity-DksvEazf.mjs} +3 -3
- package/dist/{identity-Ys6Dlc9C.mjs.map → identity-DksvEazf.mjs.map} +1 -1
- package/dist/{import-DPkLmeXO.mjs → import-CJpaBBBT.mjs} +6 -6
- package/dist/{import-DPkLmeXO.mjs.map → import-CJpaBBBT.mjs.map} +1 -1
- package/dist/{index-BVBZj4-7.d.mts → index-BJNMCWmu.d.mts} +267 -82
- package/dist/index-BJNMCWmu.d.mts.map +1 -0
- package/dist/{index-C9KuQyO-.d.mts → index-Du8K7bWa.d.mts} +3 -3
- package/dist/{index-C9KuQyO-.d.mts.map → index-Du8K7bWa.d.mts.map} +1 -1
- package/dist/index.d.mts +22 -21
- package/dist/index.mjs +79 -73
- package/dist/{init-lock-6b309ZrF.mjs → init-lock-DJkX6Hto.mjs} +1 -1
- package/dist/{init-lock-6b309ZrF.mjs.map → init-lock-DJkX6Hto.mjs.map} +1 -1
- package/dist/{load-YJ2xl3ra.mjs → load-CawHjTOH.mjs} +2 -2
- package/dist/{load-YJ2xl3ra.mjs.map → load-CawHjTOH.mjs.map} +1 -1
- package/dist/{loader-CdG_Ci3H.mjs → loader-Z8vl7zTq.mjs} +48 -13
- package/dist/loader-Z8vl7zTq.mjs.map +1 -0
- package/dist/{manifest-builder-B252yQUf.mjs → manifest-builder-COtzuca2.mjs} +2 -2
- package/dist/{manifest-builder-B252yQUf.mjs.map → manifest-builder-COtzuca2.mjs.map} +1 -1
- package/dist/{manifest-schema-BXbUAHod.mjs → manifest-schema-BNWwR8Vd.mjs} +5 -5
- package/dist/manifest-schema-BNWwR8Vd.mjs.map +1 -0
- package/dist/media/image-endpoint.d.mts +4 -2
- package/dist/media/image-endpoint.d.mts.map +1 -1
- package/dist/media/image-endpoint.mjs +6 -4
- package/dist/media/image-endpoint.mjs.map +1 -1
- package/dist/media/index.d.mts +1 -1
- package/dist/media/index.mjs +13 -3
- package/dist/media/index.mjs.map +1 -1
- package/dist/media/local-runtime.d.mts +14 -12
- package/dist/media/local-runtime.d.mts.map +1 -1
- package/dist/media/local-runtime.mjs +12 -6
- package/dist/media/local-runtime.mjs.map +1 -1
- package/dist/{media-CzhAn2--.mjs → media-BBm8Wg3f.mjs} +69 -12
- package/dist/media-BBm8Wg3f.mjs.map +1 -0
- package/dist/{media-BWWWb8kg.mjs → media-BHjus86Y.mjs} +133 -9
- package/dist/media-BHjus86Y.mjs.map +1 -0
- package/dist/{media-allowlist-D6x-Us02.mjs → media-allowlist-CoTBWoDp.mjs} +3 -2
- package/dist/media-allowlist-CoTBWoDp.mjs.map +1 -0
- package/dist/media-folders-BGkATs8n.mjs +210 -0
- package/dist/media-folders-BGkATs8n.mjs.map +1 -0
- package/dist/{media-upload-CHBVn6m-.mjs → media-upload-BCidR-EY.mjs} +9 -9
- package/dist/{media-upload-CHBVn6m-.mjs.map → media-upload-BCidR-EY.mjs.map} +1 -1
- package/dist/{media-url-BvoX88FA.mjs → media-url-DHoPr0hq.mjs} +1 -1
- package/dist/{media-url-BvoX88FA.mjs.map → media-url-DHoPr0hq.mjs.map} +1 -1
- package/dist/media-usage-CdY5jhSR.mjs +1833 -0
- package/dist/media-usage-CdY5jhSR.mjs.map +1 -0
- package/dist/media-usage-activation-BgeMtK5C.mjs +78 -0
- package/dist/media-usage-activation-BgeMtK5C.mjs.map +1 -0
- package/dist/{media-usage-work-CLo_6tct.mjs → media-usage-work-CnGCdHxx.mjs} +4 -4
- package/dist/{media-usage-work-CLo_6tct.mjs.map → media-usage-work-CnGCdHxx.mjs.map} +1 -1
- package/dist/{media-usage-work-DrCbqBcl.mjs → media-usage-work-D6D9sMCA.mjs} +221 -59
- package/dist/media-usage-work-D6D9sMCA.mjs.map +1 -0
- package/dist/{media-usage-write-fence-aHEgN1zB.mjs → media-usage-write-fence-hjeD4u7s.mjs} +2 -2
- package/dist/{media-usage-write-fence-aHEgN1zB.mjs.map → media-usage-write-fence-hjeD4u7s.mjs.map} +1 -1
- package/dist/{menus-DSo5QeW0.mjs → menus-6qSwTNxG.mjs} +375 -107
- package/dist/menus-6qSwTNxG.mjs.map +1 -0
- package/dist/{menus-TCNSd2vp.mjs → menus-uvPLXMZf.mjs} +4 -4
- package/dist/{menus-TCNSd2vp.mjs.map → menus-uvPLXMZf.mjs.map} +1 -1
- package/dist/migrations/index.d.mts +1 -1
- package/dist/migrations/index.mjs +3 -3
- package/dist/{mime-DfIVjNkr.mjs → mime-CUIG6x84.mjs} +1 -1
- package/dist/mime-CUIG6x84.mjs.map +1 -0
- package/dist/{mode-BDoH_WcF.mjs → mode-DN_WneRx.mjs} +1 -1
- package/dist/{mode-BDoH_WcF.mjs.map → mode-DN_WneRx.mjs.map} +1 -1
- package/dist/node-sqlite-compat-BuJXIeMz.mjs +46 -0
- package/dist/node-sqlite-compat-BuJXIeMz.mjs.map +1 -0
- package/dist/{normalize-Bc-s_r-a.mjs → normalize-C2xNjTSG.mjs} +36 -5
- package/dist/normalize-C2xNjTSG.mjs.map +1 -0
- package/dist/{oauth-authorization-iOikmrJd.mjs → oauth-authorization-Dj6Kwc21.mjs} +5 -5
- package/dist/{oauth-authorization-iOikmrJd.mjs.map → oauth-authorization-Dj6Kwc21.mjs.map} +1 -1
- package/dist/{oauth-clients-CvI0nHMJ.mjs → oauth-clients-FD7I0J8m.mjs} +1 -1
- package/dist/{oauth-clients-CvI0nHMJ.mjs.map → oauth-clients-FD7I0J8m.mjs.map} +1 -1
- package/dist/{oauth-state-store-Ba8KZlwW.mjs → oauth-state-store-DkmDOmHs.mjs} +1 -1
- package/dist/{oauth-state-store-Ba8KZlwW.mjs.map → oauth-state-store-DkmDOmHs.mjs.map} +1 -1
- package/dist/{oauth-user-lookup-C5SQwGYC.mjs → oauth-user-lookup-CvIwGpYd.mjs} +1 -1
- package/dist/{oauth-user-lookup-C5SQwGYC.mjs.map → oauth-user-lookup-CvIwGpYd.mjs.map} +1 -1
- package/dist/object-cache/memory.d.mts +1 -1
- package/dist/{object-cache-71tPfV4A.mjs → object-cache-DVKnyOfy.mjs} +19 -3
- package/dist/object-cache-DVKnyOfy.mjs.map +1 -0
- package/dist/{options-CBXIHUoT.mjs → options-BHPeIbBd.mjs} +1 -1
- package/dist/{options-CBXIHUoT.mjs.map → options-BHPeIbBd.mjs.map} +1 -1
- package/dist/{options--hhz-jZ1.d.mts → options-CYb4y7hM.d.mts} +24 -11
- package/dist/options-CYb4y7hM.d.mts.map +1 -0
- package/dist/page/index.d.mts +2 -2
- package/dist/{parse-DFbuc-Fh.mjs → parse-Ckpg-Qfp.mjs} +2 -2
- package/dist/{parse-DFbuc-Fh.mjs.map → parse-Ckpg-Qfp.mjs.map} +1 -1
- package/dist/{passkey-config-DFAmUyuE.mjs → passkey-config-O_lj3y0k.mjs} +1 -1
- package/dist/{passkey-config-DFAmUyuE.mjs.map → passkey-config-O_lj3y0k.mjs.map} +1 -1
- package/dist/{patterns-CiyXeDgr.mjs → patterns-D9iDO3j8.mjs} +1 -1
- package/dist/{patterns-CiyXeDgr.mjs.map → patterns-D9iDO3j8.mjs.map} +1 -1
- package/dist/{placeholder-Dp0K3RkD.d.mts → placeholder-4X9BrRrp.d.mts} +7 -1
- package/dist/placeholder-4X9BrRrp.d.mts.map +1 -0
- package/dist/plugin-types.d.mts +8 -3
- package/dist/plugin-types.d.mts.map +1 -1
- package/dist/plugin-utils.d.mts +10 -10
- package/dist/plugins/adapt-sandbox-entry.d.mts +10 -10
- package/dist/plugins/adapt-sandbox-entry.mjs +2 -2
- package/dist/{policy-TluUIxuu.mjs → policy-Dhtwntrt.mjs} +2 -2
- package/dist/{policy-TluUIxuu.mjs.map → policy-Dhtwntrt.mjs.map} +1 -1
- package/dist/{portable-text-imBW5cHK.mjs → portable-text-U85hOafW.mjs} +1 -1
- package/dist/{portable-text-imBW5cHK.mjs.map → portable-text-U85hOafW.mjs.map} +1 -1
- package/dist/{preview-PW-nOnq4.mjs → preview-B_vJLvf8.mjs} +2 -2
- package/dist/{preview-PW-nOnq4.mjs.map → preview-B_vJLvf8.mjs.map} +1 -1
- package/dist/{protocol-DjsJHTlK.d.mts → protocol-JdD2YhY9.d.mts} +2 -2
- package/dist/{protocol-DjsJHTlK.d.mts.map → protocol-JdD2YhY9.d.mts.map} +1 -1
- package/dist/{public-url-CWoFhQT8.mjs → public-url-CarhZJgf.mjs} +1 -1
- package/dist/{public-url-CWoFhQT8.mjs.map → public-url-CarhZJgf.mjs.map} +1 -1
- package/dist/{query-zTVAR1Sl.mjs → query-BZKZcG5b.mjs} +15 -15
- package/dist/{query-zTVAR1Sl.mjs.map → query-BZKZcG5b.mjs.map} +1 -1
- package/dist/{query-BWs7O5Il.mjs → query-BndaFxxp.mjs} +5 -5
- package/dist/{query-BWs7O5Il.mjs.map → query-BndaFxxp.mjs.map} +1 -1
- package/dist/{rate-limit-Bx4g9m3p.mjs → rate-limit-BZmATC6W.mjs} +2 -2
- package/dist/{rate-limit-Bx4g9m3p.mjs.map → rate-limit-BZmATC6W.mjs.map} +1 -1
- package/dist/{redirect-COsS6SWJ.mjs → redirect-CZkbozu9.mjs} +2 -2
- package/dist/{redirect-COsS6SWJ.mjs.map → redirect-CZkbozu9.mjs.map} +1 -1
- package/dist/{redirect-BgAOGHDq.mjs → redirect-CzqnLxK-.mjs} +1 -1
- package/dist/{redirect-BgAOGHDq.mjs.map → redirect-CzqnLxK-.mjs.map} +1 -1
- package/dist/{redirects-DTDHWH31.mjs → redirects-BLNOWQTn.mjs} +64 -29
- package/dist/redirects-BLNOWQTn.mjs.map +1 -0
- package/dist/{redirects-DyChwDkG.mjs → redirects-CqzNM0KM.mjs} +5 -5
- package/dist/{redirects-DyChwDkG.mjs.map → redirects-CqzNM0KM.mjs.map} +1 -1
- package/dist/{registry-Cqa2I749.mjs → registry-AZAsRsor.mjs} +30 -126
- package/dist/registry-AZAsRsor.mjs.map +1 -0
- package/dist/{relation-BnHB0T4J.mjs → relation-04DfKRTO.mjs} +2 -2
- package/dist/{relation-BnHB0T4J.mjs.map → relation-04DfKRTO.mjs.map} +1 -1
- package/dist/{relations-BBApI4e2.mjs → relations-C4htk5sb.mjs} +7 -7
- package/dist/relations-C4htk5sb.mjs.map +1 -0
- package/dist/{relations-D5sM5fW0.mjs → relations-CcFwDJdJ.mjs} +4 -4
- package/dist/{relations-D5sM5fW0.mjs.map → relations-CcFwDJdJ.mjs.map} +1 -1
- package/dist/{relations-BHo5A8Zf.d.mts → relations-DnRK4YIT.d.mts} +347 -54
- package/dist/relations-DnRK4YIT.d.mts.map +1 -0
- package/dist/{request-cache-BSUptuJR.mjs → request-cache-DH9zdCOD.mjs} +1 -1
- package/dist/{request-cache-BSUptuJR.mjs.map → request-cache-DH9zdCOD.mjs.map} +1 -1
- package/dist/request-context.d.mts +1 -1
- package/dist/{request-meta-DgZJh3zG.mjs → request-meta-DYxLlnmz.mjs} +2 -2
- package/dist/{request-meta-DgZJh3zG.mjs.map → request-meta-DYxLlnmz.mjs.map} +1 -1
- package/dist/{resolve-DOhVEvty.mjs → resolve-prZ3mP7l.mjs} +1 -1
- package/dist/{resolve-DOhVEvty.mjs.map → resolve-prZ3mP7l.mjs.map} +1 -1
- package/dist/{runner-C1T11CfC.mjs → runner-BLIDKpmA.mjs} +471 -290
- package/dist/runner-BLIDKpmA.mjs.map +1 -0
- package/dist/{runner-BYHZn3Jy.d.mts → runner-YKfIMnaF.d.mts} +3 -2
- package/dist/runner-YKfIMnaF.d.mts.map +1 -0
- package/dist/runtime.d.mts +11 -11
- package/dist/runtime.mjs +1 -1
- package/dist/{schema-DZ5YVVZj.mjs → schema-CGnBeLiW.mjs} +3 -3
- package/dist/{schema-DZ5YVVZj.mjs.map → schema-CGnBeLiW.mjs.map} +1 -1
- package/dist/{schema-2AOsSn2v.mjs → schema-DYr-Vd-L.mjs} +36 -6
- package/dist/{schema-2AOsSn2v.mjs.map → schema-DYr-Vd-L.mjs.map} +1 -1
- package/dist/{scopes-8ClPF2bC.mjs → scopes-BhWvBavj.mjs} +3 -3
- package/dist/{scopes-8ClPF2bC.mjs.map → scopes-BhWvBavj.mjs.map} +1 -1
- package/dist/{search-u1QYdOCG.mjs → search-C-qDk4kx.mjs} +4 -4
- package/dist/{search-u1QYdOCG.mjs.map → search-C-qDk4kx.mjs.map} +1 -1
- package/dist/{secrets-BEgsAQEU.mjs → secrets-rEtHt-6z.mjs} +3 -3
- package/dist/{secrets-BEgsAQEU.mjs.map → secrets-rEtHt-6z.mjs.map} +1 -1
- package/dist/{sections-DmHviGyM.mjs → sections-B_nYvlwn.mjs} +2 -2
- package/dist/{sections-DmHviGyM.mjs.map → sections-B_nYvlwn.mjs.map} +1 -1
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +25 -23
- package/dist/seo/index.d.mts +3 -3
- package/dist/seo/index.mjs +17 -15
- package/dist/seo/index.mjs.map +1 -1
- package/dist/{seo-Dq4G-RrO.mjs → seo-926NRIgt.mjs} +3 -3
- package/dist/{seo-Dq4G-RrO.mjs.map → seo-926NRIgt.mjs.map} +1 -1
- package/dist/{seo-AFpVvTqr.mjs → seo-CVWkdv6x.mjs} +1 -1
- package/dist/{seo-AFpVvTqr.mjs.map → seo-CVWkdv6x.mjs.map} +1 -1
- package/dist/{service-BpArayPr.mjs → service-CJl3ZAYs.mjs} +3 -3
- package/dist/{service-BpArayPr.mjs.map → service-CJl3ZAYs.mjs.map} +1 -1
- package/dist/{session-user-BEorKVT-.mjs → session-user-BlMgqCHS.mjs} +1 -1
- package/dist/{session-user-BEorKVT-.mjs.map → session-user-BlMgqCHS.mjs.map} +1 -1
- package/dist/{settings-xRdoUZr0.mjs → settings--wobrkkC.mjs} +21 -8
- package/dist/settings--wobrkkC.mjs.map +1 -0
- package/dist/{settings-DE9xtzqd.mjs → settings-Cwm6o2jY.mjs} +3 -3
- package/dist/{settings-DE9xtzqd.mjs.map → settings-Cwm6o2jY.mjs.map} +1 -1
- package/dist/{setup-complete-BnT8pq_C.mjs → setup-complete-DQbClIN2.mjs} +2 -2
- package/dist/{setup-complete-BnT8pq_C.mjs.map → setup-complete-DQbClIN2.mjs.map} +1 -1
- package/dist/{setup-nonce-CBitf_oQ.mjs → setup-nonce-DZCFS2sn.mjs} +1 -1
- package/dist/{setup-nonce-CBitf_oQ.mjs.map → setup-nonce-DZCFS2sn.mjs.map} +1 -1
- package/dist/{single-flight-cache-B0eLKS6K.mjs → single-flight-cache-BPuGPdcN.mjs} +2 -2
- package/dist/{single-flight-cache-B0eLKS6K.mjs.map → single-flight-cache-BPuGPdcN.mjs.map} +1 -1
- package/dist/{site-url-DjpIXMXJ.mjs → site-url-BrxA_E9H.mjs} +3 -3
- package/dist/{site-url-DjpIXMXJ.mjs.map → site-url-BrxA_E9H.mjs.map} +1 -1
- package/dist/{snapshot-BBlGkb2q.mjs → snapshot--OCDTqdb.mjs} +1 -1
- package/dist/{snapshot-BBlGkb2q.mjs.map → snapshot--OCDTqdb.mjs.map} +1 -1
- package/dist/{ssrf-Cpvg_n3A.mjs → ssrf-5sIM5jzl.mjs} +23 -6
- package/dist/{ssrf-Cpvg_n3A.mjs.map → ssrf-5sIM5jzl.mjs.map} +1 -1
- package/dist/{state-DYwPue40.mjs → state-BpFVsJZB.mjs} +12 -4
- package/dist/state-BpFVsJZB.mjs.map +1 -0
- package/dist/{status-CWVYpbD8.mjs → status-B777-dXz.mjs} +1 -1
- package/dist/{status-CWVYpbD8.mjs.map → status-B777-dXz.mjs.map} +1 -1
- package/dist/storage/local.d.mts +2 -1
- package/dist/storage/local.d.mts.map +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/local.mjs.map +1 -1
- package/dist/storage/s3.d.mts +2 -1
- package/dist/storage/s3.d.mts.map +1 -1
- package/dist/storage/s3.mjs +3 -2
- package/dist/storage/s3.mjs.map +1 -1
- package/dist/{target-DixqqV5i.mjs → target-BmR0iTwz.mjs} +1 -1
- package/dist/{target-DixqqV5i.mjs.map → target-BmR0iTwz.mjs.map} +1 -1
- package/dist/{taxonomies-OHUIiIpI.mjs → taxonomies-DkAkMupr.mjs} +17 -14
- package/dist/taxonomies-DkAkMupr.mjs.map +1 -0
- package/dist/{taxonomies-BlrncHi9.mjs → taxonomies-Wfy_Lg12.mjs} +43 -17
- package/dist/taxonomies-Wfy_Lg12.mjs.map +1 -0
- package/dist/{taxonomy-BqCZ1TdU.mjs → taxonomy-tJepplLL.mjs} +5 -5
- package/dist/{taxonomy-BqCZ1TdU.mjs.map → taxonomy-tJepplLL.mjs.map} +1 -1
- package/dist/{tokens-C39klX8R.mjs → tokens-BCO1oruF.mjs} +1 -1
- package/dist/{tokens-C39klX8R.mjs.map → tokens-BCO1oruF.mjs.map} +1 -1
- package/dist/{transaction-NQj4VJ7Z.mjs → transaction-0KOpOyMu.mjs} +2 -1
- package/dist/{transaction-NQj4VJ7Z.mjs.map → transaction-0KOpOyMu.mjs.map} +1 -1
- package/dist/{transport-DBJwa-Si.mjs → transport-Dr3qtwXC.mjs} +4 -3
- package/dist/{transport-DBJwa-Si.mjs.map → transport-Dr3qtwXC.mjs.map} +1 -1
- package/dist/{transport-RQE36APG.d.mts → transport-xh6YKW2G.d.mts} +1 -1
- package/dist/{transport-RQE36APG.d.mts.map → transport-xh6YKW2G.d.mts.map} +1 -1
- package/dist/{trusted-proxy-CEVekpby.mjs → trusted-proxy-BR5F1Otp.mjs} +1 -1
- package/dist/{trusted-proxy-CEVekpby.mjs.map → trusted-proxy-BR5F1Otp.mjs.map} +1 -1
- package/dist/{types-BW1syrlw.mjs → types-3qNFPlci.mjs} +1 -1
- package/dist/{types-BW1syrlw.mjs.map → types-3qNFPlci.mjs.map} +1 -1
- package/dist/types-75KIqzL9.mjs.map +1 -1
- package/dist/{types-DrJrVCT1.d.mts → types-B6GrPic4.d.mts} +9 -3
- package/dist/{types-DrJrVCT1.d.mts.map → types-B6GrPic4.d.mts.map} +1 -1
- package/dist/{types-DN64_zzZ.d.mts → types-BuHW4xDE.d.mts} +11 -10
- package/dist/types-BuHW4xDE.d.mts.map +1 -0
- package/dist/{types-DWRhk9xZ.d.mts → types-C00oyCZp.d.mts} +1 -1
- package/dist/{types-DWRhk9xZ.d.mts.map → types-C00oyCZp.d.mts.map} +1 -1
- package/dist/{types-BntycPTF.d.mts → types-CDtkNSFQ.d.mts} +1 -1
- package/dist/{types-BntycPTF.d.mts.map → types-CDtkNSFQ.d.mts.map} +1 -1
- package/dist/{types-Dfk8KI5R.d.mts → types-CPeXo1wF.d.mts} +1 -1
- package/dist/{types-Dfk8KI5R.d.mts.map → types-CPeXo1wF.d.mts.map} +1 -1
- package/dist/types-CQPWhPxE.mjs.map +1 -1
- package/dist/{types-BcqdcT-r.d.mts → types-CXFkwEGC.d.mts} +3 -2
- package/dist/types-CXFkwEGC.d.mts.map +1 -0
- package/dist/{types-CtzytVXn.mjs → types-DM3vioBY.mjs} +1 -1
- package/dist/{types-CtzytVXn.mjs.map → types-DM3vioBY.mjs.map} +1 -1
- package/dist/{types-CXnOzDe1.d.mts → types-DczELMop.d.mts} +1 -1
- package/dist/{types-CXnOzDe1.d.mts.map → types-DczELMop.d.mts.map} +1 -1
- package/dist/types-DfuTR6dL.mjs +3 -0
- package/dist/{types-DQIDRKF2.d.mts → types-FV23hEoW.d.mts} +10 -1
- package/dist/types-FV23hEoW.d.mts.map +1 -0
- package/dist/{types-C2pMvO62.d.mts → types-xDMtUFnO.d.mts} +2 -1
- package/dist/types-xDMtUFnO.d.mts.map +1 -0
- package/dist/{upload-attempts-D4FS8LT6.mjs → upload-attempts-BsqoQ1fn.mjs} +1 -1
- package/dist/{upload-attempts-D4FS8LT6.mjs.map → upload-attempts-BsqoQ1fn.mjs.map} +1 -1
- package/dist/{url-pattern-BHS0V5Ng.mjs → url-pattern-D4c2czpJ.mjs} +1 -1
- package/dist/{url-pattern-BHS0V5Ng.mjs.map → url-pattern-D4c2czpJ.mjs.map} +1 -1
- package/dist/{user-DJZfUJVE.mjs → user-BTZ40aq6.mjs} +2 -2
- package/dist/{user-DJZfUJVE.mjs.map → user-BTZ40aq6.mjs.map} +1 -1
- package/dist/{utils-D4vD_Y98.mjs → utils-BKvNjjhY.mjs} +1 -1
- package/dist/{utils-D4vD_Y98.mjs.map → utils-BKvNjjhY.mjs.map} +1 -1
- package/dist/{validate-BMLBvxOC.mjs → validate-DE_LRwo9.mjs} +2 -2
- package/dist/{validate-BMLBvxOC.mjs.map → validate-DE_LRwo9.mjs.map} +1 -1
- package/dist/{validate-CTqt5nuE.d.mts → validate-DUP27OYD.d.mts} +5 -5
- package/dist/{validate-CTqt5nuE.d.mts.map → validate-DUP27OYD.d.mts.map} +1 -1
- package/dist/{validation-npvENUCB.mjs → validation-BMImFJ11.mjs} +10 -8
- package/dist/{validation-npvENUCB.mjs.map → validation-BMImFJ11.mjs.map} +1 -1
- package/dist/version-Bii3suaO.mjs +7 -0
- package/dist/{version-DB_fqCSI.mjs.map → version-Bii3suaO.mjs.map} +1 -1
- package/dist/{widgets-BD3ho7Rq.mjs → widgets-D3gJ10xU.mjs} +18 -5
- package/dist/widgets-D3gJ10xU.mjs.map +1 -0
- package/dist/{wxr-taxonomies-Ca68766D.d.mts → wxr-taxonomies-B2Og_6rU.d.mts} +1 -1
- package/dist/{wxr-taxonomies-Ca68766D.d.mts.map → wxr-taxonomies-B2Og_6rU.d.mts.map} +1 -1
- package/dist/{wxr-taxonomies-B1R3vBoD.mjs → wxr-taxonomies-Cxngsjwo.mjs} +4 -4
- package/dist/{wxr-taxonomies-B1R3vBoD.mjs.map → wxr-taxonomies-Cxngsjwo.mjs.map} +1 -1
- package/dist/{zod-generator-LC-on_Vb.mjs → zod-generator-BuYSQJB7.mjs} +32 -22
- package/dist/zod-generator-BuYSQJB7.mjs.map +1 -0
- package/package.json +20 -9
- package/src/api/errors.ts +22 -0
- package/src/api/handlers/content.ts +49 -11
- package/src/api/handlers/index.ts +18 -0
- package/src/api/handlers/manifest.ts +161 -12
- package/src/api/handlers/media-allowlist.ts +1 -0
- package/src/api/handlers/media-folders.ts +130 -0
- package/src/api/handlers/media-usage-activation.ts +102 -0
- package/src/api/handlers/media-usage.ts +108 -0
- package/src/api/handlers/media.ts +92 -2
- package/src/api/handlers/registry.ts +483 -561
- package/src/api/handlers/taxonomies.ts +16 -9
- package/src/api/openapi/document.ts +277 -7
- package/src/api/parse.ts +1 -1
- package/src/api/schemas/auth.ts +4 -4
- package/src/api/schemas/bylines.ts +3 -3
- package/src/api/schemas/comments.ts +1 -1
- package/src/api/schemas/common.ts +3 -2
- package/src/api/schemas/content.ts +78 -22
- package/src/api/schemas/media-usage.ts +77 -0
- package/src/api/schemas/media.ts +121 -0
- package/src/api/schemas/redirects.ts +6 -1
- package/src/api/schemas/schema.ts +4 -0
- package/src/api/schemas/setup.ts +1 -1
- package/src/api/schemas/taxonomies.ts +2 -2
- package/src/api/schemas/users.ts +1 -1
- package/src/api/types.ts +23 -10
- package/src/astro/dev-typegen.ts +35 -0
- package/src/astro/image-endpoint.ts +2 -2
- package/src/astro/integration/dev-typegen.ts +91 -0
- package/src/astro/integration/index.ts +9 -44
- package/src/astro/integration/routes.ts +23 -0
- package/src/astro/integration/vite-config.ts +23 -9
- package/src/astro/middleware/auth.ts +4 -0
- package/src/astro/middleware.ts +5 -7
- package/src/astro/routes/api/admin/api-tokens/index.ts +4 -1
- package/src/astro/routes/api/admin/media-usage/activation.ts +42 -0
- package/src/astro/routes/api/admin/media-usage/progress.ts +37 -0
- package/src/astro/routes/api/admin/oauth-clients/[id].ts +1 -1
- package/src/astro/routes/api/admin/oauth-clients/index.ts +1 -1
- package/src/astro/routes/api/admin/plugins/registry/[id]/update.ts +4 -0
- package/src/astro/routes/api/admin/plugins/registry/artifact.ts +247 -101
- package/src/astro/routes/api/admin/plugins/registry/install.ts +4 -0
- package/src/astro/routes/api/admin/plugins/registry/verify.ts +60 -0
- package/src/astro/routes/api/auth/me.ts +14 -2
- package/src/astro/routes/api/content/[collection]/[id]/discard-draft.ts +8 -2
- package/src/astro/routes/api/content/[collection]/[id]/publish.ts +2 -1
- package/src/astro/routes/api/content/[collection]/[id]/unpublish.ts +6 -2
- package/src/astro/routes/api/manifest.ts +1 -1
- package/src/astro/routes/api/media/[id]/replace.ts +114 -0
- package/src/astro/routes/api/media/[id].ts +3 -0
- package/src/astro/routes/api/media/file/[...key].ts +4 -1
- package/src/astro/routes/api/media/folders/[id].ts +55 -0
- package/src/astro/routes/api/media/folders/index.ts +37 -0
- package/src/astro/routes/api/media/upload-url.ts +8 -4
- package/src/astro/routes/api/media.ts +66 -10
- package/src/astro/routes/api/menus/[name]/items/[id].ts +7 -2
- package/src/astro/routes/api/menus/[name]/items.ts +4 -1
- package/src/astro/routes/api/menus/[name]/reorder.ts +4 -1
- package/src/astro/routes/api/menus/[name]/translations.ts +4 -1
- package/src/astro/routes/api/menus/[name].ts +7 -2
- package/src/astro/routes/api/menus/index.ts +4 -1
- package/src/astro/routes/api/settings/email.ts +1 -1
- package/src/astro/routes/api/settings.ts +4 -1
- package/src/astro/routes/api/setup/dev-bypass.ts +12 -0
- package/src/astro/routes/api/taxonomies/[name]/reorder.ts +4 -1
- package/src/astro/routes/api/taxonomies/[name]/terms/[slug]/translations.ts +4 -1
- package/src/astro/routes/api/taxonomies/[name]/terms/[slug].ts +7 -2
- package/src/astro/routes/api/taxonomies/[name]/terms/index.ts +4 -1
- package/src/astro/routes/api/taxonomies/[name].ts +7 -2
- package/src/astro/routes/api/taxonomies/index.ts +4 -1
- package/src/astro/routes/api/widget-areas/[name]/reorder.ts +3 -1
- package/src/astro/routes/api/widget-areas/[name]/widgets/[id].ts +5 -2
- package/src/astro/routes/api/widget-areas/[name]/widgets.ts +3 -1
- package/src/astro/routes/api/widget-areas/[name].ts +3 -1
- package/src/astro/routes/api/widget-areas/index.ts +3 -1
- package/src/astro/types.ts +34 -6
- package/src/auth/challenge-store.ts +3 -1
- package/src/aws-sdk.d.ts +1 -0
- package/src/cache/chrome-tags.ts +24 -0
- package/src/client/index.ts +140 -2
- package/src/client/transport.ts +6 -2
- package/src/components/EmDashImage.astro +156 -51
- package/src/components/EmDashMedia.astro +2 -1
- package/src/components/Gallery.astro +7 -0
- package/src/components/InlinePortableTextEditor.tsx +136 -2
- package/src/components/LiveSearch.astro +23 -0
- package/src/components/inline-code-block.tsx +180 -49
- package/src/components/widgets/Archives.astro +2 -37
- package/src/content/converters/gallery.ts +2 -0
- package/src/content/converters/index.ts +2 -0
- package/src/content/converters/mark-safety.ts +1 -0
- package/src/content/converters/portable-text-identity.ts +139 -0
- package/src/content/converters/portable-text-to-prosemirror.ts +202 -69
- package/src/content/converters/prosemirror-to-portable-text.ts +96 -25
- package/src/content/converters/types.ts +3 -0
- package/src/database/connection.ts +2 -31
- package/src/database/index.ts +1 -1
- package/src/database/json-recordset.ts +16 -0
- package/src/database/migrations/017_authorization_codes.ts +14 -4
- package/src/database/migrations/019_i18n.ts +1 -1
- package/src/database/migrations/071_restore_content_bylines_table.ts +43 -0
- package/src/database/migrations/072_media_folders.ts +72 -0
- package/src/database/migrations/073_media_focal_point.ts +57 -0
- package/src/database/migrations/074_content_deleted_scheduled_index.ts +55 -0
- package/src/database/migrations/runner.ts +11 -3
- package/src/database/repositories/byline.ts +32 -16
- package/src/database/repositories/content.ts +119 -51
- package/src/database/repositories/media-folders.ts +115 -0
- package/src/database/repositories/media-usage-work.ts +395 -111
- package/src/database/repositories/media-usage.ts +1104 -47
- package/src/database/repositories/media.ts +156 -29
- package/src/database/repositories/plugin-storage.ts +74 -9
- package/src/database/repositories/types.ts +8 -7
- package/src/database/transaction.ts +1 -0
- package/src/database/types.ts +13 -0
- package/src/db/adapters.ts +10 -3
- package/src/db/node-sqlite-compat.ts +78 -0
- package/src/db/postgres.ts +23 -0
- package/src/db/sqlite.ts +3 -3
- package/src/emdash-runtime.ts +186 -251
- package/src/fields/boolean.ts +1 -1
- package/src/fields/datetime.ts +1 -1
- package/src/fields/file.ts +1 -1
- package/src/fields/image.ts +7 -1
- package/src/fields/integer.ts +1 -1
- package/src/fields/json.ts +1 -1
- package/src/fields/multiselect.ts +1 -1
- package/src/fields/number.ts +1 -1
- package/src/fields/portable-text.ts +1 -1
- package/src/fields/richtext.ts +1 -1
- package/src/fields/select.ts +1 -1
- package/src/fields/slug.ts +1 -1
- package/src/fields/text.ts +1 -1
- package/src/fields/textarea.ts +1 -1
- package/src/fields/types.ts +8 -4
- package/src/index.ts +30 -3
- package/src/loader.ts +63 -10
- package/src/mcp/server.ts +228 -24
- package/src/media/focal-point.ts +37 -0
- package/src/media/image-endpoint.ts +5 -2
- package/src/media/local-runtime.ts +8 -0
- package/src/media/mime.ts +1 -0
- package/src/media/normalize.ts +25 -4
- package/src/media/types.ts +10 -0
- package/src/media/usage/activation.ts +162 -35
- package/src/media/usage/capture-triggers.ts +19 -3
- package/src/media/usage/cleanup.ts +9 -8
- package/src/media/usage/collection-deletion-processor.ts +7 -3
- package/src/media/usage/collection-deletion.ts +10 -0
- package/src/media/usage/content-refresh.ts +258 -39
- package/src/media/usage/content-snapshots.ts +128 -31
- package/src/media/usage/extractor.ts +32 -13
- package/src/media/usage/maintenance-engine.ts +166 -0
- package/src/media/usage/reconciliation-processor.ts +106 -29
- package/src/media/usage/reconciliation.ts +90 -7
- package/src/media/usage/work-processor.ts +342 -101
- package/src/menus/index.ts +16 -0
- package/src/object-cache/index.ts +44 -2
- package/src/plugin-types.ts +18 -1
- package/src/plugins/hooks.ts +4 -1
- package/src/plugins/index.ts +7 -0
- package/src/plugins/manager.ts +2 -1
- package/src/plugins/manifest-schema.ts +1 -1
- package/src/plugins/routes.ts +3 -1
- package/src/plugins/sandbox/hook-result.ts +52 -0
- package/src/plugins/sandbox/index.ts +10 -0
- package/src/plugins/save-rejection.ts +20 -0
- package/src/plugins/scheduler/node.ts +1 -13
- package/src/plugins/scheduler/types.ts +0 -2
- package/src/plugins/state.ts +13 -3
- package/src/plugins/types.ts +6 -0
- package/src/registry/artifact-checksum.ts +15 -0
- package/src/registry/artifact-fetch.ts +530 -0
- package/src/registry/artifact-verification.ts +85 -0
- package/src/registry/authoritative-records.ts +180 -0
- package/src/registry/config.ts +24 -6
- package/src/registry/record-labels.ts +28 -0
- package/src/registry/types.ts +12 -15
- package/src/schema/registry.ts +26 -3
- package/src/schema/types.ts +1 -0
- package/src/schema/zod-generator.ts +28 -17
- package/src/security/ssrf.ts +26 -4
- package/src/seed/apply.ts +4 -4
- package/src/settings/index.ts +16 -0
- package/src/storage/local.ts +1 -0
- package/src/storage/s3.ts +2 -0
- package/src/storage/types.ts +2 -0
- package/src/taxonomies/index.ts +40 -20
- package/src/ui.ts +2 -0
- package/src/widgets/archives.ts +67 -0
- package/src/widgets/index.ts +16 -0
- package/dist/api-BeBglVxU.mjs +0 -4695
- package/dist/api-BeBglVxU.mjs.map +0 -1
- package/dist/byline-yjvWq4ip.mjs.map +0 -1
- package/dist/challenge-store-SIL5DsF2.mjs.map +0 -1
- package/dist/collection-deletion-DQPvMD8R.mjs.map +0 -1
- package/dist/content-ZHCc1ngN.mjs.map +0 -1
- package/dist/content-refresh-B_8SJzuU.mjs.map +0 -1
- package/dist/context-ZldbZcle.mjs.map +0 -1
- package/dist/errors-CLUPm7aD.mjs.map +0 -1
- package/dist/index-BVBZj4-7.d.mts.map +0 -1
- package/dist/loader-CdG_Ci3H.mjs.map +0 -1
- package/dist/manifest-schema-BXbUAHod.mjs.map +0 -1
- package/dist/media-BWWWb8kg.mjs.map +0 -1
- package/dist/media-CzhAn2--.mjs.map +0 -1
- package/dist/media-allowlist-D6x-Us02.mjs.map +0 -1
- package/dist/media-usage-BZCydfvu.mjs.map +0 -1
- package/dist/media-usage-work-DrCbqBcl.mjs.map +0 -1
- package/dist/menus-DSo5QeW0.mjs.map +0 -1
- package/dist/mime-DfIVjNkr.mjs.map +0 -1
- package/dist/normalize-Bc-s_r-a.mjs.map +0 -1
- package/dist/object-cache-71tPfV4A.mjs.map +0 -1
- package/dist/options--hhz-jZ1.d.mts.map +0 -1
- package/dist/placeholder-Dp0K3RkD.d.mts.map +0 -1
- package/dist/redirects-DTDHWH31.mjs.map +0 -1
- package/dist/registry-Cqa2I749.mjs.map +0 -1
- package/dist/relations-BBApI4e2.mjs.map +0 -1
- package/dist/relations-BHo5A8Zf.d.mts.map +0 -1
- package/dist/runner-BYHZn3Jy.d.mts.map +0 -1
- package/dist/runner-C1T11CfC.mjs.map +0 -1
- package/dist/settings-xRdoUZr0.mjs.map +0 -1
- package/dist/state-DYwPue40.mjs.map +0 -1
- package/dist/taxonomies-BlrncHi9.mjs.map +0 -1
- package/dist/taxonomies-OHUIiIpI.mjs.map +0 -1
- package/dist/types-BcqdcT-r.d.mts.map +0 -1
- package/dist/types-C2pMvO62.d.mts.map +0 -1
- package/dist/types-CP1CflWf.mjs +0 -3
- package/dist/types-DN64_zzZ.d.mts.map +0 -1
- package/dist/types-DQIDRKF2.d.mts.map +0 -1
- package/dist/version-DB_fqCSI.mjs +0 -7
- package/dist/widgets-BD3ho7Rq.mjs.map +0 -1
- package/dist/zod-generator-LC-on_Vb.mjs.map +0 -1
- /package/dist/{api-tokens-rIXC6LdE.mjs → api-tokens-BfYts-sq.mjs} +0 -0
- /package/dist/{ssrf-DpXgKsna.mjs → ssrf-Dg3cIT-b.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-Dz6rgoa3.mjs","names":["decodeBase64","pluginManifestSchema","reconcileManifestAccess","pluginManifestSchema","reconcileManifestAccess","MAX_BUNDLE_COMPRESSED_BYTES","MAX_BUNDLE_SIZE","MAX_BUNDLE_FILE_BYTES","MAX_BUNDLE_FILE_COUNT","MAX_BUNDLE_TAR_ENTRY_COUNT","MAX_BUNDLE_DECOMPRESSED_BYTES","TAR_BLOCK_BYTES","TAR_END_BYTES","decoder","verificationError","verifyMultihash","pluginManifestSchema","reconcileManifestAccess","BASE32_ALPHABET"],"sources":["../src/api/rev.ts","../src/api/handlers/validate-media-fields.ts","../src/api/handlers/content.ts","../src/api/handlers/manifest.ts","../src/api/handlers/revision.ts","../src/api/handlers/media.ts","../src/api/handlers/plugins.ts","../src/api/handlers/plugin-settings.ts","../src/plugins/marketplace.ts","../src/plugins/storage-indexes.ts","../src/api/handlers/marketplace.ts","../../registry-verification/dist/bundle.js","../src/registry/artifact-verification.ts","../../registry-verification/dist/index.js","../src/registry/authoritative-records.ts","../src/registry/plugin-id.ts","../src/registry/record-labels.ts","../src/api/handlers/registry.ts"],"sourcesContent":["/**\n * Opaque _rev token generation and validation.\n *\n * Format: base64(\"version:updated_at\")\n * Stateless — server decodes and checks both components.\n *\n * Rules:\n * - No _rev sent → blind write (backwards-compatible)\n * - _rev matches → write proceeds, new _rev returned\n * - _rev mismatch → 409 Conflict\n */\n\nimport type { ContentItem } from \"../database/repositories/types.js\";\nimport { encodeBase64, decodeBase64 } from \"../utils/base64.js\";\n\n/**\n * Generate a _rev token from a content item's version and updatedAt.\n */\nexport function encodeRev(item: ContentItem): string {\n\treturn encodeBase64(`${item.version}:${item.updatedAt}`);\n}\n\n/**\n * Decode a _rev token into its components.\n * Returns null if the token is malformed.\n */\nexport function decodeRev(rev: string): { version: number; updatedAt: string } | null {\n\ttry {\n\t\tconst decoded = decodeBase64(rev);\n\t\tconst colonIdx = decoded.indexOf(\":\");\n\t\tif (colonIdx === -1) return null;\n\n\t\tconst version = parseInt(decoded.slice(0, colonIdx), 10);\n\t\tconst updatedAt = decoded.slice(colonIdx + 1);\n\n\t\tif (isNaN(version) || !updatedAt) return null;\n\t\treturn { version, updatedAt };\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/**\n * Validate a _rev token against a content item.\n * Returns null if valid (or if no _rev provided), or an error message if invalid.\n */\nexport function validateRev(\n\trev: string | undefined,\n\titem: ContentItem,\n): { valid: true } | { valid: false; message: string } {\n\t// No _rev = blind write (backwards-compatible)\n\tif (!rev) return { valid: true };\n\n\tconst decoded = decodeRev(rev);\n\tif (!decoded) {\n\t\treturn { valid: false, message: \"Malformed _rev token\" };\n\t}\n\n\tif (decoded.version !== item.version || decoded.updatedAt !== item.updatedAt) {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\tmessage: \"Content has been modified since last read (version conflict)\",\n\t\t};\n\t}\n\n\treturn { valid: true };\n}\n","import type { Kysely } from \"kysely\";\n\nimport type { Database } from \"../../database/types.js\";\nimport { matchesMimeAllowlist, parseAllowedMimeTypes } from \"../../media/mime.js\";\nimport { requestCached } from \"../../request-cache.js\";\nimport { chunks, SQL_BATCH_SIZE } from \"../../utils/chunks.js\";\nimport type { ApiResult } from \"../types.js\";\n\ninterface FieldRow {\n\tslug: string;\n\ttype: string;\n\tallowedMimeTypes: string[];\n}\n\ninterface MediaRefValue {\n\tid?: unknown;\n\tprovider?: unknown;\n\tmimeType?: unknown;\n}\n\nfunction asMediaRef(value: unknown): MediaRefValue | null {\n\tif (value === null || value === undefined) return null;\n\tif (typeof value !== \"object\" || Array.isArray(value)) return null;\n\treturn value;\n}\n\nfunction fail(message: string): ApiResult<never> {\n\treturn { success: false, error: { code: \"INVALID_MIME_FOR_FIELD\", message } };\n}\n\nasync function loadMediaFieldsForCollection(\n\tdb: Kysely<Database>,\n\tcollectionSlug: string,\n): Promise<FieldRow[]> {\n\tconst rows = await db\n\t\t.selectFrom(\"_emdash_fields\")\n\t\t.innerJoin(\"_emdash_collections\", \"_emdash_collections.id\", \"_emdash_fields.collection_id\")\n\t\t.select([\"_emdash_fields.slug\", \"_emdash_fields.type\", \"_emdash_fields.validation\"])\n\t\t.where(\"_emdash_collections.slug\", \"=\", collectionSlug)\n\t\t.where(\"_emdash_fields.type\", \"in\", [\"file\", \"image\"])\n\t\t.execute();\n\n\tconst out: FieldRow[] = [];\n\tfor (const row of rows) {\n\t\tconst list = parseAllowedMimeTypes(row.validation);\n\t\tif (!list) continue;\n\t\tout.push({ slug: row.slug, type: row.type, allowedMimeTypes: list });\n\t}\n\treturn out;\n}\n\nexport async function validateMediaFields(\n\tdb: Kysely<Database>,\n\tcollectionSlug: string,\n\tdata: Record<string, unknown>,\n): Promise<ApiResult<true>> {\n\t// Cache is keyed on slug only. If a handler creates/modifies a field and\n\t// then writes content in the same request (e.g. bulk import), the cached\n\t// list will be stale for that request. This is an edge case in normal use.\n\tconst fields = await requestCached(`mediaFields:${collectionSlug}`, () =>\n\t\tloadMediaFieldsForCollection(db, collectionSlug),\n\t);\n\tif (fields.length === 0) return { success: true, data: true };\n\n\t// Collect local media ids that need a MIME lookup\n\tconst localIds = new Set<string>();\n\tfor (const field of fields) {\n\t\tconst ref = asMediaRef(data[field.slug]);\n\t\tif (!ref) continue;\n\t\tconst provider = typeof ref.provider === \"string\" ? ref.provider : \"local\";\n\t\tif (provider === \"local\" && typeof ref.id === \"string\") {\n\t\t\tlocalIds.add(ref.id);\n\t\t}\n\t}\n\n\t// Batch-load local media MIMEs\n\tconst idList = [...localIds];\n\tconst mimeById = new Map<string, string>();\n\tif (idList.length > 0) {\n\t\tfor (const batch of chunks(idList, SQL_BATCH_SIZE)) {\n\t\t\tconst rows = await db\n\t\t\t\t.selectFrom(\"media\")\n\t\t\t\t.select([\"id\", \"mime_type\"])\n\t\t\t\t.where(\"id\", \"in\", batch)\n\t\t\t\t.execute();\n\t\t\tfor (const r of rows) mimeById.set(r.id, r.mime_type);\n\t\t}\n\t}\n\n\tfor (const field of fields) {\n\t\tconst value = data[field.slug];\n\t\tif (value === null || value === undefined) continue;\n\t\tconst ref = asMediaRef(value);\n\t\tif (!ref) continue;\n\n\t\tconst provider = typeof ref.provider === \"string\" ? ref.provider : \"local\";\n\n\t\t// External providers carry mimeType in the ref; trust it as-is.\n\t\t// Local media: look up the stored mimeType by id.\n\t\tlet mime: string | undefined;\n\t\tif (provider === \"local\") {\n\t\t\tif (typeof ref.id !== \"string\") {\n\t\t\t\treturn fail(`Field '${field.slug}' references media with an invalid id`);\n\t\t\t}\n\t\t\tmime = mimeById.get(ref.id);\n\t\t\tif (!mime) {\n\t\t\t\treturn fail(`Field '${field.slug}' references media with unknown MIME type`);\n\t\t\t}\n\t\t} else {\n\t\t\tif (typeof ref.mimeType !== \"string\") {\n\t\t\t\treturn fail(`Field '${field.slug}' requires a mimeType declaration for non-local media`);\n\t\t\t}\n\t\t\t// TODO: long-term, consider a server-side HEAD probe or provider-vouched\n\t\t\t// MIMEs for non-local refs; for now the constraint is only as strong as\n\t\t\t// the client that constructed the ref.\n\t\t\tmime = ref.mimeType;\n\t\t}\n\n\t\tif (!matchesMimeAllowlist(mime, field.allowedMimeTypes)) {\n\t\t\treturn fail(`Field '${field.slug}' does not accept ${mime}`);\n\t\t}\n\t}\n\n\treturn { success: true, data: true };\n}\n","/**\n * Content CRUD handlers\n */\n\nimport type { Kysely } from \"kysely\";\nimport { sql } from \"kysely\";\n\nimport type { ContentFieldFilters } from \"../../content-list-query.js\";\nimport { isSqlite } from \"../../database/dialect-helpers.js\";\nimport { BylineRepository } from \"../../database/repositories/byline.js\";\nimport type { ContentBylineInput } from \"../../database/repositories/byline.js\";\nimport { CommentRepository } from \"../../database/repositories/comment.js\";\nimport {\n\tContentRepository,\n\tisSystemOrderField,\n\ttype ContentRevisionPrecondition,\n} from \"../../database/repositories/content.js\";\nimport { RedirectRepository } from \"../../database/repositories/redirect.js\";\nimport { RevisionRepository } from \"../../database/repositories/revision.js\";\nimport { SeoRepository } from \"../../database/repositories/seo.js\";\nimport { TaxonomyRepository } from \"../../database/repositories/taxonomy.js\";\nimport {\n\tContentCollectionNotFoundError,\n\tContentMutationConflictError,\n\tEmDashValidationError,\n\tScheduledNotDueError,\n\tInvalidCursorError,\n\ttype BylineSummary,\n\ttype ContentBylineCredit,\n\ttype ContentBylineFilter,\n\ttype ContentDateField,\n\ttype ContentItem,\n\ttype ContentSeo,\n\ttype ContentSeoInput,\n\ttype FindManyOptions,\n} from \"../../database/repositories/types.js\";\nimport { UserRepository } from \"../../database/repositories/user.js\";\nimport { withTransaction } from \"../../database/transaction.js\";\nimport type { Database } from \"../../database/types.js\";\nimport { validateIdentifier } from \"../../database/validate.js\";\nimport { getI18nConfig, isI18nEnabled, resolveConfiguredLocale } from \"../../i18n/config.js\";\nimport { invalidateRedirectCache } from \"../../redirects/cache.js\";\nimport { FTSManager } from \"../../search/fts-manager.js\";\nimport { invalidateTermCache } from \"../../taxonomies/index.js\";\nimport { isMissingColumnError, isMissingTableError } from \"../../utils/db-errors.js\";\nimport { decodeRev, encodeRev, validateRev } from \"../rev.js\";\nimport type { ApiResult, ContentListResponse, ContentResponse } from \"../types.js\";\nimport { validateMediaFields } from \"./validate-media-fields.js\";\n\n/**\n * Narrow a caught error to one carrying a structured `apiError` discriminant.\n * Used by transaction callbacks that want to surface a specific error code\n * through the standard Error throwing path.\n */\nfunction hasApiError(error: unknown): error is Error & { apiError: { code: string } } {\n\tif (!(error instanceof Error) || !(\"apiError\" in error)) return false;\n\tconst { apiError } = error;\n\treturn (\n\t\ttypeof apiError === \"object\" &&\n\t\tapiError !== null &&\n\t\t\"code\" in apiError &&\n\t\ttypeof apiError.code === \"string\"\n\t);\n}\n\nfunction decodeRevisionPrecondition(\n\trev: string | undefined,\n): ContentRevisionPrecondition | undefined {\n\tif (rev === undefined) return undefined;\n\tconst decoded = decodeRev(rev);\n\tif (!decoded) throw new ContentMutationConflictError(\"Revision precondition did not match\");\n\treturn decoded;\n}\n\n/**\n * Extract a slug source (title or name) from content data.\n * Returns null if no suitable string field is found.\n */\nfunction getSlugSource(data: Record<string, unknown>): string | null {\n\tif (typeof data.title === \"string\" && data.title.length > 0) return data.title;\n\tif (typeof data.name === \"string\" && data.name.length > 0) return data.name;\n\treturn null;\n}\n\n/** Default SEO values for content without an explicit SEO row */\nconst SEO_DEFAULTS: ContentSeo = {\n\ttitle: null,\n\tdescription: null,\n\timage: null,\n\tcanonical: null,\n\tnoIndex: false,\n};\n\n/**\n * Check if a collection has SEO enabled.\n */\nasync function collectionHasSeo(db: Kysely<Database>, collection: string): Promise<boolean> {\n\tconst row = await db\n\t\t.selectFrom(\"_emdash_collections\")\n\t\t.select(\"has_seo\")\n\t\t.where(\"slug\", \"=\", collection)\n\t\t.executeTakeFirst();\n\treturn row?.has_seo === 1;\n}\n\nasync function getCollectionPublishConfig(\n\tdb: Kysely<Database>,\n\tcollection: string,\n): Promise<{ supportsRevisions: boolean; routable: boolean }> {\n\tconst row = await db\n\t\t.selectFrom(\"_emdash_collections\")\n\t\t.select([\"supports\", \"routable\"])\n\t\t.where(\"slug\", \"=\", collection)\n\t\t.executeTakeFirst();\n\tconst supports: unknown = row?.supports ? JSON.parse(row.supports) : [];\n\treturn {\n\t\tsupportsRevisions: Array.isArray(supports) && supports.includes(\"revisions\"),\n\t\troutable: row?.routable !== 0,\n\t};\n}\n\nfunction requireRoutablePublishSlug(routable: boolean, slug: string | null | undefined): void {\n\tif (routable && !slug?.trim()) {\n\t\tthrow new EmDashValidationError(\"Cannot publish routable content without a slug\");\n\t}\n}\n\n/**\n * Hydrate SEO data on a single content item if the collection has SEO enabled.\n */\nasync function hydrateSeo(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\titem: ContentItem,\n\thasSeo: boolean,\n): Promise<void> {\n\tif (!hasSeo) return;\n\tconst seoRepo = new SeoRepository(db);\n\titem.seo = await seoRepo.get(collection, item.id);\n}\n\n/**\n * Hydrate SEO data on multiple content items using a single batch query.\n */\nasync function hydrateSeoMany(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\titems: ContentItem[],\n\thasSeo: boolean,\n): Promise<void> {\n\tif (!hasSeo || items.length === 0) return;\n\tconst seoRepo = new SeoRepository(db);\n\tconst seoMap = await seoRepo.getMany(\n\t\tcollection,\n\t\titems.map((i) => i.id),\n\t);\n\tfor (const item of items) {\n\t\titem.seo = seoMap.get(item.id) ?? { ...SEO_DEFAULTS };\n\t}\n}\n\nasync function hydrateBylines(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\titem: ContentItem,\n): Promise<void> {\n\tconst bylineRepo = new BylineRepository(db);\n\t// Strict per-locale (migration 040): a credit at locale X renders iff a\n\t// byline row exists at locale X in the credited translation_group. The\n\t// junction itself spans translations; rendering does not fall back.\n\tconst localeOpt = item.locale ? { locale: item.locale } : undefined;\n\tconst bylines = await bylineRepo.getContentBylines(collection, item.id, localeOpt);\n\n\tif (bylines.length > 0) {\n\t\titem.bylines = bylines.map((c) => ({ ...c, source: \"explicit\" as const }));\n\t\titem.byline = bylines[0]?.byline ?? null;\n\t\treturn;\n\t}\n\n\t// `primaryBylineId` is set iff junction rows exist; non-null\n\t// suppresses author fallback even when the credit doesn't resolve\n\t// at this locale.\n\tif (item.primaryBylineId) {\n\t\titem.bylines = [];\n\t\titem.byline = null;\n\t\treturn;\n\t}\n\n\tif (item.authorId) {\n\t\t// Same strict-locale rule as explicit credits: a user-linked byline\n\t\t// renders on the entry only when a sibling exists at the entry's\n\t\t// locale. Without this we'd silently surface the default-locale\n\t\t// row, which contradicts the per-locale model.\n\t\tconst fallback = await bylineRepo.findByUserId(item.authorId, localeOpt);\n\t\tif (fallback) {\n\t\t\titem.bylines = [{ byline: fallback, sortOrder: 0, roleLabel: null, source: \"inferred\" }];\n\t\t\titem.byline = fallback;\n\t\t\treturn;\n\t\t}\n\t}\n\n\titem.bylines = [];\n\titem.byline = null;\n}\n\n/**\n * Batch-hydrate bylines for multiple items using two bulk queries instead of N+1.\n *\n * Items may live at different locales (e.g. a list endpoint returning the\n * translations of an entry). Group by `item.locale` and call the strict\n * per-locale repo method once per group so each item resolves against its\n * own locale's byline rows.\n */\nasync function hydrateBylinesMany(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\titems: ContentItem[],\n): Promise<void> {\n\tif (items.length === 0) return;\n\n\tconst bylineRepo = new BylineRepository(db);\n\n\t// 1. Bucket items by locale so we can call the strict-locale repo\n\t// once per bucket. Items with a null/undefined locale (pre-i18n\n\t// rows on a single-locale install) share an \"unscoped\" bucket.\n\tconst localeBuckets = new Map<string | null, ContentItem[]>();\n\tfor (const item of items) {\n\t\tconst key = item.locale ?? null;\n\t\tconst bucket = localeBuckets.get(key);\n\t\tif (bucket) bucket.push(item);\n\t\telse localeBuckets.set(key, [item]);\n\t}\n\n\t// 2. Per-locale: fetch explicit credits. Items whose credits don't\n\t// resolve at this locale go through a locale-agnostic \"has any\n\t// junction\" check before being considered for author inference —\n\t// explicit editorial intent at any locale beats inferred fallback.\n\tconst bylinesByItem = new Map<string, ContentBylineCredit[]>();\n\tconst itemsNeedingAuthorCheck: ContentItem[] = [];\n\tfor (const [locale, bucket] of localeBuckets) {\n\t\tconst localeOpt = locale ? { locale } : undefined;\n\t\tconst ids = bucket.map((i) => i.id);\n\t\tconst credits = await bylineRepo.getContentBylinesMany(collection, ids, localeOpt);\n\t\tfor (const [id, list] of credits) bylinesByItem.set(id, list);\n\n\t\tfor (const item of bucket) {\n\t\t\tif (credits.has(item.id) && credits.get(item.id)!.length > 0) continue;\n\t\t\tif (item.authorId) itemsNeedingAuthorCheck.push(item);\n\t\t}\n\t}\n\n\t// 3. Author fallback applies only when no explicit credit exists\n\t// (primaryBylineId null).\n\tconst fallbackByItem = new Map<string, BylineSummary>();\n\tif (itemsNeedingAuthorCheck.length > 0) {\n\t\tconst authorBuckets = new Map<string | null, ContentItem[]>();\n\t\tfor (const item of itemsNeedingAuthorCheck) {\n\t\t\tif (item.primaryBylineId) continue;\n\t\t\tconst key = item.locale ?? null;\n\t\t\tconst bucket = authorBuckets.get(key);\n\t\t\tif (bucket) bucket.push(item);\n\t\t\telse authorBuckets.set(key, [item]);\n\t\t}\n\n\t\tfor (const [locale, bucket] of authorBuckets) {\n\t\t\tconst localeOpt = locale ? { locale } : undefined;\n\t\t\tconst authorIds = bucket.map((i) => i.authorId).filter((id): id is string => id !== null);\n\t\t\tconst uniqueAuthorIds = [...new Set(authorIds)];\n\t\t\tif (uniqueAuthorIds.length === 0) continue;\n\t\t\tconst authorMap = await bylineRepo.findByUserIds(uniqueAuthorIds, localeOpt);\n\t\t\tfor (const item of bucket) {\n\t\t\t\tif (!item.authorId) continue;\n\t\t\t\tconst f = authorMap.get(item.authorId);\n\t\t\t\tif (f) fallbackByItem.set(item.id, f);\n\t\t\t}\n\t\t}\n\t}\n\n\t// 4. Assign to each item.\n\tfor (const item of items) {\n\t\tconst explicit = bylinesByItem.get(item.id);\n\t\tif (explicit && explicit.length > 0) {\n\t\t\titem.bylines = explicit.map((c) => ({ ...c, source: \"explicit\" as const }));\n\t\t\titem.byline = explicit[0]?.byline ?? null;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst fallback = fallbackByItem.get(item.id);\n\t\tif (fallback) {\n\t\t\titem.bylines = [{ byline: fallback, sortOrder: 0, roleLabel: null, source: \"inferred\" }];\n\t\t\titem.byline = fallback;\n\t\t\tcontinue;\n\t\t}\n\n\t\titem.bylines = [];\n\t\titem.byline = null;\n\t}\n}\n\n/**\n * Resolve an identifier (ID or slug) to a real content ID.\n * Returns the ID if found, null if not found.\n * When locale is provided, slug lookups are scoped to that locale.\n */\nasync function resolveId(\n\trepo: ContentRepository,\n\tcollection: string,\n\tidentifier: string,\n\tlocale?: string,\n): Promise<string | null> {\n\tconst item = await repo.findByIdOrSlug(\n\t\tcollection,\n\t\tidentifier,\n\t\tlocale ? resolveConfiguredLocale(locale) : undefined,\n\t);\n\treturn item?.id ?? null;\n}\n\n/**\n * Resolve an identifier (ID or slug) to a real content ID,\n * including trashed (soft-deleted) items.\n */\nasync function resolveIdIncludingTrashed(\n\trepo: ContentRepository,\n\tcollection: string,\n\tidentifier: string,\n\tlocale?: string,\n): Promise<string | null> {\n\tconst item = await repo.findByIdOrSlugIncludingTrashed(\n\t\tcollection,\n\t\tidentifier,\n\t\tlocale ? resolveConfiguredLocale(locale) : undefined,\n\t);\n\treturn item?.id ?? null;\n}\n\n/**\n * Trashed content item with deletion timestamp\n */\nexport interface TrashedContentItem {\n\tid: string;\n\ttype: string;\n\tslug: string | null;\n\tstatus: string;\n\tlocale: string | null;\n\ttranslationGroup: string | null;\n\tdata: Record<string, unknown>;\n\tauthorId: string | null;\n\tcreatedAt: string;\n\tupdatedAt: string;\n\tpublishedAt: string | null;\n\tdeletedAt: string;\n}\n\n/**\n * Resolve the columns a content-list search should match against. Always\n * includes `slug` (a standard column), adds the configured `titleField` plus\n * the `title`/`name` display fields when the collection actually defines them,\n * mirroring the admin's item-title resolution (titleField -> title -> name ->\n * slug), and includes every field explicitly marked searchable. Returning only\n * schema-backed columns avoids \"no such column\" errors.\n */\nasync function resolveSearchColumns(db: Kysely<Database>, collection: string): Promise<string[]> {\n\tconst row = await db\n\t\t.selectFrom(\"_emdash_collections\")\n\t\t.select([\"id\", \"title_field\"])\n\t\t.where(\"slug\", \"=\", collection)\n\t\t.executeTakeFirst();\n\tif (!row) return [\"slug\"];\n\n\tconst fields = await db\n\t\t.selectFrom(\"_emdash_fields\")\n\t\t.select([\"slug\", \"searchable\"])\n\t\t.where(\"collection_id\", \"=\", row.id)\n\t\t.orderBy(\"sort_order\", \"asc\")\n\t\t.execute();\n\tconst columns = new Set([\"slug\"]);\n\tconst fieldSlugs = new Set(fields.map((f) => f.slug));\n\n\t// A configured titleField takes precedence, then the conventional\n\t// title/name fields. A null title_field falls through to those defaults.\n\tif (row.title_field && fieldSlugs.has(row.title_field)) columns.add(row.title_field);\n\tfor (const candidate of [\"title\", \"name\"]) {\n\t\tif (fieldSlugs.has(candidate)) columns.add(candidate);\n\t}\n\tfor (const field of fields) {\n\t\tif (field.searchable === 1) columns.add(field.slug);\n\t}\n\treturn [...columns];\n}\n\n/**\n * Decide whether the content-list `q` filter can be served from the\n * collection's FTS5 index instead of a full-scan substring LIKE (#1517).\n *\n * Requires SQLite (FTS5 is SQLite-only), search enabled on the collection,\n * every non-slug display column present in the searchable-field set (or the\n * index would miss matches the LIKE finds), and the index table actually\n * existing.\n */\nasync function canUseFtsForListFilter(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tsearchColumns: string[],\n): Promise<boolean> {\n\tif (!isSqlite(db)) return false;\n\tconst ftsManager = new FTSManager(db);\n\tconst config = await ftsManager.getSearchConfig(collection);\n\tif (!config?.enabled) return false;\n\tconst searchable = new Set(await ftsManager.getSearchableFields(collection));\n\tconst covered = searchColumns.every((col) => col === \"slug\" || searchable.has(col));\n\tif (!covered) return false;\n\treturn ftsManager.ftsTableExists(collection);\n}\n\n/**\n * Create a 301 auto-redirect from an entry's old URL to its new one after a\n * slug change, using the collection's URL pattern. Shared by\n * handleContentUpdate (direct slug edits) and handleContentPublish (slug edits\n * staged as `_slug` in a draft revision, which only land on publish).\n */\nasync function createSlugChangeRedirect(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\toldSlug: string,\n\tnewSlug: string,\n\tcontentId: string,\n): Promise<void> {\n\t// A URL pattern has no locale token, so every locale variant of an entry\n\t// generates the same URL, and slugs are unique per (slug, locale) — a\n\t// translation may still hold the old slug. Redirecting away from a URL\n\t// another row still answers on would take that page down: the redirect\n\t// middleware runs `order: \"pre\"`, so routing never gets a chance.\n\t// Any surviving row counts, published or not: a draft that publishes later\n\t// would otherwise be shadowed by the redirect.\n\tif (await slugStillTaken(db, collection, oldSlug, contentId)) return;\n\n\tconst collectionRow = await db\n\t\t.selectFrom(\"_emdash_collections\")\n\t\t.select(\"url_pattern\")\n\t\t.where(\"slug\", \"=\", collection)\n\t\t.executeTakeFirst();\n\n\tconst redirectRepo = new RedirectRepository(db);\n\tawait redirectRepo.createAutoRedirect(\n\t\tcollection,\n\t\toldSlug,\n\t\tnewSlug,\n\t\tcontentId,\n\t\tcollectionRow?.url_pattern ?? null,\n\t);\n\tinvalidateRedirectCache();\n}\n\n/** Whether a row other than `contentId` still holds `slug` in this collection. */\nasync function slugStillTaken(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tslug: string,\n\tcontentId: string,\n): Promise<boolean> {\n\tvalidateIdentifier(collection, \"collection slug\");\n\tconst result = await sql<{ id: string }>`\n\t\tSELECT id FROM ${sql.ref(`ec_${collection}`)}\n\t\tWHERE slug = ${slug}\n\t\tAND id != ${contentId}\n\t\tAND deleted_at IS NULL\n\t\tLIMIT 1\n\t`.execute(db);\n\treturn result.rows.length > 0;\n}\n\n/** Matches a date-only `YYYY-MM-DD` bound (no time component). */\nconst DATE_ONLY_RE = /^\\d{4}-\\d{2}-\\d{2}$/;\n\n/**\n * Normalize a date-range bound to an ISO datetime for lexicographic comparison\n * against stored ISO 8601 timestamps. A bare `YYYY-MM-DD` is widened to the\n * appropriate UTC day boundary so the range stays inclusive: a `start` bound\n * becomes the start of the day and an `end` bound the end of the day.\n * Otherwise a date-only upper bound would exclude every same-day row (since\n * `2024-06-01T12:00:00Z` sorts after `2024-06-01`). Full datetimes pass\n * through unchanged.\n */\nfunction normalizeDateBound(value: string | undefined, edge: \"start\" | \"end\"): string | undefined {\n\tif (!value) return undefined;\n\tif (!DATE_ONLY_RE.test(value)) return value;\n\treturn edge === \"start\" ? `${value}T00:00:00.000Z` : `${value}T23:59:59.999Z`;\n}\n\n/**\n * Build the repository's byline filter from the wire params.\n *\n * `locale` is the locale the list is scoped to, which is the locale an\n * inferred credit has to resolve at — the admin list is always scoped to the\n * locale picked in its switcher.\n */\nfunction resolveBylineFilter(\n\tparams: { bylines?: string[]; bylinesNone?: boolean; includeInferredBylines?: boolean },\n\tlocale: string | undefined,\n): ContentBylineFilter | undefined {\n\tconst includeInferred = params.includeInferredBylines === true;\n\n\tif (params.bylinesNone) return { mode: \"none\", includeInferred, locale };\n\n\tconst bylineIds = params.bylines ?? [];\n\tif (bylineIds.length === 0) return undefined;\n\n\treturn { mode: \"any\", bylineIds, includeInferred, locale };\n}\n\n/**\n * Create content list handler\n */\nexport async function handleContentList(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tparams: {\n\t\tcursor?: string;\n\t\tlimit?: number;\n\t\tstatus?: string;\n\t\torderBy?: string;\n\t\torder?: \"asc\" | \"desc\";\n\t\tlocale?: string;\n\t\tq?: string;\n\t\tauthorId?: string;\n\t\tdateField?: ContentDateField;\n\t\tdateFrom?: string;\n\t\tdateTo?: string;\n\t\tbylines?: string[];\n\t\tbylinesNone?: boolean;\n\t\tincludeInferredBylines?: boolean;\n\t\tfieldFilters?: ContentFieldFilters;\n\t},\n): Promise<ApiResult<ContentListResponse>> {\n\ttry {\n\t\tconst repo = new ContentRepository(db);\n\t\tconst where: FindManyOptions[\"where\"] = {};\n\t\tif (params.status) where.status = params.status;\n\t\tconst locale = params.locale ? resolveConfiguredLocale(params.locale) : undefined;\n\t\tif (locale) where.locale = locale;\n\t\tif (params.authorId) where.authorId = params.authorId;\n\t\tif (params.fieldFilters && Object.keys(params.fieldFilters).length > 0) {\n\t\t\twhere.fieldFilters = params.fieldFilters;\n\t\t}\n\n\t\tconst bylineFilter = resolveBylineFilter(params, locale);\n\t\tif (bylineFilter) where.bylineFilter = bylineFilter;\n\n\t\t// A date range requires a target column; ignore stray from/to without\n\t\t// a field so a half-specified filter doesn't silently drop all rows.\n\t\tif (params.dateField && (params.dateFrom || params.dateTo)) {\n\t\t\twhere.dateFilter = {\n\t\t\t\tfield: params.dateField,\n\t\t\t\tfrom: normalizeDateBound(params.dateFrom, \"start\"),\n\t\t\t\tto: normalizeDateBound(params.dateTo, \"end\"),\n\t\t\t};\n\t\t}\n\n\t\tconst q = params.q?.trim();\n\t\tif (q) {\n\t\t\twhere.q = q;\n\t\t\twhere.searchColumns = await resolveSearchColumns(db, collection);\n\t\t\twhere.useFts = await canUseFtsForListFilter(db, collection, where.searchColumns);\n\t\t}\n\n\t\t// Sorting by a non-system field (a collection's titleField/dateField)\n\t\t// needs the collection's *actual* sort fields resolved server-side,\n\t\t// so the orderBy set stays closed. Only query when it's not a system field.\n\t\tlet sortableExtras: string[] | undefined;\n\t\tif (params.orderBy && !isSystemOrderField(params.orderBy)) {\n\t\t\tconst coll = await db\n\t\t\t\t.selectFrom(\"_emdash_collections\")\n\t\t\t\t.select([\"title_field\", \"date_field\"])\n\t\t\t\t.where(\"slug\", \"=\", collection)\n\t\t\t\t.executeTakeFirst();\n\t\t\tsortableExtras = [coll?.title_field, coll?.date_field].filter(\n\t\t\t\t(slug): slug is string => !!slug,\n\t\t\t);\n\t\t}\n\n\t\tconst result = await repo.findMany(collection, {\n\t\t\tcursor: params.cursor,\n\t\t\tlimit: params.limit || 50,\n\t\t\twhere: Object.keys(where).length > 0 ? where : undefined,\n\t\t\torderBy: params.orderBy\n\t\t\t\t? { field: params.orderBy, direction: params.order || \"desc\" }\n\t\t\t\t: undefined,\n\t\t\tsortableExtras,\n\t\t});\n\n\t\t// Hydrate SEO data if the collection has SEO enabled\n\t\tconst hasSeo = await collectionHasSeo(db, collection);\n\t\tawait hydrateSeoMany(db, collection, result.items, hasSeo);\n\t\tawait hydrateBylinesMany(db, collection, result.items);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\titems: result.items,\n\t\t\t\tnextCursor: result.nextCursor,\n\t\t\t\ttotal: result.total,\n\t\t\t},\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof InvalidCursorError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"INVALID_CURSOR\", message: error.message },\n\t\t\t};\n\t\t}\n\t\tif (error instanceof ContentCollectionNotFoundError || isMissingTableError(error)) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"COLLECTION_NOT_FOUND\",\n\t\t\t\t\tmessage: `Collection '${collection}' not found`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (isMissingColumnError(error, \"deleted_at\")) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"COLLECTION_SCHEMA_MISMATCH\",\n\t\t\t\t\tmessage: `Collection '${collection}' backing table is missing the 'deleted_at' column`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (error instanceof EmDashValidationError) {\n\t\t\t// e.g. invalid orderBy field\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"VALIDATION_ERROR\", message: error.message },\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Content list error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_LIST_ERROR\",\n\t\t\t\tmessage: \"Failed to list content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/** A content author option for the admin author filter. */\nexport interface ContentAuthor {\n\tid: string;\n\tname: string | null;\n\temail: string;\n\tavatarUrl: string | null;\n}\n\n/**\n * List the distinct authors of a collection's live content.\n *\n * Backs the admin content-list author filter. Unlike `/admin/users` (ADMIN\n * only), this is gated on `content:read`, so any editor can filter by author.\n * Returns only users who have authored at least one non-trashed entry, sorted\n * by display name then email for a stable dropdown order.\n */\nexport async function handleContentAuthors(\n\tdb: Kysely<Database>,\n\tcollection: string,\n): Promise<ApiResult<{ items: ContentAuthor[] }>> {\n\ttry {\n\t\tconst repo = new ContentRepository(db);\n\t\tconst authorIds = await repo.findDistinctAuthorIds(collection);\n\t\tif (authorIds.length === 0) {\n\t\t\treturn { success: true, data: { items: [] } };\n\t\t}\n\n\t\tconst userRepo = new UserRepository(db);\n\t\tconst users = await userRepo.findByIds(authorIds);\n\n\t\tconst items: ContentAuthor[] = users\n\t\t\t.map((u) => ({ id: u.id, name: u.name, email: u.email, avatarUrl: u.avatarUrl }))\n\t\t\t.toSorted((a, b) => (a.name ?? a.email).localeCompare(b.name ?? b.email));\n\n\t\treturn { success: true, data: { items } };\n\t} catch (error) {\n\t\tif (isMissingTableError(error)) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"COLLECTION_NOT_FOUND\",\n\t\t\t\t\tmessage: `Collection '${collection}' not found`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Content authors error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_AUTHORS_ERROR\",\n\t\t\t\tmessage: \"Failed to list content authors\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Get single content item\n */\nexport async function handleContentGet(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tid: string,\n\tlocale?: string,\n): Promise<ApiResult<ContentResponse>> {\n\ttry {\n\t\tconst repo = new ContentRepository(db);\n\t\tconst item = await repo.findByIdOrSlug(\n\t\t\tcollection,\n\t\t\tid,\n\t\t\tlocale ? resolveConfiguredLocale(locale) : undefined,\n\t\t);\n\n\t\tif (!item) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `Content item not found: ${id}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Hydrate SEO data if the collection has SEO enabled\n\t\tconst hasSeo = await collectionHasSeo(db, collection);\n\t\tawait hydrateSeo(db, collection, item, hasSeo);\n\t\tawait hydrateBylines(db, collection, item);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item, _rev: encodeRev(item) },\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"Content get error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_GET_ERROR\",\n\t\t\t\tmessage: \"Failed to get content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Get a content item by id, including trashed items.\n * Used by restore endpoint for ownership checks on soft-deleted items.\n */\nexport async function handleContentGetIncludingTrashed(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tid: string,\n\tlocale?: string,\n): Promise<ApiResult<ContentResponse>> {\n\ttry {\n\t\tconst repo = new ContentRepository(db);\n\t\tconst item = await repo.findByIdOrSlugIncludingTrashed(\n\t\t\tcollection,\n\t\t\tid,\n\t\t\tlocale ? resolveConfiguredLocale(locale) : undefined,\n\t\t);\n\n\t\tif (!item) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `Content item not found: ${id}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Hydrate SEO data if the collection has SEO enabled\n\t\tconst hasSeo = await collectionHasSeo(db, collection);\n\t\tawait hydrateSeo(db, collection, item, hasSeo);\n\t\tawait hydrateBylines(db, collection, item);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item, _rev: encodeRev(item) },\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"Content get error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_GET_ERROR\",\n\t\t\t\tmessage: \"Failed to get content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Create content item.\n *\n * Content + SEO writes are wrapped in a transaction so either both succeed\n * or neither does. If `body.seo` is provided for a non-SEO collection, the\n * API returns a validation error rather than silently dropping it.\n */\nexport async function handleContentCreate(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tbody: {\n\t\tdata: Record<string, unknown>;\n\t\tslug?: string | null;\n\t\tstatus?: string;\n\t\tauthorId?: string;\n\t\tbylines?: ContentBylineInput[];\n\t\tlocale?: string;\n\t\ttranslationOf?: string;\n\t\tseo?: ContentSeoInput;\n\t\ttaxonomies?: Record<string, string[]>;\n\t\tcreatedAt?: string | null;\n\t\tpublishedAt?: string | null;\n\t},\n): Promise<ApiResult<ContentResponse>> {\n\ttry {\n\t\tconst hasSeo = await collectionHasSeo(db, collection);\n\n\t\t// Reject SEO input for non-SEO collections\n\t\tif (body.seo && !hasSeo) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\t\tmessage: `Collection \"${collection}\" does not have SEO enabled. Remove the seo field or enable SEO on this collection.`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst mimeCheck = await validateMediaFields(db, collection, body.data);\n\t\tif (!mimeCheck.success) return mimeCheck;\n\n\t\t// Wrap content + SEO writes in a transaction for atomicity\n\t\tconst item = await withTransaction(db, async (trx) => {\n\t\t\tconst repo = new ContentRepository(trx);\n\t\t\tconst bylineRepo = new BylineRepository(trx);\n\n\t\t\t// Default to the configured site locale rather than the repo's\n\t\t\t// hard-coded \"en\" — otherwise non-English default-locale sites\n\t\t\t// silently create entries in a locale the editor never chose.\n\t\t\tconst effectiveLocale = body.locale\n\t\t\t\t? resolveConfiguredLocale(body.locale)\n\t\t\t\t: getI18nConfig()?.defaultLocale;\n\n\t\t\tlet slug: string | null | undefined = body.slug;\n\t\t\tif (!slug) {\n\t\t\t\tconst slugSource = getSlugSource(body.data);\n\t\t\t\tif (slugSource) {\n\t\t\t\t\tslug = await repo.generateUniqueSlug(collection, slugSource, effectiveLocale);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (body.status === \"published\") {\n\t\t\t\tconst publishConfig = await getCollectionPublishConfig(trx, collection);\n\t\t\t\trequireRoutablePublishSlug(publishConfig.routable, slug);\n\t\t\t}\n\n\t\t\tconst created = await repo.create({\n\t\t\t\ttype: collection,\n\t\t\t\tslug,\n\t\t\t\tdata: body.data,\n\t\t\t\tstatus: body.status || \"draft\",\n\t\t\t\tauthorId: body.authorId,\n\t\t\t\tlocale: effectiveLocale,\n\t\t\t\ttranslationOf: body.translationOf,\n\t\t\t\tcreatedAt: body.createdAt,\n\t\t\t\tpublishedAt: body.publishedAt,\n\t\t\t});\n\n\t\t\tif (body.bylines !== undefined) {\n\t\t\t\tconst credits = await bylineRepo.setContentBylines(collection, created.id, body.bylines);\n\t\t\t\t// `setContentBylines` translates wire row ids to their\n\t\t\t\t// `translation_group` before writing. The response-shape\n\t\t\t\t// `primaryBylineId` must match what's now in the DB, so read\n\t\t\t\t// it from the returned credit (whose `byline` came from a\n\t\t\t\t// hydration round-trip).\n\t\t\t\tcreated.primaryBylineId = credits[0]?.byline.translationGroup ?? null;\n\t\t\t}\n\n\t\t\t// Taxonomy assignments already belong to the content translation\n\t\t\t// group. Byline credits remain per content row and need copying.\n\t\t\t// Explicit `body.bylines` wins — `copyContentBylines` no-ops\n\t\t\t// when the target already has credits, but the cleaner guard\n\t\t\t// is to skip the call entirely.\n\t\t\tif (body.translationOf) {\n\t\t\t\tif (body.bylines === undefined) {\n\t\t\t\t\tawait bylineRepo.copyContentBylines(collection, body.translationOf, created.id);\n\t\t\t\t\t// `copyContentBylines` writes the source's primary\n\t\t\t\t\t// pointer onto the new row; reflect it in-memory so the\n\t\t\t\t\t// response includes it before hydrateBylines runs.\n\t\t\t\t\tconst source = await repo.findById(collection, body.translationOf);\n\t\t\t\t\tif (source) created.primaryBylineId = source.primaryBylineId;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tawait hydrateBylines(trx, collection, created);\n\n\t\t\t// Side-write SEO data if provided\n\t\t\tif (body.seo && hasSeo) {\n\t\t\t\tconst seoRepo = new SeoRepository(trx);\n\t\t\t\tcreated.seo = await seoRepo.upsert(collection, created.id, body.seo);\n\t\t\t} else if (hasSeo) {\n\t\t\t\t// Assign defaults in-memory — no DB round-trip needed\n\t\t\t\tcreated.seo = { ...SEO_DEFAULTS };\n\t\t\t}\n\n\t\t\t// Attach taxonomy terms in the same transaction. The MCP tool\n\t\t\t// (and the REST create body) previously accepted a `taxonomies`\n\t\t\t// field on `content_create` without doing anything with it, so\n\t\t\t// agents publishing a categorized/tagged entry had to make N\n\t\t\t// follow-up REST calls per taxonomy. This resolves each slug in\n\t\t\t// the entry's locale and pipes it through the same\n\t\t\t// `setTermsForEntry` path the `.../terms/{taxonomy}` REST route\n\t\t\t// uses, so the two entry points can't drift.\n\t\t\tif (body.taxonomies) {\n\t\t\t\tawait assignTaxonomies(trx, collection, created.id, effectiveLocale, body.taxonomies);\n\t\t\t}\n\n\t\t\treturn created;\n\t\t});\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item, _rev: encodeRev(item) },\n\t\t};\n\t} catch (error) {\n\t\tif (isMissingTableError(error)) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"COLLECTION_NOT_FOUND\",\n\t\t\t\t\tmessage: `Collection '${collection}' not found`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (error instanceof EmDashValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"VALIDATION_ERROR\", message: error.message },\n\t\t\t};\n\t\t}\n\t\t// SQLite UNIQUE constraint OR Postgres unique_violation — slug\n\t\t// collisions and any other unique violations land here. Match\n\t\t// specifically on \"unique constraint failed\" / \"duplicate key\" so we\n\t\t// don't false-positive on NOT NULL or CHECK violations whose\n\t\t// messages also contain \"constraint failed\".\n\t\tconst message = error instanceof Error ? error.message.toLowerCase() : \"\";\n\t\tif (message.includes(\"unique constraint failed\") || message.includes(\"duplicate key\")) {\n\t\t\t// Detect slug-specific collisions by message fingerprint\n\t\t\tif (message.includes(\"slug\")) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: \"SLUG_CONFLICT\",\n\t\t\t\t\t\tmessage: `Slug '${body.slug ?? \"(auto-generated)\"}' already exists in collection '${collection}'`,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"CONFLICT\",\n\t\t\t\t\tmessage: \"Unique constraint violation\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Content create error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_CREATE_ERROR\",\n\t\t\t\tmessage: \"Failed to create content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Update content item.\n * If `_rev` is provided, validates it against the current version before writing.\n * No `_rev` = blind write (backwards-compatible for admin UI).\n *\n * Content + SEO writes are wrapped in a transaction for atomicity.\n */\nexport async function handleContentUpdate(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tid: string,\n\tbody: {\n\t\tdata?: Record<string, unknown>;\n\t\tslug?: string | null;\n\t\tstatus?: string;\n\t\tauthorId?: string | null;\n\t\tbylines?: ContentBylineInput[];\n\t\tlocale?: string;\n\t\t_rev?: string;\n\t\tseo?: ContentSeoInput;\n\t\ttaxonomies?: Record<string, string[]>;\n\t\tpublishedAt?: string | null;\n\t},\n): Promise<ApiResult<ContentResponse>> {\n\ttry {\n\t\tconst hasSeo = await collectionHasSeo(db, collection);\n\n\t\t// Reject SEO input for non-SEO collections\n\t\tif (body.seo && !hasSeo) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\t\tmessage: `Collection \"${collection}\" does not have SEO enabled. Remove the seo field or enable SEO on this collection.`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tif (body.data) {\n\t\t\tconst mimeCheck = await validateMediaFields(db, collection, body.data);\n\t\t\tif (!mimeCheck.success) return mimeCheck;\n\t\t}\n\n\t\tconst repo = new ContentRepository(db);\n\n\t\t// Resolve slug → ID if needed\n\t\tconst resolvedId = (await resolveId(repo, collection, id, body.locale)) ?? id;\n\n\t\t// Wrap content + SEO writes in a transaction for atomicity.\n\t\t// The _rev check is inside the transaction so the read-then-write\n\t\t// is atomic -- no concurrent write can slip between the check and update.\n\t\tconst item = await withTransaction(db, async (trx) => {\n\t\t\tconst trxRepo = new ContentRepository(trx);\n\t\t\tconst bylineRepo = new BylineRepository(trx);\n\n\t\t\t// Read existing item once for both _rev check and old slug capture\n\t\t\tconst existing =\n\t\t\t\tbody._rev || body.slug !== undefined || body.status === \"published\"\n\t\t\t\t\t? await trxRepo.findById(collection, resolvedId)\n\t\t\t\t\t: null;\n\n\t\t\t// Validate _rev if provided (optimistic concurrency)\n\t\t\tif (body._rev) {\n\t\t\t\tif (!existing) {\n\t\t\t\t\tthrow Object.assign(new Error(`Content item not found: ${id}`), {\n\t\t\t\t\t\tapiError: { code: \"NOT_FOUND\" as const },\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst revCheck = validateRev(body._rev, existing);\n\t\t\t\tif (!revCheck.valid) {\n\t\t\t\t\tthrow Object.assign(new Error(revCheck.message), {\n\t\t\t\t\t\tapiError: { code: \"CONFLICT\" as const },\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Capture old slug before update for auto-redirect\n\t\t\tlet oldSlug: string | undefined;\n\t\t\tif (body.slug && existing?.slug && existing.slug !== body.slug) {\n\t\t\t\toldSlug = existing.slug;\n\t\t\t}\n\n\t\t\tconst resultingStatus = body.status ?? existing?.status;\n\t\t\tif (resultingStatus === \"published\") {\n\t\t\t\tif (!existing) {\n\t\t\t\t\tthrow Object.assign(new Error(`Content item not found: ${id}`), {\n\t\t\t\t\t\tapiError: { code: \"NOT_FOUND\" as const },\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst publishConfig = await getCollectionPublishConfig(trx, collection);\n\t\t\t\tconst intendedSlug = body.slug !== undefined ? body.slug : existing.slug;\n\t\t\t\trequireRoutablePublishSlug(publishConfig.routable, intendedSlug);\n\t\t\t}\n\n\t\t\tconst updated = await trxRepo.update(collection, resolvedId, {\n\t\t\t\tdata: body.data,\n\t\t\t\tslug: body.slug,\n\t\t\t\tstatus: body.status,\n\t\t\t\tauthorId: body.authorId,\n\t\t\t\tpublishedAt: body.publishedAt,\n\t\t\t});\n\n\t\t\tif (body.bylines !== undefined) {\n\t\t\t\tconst credits = await bylineRepo.setContentBylines(collection, resolvedId, body.bylines);\n\t\t\t\t// `setContentBylines` translates wire row ids to their\n\t\t\t\t// `translation_group` before writing. Read the in-memory\n\t\t\t\t// pointer from the persisted credit so the response shape\n\t\t\t\t// matches the DB. See the matching block in handleContentCreate.\n\t\t\t\tupdated.primaryBylineId = credits[0]?.byline.translationGroup ?? null;\n\t\t\t}\n\n\t\t\t// Create auto-redirect when slug changes\n\t\t\tif (oldSlug && body.slug) {\n\t\t\t\tawait createSlugChangeRedirect(trx, collection, oldSlug, body.slug, resolvedId);\n\t\t\t}\n\n\t\t\t// Sync non-translatable fields to sibling locales in the same\n\t\t\t// translation group. Only runs when i18n is enabled, data was updated,\n\t\t\t// and the item belongs to a translation group with siblings.\n\t\t\tif (isI18nEnabled() && body.data && updated.translationGroup) {\n\t\t\t\tawait syncNonTranslatableFields(\n\t\t\t\t\ttrx,\n\t\t\t\t\tcollection,\n\t\t\t\t\tupdated.id,\n\t\t\t\t\tupdated.translationGroup,\n\t\t\t\t\tbody.data,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Side-write SEO data if provided, always hydrate for SEO-enabled collections\n\t\t\tif (body.seo && hasSeo) {\n\t\t\t\tconst seoRepo = new SeoRepository(trx);\n\t\t\t\tupdated.seo = await seoRepo.upsert(collection, resolvedId, body.seo);\n\t\t\t} else if (hasSeo) {\n\t\t\t\tconst seoRepo = new SeoRepository(trx);\n\t\t\t\tupdated.seo = await seoRepo.get(collection, resolvedId);\n\t\t\t}\n\n\t\t\tawait hydrateBylines(trx, collection, updated);\n\n\t\t\t// Replace taxonomy assignments in the same transaction. Uses the\n\t\t\t// entry's own locale (post-update) to resolve slugs so an update\n\t\t\t// that also changes locale still lands on the correct term\n\t\t\t// variants. See handleContentCreate for rationale.\n\t\t\tif (body.taxonomies) {\n\t\t\t\tawait assignTaxonomies(\n\t\t\t\t\ttrx,\n\t\t\t\t\tcollection,\n\t\t\t\t\tresolvedId,\n\t\t\t\t\tupdated.locale ?? body.locale,\n\t\t\t\t\tbody.taxonomies,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn updated;\n\t\t});\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item, _rev: encodeRev(item) },\n\t\t};\n\t} catch (error) {\n\t\t// Handle structured errors thrown from inside the transaction\n\t\t// (rev check failures, not-found)\n\t\tif (hasApiError(error)) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: error.apiError.code, message: error.message },\n\t\t\t};\n\t\t}\n\t\tif (isMissingTableError(error)) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"COLLECTION_NOT_FOUND\",\n\t\t\t\t\tmessage: `Collection '${collection}' not found`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (error instanceof EmDashValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"VALIDATION_ERROR\", message: error.message },\n\t\t\t};\n\t\t}\n\t\tconst message = error instanceof Error ? error.message.toLowerCase() : \"\";\n\t\tif (message.includes(\"unique constraint failed\") || message.includes(\"duplicate key\")) {\n\t\t\tif (message.includes(\"slug\")) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: \"SLUG_CONFLICT\",\n\t\t\t\t\t\tmessage: `Slug '${body.slug ?? id}' already exists in collection '${collection}'`,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"CONFLICT\",\n\t\t\t\t\tmessage: \"Unique constraint violation\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Content update error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_UPDATE_ERROR\",\n\t\t\t\tmessage: \"Failed to update content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Duplicate content item.\n *\n * Only copies SEO data if the collection has SEO enabled.\n * Always returns consistent `seo` shape for SEO-enabled collections.\n */\nexport async function handleContentDuplicate(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tid: string,\n\tauthorId?: string,\n): Promise<ApiResult<{ item: ContentItem }>> {\n\ttry {\n\t\tconst hasSeo = await collectionHasSeo(db, collection);\n\n\t\t// Wrap duplicate + SEO copy in a transaction for atomicity\n\t\tconst duplicate = await withTransaction(db, async (trx) => {\n\t\t\tconst repo = new ContentRepository(trx);\n\t\t\tconst bylineRepo = new BylineRepository(trx);\n\t\t\tconst resolvedId = (await resolveId(repo, collection, id)) ?? id;\n\t\t\tconst dup = await repo.duplicate(collection, resolvedId, authorId);\n\n\t\t\tconst existingBylines = await bylineRepo.getContentBylines(collection, resolvedId);\n\t\t\tif (existingBylines.length > 0) {\n\t\t\t\tawait bylineRepo.setContentBylines(\n\t\t\t\t\tcollection,\n\t\t\t\t\tdup.id,\n\t\t\t\t\texistingBylines.map((entry) => ({\n\t\t\t\t\t\tbylineId: entry.byline.id,\n\t\t\t\t\t\troleLabel: entry.roleLabel,\n\t\t\t\t\t})),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (hasSeo) {\n\t\t\t\t// Copy SEO data from the original (clears canonical)\n\t\t\t\tconst seoRepo = new SeoRepository(trx);\n\t\t\t\tawait seoRepo.copyForDuplicate(collection, resolvedId, dup.id);\n\t\t\t\t// Always hydrate SEO for consistent response shape\n\t\t\t\tdup.seo = await seoRepo.get(collection, dup.id);\n\t\t\t}\n\n\t\t\tawait hydrateBylines(trx, collection, dup);\n\n\t\t\treturn dup;\n\t\t});\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item: duplicate },\n\t\t};\n\t} catch (err) {\n\t\tif (err instanceof EmDashValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Content duplicate error:\", err);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_DUPLICATE_ERROR\",\n\t\t\t\tmessage: \"Failed to duplicate content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Delete content item (soft delete - moves to trash)\n */\nexport async function handleContentDelete(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tid: string,\n): Promise<ApiResult<{ deleted: true; id: string }>> {\n\ttry {\n\t\tconst result = await withTransaction(db, async (trx) => {\n\t\t\tconst repo = new ContentRepository(trx);\n\t\t\tconst resolvedId = (await resolveId(repo, collection, id)) ?? id;\n\t\t\treturn {\n\t\t\t\tid: resolvedId,\n\t\t\t\tdeleted: await repo.delete(collection, resolvedId),\n\t\t\t};\n\t\t});\n\n\t\tif (!result.deleted) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `Content item not found: ${id}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { deleted: true, id: result.id },\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"Content delete error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_DELETE_ERROR\",\n\t\t\t\tmessage: \"Failed to delete content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Restore content item from trash\n */\nexport async function handleContentRestore(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tid: string,\n): Promise<ApiResult<{ restored: true; item: ContentItem }>> {\n\ttry {\n\t\tconst item = await withTransaction(db, async (trx) => {\n\t\t\tconst repo = new ContentRepository(trx);\n\t\t\tconst resolvedId = (await resolveIdIncludingTrashed(repo, collection, id)) ?? id;\n\t\t\treturn repo.restore(collection, resolvedId);\n\t\t});\n\n\t\tif (!item) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `Trashed content item not found: ${id}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { restored: true, item },\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"Content restore error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_RESTORE_ERROR\",\n\t\t\t\tmessage: \"Failed to restore content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Permanently delete content item (cannot be undone).\n * Also cleans up associated SEO data.\n */\nexport async function handleContentPermanentDelete(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tid: string,\n): Promise<ApiResult<{ deleted: true; id: string }>> {\n\ttry {\n\t\tconst repo = new ContentRepository(db);\n\t\tconst resolvedId = (await resolveIdIncludingTrashed(repo, collection, id)) ?? id;\n\n\t\t// Wrap content delete + SEO/comment cleanup in a transaction\n\t\tconst deleted = await withTransaction(db, async (trx) => {\n\t\t\tconst trxRepo = new ContentRepository(trx);\n\t\t\tconst wasDeleted = await trxRepo.permanentDelete(collection, resolvedId);\n\n\t\t\tif (wasDeleted) {\n\t\t\t\t// Clean up SEO data for permanently deleted content\n\t\t\t\tconst seoRepo = new SeoRepository(trx);\n\t\t\t\tawait seoRepo.delete(collection, resolvedId);\n\t\t\t\t// Clean up comments for permanently deleted content\n\t\t\t\tconst commentRepo = new CommentRepository(trx);\n\t\t\t\tawait commentRepo.deleteByContent(collection, resolvedId);\n\t\t\t\t// Clean up revisions for permanently deleted content\n\t\t\t\tconst revisionRepo = new RevisionRepository(trx);\n\t\t\t\tawait revisionRepo.deleteByEntry(collection, resolvedId);\n\t\t\t}\n\n\t\t\treturn wasDeleted;\n\t\t});\n\n\t\tif (!deleted) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `Content item not found: ${id}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { deleted: true, id: resolvedId },\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"Content permanent delete error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_DELETE_ERROR\",\n\t\t\t\tmessage: \"Failed to permanently delete content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * List trashed content items\n */\nexport async function handleContentListTrashed(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\toptions: { limit?: number; cursor?: string; locale?: string } = {},\n): Promise<ApiResult<{ items: TrashedContentItem[]; nextCursor?: string }>> {\n\ttry {\n\t\tconst repo = new ContentRepository(db);\n\t\tconst result = await repo.findTrashed(collection, {\n\t\t\tlimit: options.limit,\n\t\t\tcursor: options.cursor,\n\t\t\twhere: { locale: options.locale },\n\t\t});\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\titems: result.items.map((item) => ({\n\t\t\t\t\tid: item.id,\n\t\t\t\t\ttype: item.type,\n\t\t\t\t\tslug: item.slug,\n\t\t\t\t\tstatus: item.status,\n\t\t\t\t\tlocale: item.locale,\n\t\t\t\t\ttranslationGroup: item.translationGroup,\n\t\t\t\t\tdata: item.data,\n\t\t\t\t\tauthorId: item.authorId,\n\t\t\t\t\tcreatedAt: item.createdAt,\n\t\t\t\t\tupdatedAt: item.updatedAt,\n\t\t\t\t\tpublishedAt: item.publishedAt,\n\t\t\t\t\tdeletedAt: item.deletedAt,\n\t\t\t\t})),\n\t\t\t\tnextCursor: result.nextCursor,\n\t\t\t},\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof InvalidCursorError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"INVALID_CURSOR\", message: error.message },\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Content list trashed error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_LIST_ERROR\",\n\t\t\t\tmessage: \"Failed to list trashed content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Count trashed content items\n */\nexport async function handleContentCountTrashed(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\toptions: { locale?: string } = {},\n): Promise<ApiResult<{ count: number }>> {\n\ttry {\n\t\tconst repo = new ContentRepository(db);\n\t\tconst count = await repo.countTrashed(collection, { locale: options.locale });\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { count },\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"Content count trashed error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_COUNT_ERROR\",\n\t\t\t\tmessage: \"Failed to count trashed content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Schedule content for future publishing\n */\nexport async function handleContentSchedule(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tid: string,\n\tscheduledAt: string,\n): Promise<ApiResult<ContentResponse>> {\n\ttry {\n\t\tconst item = await withTransaction(db, async (trx) => {\n\t\t\tconst repo = new ContentRepository(trx);\n\t\t\tconst existing = await repo.findByIdOrSlug(collection, id);\n\t\t\tconst resolvedId = existing?.id ?? id;\n\t\t\tif (existing) {\n\t\t\t\tconst publishConfig = await getCollectionPublishConfig(trx, collection);\n\t\t\t\trequireRoutablePublishSlug(publishConfig.routable, existing.slug);\n\t\t\t}\n\t\t\treturn repo.schedule(collection, resolvedId, scheduledAt);\n\t\t});\n\n\t\tconst hasSeo = await collectionHasSeo(db, collection);\n\t\tawait hydrateSeo(db, collection, item, hasSeo);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item, _rev: encodeRev(item) },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof EmDashValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Content schedule error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_SCHEDULE_ERROR\",\n\t\t\t\tmessage: \"Failed to schedule content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Unschedule content (revert to draft)\n */\nexport async function handleContentUnschedule(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tid: string,\n): Promise<ApiResult<ContentResponse>> {\n\ttry {\n\t\tconst item = await withTransaction(db, async (trx) => {\n\t\t\tconst repo = new ContentRepository(trx);\n\t\t\tconst resolvedId = (await resolveId(repo, collection, id)) ?? id;\n\t\t\treturn repo.unschedule(collection, resolvedId);\n\t\t});\n\n\t\tconst hasSeo = await collectionHasSeo(db, collection);\n\t\tawait hydrateSeo(db, collection, item, hasSeo);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item, _rev: encodeRev(item) },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof EmDashValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Content unschedule error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_UNSCHEDULE_ERROR\",\n\t\t\t\tmessage: \"Failed to unschedule content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Publish content immediately.\n *\n * Publication is one atomic content-row statement. On databases that support\n * transactions, the existing slug-redirect side write remains grouped with it.\n */\nexport async function handleContentPublish(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tid: string,\n\toptions: {\n\t\tpublishedAt?: string;\n\t\trequireScheduledDue?: boolean;\n\t\texpectedScheduledAt?: string;\n\t\t_rev?: string;\n\t} = {},\n): Promise<ApiResult<ContentResponse>> {\n\ttry {\n\t\tconst expectedRevision = decodeRevisionPrecondition(options._rev);\n\t\tconst item = await withTransaction(db, async (trx) => {\n\t\t\tconst repo = new ContentRepository(trx);\n\t\t\tconst resolvedId = (await resolveId(repo, collection, id)) ?? id;\n\t\t\tconst publishConfig = await getCollectionPublishConfig(trx, collection);\n\n\t\t\t// Capture the pre-publish state. For revision-supporting collections a\n\t\t\t// slug edit is staged as `_slug` in the draft revision and only lands\n\t\t\t// on the live `slug` column here, inside `repo.publish()` — it never\n\t\t\t// passes through handleContentUpdate, where slug-change auto-redirects\n\t\t\t// are normally created.\n\t\t\tconst existing = await repo.findById(collection, resolvedId);\n\n\t\t\tconst published = await repo.publish(\n\t\t\t\tcollection,\n\t\t\t\tresolvedId,\n\t\t\t\toptions.publishedAt,\n\t\t\t\toptions.requireScheduledDue,\n\t\t\t\toptions.expectedScheduledAt,\n\t\t\t\tpublishConfig.supportsRevisions,\n\t\t\t\tpublishConfig.routable,\n\t\t\t\texpectedRevision,\n\t\t\t);\n\n\t\t\t// Leave a 301 behind when publishing changed the slug of an entry that\n\t\t\t// was already published — its old URL was live and may be indexed or\n\t\t\t// linked. A first publish is excluded: a draft's URL was never public.\n\t\t\tif (\n\t\t\t\texisting?.status === \"published\" &&\n\t\t\t\texisting.slug &&\n\t\t\t\tpublished.slug &&\n\t\t\t\texisting.slug !== published.slug\n\t\t\t) {\n\t\t\t\tawait createSlugChangeRedirect(trx, collection, existing.slug, published.slug, resolvedId);\n\t\t\t}\n\n\t\t\treturn published;\n\t\t});\n\n\t\tconst hasSeo = await collectionHasSeo(db, collection);\n\t\tawait hydrateSeo(db, collection, item, hasSeo);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item, _rev: encodeRev(item) },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof ContentMutationConflictError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"CONFLICT\",\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\t// The scheduled sweep gates publish on the row still being due; a row\n\t\t// unscheduled in the meantime is a silent skip, not a failure.\n\t\tif (error instanceof ScheduledNotDueError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_DUE\",\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (error instanceof EmDashValidationError) {\n\t\t\t// The staged-slug pre-check tags its error so it maps to the same\n\t\t\t// 409 SLUG_CONFLICT as direct slug edits in create/update.\n\t\t\tconst details: unknown = error.details;\n\t\t\tconst isSlugConflict =\n\t\t\t\ttypeof details === \"object\" &&\n\t\t\t\tdetails !== null &&\n\t\t\t\t\"code\" in details &&\n\t\t\t\tdetails.code === \"SLUG_CONFLICT\";\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: isSlugConflict ? \"SLUG_CONFLICT\" : \"VALIDATION_ERROR\",\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\t// Backstop for the pre-check inside repo.publish(): a concurrent write\n\t\t// can still take the slug between the check and the UPDATE, in which\n\t\t// case the `(slug, locale)` unique constraint fires. Same fingerprint\n\t\t// mapping as create/update — never a raw SQLite error to the client.\n\t\tconst message = error instanceof Error ? error.message.toLowerCase() : \"\";\n\t\tif (\n\t\t\t(message.includes(\"unique constraint failed\") || message.includes(\"duplicate key\")) &&\n\t\t\tmessage.includes(\"slug\")\n\t\t) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"SLUG_CONFLICT\",\n\t\t\t\t\tmessage: `The staged slug is already used by another entry in collection '${collection}'`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Content publish error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_PUBLISH_ERROR\",\n\t\t\t\tmessage: \"Failed to publish content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Unpublish content (revert to draft).\n *\n * Wrapped in a transaction — unpublish may create a draft revision\n * from the live version then update the status, which is multi-step.\n */\nexport async function handleContentUnpublish(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tid: string,\n\toptions: { _rev?: string } = {},\n): Promise<ApiResult<ContentResponse>> {\n\ttry {\n\t\tconst expectedRevision = decodeRevisionPrecondition(options._rev);\n\t\tconst item = await withTransaction(db, async (trx) => {\n\t\t\tconst repo = new ContentRepository(trx);\n\t\t\tconst resolvedId = (await resolveId(repo, collection, id)) ?? id;\n\t\t\treturn repo.unpublish(collection, resolvedId, expectedRevision);\n\t\t});\n\n\t\tconst hasSeo = await collectionHasSeo(db, collection);\n\t\tawait hydrateSeo(db, collection, item, hasSeo);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item, _rev: encodeRev(item) },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof ContentMutationConflictError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"CONFLICT\", message: error.message },\n\t\t\t};\n\t\t}\n\t\tif (error instanceof EmDashValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Content unpublish error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_UNPUBLISH_ERROR\",\n\t\t\t\tmessage: \"Failed to unpublish content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Count scheduled content items\n */\nexport async function handleContentCountScheduled(\n\tdb: Kysely<Database>,\n\tcollection: string,\n): Promise<ApiResult<{ count: number }>> {\n\ttry {\n\t\tconst repo = new ContentRepository(db);\n\t\tconst count = await repo.countScheduled(collection);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { count },\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"Content count scheduled error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_COUNT_ERROR\",\n\t\t\t\tmessage: \"Failed to count scheduled content\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Discard draft changes (revert to live version)\n */\nexport async function handleContentDiscardDraft(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tid: string,\n\toptions: { _rev?: string } = {},\n): Promise<ApiResult<ContentResponse>> {\n\ttry {\n\t\tconst expectedRevision = decodeRevisionPrecondition(options._rev);\n\t\tconst item = await withTransaction(db, async (trx) => {\n\t\t\tconst repo = new ContentRepository(trx);\n\t\t\tconst resolvedId = (await resolveId(repo, collection, id)) ?? id;\n\t\t\treturn repo.discardDraft(collection, resolvedId, expectedRevision);\n\t\t});\n\n\t\tconst hasSeo = await collectionHasSeo(db, collection);\n\t\tawait hydrateSeo(db, collection, item, hasSeo);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item, _rev: encodeRev(item) },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof ContentMutationConflictError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"CONFLICT\", message: error.message },\n\t\t\t};\n\t\t}\n\t\tif (error instanceof EmDashValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Content discard draft error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_DISCARD_DRAFT_ERROR\",\n\t\t\t\tmessage: \"Failed to discard draft\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Compare live and draft revisions\n */\nexport async function handleContentCompare(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tid: string,\n): Promise<\n\tApiResult<{\n\t\thasChanges: boolean;\n\t\tlive: Record<string, unknown> | null;\n\t\tdraft: Record<string, unknown> | null;\n\t}>\n> {\n\ttry {\n\t\tconst repo = new ContentRepository(db);\n\t\tconst entry = await repo.findByIdOrSlug(collection, id);\n\n\t\tif (!entry) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `Content item not found: ${id}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst revisionRepo = new RevisionRepository(db);\n\n\t\tconst live = entry.liveRevisionId ? await revisionRepo.findById(entry.liveRevisionId) : null;\n\t\tconst draft = entry.draftRevisionId ? await revisionRepo.findById(entry.draftRevisionId) : null;\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\thasChanges:\n\t\t\t\t\tentry.draftRevisionId !== null && entry.draftRevisionId !== entry.liveRevisionId,\n\t\t\t\tlive: live?.data ?? null,\n\t\t\t\tdraft: draft?.data ?? null,\n\t\t\t},\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"Content compare error:\", error);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_COMPARE_ERROR\",\n\t\t\t\tmessage: \"Failed to compare revisions\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Get all translations for a content item.\n * Returns the item's translation group members with locale and status info.\n */\nexport async function handleContentTranslations(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tid: string,\n): Promise<\n\tApiResult<{\n\t\ttranslationGroup: string;\n\t\ttranslations: Array<{\n\t\t\tid: string;\n\t\t\tlocale: string | null;\n\t\t\tslug: string | null;\n\t\t\tstatus: string;\n\t\t\tupdatedAt: string;\n\t\t}>;\n\t}>\n> {\n\ttry {\n\t\tconst repo = new ContentRepository(db);\n\t\tconst item = await repo.findByIdOrSlug(collection, id);\n\n\t\tif (!item) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `Content item not found: ${id}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tif (!item.translationGroup) {\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tdata: {\n\t\t\t\t\ttranslationGroup: item.id,\n\t\t\t\t\ttranslations: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: item.id,\n\t\t\t\t\t\t\tlocale: item.locale,\n\t\t\t\t\t\t\tslug: item.slug,\n\t\t\t\t\t\t\tstatus: item.status,\n\t\t\t\t\t\t\tupdatedAt: item.updatedAt,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst translations = await repo.findTranslations(collection, item.translationGroup);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\ttranslationGroup: item.translationGroup,\n\t\t\t\ttranslations: translations.map((t) => ({\n\t\t\t\t\tid: t.id,\n\t\t\t\t\tlocale: t.locale,\n\t\t\t\t\tslug: t.slug,\n\t\t\t\t\tstatus: t.status,\n\t\t\t\t\tupdatedAt: t.updatedAt,\n\t\t\t\t})),\n\t\t\t},\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof Error) {\n\t\t\tconsole.error(\"Content translations error:\", error);\n\t\t}\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"CONTENT_TRANSLATIONS_ERROR\",\n\t\t\t\tmessage: \"Failed to get translations\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Non-translatable field sync\n// ---------------------------------------------------------------------------\n\n/**\n * Sync non-translatable fields to sibling locales.\n *\n * When a content item is updated and it belongs to a translation group,\n * any non-translatable fields in the update data are written to all other\n * rows in the same translation group within the same transaction.\n *\n * Non-translatable fields are **copied, not linked** — each row owns its\n * own data. This keeps queries simple and avoids cross-row joins.\n */\nasync function syncNonTranslatableFields(\n\ttrx: Kysely<Database>,\n\tcollectionSlug: string,\n\tupdatedItemId: string,\n\ttranslationGroup: string,\n\tdata: Record<string, unknown>,\n): Promise<void> {\n\t// Get the collection to find its fields\n\tconst collection = await trx\n\t\t.selectFrom(\"_emdash_collections\")\n\t\t.select(\"id\")\n\t\t.where(\"slug\", \"=\", collectionSlug)\n\t\t.executeTakeFirst();\n\n\tif (!collection) return;\n\n\t// Find non-translatable fields that are present in the update data\n\tconst fields = await trx\n\t\t.selectFrom(\"_emdash_fields\")\n\t\t.select(\"slug\")\n\t\t.where(\"collection_id\", \"=\", collection.id)\n\t\t.where(\"translatable\", \"=\", 0)\n\t\t.execute();\n\n\tconst nonTranslatableSlugs = fields.map((f) => f.slug);\n\tif (nonTranslatableSlugs.length === 0) return;\n\n\t// Filter to only the non-translatable fields present in this update\n\tconst syncData: Record<string, unknown> = {};\n\tfor (const slug of nonTranslatableSlugs) {\n\t\tif (slug in data) {\n\t\t\tsyncData[slug] = data[slug];\n\t\t}\n\t}\n\tif (Object.keys(syncData).length === 0) return;\n\n\t// Build the SET clause for sibling rows\n\tvalidateIdentifier(collectionSlug, \"collection slug\");\n\tconst tableName = `ec_${collectionSlug}`;\n\n\t// Update all sibling rows (same translation_group, different id)\n\tconst setClauses = Object.entries(syncData).map(([key, value]) => {\n\t\tvalidateIdentifier(key, \"field slug\");\n\t\tconst serialized = typeof value === \"object\" && value !== null ? JSON.stringify(value) : value;\n\t\treturn sql`${sql.ref(key)} = ${serialized}`;\n\t});\n\n\tawait sql`\n\t\tUPDATE ${sql.ref(tableName)}\n\t\tSET ${sql.join(setClauses, sql`, `)}\n\t\tWHERE translation_group = ${translationGroup}\n\t\tAND id != ${updatedItemId}\n\t`.execute(trx);\n}\n\n/**\n * Resolve a `{ taxonomyName: [slug, ...] }` map to term IDs and replace the\n * entry's assignments for each named taxonomy.\n *\n * Shared by handleContentCreate and handleContentUpdate so both MCP entry\n * points behave identically. Slug resolution is scoped to `locale`; passing\n * `undefined` lets `findBySlug` fall back to its default (lowest locale code)\n * so callers on single-locale sites don't need to know the site's default.\n *\n * Throws EmDashValidationError on unknown slug or wrong shape; the calling\n * handler translates that into a VALIDATION_ERROR response.\n */\nasync function assignTaxonomies(\n\ttrx: Kysely<Database>,\n\tcollection: string,\n\tentryId: string,\n\tlocale: string | undefined,\n\ttaxonomies: Record<string, string[]>,\n): Promise<void> {\n\tconst taxRepo = new TaxonomyRepository(trx);\n\tlet anyChange = false;\n\n\tfor (const [taxonomyName, slugs] of Object.entries(taxonomies)) {\n\t\tif (!Array.isArray(slugs)) {\n\t\t\tthrow new EmDashValidationError(`taxonomies.${taxonomyName} must be an array of term slugs`);\n\t\t}\n\n\t\tconst termIds: string[] = [];\n\t\tfor (const slug of slugs) {\n\t\t\tif (typeof slug !== \"string\" || slug.length === 0) {\n\t\t\t\tthrow new EmDashValidationError(\n\t\t\t\t\t`taxonomies.${taxonomyName} contains a non-string or empty slug`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst term = await taxRepo.findBySlug(taxonomyName, slug, locale);\n\t\t\tif (!term) {\n\t\t\t\tthrow new EmDashValidationError(\n\t\t\t\t\t`Unknown taxonomy term: ${taxonomyName}='${slug}'${\n\t\t\t\t\t\tlocale ? ` (locale '${locale}')` : \"\"\n\t\t\t\t\t}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\ttermIds.push(term.id);\n\t\t}\n\n\t\tawait taxRepo.setTermsForEntry(collection, entryId, taxonomyName, termIds);\n\t\tanyChange = true;\n\t}\n\n\t// Match the REST route's behaviour: taxonomy term assignments changed,\n\t// so invalidate the taxonomy object cache used during hydration.\n\tif (anyChange) invalidateTermCache();\n}\n","/**\n * Manifest generation handlers\n */\n\nimport type { Kysely } from \"kysely\";\n\nimport type { Database } from \"../../database/types.js\";\nimport { SchemaRegistry } from \"../../schema/registry.js\";\nimport { MAX_COLLECTION_LIST_COLUMNS } from \"../../schema/types.js\";\nimport type { Field, FieldType } from \"../../schema/types.js\";\nimport { hashString } from \"../../utils/hash.js\";\nimport type {\n\tFieldDescriptor,\n\tManifestCollectionMap,\n\tManifestFieldDescriptor,\n\tManifestResponse,\n} from \"../types.js\";\n\n/** Pattern to add spaces before capital letters */\nconst CAMEL_CASE_PATTERN = /([A-Z])/g;\nconst FIRST_CHAR_PATTERN = /^./;\n\n/**\n * Map schema field types to editor field kinds.\n */\n/** Field types that can be surfaced as list columns in the admin. */\nconst LIST_COLUMN_FIELD_TYPES: ReadonlySet<FieldType> = new Set([\n\t\"string\",\n\t\"number\",\n\t\"integer\",\n\t\"boolean\",\n\t\"datetime\",\n\t\"select\",\n\t\"multiSelect\",\n]);\n\nconst FIELD_TYPE_TO_KIND: Record<FieldType, string> = {\n\tstring: \"string\",\n\tslug: \"string\",\n\turl: \"url\",\n\ttext: \"richText\",\n\tnumber: \"number\",\n\tinteger: \"number\",\n\tboolean: \"boolean\",\n\tdatetime: \"datetime\",\n\tselect: \"select\",\n\tmultiSelect: \"multiSelect\",\n\tportableText: \"portableText\",\n\timage: \"image\",\n\tfile: \"file\",\n\treference: \"reference\",\n\tjson: \"json\",\n\trepeater: \"repeater\",\n};\n\n// Collection definition shape for manifest generation\ninterface CollectionDefinition {\n\tschema: {\n\t\t_def?: { shape?: () => Record<string, unknown> };\n\t\tshape?: Record<string, unknown>;\n\t};\n\tadmin: {\n\t\tlabel: string;\n\t\tlabelSingular?: string;\n\t\tsupports?: string[];\n\t\troutable?: boolean;\n\t};\n}\ntype CollectionMap = Record<string, CollectionDefinition>;\n\ninterface GenerateManifestOptions {\n\tdb?: Kysely<Database> | null;\n}\n\n/**\n * Generate admin manifest from collections\n */\nexport async function generateManifest(\n\tcollections: CollectionMap,\n\tplugins: Record<\n\t\tstring,\n\t\t{\n\t\t\tadminPages?: Array<{ path: string; component: string }>;\n\t\t\twidgets?: string[];\n\t\t}\n\t> = {},\n\toptions: GenerateManifestOptions = {},\n): Promise<ManifestResponse> {\n\tconst manifestCollections = await buildManifestCollections(collections, options.db);\n\n\t// Generate hash from collections (for cache invalidation)\n\tconst hash = await hashString(JSON.stringify(manifestCollections));\n\n\treturn {\n\t\tversion: \"0.1.0\",\n\t\thash,\n\t\tcollections: manifestCollections,\n\t\tplugins,\n\t};\n}\n\n/**\n * Build collection descriptors from build-time config plus live database rows.\n *\n * Config collections are added first and win on slug conflicts. Runtime/manual\n * collections have no Zod schema to inspect, so their field descriptors are\n * synthesized from `_emdash_fields`.\n */\nexport async function buildManifestCollections(\n\tcollections: CollectionMap,\n\tdb?: Kysely<Database> | null,\n): Promise<ManifestCollectionMap> {\n\tconst manifestCollections: ManifestCollectionMap = {};\n\n\tfor (const [name, definition] of Object.entries(collections)) {\n\t\t// Extract field descriptors from Zod schema\n\t\tconst fields = extractFieldDescriptors(definition.schema);\n\n\t\tmanifestCollections[name] = {\n\t\t\tlabel: definition.admin.label,\n\t\t\tlabelSingular: definition.admin.labelSingular || definition.admin.label,\n\t\t\tsupports: definition.admin.supports || [],\n\t\t\thasSeo: (definition.admin.supports || []).includes(\"seo\"),\n\t\t\troutable: definition.admin.routable ?? true,\n\t\t\tfields,\n\t\t};\n\t}\n\n\tif (!db) return manifestCollections;\n\n\ttry {\n\t\tconst registry = new SchemaRegistry(db);\n\t\tconst dbCollections = await registry.listCollectionsWithFields();\n\t\tfor (const collection of dbCollections) {\n\t\t\tif (manifestCollections[collection.slug]) continue;\n\n\t\t\tconst fields: Record<string, ManifestFieldDescriptor> = {};\n\t\t\tfor (const field of collection.fields) {\n\t\t\t\tfields[field.slug] = dbFieldDescriptor(field);\n\t\t\t}\n\n\t\t\tconst configuredListColumns = collection.admin?.listColumns ?? [];\n\t\t\tconst fieldTypes = new Map(collection.fields.map((field) => [field.slug, field.type]));\n\t\t\tconst listColumns: string[] = [];\n\t\t\tfor (const slug of configuredListColumns) {\n\t\t\t\tif (listColumns.includes(slug)) continue;\n\t\t\t\tconst fieldType = fieldTypes.get(slug);\n\t\t\t\tif (!fieldType || !LIST_COLUMN_FIELD_TYPES.has(fieldType)) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`EmDash: Ignoring unsupported or unknown list column \"${slug}\" in collection \"${collection.slug}\".`,\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (listColumns.length >= MAX_COLLECTION_LIST_COLUMNS) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`EmDash: Collection \"${collection.slug}\" declares more than ${MAX_COLLECTION_LIST_COLUMNS} list columns; extra columns are ignored.`,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tlistColumns.push(slug);\n\t\t\t}\n\n\t\t\tmanifestCollections[collection.slug] = {\n\t\t\t\tlabel: collection.label,\n\t\t\t\tlabelSingular: collection.labelSingular || collection.label,\n\t\t\t\tsupports: collection.supports || [],\n\t\t\t\thasSeo: collection.hasSeo,\n\t\t\t\turlPattern: collection.urlPattern,\n\t\t\t\troutable: collection.routable !== false,\n\t\t\t\ttitleField: collection.titleField,\n\t\t\t\tdateField: collection.dateField,\n\t\t\t\t...(collection.hidden ? { hidden: true } : {}),\n\t\t\t\tlistColumns: listColumns.length > 0 ? listColumns : undefined,\n\t\t\t\tfields,\n\t\t\t};\n\t\t}\n\t} catch (error) {\n\t\tconsole.debug(\"EmDash: Could not load database collections for manifest:\", error);\n\t}\n\n\treturn manifestCollections;\n}\n\n/**\n * Extract field descriptors from Zod schema\n * Note: This is a simplified implementation that handles common types\n */\nfunction extractFieldDescriptors(schema: {\n\t_def?: { shape?: () => Record<string, unknown> };\n\tshape?: Record<string, unknown>;\n}): Record<string, ManifestFieldDescriptor> {\n\tconst fields: Record<string, ManifestFieldDescriptor> = {};\n\n\t// Handle Zod object schema\n\tconst shape = typeof schema._def?.shape === \"function\" ? schema._def.shape() : schema.shape || {};\n\n\tfor (const [name, fieldSchema] of Object.entries(shape)) {\n\t\tfields[name] = extractFieldType(name, fieldSchema);\n\t}\n\n\treturn fields;\n}\n\n/**\n * Extract field type from Zod schema\n */\n/** Type guard: check if a value is a non-null object */\nfunction isObject(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction extractFieldType(name: string, schema: unknown): FieldDescriptor {\n\tif (!isObject(schema)) {\n\t\treturn { kind: \"string\", label: formatLabel(name) };\n\t}\n\n\t// Check for custom field markers\n\tif (schema.isPortableText) {\n\t\treturn { kind: \"portableText\", label: formatLabel(name) };\n\t}\n\tif (schema.isImage) {\n\t\treturn { kind: \"image\", label: formatLabel(name) };\n\t}\n\tif (schema.isReference) {\n\t\treturn { kind: \"reference\", label: formatLabel(name) };\n\t}\n\n\t// Handle standard Zod types\n\tconst def = isObject(schema._def) ? schema._def : undefined;\n\tconst typeName = typeof def?.typeName === \"string\" ? def.typeName : undefined;\n\n\tswitch (typeName) {\n\t\tcase \"ZodString\":\n\t\t\treturn { kind: \"string\", label: formatLabel(name) };\n\t\tcase \"ZodNumber\":\n\t\t\treturn { kind: \"number\", label: formatLabel(name) };\n\t\tcase \"ZodBoolean\":\n\t\t\treturn { kind: \"boolean\", label: formatLabel(name) };\n\t\tcase \"ZodDate\":\n\t\t\treturn { kind: \"datetime\", label: formatLabel(name) };\n\t\tcase \"ZodEnum\": {\n\t\t\tconst values = Array.isArray(def?.values) ? def.values : [];\n\t\t\treturn {\n\t\t\t\tkind: \"select\",\n\t\t\t\tlabel: formatLabel(name),\n\t\t\t\toptions: values\n\t\t\t\t\t.filter((v): v is string => typeof v === \"string\")\n\t\t\t\t\t.map((v) => ({\n\t\t\t\t\t\tvalue: v,\n\t\t\t\t\t\tlabel: v.charAt(0).toUpperCase() + v.slice(1),\n\t\t\t\t\t})),\n\t\t\t};\n\t\t}\n\t\tcase \"ZodArray\":\n\t\t\treturn { kind: \"array\", label: formatLabel(name) };\n\t\tcase \"ZodObject\":\n\t\t\treturn { kind: \"object\", label: formatLabel(name) };\n\t\tcase \"ZodOptional\":\n\t\tcase \"ZodDefault\":\n\t\t\t// Unwrap optional/default types\n\t\t\tif (def?.innerType) {\n\t\t\t\treturn extractFieldType(name, def.innerType);\n\t\t\t}\n\t\t\treturn { kind: \"string\", label: formatLabel(name) };\n\t\tdefault:\n\t\t\treturn { kind: \"string\", label: formatLabel(name) };\n\t}\n}\n\nfunction dbFieldDescriptor(field: Field): ManifestFieldDescriptor {\n\tconst entry: ManifestFieldDescriptor = {\n\t\tkind: FIELD_TYPE_TO_KIND[field.type] ?? \"string\",\n\t\tlabel: field.label,\n\t\trequired: field.required,\n\t\tid: field.id,\n\t};\n\n\tif (field.widget) entry.widget = field.widget;\n\tif (field.options) entry.options = field.options;\n\n\t// Legacy: select/multiSelect enum options live on `field.validation.options`.\n\t// They win over widget options to preserve existing select behavior.\n\tif (field.validation?.options) {\n\t\tentry.options = field.validation.options.map((value) => ({\n\t\t\tvalue,\n\t\t\tlabel: value.charAt(0).toUpperCase() + value.slice(1),\n\t\t}));\n\t}\n\n\t// Include validation only for field widgets that need it client-side.\n\tif (\n\t\t(field.type === \"repeater\" || field.type === \"file\" || field.type === \"image\") &&\n\t\tfield.validation\n\t) {\n\t\tentry.validation = { ...field.validation };\n\t}\n\n\treturn entry;\n}\n\n/**\n * Format field name as label\n */\nfunction formatLabel(name: string): string {\n\treturn name\n\t\t.replace(CAMEL_CASE_PATTERN, \" $1\")\n\t\t.replace(FIRST_CHAR_PATTERN, (str) => str.toUpperCase())\n\t\t.trim();\n}\n","/**\n * Revision history handlers\n */\n\nimport type { Kysely } from \"kysely\";\n\nimport { after } from \"../../after.js\";\nimport { ContentRepository } from \"../../database/repositories/content.js\";\nimport { RevisionRepository, type Revision } from \"../../database/repositories/revision.js\";\nimport { withTransaction } from \"../../database/transaction.js\";\nimport type { Database } from \"../../database/types.js\";\nimport type { ApiResult, ContentResponse } from \"../types.js\";\n\nexport interface RevisionListResponse {\n\titems: Revision[];\n\ttotal: number;\n}\n\nexport interface RevisionResponse {\n\titem: Revision;\n}\n\n/**\n * List revisions for a content entry\n */\nexport async function handleRevisionList(\n\tdb: Kysely<Database>,\n\tcollection: string,\n\tentryId: string,\n\tparams: { limit?: number } = {},\n): Promise<ApiResult<RevisionListResponse>> {\n\ttry {\n\t\tconst repo = new RevisionRepository(db);\n\t\tconst [items, total] = await Promise.all([\n\t\t\trepo.findByEntry(collection, entryId, { limit: Math.min(params.limit || 50, 100) }),\n\t\t\trepo.countByEntry(collection, entryId),\n\t\t]);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { items, total },\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"REVISION_LIST_ERROR\",\n\t\t\t\tmessage: \"Failed to list revisions\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Get a specific revision\n */\nexport async function handleRevisionGet(\n\tdb: Kysely<Database>,\n\trevisionId: string,\n): Promise<ApiResult<RevisionResponse>> {\n\ttry {\n\t\tconst repo = new RevisionRepository(db);\n\t\tconst item = await repo.findById(revisionId);\n\n\t\tif (!item) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `Revision not found: ${revisionId}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item },\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"REVISION_GET_ERROR\",\n\t\t\t\tmessage: \"Failed to get revision\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Restore a revision (updates content to this revision's data and creates new revision)\n */\nexport async function handleRevisionRestore(\n\tdb: Kysely<Database>,\n\trevisionId: string,\n\tcallerUserId: string,\n): Promise<ApiResult<ContentResponse>> {\n\ttry {\n\t\tconst revisionRepo = new RevisionRepository(db);\n\n\t\t// Get the revision\n\t\tconst revision = await revisionRepo.findById(revisionId);\n\t\tif (!revision) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `Revision not found: ${revisionId}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Extract _slug from revision data (stored as metadata, not a real column)\n\t\tconst { _slug, ...fieldData } = revision.data;\n\n\t\t// Atomically update content and create a new revision to record the restore.\n\t\t// If either operation fails, neither is committed (on engines that support\n\t\t// transactions; on D1, withTransaction falls back to sequential execution).\n\t\tconst { item, queuedRevisionId } = await withTransaction(db, async (trx) => {\n\t\t\tconst trxContentRepo = new ContentRepository(trx);\n\t\t\tconst trxRevisionRepo = new RevisionRepository(trx);\n\n\t\t\tconst updated = await trxContentRepo.update(revision.collection, revision.entryId, {\n\t\t\t\tdata: fieldData,\n\t\t\t\tslug: typeof _slug === \"string\" ? _slug : undefined,\n\t\t\t});\n\n\t\t\tconst queuedRevision = await trxRevisionRepo.create({\n\t\t\t\tcollection: revision.collection,\n\t\t\t\tentryId: revision.entryId,\n\t\t\t\tdata: revision.data,\n\t\t\t\tauthorId: callerUserId,\n\t\t\t});\n\n\t\t\treturn { item: updated, queuedRevisionId: queuedRevision.id };\n\t\t});\n\n\t\tconst pruneRepo = new RevisionRepository(db);\n\t\tafter(async () => {\n\t\t\ttry {\n\t\t\t\tawait pruneRepo.pruneQueuedEntry(\n\t\t\t\t\trevision.collection,\n\t\t\t\t\trevision.entryId,\n\t\t\t\t\tqueuedRevisionId,\n\t\t\t\t\t50,\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[revisions] Failed to prune revisions for ${revision.collection}/${revision.entryId}:`,\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item },\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"REVISION_RESTORE_ERROR\",\n\t\t\t\tmessage: \"Failed to restore revision\",\n\t\t\t},\n\t\t};\n\t}\n}\n","/**\n * Media CRUD handlers\n */\n\nimport type { Kysely } from \"kysely\";\n\nimport { MediaRepository, type MediaItem } from \"../../database/repositories/media.js\";\nimport { InvalidCursorError } from \"../../database/repositories/types.js\";\nimport type { Database } from \"../../database/types.js\";\nimport { isValidFocalPointUpdate, type FocalPointUpdate } from \"../../media/focal-point.js\";\nimport type { ApiResult } from \"../types.js\";\n\nconst FOREIGN_KEY_VIOLATION_RE = /foreign key constraint failed/i;\n\nexport interface MediaListResponse {\n\titems: MediaItem[];\n\tnextCursor?: string;\n\ttotalCount?: number;\n}\n\nexport interface MediaResponse {\n\titem: MediaItem;\n}\n\n/**\n * List media items\n */\nexport async function handleMediaList(\n\tdb: Kysely<Database>,\n\tparams: {\n\t\tcursor?: string;\n\t\tpage?: number;\n\t\tlimit?: number;\n\t\tmimeType?: string | readonly string[];\n\t\tq?: string;\n\t\tfolderId?: string | null;\n\t},\n): Promise<ApiResult<MediaListResponse>> {\n\ttry {\n\t\tif (params.page !== undefined) {\n\t\t\tconst limit = Math.min(params.limit || 50, 100);\n\t\t\tconst offset = (params.page - 1) * limit;\n\t\t\tif (\n\t\t\t\tparams.cursor !== undefined ||\n\t\t\t\t!Number.isSafeInteger(params.page) ||\n\t\t\t\tparams.page < 1 ||\n\t\t\t\t!Number.isSafeInteger(offset)\n\t\t\t) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: { code: \"VALIDATION_ERROR\", message: \"Invalid media page\" },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst repo = new MediaRepository(db);\n\t\t\tconst result = await repo.findPage({\n\t\t\t\tpage: params.page,\n\t\t\t\tlimit,\n\t\t\t\tmimeType: params.mimeType,\n\t\t\t\tq: params.q,\n\t\t\t\tfolderId: params.folderId,\n\t\t\t});\n\t\t\treturn { success: true, data: result };\n\t\t}\n\n\t\tconst repo = new MediaRepository(db);\n\t\tconst result = await repo.findMany({\n\t\t\tcursor: params.cursor,\n\t\t\tlimit: Math.min(params.limit || 50, 100),\n\t\t\tmimeType: params.mimeType,\n\t\t\tq: params.q,\n\t\t\tfolderId: params.folderId,\n\t\t});\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\titems: result.items,\n\t\t\t\tnextCursor: result.nextCursor,\n\t\t\t},\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof InvalidCursorError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"INVALID_CURSOR\", message: error.message },\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"MEDIA_LIST_ERROR\",\n\t\t\t\tmessage: \"Failed to list media\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Get single media item\n */\nexport async function handleMediaGet(\n\tdb: Kysely<Database>,\n\tid: string,\n): Promise<ApiResult<MediaResponse>> {\n\ttry {\n\t\tconst repo = new MediaRepository(db);\n\t\tconst item = await repo.findById(id);\n\n\t\tif (!item) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `Media item not found: ${id}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item },\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"MEDIA_GET_ERROR\",\n\t\t\t\tmessage: \"Failed to get media\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Create media item (after file upload)\n */\nexport async function handleMediaCreate(\n\tdb: Kysely<Database>,\n\tinput: {\n\t\tfilename: string;\n\t\tmimeType: string;\n\t\tsize?: number;\n\t\twidth?: number;\n\t\theight?: number;\n\t\talt?: string;\n\t\tstorageKey: string;\n\t\tcontentHash?: string;\n\t\tblurhash?: string;\n\t\tdominantColor?: string;\n\t\tauthorId?: string;\n\t\tfolderId?: string | null;\n\t},\n): Promise<ApiResult<MediaResponse>> {\n\ttry {\n\t\tconst repo = new MediaRepository(db);\n\t\tconst item = await repo.create(input);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item },\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"MEDIA_CREATE_ERROR\",\n\t\t\t\tmessage: \"Failed to create media\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Update media metadata\n */\nexport async function handleMediaUpdate(\n\tdb: Kysely<Database>,\n\tid: string,\n\tinput: {\n\t\talt?: string;\n\t\tcaption?: string;\n\t\twidth?: number;\n\t\theight?: number;\n\t\tfolderId?: string | null;\n\t} & FocalPointUpdate,\n): Promise<ApiResult<MediaResponse>> {\n\tif (!isValidFocalPointUpdate(input)) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"VALIDATION_ERROR\",\n\t\t\t\tmessage: \"focalX and focalY must both be valid numbers or both be null\",\n\t\t\t},\n\t\t};\n\t}\n\ttry {\n\t\tconst repo = new MediaRepository(db);\n\t\tconst item = await repo.update(id, input);\n\n\t\tif (!item) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `Media item not found: ${id}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { item },\n\t\t};\n\t} catch (error) {\n\t\tif (isForeignKeyViolation(error)) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"NOT_FOUND\", message: \"Media folder not found\" },\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"MEDIA_UPDATE_ERROR\",\n\t\t\t\tmessage: \"Failed to update media\",\n\t\t\t},\n\t\t};\n\t}\n}\n\nexport async function handleMediaReplaceMetadata(\n\tdb: Kysely<Database>,\n\tid: string,\n\texpectedStorageKey: string,\n\tinput: { size: number; width: number; height: number; contentHash: string },\n): Promise<ApiResult<MediaResponse>> {\n\ttry {\n\t\tconst item = await new MediaRepository(db).replaceReadyFile(id, expectedStorageKey, input);\n\t\tif (!item) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"MEDIA_REPLACE_METADATA_ERROR\",\n\t\t\t\t\tmessage: \"Failed to update replaced media metadata\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn { success: true, data: { item } };\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"MEDIA_REPLACE_METADATA_ERROR\",\n\t\t\t\tmessage: \"Failed to update replaced media metadata\",\n\t\t\t},\n\t\t};\n\t}\n}\n\nfunction isForeignKeyViolation(error: unknown): boolean {\n\tif (error && typeof error === \"object\") {\n\t\tif (\"code\" in error && error.code === \"23503\") return true;\n\t}\n\tconst message = error instanceof Error ? error.message : \"\";\n\tif (FOREIGN_KEY_VIOLATION_RE.test(message)) return true;\n\treturn Boolean(\n\t\terror && typeof error === \"object\" && \"cause\" in error && isForeignKeyViolation(error.cause),\n\t);\n}\n\n/**\n * Delete media item\n */\nexport async function handleMediaDelete(\n\tdb: Kysely<Database>,\n\tid: string,\n): Promise<ApiResult<{ deleted: true; storageKey: string }>> {\n\ttry {\n\t\tconst repo = new MediaRepository(db);\n\t\tconst storageKey = await repo.deleteWithStorageKey(id);\n\n\t\tif (!storageKey) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `Media item not found: ${id}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { deleted: true, storageKey },\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"MEDIA_DELETE_ERROR\",\n\t\t\t\tmessage: \"Failed to delete media\",\n\t\t\t},\n\t\t};\n\t}\n}\n","/**\n * Plugin management handlers\n */\n\nimport type { Kysely } from \"kysely\";\n\nimport type { Database } from \"../../database/types.js\";\nimport type { SandboxedPluginEntry } from \"../../emdash-runtime.js\";\nimport { PluginStateRepository, type PluginState, type PluginStatus } from \"../../plugins/state.js\";\nimport type { ResolvedPlugin } from \"../../plugins/types.js\";\nimport type { ApiResult } from \"../types.js\";\n\nexport interface PluginInfo {\n\tid: string;\n\tname: string;\n\tversion: string;\n\tpackage?: string;\n\tenabled: boolean;\n\tstatus: PluginStatus;\n\tsource?: \"config\" | \"marketplace\" | \"registry\";\n\t/** True for statically-sandboxed plugins (registered via `sandboxed: []`) */\n\tsandboxed?: boolean;\n\tmarketplaceVersion?: string;\n\t/** Publisher DID, for registry-source plugins */\n\tregistryPublisherDid?: string;\n\t/** Publisher slug, for registry-source plugins */\n\tregistrySlug?: string;\n\tcapabilities: string[];\n\thasAdminPages: boolean;\n\thasDashboardWidgets: boolean;\n\thasHooks: boolean;\n\t/** True when the plugin declares `admin.settingsSchema` (auto-generated settings form) */\n\thasSettings: boolean;\n\tinstalledAt?: string;\n\tactivatedAt?: string;\n\tdeactivatedAt?: string;\n\t/** Description of what the plugin does */\n\tdescription?: string;\n\t/** URL to the plugin icon on the marketplace */\n\ticonUrl?: string;\n\tmcpToolsEnabled: boolean;\n\tmcpTools: Array<{\n\t\tname: string;\n\t\tdescription: string;\n\t\troute: string;\n\t\tpermission: string;\n\t\tdestructive: boolean;\n\t}>;\n}\n\nexport interface PluginListResponse {\n\titems: PluginInfo[];\n}\n\nexport interface PluginResponse {\n\titem: PluginInfo;\n}\n\nfunction marketplaceIconUrl(marketplaceUrl: string, pluginId: string): string {\n\treturn `${marketplaceUrl}/api/v1/plugins/${encodeURIComponent(pluginId)}/icon`;\n}\n\n/**\n * Get plugin info from configured plugin and database state\n */\nfunction buildPluginInfo(\n\tplugin: ResolvedPlugin,\n\tstate: PluginState | null,\n\tmarketplaceUrl?: string,\n): PluginInfo {\n\t// If no state exists, plugin is considered active (default on first run)\n\tconst status = state?.status ?? \"active\";\n\tconst enabled = status === \"active\";\n\tconst isMarketplace = (state?.source ?? \"config\") === \"marketplace\";\n\n\treturn {\n\t\tid: plugin.id,\n\t\tname: state?.displayName || plugin.id,\n\t\tversion: plugin.version,\n\t\tpackage: undefined, // v2 doesn't have package field\n\t\tenabled,\n\t\tstatus,\n\t\tsource: state?.source ?? \"config\",\n\t\tmarketplaceVersion: state?.marketplaceVersion ?? undefined,\n\t\tregistryPublisherDid: state?.registryPublisherDid ?? undefined,\n\t\tregistrySlug: state?.registrySlug ?? undefined,\n\t\tcapabilities: plugin.capabilities,\n\t\thasAdminPages: (plugin.admin.pages?.length ?? 0) > 0,\n\t\thasDashboardWidgets: (plugin.admin.widgets?.length ?? 0) > 0,\n\t\thasHooks: Object.keys(plugin.hooks ?? {}).length > 0,\n\t\thasSettings: Object.keys(plugin.admin.settingsSchema ?? {}).length > 0,\n\t\tinstalledAt: state?.installedAt?.toISOString(),\n\t\tactivatedAt: state?.activatedAt?.toISOString() ?? undefined,\n\t\tdeactivatedAt: state?.deactivatedAt?.toISOString() ?? undefined,\n\t\tdescription: state?.description ?? undefined,\n\t\ticonUrl:\n\t\t\tisMarketplace && marketplaceUrl ? marketplaceIconUrl(marketplaceUrl, plugin.id) : undefined,\n\t\tmcpToolsEnabled: state?.mcpToolsEnabled ?? false,\n\t\tmcpTools: Object.entries(plugin.mcp?.tools ?? {}).flatMap(([name, tool]) => {\n\t\t\tconst permission = plugin.routes[tool.route]?.permission;\n\t\t\treturn permission\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tdescription: tool.description,\n\t\t\t\t\t\t\troute: tool.route,\n\t\t\t\t\t\t\tpermission,\n\t\t\t\t\t\t\tdestructive: tool.destructive ?? false,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: [];\n\t\t}),\n\t};\n}\n\n/**\n * Build plugin info for a statically-sandboxed plugin entry\n */\nfunction buildSandboxedPluginInfo(\n\tentry: SandboxedPluginEntry,\n\tstate: PluginState | null,\n): PluginInfo {\n\tconst status = state?.status ?? \"active\";\n\tconst enabled = status === \"active\";\n\n\treturn {\n\t\tid: entry.id,\n\t\tname: state?.displayName || entry.id,\n\t\tversion: entry.version,\n\t\tpackage: undefined, // v2 doesn't have package field\n\t\tenabled,\n\t\tstatus,\n\t\tsource: \"config\",\n\t\tsandboxed: true,\n\t\tcapabilities: entry.capabilities,\n\t\thasAdminPages: (entry.adminPages?.length ?? 0) > 0,\n\t\thasDashboardWidgets: (entry.adminWidgets?.length ?? 0) > 0,\n\t\thasHooks: false,\n\t\thasSettings: Object.keys(entry.settingsSchema ?? {}).length > 0,\n\t\tinstalledAt: state?.installedAt?.toISOString(),\n\t\tactivatedAt: state?.activatedAt?.toISOString() ?? undefined,\n\t\tdeactivatedAt: state?.deactivatedAt?.toISOString() ?? undefined,\n\t\tdescription: state?.description ?? undefined,\n\t\tmcpToolsEnabled: state?.mcpToolsEnabled ?? false,\n\t\tmcpTools: entry.mcp?.tools.map(({ inputSchema: _, outputSchema: __, ...tool }) => tool) ?? [],\n\t};\n}\n\n/**\n * List all configured plugins with their state\n */\nexport async function handlePluginList(\n\tdb: Kysely<Database>,\n\tconfiguredPlugins: ResolvedPlugin[],\n\tsandboxedPluginEntries: SandboxedPluginEntry[],\n\tmarketplaceUrl?: string,\n\t/**\n\t * Settings-schema lookup for runtime-installed (marketplace/registry)\n\t * plugins, which aren't in either build-time list. Typically\n\t * `EmDashRuntime.getRuntimePluginSettingsSchema`.\n\t */\n\truntimeSettingsSchemaLookup?: (pluginId: string) => Record<string, unknown> | null,\n): Promise<ApiResult<PluginListResponse>> {\n\ttry {\n\t\tconst stateRepo = new PluginStateRepository(db);\n\t\tconst allStates = await stateRepo.getAll();\n\t\tconst stateMap = new Map(allStates.map((s) => [s.pluginId, s]));\n\n\t\tconst configuredIds = new Set(configuredPlugins.map((p) => p.id));\n\n\t\tconst items = configuredPlugins.map((plugin) => {\n\t\t\tconst state = stateMap.get(plugin.id) ?? null;\n\t\t\treturn buildPluginInfo(plugin, state, marketplaceUrl);\n\t\t});\n\n\t\t// Include statically-sandboxed plugins (registered via `sandboxed: []`\n\t\t// in astro.config.mjs).\n\t\tfor (const entry of sandboxedPluginEntries) {\n\t\t\tif (configuredIds.has(entry.id)) continue;\n\t\t\tconfiguredIds.add(entry.id);\n\t\t\titems.push(buildSandboxedPluginInfo(entry, stateMap.get(entry.id) ?? null));\n\t\t}\n\n\t\t// Include runtime-installed plugins (marketplace or registry) that\n\t\t// aren't in the configured plugins list.\n\t\tfor (const state of allStates) {\n\t\t\tif (state.source !== \"marketplace\" && state.source !== \"registry\") continue;\n\t\t\tif (configuredIds.has(state.pluginId)) continue;\n\n\t\t\titems.push({\n\t\t\t\tid: state.pluginId,\n\t\t\t\tname: state.displayName || state.pluginId,\n\t\t\t\tversion: state.marketplaceVersion ?? state.version,\n\t\t\t\tenabled: state.status === \"active\",\n\t\t\t\tstatus: state.status,\n\t\t\t\tsource: state.source,\n\t\t\t\tmarketplaceVersion: state.marketplaceVersion ?? undefined,\n\t\t\t\tregistryPublisherDid: state.registryPublisherDid ?? undefined,\n\t\t\t\tregistrySlug: state.registrySlug ?? undefined,\n\t\t\t\tcapabilities: [],\n\t\t\t\thasAdminPages: false,\n\t\t\t\thasDashboardWidgets: false,\n\t\t\t\thasHooks: false,\n\t\t\t\thasSettings: Object.keys(runtimeSettingsSchemaLookup?.(state.pluginId) ?? {}).length > 0,\n\t\t\t\tinstalledAt: state.installedAt?.toISOString(),\n\t\t\t\tactivatedAt: state.activatedAt?.toISOString() ?? undefined,\n\t\t\t\tdeactivatedAt: state.deactivatedAt?.toISOString() ?? undefined,\n\t\t\t\tdescription: state.description ?? undefined,\n\t\t\t\ticonUrl:\n\t\t\t\t\tstate.source === \"marketplace\" && marketplaceUrl\n\t\t\t\t\t\t? marketplaceIconUrl(marketplaceUrl, state.pluginId)\n\t\t\t\t\t\t: undefined,\n\t\t\t\tmcpToolsEnabled: state.mcpToolsEnabled,\n\t\t\t\tmcpTools: [],\n\t\t\t});\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { items },\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"PLUGIN_LIST_ERROR\",\n\t\t\t\tmessage: \"Failed to list plugins\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Get a single plugin's info\n */\nexport async function handlePluginGet(\n\tdb: Kysely<Database>,\n\tconfiguredPlugins: ResolvedPlugin[],\n\tsandboxedPluginEntries: SandboxedPluginEntry[],\n\tpluginId: string,\n\tmarketplaceUrl?: string,\n): Promise<ApiResult<PluginResponse>> {\n\ttry {\n\t\tconst stateRepo = new PluginStateRepository(db);\n\t\tconst plugin = configuredPlugins.find((p) => p.id === pluginId);\n\n\t\tif (plugin) {\n\t\t\tconst state = await stateRepo.get(pluginId);\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tdata: { item: buildPluginInfo(plugin, state, marketplaceUrl) },\n\t\t\t};\n\t\t}\n\n\t\tconst sandboxed = sandboxedPluginEntries.find((e) => e.id === pluginId);\n\t\tif (sandboxed) {\n\t\t\tconst state = await stateRepo.get(pluginId);\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tdata: { item: buildSandboxedPluginInfo(sandboxed, state) },\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\tmessage: `Plugin not found: ${pluginId}`,\n\t\t\t},\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"PLUGIN_GET_ERROR\",\n\t\t\t\tmessage: \"Failed to get plugin\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Build a minimal `PluginInfo` for a plugin that exists only as a\n * `_plugin_state` row (marketplace or registry install), with no\n * matching `configuredPlugins` entry. Runtime-installed plugins don't\n * have ResolvedPlugin metadata until they're loaded into the sandbox,\n * so the enable/disable response surfaces the state-row view as a\n * stable shape the admin UI already understands.\n */\nfunction buildStateOnlyPluginInfo(\n\tstate: NonNullable<Awaited<ReturnType<PluginStateRepository[\"get\"]>>>,\n): PluginInfo {\n\treturn {\n\t\tid: state.pluginId,\n\t\tname: state.displayName || state.pluginId,\n\t\tversion: state.marketplaceVersion ?? state.version,\n\t\tenabled: state.status === \"active\",\n\t\tstatus: state.status,\n\t\tsource: state.source,\n\t\tmarketplaceVersion: state.marketplaceVersion ?? undefined,\n\t\tregistryPublisherDid: state.registryPublisherDid ?? undefined,\n\t\tregistrySlug: state.registrySlug ?? undefined,\n\t\tcapabilities: [],\n\t\thasAdminPages: false,\n\t\thasDashboardWidgets: false,\n\t\thasHooks: false,\n\t\thasSettings: false,\n\t\tinstalledAt: state.installedAt?.toISOString(),\n\t\tactivatedAt: state.activatedAt?.toISOString() ?? undefined,\n\t\tdeactivatedAt: state.deactivatedAt?.toISOString() ?? undefined,\n\t\tdescription: state.description ?? undefined,\n\t\tmcpToolsEnabled: state.mcpToolsEnabled,\n\t\tmcpTools: [],\n\t};\n}\n\n/**\n * Enable a plugin\n */\nexport async function handlePluginEnable(\n\tdb: Kysely<Database>,\n\tconfiguredPlugins: ResolvedPlugin[],\n\tsandboxedPluginEntries: SandboxedPluginEntry[],\n\tpluginId: string,\n): Promise<ApiResult<PluginResponse>> {\n\ttry {\n\t\tconst stateRepo = new PluginStateRepository(db);\n\t\tconst plugin = configuredPlugins.find((p) => p.id === pluginId);\n\n\t\t// Configured plugin: use its version as the source of truth.\n\t\tif (plugin) {\n\t\t\tconst state = await stateRepo.enable(pluginId, plugin.version);\n\t\t\treturn { success: true, data: { item: buildPluginInfo(plugin, state) } };\n\t\t}\n\n\t\t// Statically-sandboxed plugin: addressable via its build-time entry.\n\t\tconst sandboxed = sandboxedPluginEntries.find((e) => e.id === pluginId);\n\t\tif (sandboxed) {\n\t\t\tconst state = await stateRepo.enable(pluginId, sandboxed.version);\n\t\t\treturn { success: true, data: { item: buildSandboxedPluginInfo(sandboxed, state) } };\n\t\t}\n\n\t\t// Runtime-installed plugin (marketplace or registry): only\n\t\t// addressable through the state row. Fall back to the existing\n\t\t// version recorded there.\n\t\tconst existing = await stateRepo.get(pluginId);\n\t\tif (!existing || (existing.source !== \"marketplace\" && existing.source !== \"registry\")) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"NOT_FOUND\", message: `Plugin not found: ${pluginId}` },\n\t\t\t};\n\t\t}\n\t\tconst enabled = await stateRepo.enable(pluginId, existing.version);\n\t\treturn { success: true, data: { item: buildStateOnlyPluginInfo(enabled) } };\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"PLUGIN_ENABLE_ERROR\",\n\t\t\t\tmessage: \"Failed to enable plugin\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Disable a plugin\n */\nexport async function handlePluginDisable(\n\tdb: Kysely<Database>,\n\tconfiguredPlugins: ResolvedPlugin[],\n\tsandboxedPluginEntries: SandboxedPluginEntry[],\n\tpluginId: string,\n): Promise<ApiResult<PluginResponse>> {\n\ttry {\n\t\tconst stateRepo = new PluginStateRepository(db);\n\t\tconst plugin = configuredPlugins.find((p) => p.id === pluginId);\n\n\t\tif (plugin) {\n\t\t\tconst state = await stateRepo.disable(pluginId, plugin.version);\n\t\t\treturn { success: true, data: { item: buildPluginInfo(plugin, state) } };\n\t\t}\n\n\t\tconst sandboxed = sandboxedPluginEntries.find((e) => e.id === pluginId);\n\t\tif (sandboxed) {\n\t\t\tconst state = await stateRepo.disable(pluginId, sandboxed.version);\n\t\t\treturn { success: true, data: { item: buildSandboxedPluginInfo(sandboxed, state) } };\n\t\t}\n\n\t\tconst existing = await stateRepo.get(pluginId);\n\t\tif (!existing || (existing.source !== \"marketplace\" && existing.source !== \"registry\")) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"NOT_FOUND\", message: `Plugin not found: ${pluginId}` },\n\t\t\t};\n\t\t}\n\t\tconst disabled = await stateRepo.disable(pluginId, existing.version);\n\t\treturn { success: true, data: { item: buildStateOnlyPluginInfo(disabled) } };\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"PLUGIN_DISABLE_ERROR\",\n\t\t\t\tmessage: \"Failed to disable plugin\",\n\t\t\t},\n\t\t};\n\t}\n}\n","/**\n * Plugin settings handlers\n *\n * Auto-generated settings UI backend for plugins that declare\n * `admin.settingsSchema`. Values are stored in the options table under\n * `plugin:{pluginId}:settings:{key}` — the same keys the plugin itself\n * reads via `ctx.kv.get(\"settings:{key}\")`.\n */\n\nimport type { Kysely } from \"kysely\";\n\nimport { OptionsRepository } from \"../../database/repositories/options.js\";\nimport { withTransaction } from \"../../database/transaction.js\";\nimport type { Database } from \"../../database/types.js\";\nimport type { SandboxedPluginEntry } from \"../../emdash-runtime.js\";\nimport type { ResolvedPlugin, SettingField } from \"../../plugins/types.js\";\nimport { ErrorCode } from \"../errors.js\";\nimport type { ApiResult } from \"../types.js\";\n\nexport interface PluginSettingsResponse {\n\t/** The plugin's declared settings schema, keyed by setting name */\n\tschema: Record<string, SettingField>;\n\t/**\n\t * Current values keyed by setting name. Secret fields are never\n\t * included here — check `secretsSet` instead.\n\t */\n\tvalues: Record<string, unknown>;\n\t/** For secret fields: whether a value is currently stored */\n\tsecretsSet: Record<string, boolean>;\n}\n\nfunction settingsKey(pluginId: string, key: string): string {\n\treturn `plugin:${pluginId}:settings:${key}`;\n}\n\n/**\n * Resolve a plugin's settings schema from either the configured\n * (in-process) plugin list or the statically-sandboxed entries.\n * Returns null when the plugin doesn't exist, undefined-equivalent\n * empty object when it declares no schema.\n */\nexport function getPluginSettingsSchema(\n\tconfiguredPlugins: ResolvedPlugin[],\n\tsandboxedPluginEntries: SandboxedPluginEntry[],\n\tpluginId: string,\n): Record<string, SettingField> | null {\n\tconst plugin = configuredPlugins.find((p) => p.id === pluginId);\n\tif (plugin) return plugin.admin.settingsSchema ?? {};\n\n\tconst sandboxed = sandboxedPluginEntries.find((e) => e.id === pluginId);\n\tif (sandboxed) return sandboxed.settingsSchema ?? {};\n\n\treturn null;\n}\n\n/**\n * Validate a single value against its schema field.\n * Returns an error message, or null when valid.\n */\nfunction validateValue(key: string, field: SettingField, value: unknown): string | null {\n\tswitch (field.type) {\n\t\tcase \"string\":\n\t\tcase \"secret\":\n\t\tcase \"url\":\n\t\tcase \"email\":\n\t\t\tif (typeof value !== \"string\") return `Setting \"${key}\" must be a string`;\n\t\t\tif (field.type === \"url\" && value !== \"\" && !URL.canParse(value)) {\n\t\t\t\treturn `Setting \"${key}\" must be a valid URL`;\n\t\t\t}\n\t\t\tif (field.type === \"email\" && value !== \"\" && !value.includes(\"@\")) {\n\t\t\t\treturn `Setting \"${key}\" must be a valid email address`;\n\t\t\t}\n\t\t\treturn null;\n\t\tcase \"number\": {\n\t\t\tif (typeof value !== \"number\" || Number.isNaN(value)) {\n\t\t\t\treturn `Setting \"${key}\" must be a number`;\n\t\t\t}\n\t\t\tif (field.min !== undefined && value < field.min) {\n\t\t\t\treturn `Setting \"${key}\" must be at least ${field.min}`;\n\t\t\t}\n\t\t\tif (field.max !== undefined && value > field.max) {\n\t\t\t\treturn `Setting \"${key}\" must be at most ${field.max}`;\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t\tcase \"boolean\":\n\t\t\treturn typeof value === \"boolean\" ? null : `Setting \"${key}\" must be a boolean`;\n\t\tcase \"select\":\n\t\t\tif (typeof value !== \"string\" || !field.options.some((o) => o.value === value)) {\n\t\t\t\treturn `Setting \"${key}\" must be one of the defined options`;\n\t\t\t}\n\t\t\treturn null;\n\t\tdefault: {\n\t\t\tconst _exhaustive: never = field;\n\t\t\treturn `Setting \"${key}\" has an unknown field type`;\n\t\t}\n\t}\n}\n\nasync function buildSettingsResponse(\n\toptionsRepo: OptionsRepository,\n\tpluginId: string,\n\tschema: Record<string, SettingField>,\n): Promise<PluginSettingsResponse> {\n\tconst keys = Object.keys(schema);\n\tconst stored = await optionsRepo.getMany(keys.map((key) => settingsKey(pluginId, key)));\n\n\tconst values: Record<string, unknown> = {};\n\tconst secretsSet: Record<string, boolean> = {};\n\n\tfor (const key of keys) {\n\t\tconst field = schema[key];\n\t\tif (!field) continue;\n\t\tconst storedValue = stored.get(settingsKey(pluginId, key));\n\n\t\tif (field.type === \"secret\") {\n\t\t\tsecretsSet[key] = typeof storedValue === \"string\" && storedValue.length > 0;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (storedValue !== undefined && storedValue !== null) {\n\t\t\tvalues[key] = storedValue;\n\t\t} else if (\"default\" in field && field.default !== undefined) {\n\t\t\tvalues[key] = field.default;\n\t\t} else {\n\t\t\tvalues[key] = null;\n\t\t}\n\t}\n\n\treturn { schema, values, secretsSet };\n}\n\n/**\n * Get a plugin's settings (schema + current values, secrets masked)\n */\nexport async function handlePluginSettingsGet(\n\tdb: Kysely<Database>,\n\tpluginId: string,\n\tschema: Record<string, SettingField>,\n): Promise<ApiResult<PluginSettingsResponse>> {\n\ttry {\n\t\tconst optionsRepo = new OptionsRepository(db);\n\t\treturn { success: true, data: await buildSettingsResponse(optionsRepo, pluginId, schema) };\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: ErrorCode.PLUGIN_SETTINGS_READ_ERROR,\n\t\t\t\tmessage: \"Failed to read plugin settings\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n/**\n * Update a plugin's settings.\n *\n * Only keys present in `updates` are written. A `null` value deletes the\n * stored value (reverting to the schema default). Secret fields are\n * write-only: they accept a new string value or `null` to clear, and the\n * response never echoes them back.\n */\nexport async function handlePluginSettingsUpdate(\n\tdb: Kysely<Database>,\n\tpluginId: string,\n\tschema: Record<string, SettingField>,\n\tupdates: Record<string, unknown>,\n): Promise<ApiResult<PluginSettingsResponse>> {\n\ttry {\n\t\t// Validate everything before writing anything.\n\t\tfor (const [key, value] of Object.entries(updates)) {\n\t\t\tconst field = schema[key];\n\t\t\tif (!field) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: ErrorCode.VALIDATION_ERROR,\n\t\t\t\t\t\tmessage: `Unknown setting \"${key}\" for plugin \"${pluginId}\"`,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (value === null) continue;\n\t\t\tconst error = validateValue(key, field, value);\n\t\t\tif (error) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: { code: ErrorCode.VALIDATION_ERROR, message: error },\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// Wrap the writes + read-back in a transaction so a partial failure\n\t\t// can't leave some settings updated and others not. On D1\n\t\t// withTransaction degrades to running the callback directly — D1 is\n\t\t// single-writer, so per-statement atomicity still holds.\n\t\tconst data = await withTransaction(db, async (trx) => {\n\t\t\tconst txRepo = new OptionsRepository(trx);\n\t\t\tfor (const [key, value] of Object.entries(updates)) {\n\t\t\t\tif (value === null) {\n\t\t\t\t\tawait txRepo.delete(settingsKey(pluginId, key));\n\t\t\t\t} else {\n\t\t\t\t\tawait txRepo.set(settingsKey(pluginId, key), value);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn buildSettingsResponse(txRepo, pluginId, schema);\n\t\t});\n\n\t\treturn { success: true, data };\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: ErrorCode.PLUGIN_SETTINGS_UPDATE_ERROR,\n\t\t\t\tmessage: \"Failed to update plugin settings\",\n\t\t\t},\n\t\t};\n\t}\n}\n","/**\n * MarketplaceClient — HTTP client for the EmDash Plugin Marketplace\n *\n * Used by the install/update/proxy endpoints in EmDash core to communicate\n * with the marketplace Worker. The marketplace is a distribution channel,\n * not a runtime dependency — bundles are copied to site-local R2 at install time.\n */\n\nimport { createGzipDecoder, unpackTar } from \"modern-tar\";\n\nimport { pluginManifestSchema, reconcileManifestAccess } from \"./manifest-schema.js\";\nimport type { PluginManifest } from \"./types.js\";\n\n// ── Module-level regex patterns ───────────────────────────────────\n\nconst TRAILING_SLASHES = /\\/+$/;\nconst LEADING_DOT_SLASH = /^\\.\\//;\n\n// ── Types ──────────────────────────────────────────────────────────\n\nexport interface MarketplacePluginSummary {\n\tid: string;\n\tname: string;\n\tdescription: string | null;\n\tauthor: {\n\t\tname: string;\n\t\tverified: boolean;\n\t\tavatarUrl: string | null;\n\t};\n\tcapabilities: string[];\n\tkeywords: string[];\n\tinstallCount: number;\n\thasIcon: boolean;\n\ticonUrl: string;\n\tlatestVersion?: {\n\t\tversion: string;\n\t\taudit?: {\n\t\t\tverdict: string;\n\t\t\triskScore: number;\n\t\t};\n\t\timageAudit?: {\n\t\t\tverdict: string;\n\t\t};\n\t};\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface MarketplaceVersionSummary {\n\tversion: string;\n\tminEmDashVersion: string | null;\n\tbundleSize: number;\n\tchecksum: string;\n\tchangelog: string | null;\n\tcapabilities: string[];\n\tstatus: string;\n\tauditVerdict: string | null;\n\timageAuditVerdict: string | null;\n\tpublishedAt: string;\n}\n\nexport interface MarketplacePluginDetail extends MarketplacePluginSummary {\n\trepositoryUrl: string | null;\n\thomepageUrl: string | null;\n\tlicense: string | null;\n\tlatestVersion?: {\n\t\tversion: string;\n\t\tminEmDashVersion: string | null;\n\t\tbundleSize: number;\n\t\tchecksum: string;\n\t\tchangelog: string | null;\n\t\treadme: string | null;\n\t\thasIcon: boolean;\n\t\tscreenshotCount: number;\n\t\tscreenshotUrls: string[];\n\t\tcapabilities: string[];\n\t\tstatus: string;\n\t\taudit?: {\n\t\t\tverdict: string;\n\t\t\triskScore: number;\n\t\t};\n\t\timageAudit?: {\n\t\t\tverdict: string;\n\t\t};\n\t\tpublishedAt: string;\n\t};\n}\n\nexport interface MarketplaceSearchOpts {\n\tcategory?: string;\n\tcapability?: string;\n\tsort?: \"installs\" | \"updated\" | \"created\" | \"name\";\n\tcursor?: string;\n\tlimit?: number;\n}\n\nexport interface MarketplaceSearchResult {\n\titems: MarketplacePluginSummary[];\n\tnextCursor?: string;\n}\n\n// ── Theme types ───────────────────────────────────────────────────\n\nexport interface MarketplaceThemeSummary {\n\tid: string;\n\tname: string;\n\tdescription: string | null;\n\tauthor: {\n\t\tname: string;\n\t\tverified: boolean;\n\t\tavatarUrl: string | null;\n\t};\n\tkeywords: string[];\n\tpreviewUrl: string;\n\tdemoUrl: string | null;\n\thasThumbnail: boolean;\n\tthumbnailUrl: string | null;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface MarketplaceThemeDetail extends MarketplaceThemeSummary {\n\tauthor: {\n\t\tid: string;\n\t\tname: string;\n\t\tverified: boolean;\n\t\tavatarUrl: string | null;\n\t};\n\trepositoryUrl: string | null;\n\thomepageUrl: string | null;\n\tlicense: string | null;\n\tscreenshotCount: number;\n\tscreenshotUrls: string[];\n}\n\nexport interface MarketplaceThemeSearchOpts {\n\tkeyword?: string;\n\tsort?: \"name\" | \"created\" | \"updated\";\n\tcursor?: string;\n\tlimit?: number;\n}\n\nexport interface MarketplaceThemeSearchResult {\n\titems: MarketplaceThemeSummary[];\n\tnextCursor?: string;\n}\n\nexport interface PluginBundle {\n\tmanifest: PluginManifest;\n\tbackendCode: string;\n\tadminCode?: string;\n\tchecksum: string;\n}\n\n// ── Interface ──────────────────────────────────────────────────────\n\nexport interface MarketplaceClient {\n\t/** Search the marketplace catalog */\n\tsearch(query?: string, opts?: MarketplaceSearchOpts): Promise<MarketplaceSearchResult>;\n\n\t/** Get full plugin detail */\n\tgetPlugin(id: string): Promise<MarketplacePluginDetail>;\n\n\t/** Get version history for a plugin */\n\tgetVersions(id: string): Promise<MarketplaceVersionSummary[]>;\n\n\t/** Download and extract a plugin bundle */\n\tdownloadBundle(id: string, version: string): Promise<PluginBundle>;\n\n\t/** Fire-and-forget install stat (never throws) */\n\treportInstall(id: string, version: string): Promise<void>;\n\n\t/** Search theme listings */\n\tsearchThemes(\n\t\tquery?: string,\n\t\topts?: MarketplaceThemeSearchOpts,\n\t): Promise<MarketplaceThemeSearchResult>;\n\n\t/** Get full theme detail */\n\tgetTheme(id: string): Promise<MarketplaceThemeDetail>;\n}\n\n// ── Errors ─────────────────────────────────────────────────────────\n\nexport class MarketplaceError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic readonly status?: number,\n\t\tpublic readonly code?: string,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"MarketplaceError\";\n\t}\n}\n\nexport class MarketplaceUnavailableError extends MarketplaceError {\n\tconstructor(cause?: unknown) {\n\t\tsuper(\"Plugin marketplace is unavailable\", undefined, \"MARKETPLACE_UNAVAILABLE\");\n\t\tif (cause) this.cause = cause;\n\t}\n}\n\n// ── Implementation ─────────────────────────────────────────────────\n\nclass MarketplaceClientImpl implements MarketplaceClient {\n\tprivate readonly baseUrl: string;\n\tprivate readonly siteOrigin: string | undefined;\n\n\tconstructor(baseUrl: string, siteOrigin?: string) {\n\t\t// Strip trailing slash\n\t\tthis.baseUrl = baseUrl.replace(TRAILING_SLASHES, \"\");\n\t\tthis.siteOrigin = siteOrigin;\n\t}\n\n\tasync search(query?: string, opts?: MarketplaceSearchOpts): Promise<MarketplaceSearchResult> {\n\t\tconst params = new URLSearchParams();\n\t\tif (query) params.set(\"q\", query);\n\t\tif (opts?.category) params.set(\"category\", opts.category);\n\t\tif (opts?.capability) params.set(\"capability\", opts.capability);\n\t\tif (opts?.sort) params.set(\"sort\", opts.sort);\n\t\tif (opts?.cursor) params.set(\"cursor\", opts.cursor);\n\t\tif (opts?.limit) params.set(\"limit\", String(opts.limit));\n\n\t\tconst qs = params.toString();\n\t\tconst url = `${this.baseUrl}/api/v1/plugins${qs ? `?${qs}` : \"\"}`;\n\t\tconst data = await this.fetchJson<MarketplaceSearchResult>(url);\n\t\treturn data;\n\t}\n\n\tasync getPlugin(id: string): Promise<MarketplacePluginDetail> {\n\t\tconst url = `${this.baseUrl}/api/v1/plugins/${encodeURIComponent(id)}`;\n\t\treturn this.fetchJson<MarketplacePluginDetail>(url);\n\t}\n\n\tasync getVersions(id: string): Promise<MarketplaceVersionSummary[]> {\n\t\tconst url = `${this.baseUrl}/api/v1/plugins/${encodeURIComponent(id)}/versions`;\n\t\tconst data = await this.fetchJson<{ items: MarketplaceVersionSummary[] }>(url);\n\t\treturn data.items;\n\t}\n\n\tasync downloadBundle(id: string, version: string): Promise<PluginBundle> {\n\t\tconst bundleUrl = `${this.baseUrl}/api/v1/plugins/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}/bundle`;\n\n\t\tconst marketplaceOrigin = new URL(this.baseUrl).origin;\n\t\tconst MAX_REDIRECTS = 5;\n\t\tlet response: Response;\n\t\ttry {\n\t\t\tlet currentUrl = bundleUrl;\n\t\t\tresponse = await fetch(currentUrl, { redirect: \"manual\" });\n\n\t\t\t// Follow redirects manually, validating each target stays on the marketplace host\n\t\t\tfor (let i = 0; i < MAX_REDIRECTS; i++) {\n\t\t\t\tif (response.status < 300 || response.status >= 400) break;\n\n\t\t\t\tconst location = response.headers.get(\"location\");\n\t\t\t\tif (!location) break;\n\n\t\t\t\tconst target = new URL(location, currentUrl);\n\t\t\t\tif (target.origin !== marketplaceOrigin) {\n\t\t\t\t\tthrow new MarketplaceError(\n\t\t\t\t\t\t`Bundle download redirected to untrusted host: ${target.origin}`,\n\t\t\t\t\t\tresponse.status,\n\t\t\t\t\t\t\"BUNDLE_REDIRECT_UNTRUSTED\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcurrentUrl = target.href;\n\t\t\t\tresponse = await fetch(currentUrl, { redirect: \"manual\" });\n\t\t\t}\n\n\t\t\t// If still a redirect after MAX_REDIRECTS, fail explicitly\n\t\t\tif (response.status >= 300 && response.status < 400) {\n\t\t\t\tthrow new MarketplaceError(\n\t\t\t\t\t`Bundle download exceeded maximum redirects (${MAX_REDIRECTS})`,\n\t\t\t\t\tresponse.status,\n\t\t\t\t\t\"BUNDLE_TOO_MANY_REDIRECTS\",\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tif (err instanceof MarketplaceError) throw err;\n\t\t\tthrow new MarketplaceUnavailableError(err);\n\t\t}\n\n\t\tif (!response.ok) {\n\t\t\tthrow new MarketplaceError(\n\t\t\t\t`Failed to download bundle: ${response.status} ${response.statusText}`,\n\t\t\t\tresponse.status,\n\t\t\t\t\"BUNDLE_DOWNLOAD_FAILED\",\n\t\t\t);\n\t\t}\n\n\t\tconst tarballBytes = new Uint8Array(await response.arrayBuffer());\n\t\ttry {\n\t\t\treturn await extractBundle(tarballBytes);\n\t\t} catch (err) {\n\t\t\tif (err instanceof MarketplaceError) throw err;\n\t\t\tthrow new MarketplaceError(\n\t\t\t\t\"Failed to extract plugin bundle\",\n\t\t\t\tundefined,\n\t\t\t\t\"BUNDLE_EXTRACT_FAILED\",\n\t\t\t);\n\t\t}\n\t}\n\n\tasync reportInstall(id: string, version: string): Promise<void> {\n\t\t// Generate a stable site hash from the site origin (best-effort, non-identifying)\n\t\tconst siteHash = await generateSiteHash(this.siteOrigin);\n\t\tconst url = `${this.baseUrl}/api/v1/plugins/${encodeURIComponent(id)}/installs`;\n\n\t\ttry {\n\t\t\tawait fetch(url, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\t\tbody: JSON.stringify({ siteHash, version }),\n\t\t\t});\n\t\t} catch {\n\t\t\t// Fire-and-forget — never throw\n\t\t}\n\t}\n\n\tasync searchThemes(\n\t\tquery?: string,\n\t\topts?: MarketplaceThemeSearchOpts,\n\t): Promise<MarketplaceThemeSearchResult> {\n\t\tconst params = new URLSearchParams();\n\t\tif (query) params.set(\"q\", query);\n\t\tif (opts?.keyword) params.set(\"keyword\", opts.keyword);\n\t\tif (opts?.sort) params.set(\"sort\", opts.sort);\n\t\tif (opts?.cursor) params.set(\"cursor\", opts.cursor);\n\t\tif (opts?.limit) params.set(\"limit\", String(opts.limit));\n\n\t\tconst qs = params.toString();\n\t\tconst url = `${this.baseUrl}/api/v1/themes${qs ? `?${qs}` : \"\"}`;\n\t\treturn this.fetchJson<MarketplaceThemeSearchResult>(url);\n\t}\n\n\tasync getTheme(id: string): Promise<MarketplaceThemeDetail> {\n\t\tconst url = `${this.baseUrl}/api/v1/themes/${encodeURIComponent(id)}`;\n\t\treturn this.fetchJson<MarketplaceThemeDetail>(url);\n\t}\n\n\tprivate async fetchJson<T>(url: string): Promise<T> {\n\t\tlet response: Response;\n\t\ttry {\n\t\t\tresponse = await fetch(url, {\n\t\t\t\theaders: { Accept: \"application/json\" },\n\t\t\t});\n\t\t} catch (err) {\n\t\t\tthrow new MarketplaceUnavailableError(err);\n\t\t}\n\n\t\tif (!response.ok) {\n\t\t\tlet errorMessage = `Marketplace request failed: ${response.status}`;\n\t\t\ttry {\n\t\t\t\tconst body: { error?: string } = await response.json();\n\t\t\t\tif (body.error) errorMessage = body.error;\n\t\t\t} catch {\n\t\t\t\t// use default message\n\t\t\t}\n\t\t\tthrow new MarketplaceError(errorMessage, response.status);\n\t\t}\n\n\t\tconst data: T = await response.json();\n\t\treturn data;\n\t}\n}\n\n// ── Bundle extraction ──────────────────────────────────────────────\n\n/**\n * Extract manifest + code files from a tarball.\n *\n * The tarball is a gzipped tar archive containing:\n * - manifest.json\n * - backend.js\n * - admin.js (optional)\n *\n * We use a minimal tar parser since we only need to read a few small files.\n */\n/**\n * Exported so the experimental registry install handler can reuse the\n * same parse / validate / hash primitive. Despite the file name, this\n * function predates the marketplace-vs-registry split and is generic\n * over plugin bundle tarballs regardless of distribution channel.\n */\n// Aligns with RFC 0001 §\"Bundle size limits\" (256 KiB decompressed,\n// 20 files). Matches `MAX_BUNDLE_SIZE` in cli/commands/bundle-utils.ts\n// (the publish-side cap). We don't import that constant to keep this\n// runtime module independent of the CLI; the two values are\n// load-bearing identical and must stay in sync.\n//\n// Tar adds per-file headers (~512 bytes each) plus directory entries,\n// so the entry count cap is set comfortably above RFC's 20-file limit.\n// Going over either is a strong signal the bundle isn't a legitimate\n// sandboxed plugin.\nconst MAX_DECOMPRESSED_BUNDLE_BYTES = 256 * 1024;\nconst MAX_BUNDLE_TAR_ENTRIES = 32;\n\nexport async function extractBundle(tarballBytes: Uint8Array): Promise<PluginBundle> {\n\t// Decompress fully into memory first, then parse the tar.\n\t// Passing a pipeThrough() stream directly to unpackTar causes a backpressure\n\t// deadlock in workerd: the tar decoder's body-stream pull() needs more\n\t// decompressed data, but the upstream pipe is stalled waiting for the\n\t// decoder's writable side to drain — a circular dependency.\n\tconst decompressedStream = new ReadableStream<Uint8Array>({\n\t\tstart(controller) {\n\t\t\tcontroller.enqueue(tarballBytes);\n\t\t\tcontroller.close();\n\t\t},\n\t}).pipeThrough(createGzipDecoder());\n\n\t// Collect decompressed bytes with a hard cap. A gzip-bomb -- a small\n\t// tarball that decompresses to gigabytes -- otherwise exhausts\n\t// worker / Node memory before we know to reject it. The cap matches\n\t// RFC 0001's publish-time bundle size limit (MAX_DECOMPRESSED_BUNDLE_BYTES);\n\t// anything past that isn't a legitimate sandboxed plugin.\n\tconst reader = decompressedStream.getReader();\n\tconst chunks: Uint8Array[] = [];\n\tlet total = 0;\n\twhile (true) {\n\t\tconst { done, value } = await reader.read();\n\t\tif (done) break;\n\t\tif (!value) continue;\n\t\ttotal += value.byteLength;\n\t\tif (total > MAX_DECOMPRESSED_BUNDLE_BYTES) {\n\t\t\ttry {\n\t\t\t\tawait reader.cancel();\n\t\t\t} catch {\n\t\t\t\t// nothing to do\n\t\t\t}\n\t\t\tthrow new MarketplaceError(\n\t\t\t\t`Bundle decompressed size exceeds limit (${MAX_DECOMPRESSED_BUNDLE_BYTES} bytes)`,\n\t\t\t\tundefined,\n\t\t\t\t\"INVALID_BUNDLE\",\n\t\t\t);\n\t\t}\n\t\tchunks.push(value);\n\t}\n\tconst decompressedBytes = new Uint8Array(total);\n\t{\n\t\tlet offset = 0;\n\t\tfor (const chunk of chunks) {\n\t\t\tdecompressedBytes.set(chunk, offset);\n\t\t\toffset += chunk.byteLength;\n\t\t}\n\t}\n\n\tconst decompressed = new ReadableStream<Uint8Array>({\n\t\tstart(controller) {\n\t\t\tcontroller.enqueue(decompressedBytes);\n\t\t\tcontroller.close();\n\t\t},\n\t});\n\n\tconst entries = await unpackTar(decompressed);\n\tif (entries.length > MAX_BUNDLE_TAR_ENTRIES) {\n\t\tthrow new MarketplaceError(\n\t\t\t`Bundle has too many tar entries (${entries.length} > ${MAX_BUNDLE_TAR_ENTRIES})`,\n\t\t\tundefined,\n\t\t\t\"INVALID_BUNDLE\",\n\t\t);\n\t}\n\n\tconst decoder = new TextDecoder();\n\tconst files = new Map<string, string>();\n\tfor (const entry of entries) {\n\t\tif (entry.data && entry.header.type === \"file\") {\n\t\t\t// Strip leading ./ prefix that tar tools commonly add\n\t\t\tconst name = entry.header.name.replace(LEADING_DOT_SLASH, \"\");\n\t\t\tfiles.set(name, decoder.decode(entry.data));\n\t\t}\n\t}\n\n\tconst manifestJson = files.get(\"manifest.json\");\n\tconst backendCode = files.get(\"backend.js\");\n\n\tif (!manifestJson) {\n\t\tthrow new MarketplaceError(\n\t\t\t\"Invalid bundle: missing manifest.json\",\n\t\t\tundefined,\n\t\t\t\"INVALID_BUNDLE\",\n\t\t);\n\t}\n\tif (!backendCode) {\n\t\tthrow new MarketplaceError(\"Invalid bundle: missing backend.js\", undefined, \"INVALID_BUNDLE\");\n\t}\n\n\tlet manifest: PluginManifest;\n\ttry {\n\t\tconst parsed: unknown = JSON.parse(manifestJson);\n\t\tconst result = pluginManifestSchema.safeParse(parsed);\n\t\tif (!result.success) {\n\t\t\tthrow new MarketplaceError(\n\t\t\t\t\"Invalid bundle: manifest.json failed validation\",\n\t\t\t\tundefined,\n\t\t\t\t\"INVALID_BUNDLE\",\n\t\t\t);\n\t\t}\n\t\tmanifest = reconcileManifestAccess(result.data);\n\t} catch (err) {\n\t\tif (err instanceof MarketplaceError) throw err;\n\t\tthrow new MarketplaceError(\n\t\t\t\"Invalid bundle: malformed manifest.json\",\n\t\t\tundefined,\n\t\t\t\"INVALID_BUNDLE\",\n\t\t);\n\t}\n\n\t// Compute SHA-256 checksum of the tarball for verification\n\t// eslint-disable-next-line typescript/no-unsafe-type-assertion -- Uint8Array is a valid BufferSource at runtime; TS lib mismatch\n\tconst hashBuffer = await crypto.subtle.digest(\"SHA-256\", tarballBytes as unknown as BufferSource);\n\tconst hashArray = new Uint8Array(hashBuffer);\n\tconst checksum = Array.from(hashArray, (b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n\n\treturn {\n\t\tmanifest,\n\t\tbackendCode,\n\t\tadminCode: files.get(\"admin.js\"),\n\t\tchecksum,\n\t};\n}\n\n// ── Helpers ────────────────────────────────────────────────────────\n\n/**\n * Generate a stable non-identifying site hash from the site origin.\n * The same origin always produces the same hash, so the marketplace\n * installs table deduplicates correctly per (plugin_id, site_hash).\n */\nasync function generateSiteHash(siteOrigin?: string): Promise<string> {\n\tconst seed = siteOrigin ? `emdash-site:${siteOrigin}` : `emdash-anonymous`;\n\ttry {\n\t\tconst hash = await crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(seed));\n\t\tconst arr = new Uint8Array(hash);\n\t\treturn Array.from(arr.slice(0, 8), (b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n\t} catch {\n\t\t// Fallback for environments without crypto.subtle: FNV-1a hash encoded as hex.\n\t\t// Deterministic, uniform distribution, no origin leakage.\n\t\tlet h = 0x811c9dc5;\n\t\tfor (let i = 0; i < seed.length; i++) {\n\t\t\th ^= seed.charCodeAt(i);\n\t\t\th = Math.imul(h, 0x01000193);\n\t\t}\n\t\tconst h2 = h ^ (h >>> 16);\n\t\treturn (h >>> 0).toString(16).padStart(8, \"0\") + (h2 >>> 0).toString(16).padStart(8, \"0\");\n\t}\n}\n\n// ── Factory ────────────────────────────────────────────────────────\n\n/**\n * Create a MarketplaceClient for the given marketplace URL.\n *\n * @param baseUrl - The marketplace API base URL (e.g. \"https://marketplace.emdashcms.com\")\n * @param siteOrigin - The origin of the EmDash site (e.g. \"https://myblog.example.com\").\n * Used to generate a stable, non-identifying site hash for install deduplication.\n */\nexport function createMarketplaceClient(baseUrl: string, siteOrigin?: string): MarketplaceClient {\n\treturn new MarketplaceClientImpl(baseUrl, siteOrigin);\n}\n","/**\n * Plugin Storage Index Management\n *\n * Manages expression indexes on the _plugin_storage table for efficient queries.\n *\n * @see PLUGIN-SYSTEM.md § Plugin Storage > Index Management\n */\n\nimport type { Kysely, RawBuilder } from \"kysely\";\nimport { sql } from \"kysely\";\n\nimport { jsonExtractExpr, isPostgres } from \"../database/dialect-helpers.js\";\nimport type { Database } from \"../database/types.js\";\nimport {\n\tvalidateJsonFieldName,\n\tvalidatePluginIdentifier,\n\tvalidateStorageCollectionName,\n} from \"../database/validate.js\";\n\n/**\n * Generate a deterministic index name.\n * Unique indexes use a `uidx_` prefix to avoid collisions with regular indexes on the same fields.\n */\nexport function generateIndexName(\n\tpluginId: string,\n\tcollection: string,\n\tfields: string[],\n\toptions?: { unique?: boolean },\n): string {\n\tconst prefix = options?.unique ? \"uidx\" : \"idx\";\n\tconst fieldPart = fields.join(\"_\");\n\t// SQLite index names have no length limit, but keep it reasonable\n\treturn `${prefix}_plugin_${pluginId}_${collection}_${fieldPart}`.substring(0, 128);\n}\n\n/**\n * Generate a Kysely sql expression for creating an expression index.\n *\n * Validates all inputs before interpolation. The collection uses the\n * permissive manifest-key rules rather than SQL-identifier rules — it is\n * stored as opaque text and only reaches SQL inside the generated index\n * name — so kebab-case collections index like any other.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- accepts any Kysely instance\nexport function generateCreateIndexSql(\n\tdb: Kysely<any>,\n\tpluginId: string,\n\tcollection: string,\n\tfields: string[],\n\toptions?: { unique?: boolean },\n): RawBuilder<unknown> {\n\tvalidatePluginIdentifier(pluginId, \"plugin ID\");\n\tvalidateStorageCollectionName(collection, \"collection name\");\n\tfor (const field of fields) {\n\t\tvalidateJsonFieldName(field, \"index field name\");\n\t}\n\n\tconst indexName = generateIndexName(pluginId, collection, fields, options);\n\n\t// Build the indexed expressions\n\t// Fields are validated above, safe to interpolate into json path\n\tconst expressions = fields\n\t\t.map((field) => {\n\t\t\tif (isPostgres(db)) {\n\t\t\t\t// Postgres expression indexes need parens around the expression\n\t\t\t\treturn `(${jsonExtractExpr(db, \"data\", field)})`;\n\t\t\t}\n\t\t\treturn jsonExtractExpr(db, \"data\", field);\n\t\t})\n\t\t.join(\", \");\n\n\t// Composite non-partial index: the leading (plugin_id, collection) columns\n\t// scope it per plugin/collection — including unique-index semantics — and\n\t// let it serve the repository's bound-parameter WHERE plus the JSON\n\t// expression ORDER BY. A partial index (WHERE plugin_id = 'x' AND\n\t// collection = 'y') is never chosen by SQLite under bound parameters\n\t// unless ANALYZE has run, and D1 never runs ANALYZE.\n\tconst createKeyword = options?.unique ? \"CREATE UNIQUE INDEX\" : \"CREATE INDEX\";\n\treturn sql`${sql.raw(createKeyword)} IF NOT EXISTS ${sql.ref(indexName)}\n\t\tON _plugin_storage(plugin_id, collection, ${sql.raw(expressions)})\n\t`;\n}\n\n/**\n * Generate a Kysely sql expression for dropping an index.\n *\n * Uses sql.ref() for safe identifier quoting.\n */\nexport function generateDropIndexSql(indexName: string): RawBuilder<unknown> {\n\treturn sql`DROP INDEX IF EXISTS ${sql.ref(indexName)}`;\n}\n\n/**\n * Normalize index declarations to arrays of field arrays\n */\nexport function normalizeIndexes(indexes: Array<string | string[]>): string[][] {\n\treturn indexes.map((index) => (Array.isArray(index) ? index : [index]));\n}\n\n/**\n * Create all declared indexes for a plugin collection\n */\nexport async function createStorageIndexes(\n\tdb: Kysely<Database>,\n\tpluginId: string,\n\tcollection: string,\n\tindexes: Array<string | string[]>,\n\toptions?: { uniqueIndexes?: Array<string | string[]> },\n): Promise<{\n\tcreated: string[];\n\terrors: Array<{ index: string; error: string }>;\n}> {\n\tconst normalized = normalizeIndexes(indexes);\n\tconst uniqueNormalized = options?.uniqueIndexes ? normalizeIndexes(options.uniqueIndexes) : [];\n\tconst uniqueSet = new Set(uniqueNormalized.map((f) => f.join(\",\")));\n\n\t// Deduplicate: if fields appear in both indexes and uniqueIndexes, only create the unique version\n\tconst deduped = normalized.filter((f) => !uniqueSet.has(f.join(\",\")));\n\tconst allEntries: Array<{ fields: string[]; unique: boolean }> = [\n\t\t...deduped.map((fields) => ({ fields, unique: false })),\n\t\t...uniqueNormalized.map((fields) => ({ fields, unique: true })),\n\t];\n\n\tconst created: string[] = [];\n\tconst errors: Array<{ index: string; error: string }> = [];\n\n\tfor (const entry of allEntries) {\n\t\tconst { fields } = entry;\n\t\tconst indexName = generateIndexName(pluginId, collection, fields, { unique: entry.unique });\n\n\t\ttry {\n\t\t\t// Create the index\n\t\t\tconst createSql = generateCreateIndexSql(db, pluginId, collection, fields, {\n\t\t\t\tunique: entry.unique,\n\t\t\t});\n\t\t\tawait createSql.execute(db);\n\n\t\t\t// Track in _plugin_indexes table\n\t\t\tawait db\n\t\t\t\t.insertInto(\"_plugin_indexes\")\n\t\t\t\t.values({\n\t\t\t\t\tplugin_id: pluginId,\n\t\t\t\t\tcollection,\n\t\t\t\t\tindex_name: indexName,\n\t\t\t\t\tfields: JSON.stringify(fields),\n\t\t\t\t})\n\t\t\t\t.onConflict((oc) =>\n\t\t\t\t\toc\n\t\t\t\t\t\t.columns([\"plugin_id\", \"collection\", \"index_name\"])\n\t\t\t\t\t\t.doUpdateSet({ fields: JSON.stringify(fields) }),\n\t\t\t\t)\n\t\t\t\t.execute();\n\n\t\t\tcreated.push(indexName);\n\t\t} catch (error) {\n\t\t\terrors.push({\n\t\t\t\tindex: indexName,\n\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t});\n\t\t}\n\t}\n\n\treturn { created, errors };\n}\n\n/**\n * Remove indexes that are no longer declared\n */\nexport async function removeOrphanedIndexes(\n\tdb: Kysely<Database>,\n\tpluginId: string,\n\tcollection: string,\n\tcurrentIndexes: Array<string | string[]>,\n\toptions?: { uniqueIndexes?: Array<string | string[]> },\n): Promise<{\n\tremoved: string[];\n\terrors: Array<{ index: string; error: string }>;\n}> {\n\tconst normalized = normalizeIndexes(currentIndexes);\n\tconst uniqueNormalized = options?.uniqueIndexes ? normalizeIndexes(options.uniqueIndexes) : [];\n\tconst uniqueSet = new Set(uniqueNormalized.map((f) => f.join(\",\")));\n\n\t// Build the set of expected index names (regular + unique with correct prefix)\n\tconst currentIndexNames = new Set<string>();\n\tfor (const fields of normalized) {\n\t\t// If this field set is in both, only the unique version exists (deduplication in create)\n\t\tif (!uniqueSet.has(fields.join(\",\"))) {\n\t\t\tcurrentIndexNames.add(generateIndexName(pluginId, collection, fields));\n\t\t}\n\t}\n\tfor (const fields of uniqueNormalized) {\n\t\tcurrentIndexNames.add(generateIndexName(pluginId, collection, fields, { unique: true }));\n\t}\n\n\t// Get existing indexes from tracking table\n\tconst existingIndexes = await db\n\t\t.selectFrom(\"_plugin_indexes\")\n\t\t.select([\"index_name\"])\n\t\t.where(\"plugin_id\", \"=\", pluginId)\n\t\t.where(\"collection\", \"=\", collection)\n\t\t.execute();\n\n\tconst removed: string[] = [];\n\tconst errors: Array<{ index: string; error: string }> = [];\n\n\tfor (const { index_name } of existingIndexes) {\n\t\tif (!currentIndexNames.has(index_name)) {\n\t\t\ttry {\n\t\t\t\t// Drop the index\n\t\t\t\tawait generateDropIndexSql(index_name).execute(db);\n\n\t\t\t\t// Remove from tracking table\n\t\t\t\tawait db\n\t\t\t\t\t.deleteFrom(\"_plugin_indexes\")\n\t\t\t\t\t.where(\"plugin_id\", \"=\", pluginId)\n\t\t\t\t\t.where(\"collection\", \"=\", collection)\n\t\t\t\t\t.where(\"index_name\", \"=\", index_name)\n\t\t\t\t\t.execute();\n\n\t\t\t\tremoved.push(index_name);\n\t\t\t} catch (error) {\n\t\t\t\terrors.push({\n\t\t\t\t\tindex: index_name,\n\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { removed, errors };\n}\n\n/**\n * Sync indexes for a plugin collection (create new, remove old)\n */\nexport async function syncStorageIndexes(\n\tdb: Kysely<Database>,\n\tpluginId: string,\n\tcollection: string,\n\tindexes: Array<string | string[]>,\n\toptions?: { uniqueIndexes?: Array<string | string[]> },\n): Promise<{\n\tcreated: string[];\n\tremoved: string[];\n\terrors: Array<{ index: string; error: string }>;\n}> {\n\tconst [createResult, removeResult] = await Promise.all([\n\t\tcreateStorageIndexes(db, pluginId, collection, indexes, options),\n\t\tremoveOrphanedIndexes(db, pluginId, collection, indexes, options),\n\t]);\n\n\treturn {\n\t\tcreated: createResult.created,\n\t\tremoved: removeResult.removed,\n\t\terrors: [...createResult.errors, ...removeResult.errors],\n\t};\n}\n\n/**\n * Materialize the storage indexes a set of plugins declare in their\n * manifests. Failures are logged per collection and never thrown — a missing\n * index affects query performance, not correctness, so it must not fail an\n * install or a scheduler tick.\n */\nexport async function syncDeclaredStorageIndexes(\n\tdb: Kysely<Database>,\n\tplugins: Array<{\n\t\tid: string;\n\t\tstorage?: Record<\n\t\t\tstring,\n\t\t\t{ indexes: Array<string | string[]>; uniqueIndexes?: Array<string | string[]> }\n\t\t>;\n\t}>,\n): Promise<void> {\n\tfor (const plugin of plugins) {\n\t\tfor (const [collection, config] of Object.entries(plugin.storage ?? {})) {\n\t\t\ttry {\n\t\t\t\tconst result = await syncStorageIndexes(db, plugin.id, collection, config.indexes, {\n\t\t\t\t\tuniqueIndexes: config.uniqueIndexes,\n\t\t\t\t});\n\t\t\t\tfor (const failure of result.errors) {\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t`[plugins] Failed to sync storage index ${failure.index} for ${plugin.id}/${collection}: ${failure.error}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[plugins] Failed to sync storage indexes for ${plugin.id}/${collection}:`,\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Remove all indexes for a plugin\n */\nexport async function removeAllPluginIndexes(\n\tdb: Kysely<Database>,\n\tpluginId: string,\n): Promise<{\n\tremoved: string[];\n\terrors: Array<{ index: string; error: string }>;\n}> {\n\tconst existingIndexes = await db\n\t\t.selectFrom(\"_plugin_indexes\")\n\t\t.select([\"index_name\", \"collection\"])\n\t\t.where(\"plugin_id\", \"=\", pluginId)\n\t\t.execute();\n\n\tconst removed: string[] = [];\n\tconst errors: Array<{ index: string; error: string }> = [];\n\n\tfor (const { index_name } of existingIndexes) {\n\t\ttry {\n\t\t\tawait generateDropIndexSql(index_name).execute(db);\n\t\t\tremoved.push(index_name);\n\t\t} catch (error) {\n\t\t\terrors.push({\n\t\t\t\tindex: index_name,\n\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t});\n\t\t}\n\t}\n\n\t// Clean up tracking table\n\tawait db.deleteFrom(\"_plugin_indexes\").where(\"plugin_id\", \"=\", pluginId).execute();\n\n\treturn { removed, errors };\n}\n\n/**\n * Get current index status for a plugin\n */\nexport async function getPluginIndexStatus(\n\tdb: Kysely<Database>,\n\tpluginId: string,\n): Promise<\n\tArray<{\n\t\tcollection: string;\n\t\tindexName: string;\n\t\tfields: string[];\n\t\tcreatedAt: string;\n\t}>\n> {\n\tconst rows = await db\n\t\t.selectFrom(\"_plugin_indexes\")\n\t\t.select([\"collection\", \"index_name\", \"fields\", \"created_at\"])\n\t\t.where(\"plugin_id\", \"=\", pluginId)\n\t\t.execute();\n\n\treturn rows.map((row) => {\n\t\tconst parsed: unknown = JSON.parse(row.fields);\n\t\tconst fields = Array.isArray(parsed)\n\t\t\t? parsed.filter((f): f is string => typeof f === \"string\")\n\t\t\t: [];\n\t\treturn {\n\t\t\tcollection: row.collection,\n\t\t\tindexName: row.index_name,\n\t\t\tfields,\n\t\t\tcreatedAt: row.created_at,\n\t\t};\n\t});\n}\n","/**\n * Marketplace plugin handlers\n *\n * Business logic for installing, updating, uninstalling, and checking\n * updates for marketplace plugins. Routes are thin wrappers around these.\n */\n\nimport type { Kysely } from \"kysely\";\n\nimport type { Database } from \"../../database/types.js\";\nimport { validatePluginIdentifier } from \"../../database/validate.js\";\nimport { pluginManifestSchema, reconcileManifestAccess } from \"../../plugins/manifest-schema.js\";\nimport { normalizeManifestRoute } from \"../../plugins/manifest-schema.js\";\nimport {\n\tcreateMarketplaceClient,\n\tMarketplaceError,\n\tMarketplaceUnavailableError,\n\ttype MarketplaceClient,\n\ttype MarketplacePluginDetail,\n\ttype MarketplaceSearchOpts,\n\ttype MarketplaceThemeSearchOpts,\n\ttype MarketplaceVersionSummary,\n\ttype PluginBundle,\n} from \"../../plugins/marketplace.js\";\nimport type { SandboxRunner } from \"../../plugins/sandbox/types.js\";\nimport { PluginStateRepository } from \"../../plugins/state.js\";\nimport {\n\tremoveAllPluginIndexes,\n\tsyncDeclaredStorageIndexes,\n} from \"../../plugins/storage-indexes.js\";\nimport { normalizeCapabilities } from \"../../plugins/types.js\";\nimport type { PluginManifest } from \"../../plugins/types.js\";\nimport { EmDashStorageError } from \"../../storage/types.js\";\nimport type { Storage } from \"../../storage/types.js\";\nimport type { ApiResult } from \"../types.js\";\n\n// ── Types ──────────────────────────────────────────────────────────\n\nexport interface MarketplaceInstallResult {\n\tpluginId: string;\n\tversion: string;\n\tcapabilities: string[];\n}\n\nexport interface MarketplaceUpdateResult {\n\tpluginId: string;\n\toldVersion: string;\n\tnewVersion: string;\n\tcapabilityChanges: {\n\t\tadded: string[];\n\t\tremoved: string[];\n\t};\n\trouteVisibilityChanges?: {\n\t\tnewlyPublic: string[];\n\t};\n}\n\nexport interface MarketplaceUpdateCheck {\n\tpluginId: string;\n\tinstalled: string;\n\tlatest: string;\n\thasUpdate: boolean;\n\thasCapabilityChanges: boolean;\n\tcapabilityChanges?: {\n\t\tadded: string[];\n\t\tremoved: string[];\n\t};\n\thasRouteVisibilityChanges: boolean;\n\trouteVisibilityChanges?: {\n\t\tnewlyPublic: string[];\n\t};\n}\n\nexport interface MarketplaceUninstallResult {\n\tpluginId: string;\n\tdataDeleted: boolean;\n}\n\n// ── Helpers ────────────────────────────────────────────────────────\n\n/** Semver-like pattern: digits, dots, hyphens, plus signs (e.g. 1.0.0, 1.0.0-beta.1) */\nconst VERSION_PATTERN = /^[a-z0-9][a-z0-9._+-]*$/i;\n\nfunction validateVersion(version: string): void {\n\tif (version.includes(\"..\")) throw new Error(\"Invalid version format\");\n\tif (!VERSION_PATTERN.test(version)) {\n\t\tthrow new Error(\"Invalid version format\");\n\t}\n}\n\nfunction getClient(\n\tmarketplaceUrl: string | undefined,\n\tsiteOrigin?: string,\n): MarketplaceClient | null {\n\tif (!marketplaceUrl) return null;\n\treturn createMarketplaceClient(marketplaceUrl, siteOrigin);\n}\n\nexport function diffCapabilities(\n\toldCaps: string[],\n\tnewCaps: string[],\n): { added: string[]; removed: string[] } {\n\t// Normalize both sides before diffing so that an installed v1 manifest\n\t// declaring `read:content` and an upgrade v2 manifest declaring\n\t// `content:read` produces an empty diff — users should not see a\n\t// spurious \"capability changed\" prompt for a pure rename.\n\tconst oldNorm = normalizeCapabilities(oldCaps);\n\tconst newNorm = normalizeCapabilities(newCaps);\n\tconst oldSet = new Set(oldNorm);\n\tconst newSet = new Set(newNorm);\n\treturn {\n\t\tadded: newNorm.filter((c) => !oldSet.has(c)),\n\t\tremoved: oldNorm.filter((c) => !newSet.has(c)),\n\t};\n}\n\n/**\n * Diff route visibility between two manifests.\n * Returns routes that changed from private to public (newly exposed).\n */\nexport function diffRouteVisibility(\n\toldManifest: PluginManifest | undefined,\n\tnewManifest: PluginManifest,\n): { newlyPublic: string[] } {\n\tconst oldPublicRoutes = new Set<string>();\n\tif (oldManifest) {\n\t\tfor (const entry of oldManifest.routes) {\n\t\t\tconst normalized = normalizeManifestRoute(entry);\n\t\t\tif (normalized.public === true) {\n\t\t\t\toldPublicRoutes.add(normalized.name);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst newlyPublic: string[] = [];\n\tfor (const entry of newManifest.routes) {\n\t\tconst normalized = normalizeManifestRoute(entry);\n\t\tif (normalized.public === true && !oldPublicRoutes.has(normalized.name)) {\n\t\t\tnewlyPublic.push(normalized.name);\n\t\t}\n\t}\n\n\treturn { newlyPublic };\n}\n\nasync function resolveVersionMetadata(\n\tclient: MarketplaceClient,\n\tpluginId: string,\n\tpluginDetail: MarketplacePluginDetail,\n\tversion: string,\n): Promise<MarketplaceVersionSummary | null> {\n\tif (pluginDetail.latestVersion?.version === version) {\n\t\treturn {\n\t\t\tversion: pluginDetail.latestVersion.version,\n\t\t\tminEmDashVersion: pluginDetail.latestVersion.minEmDashVersion,\n\t\t\tbundleSize: pluginDetail.latestVersion.bundleSize,\n\t\t\tchecksum: pluginDetail.latestVersion.checksum,\n\t\t\tchangelog: pluginDetail.latestVersion.changelog,\n\t\t\tcapabilities: pluginDetail.latestVersion.capabilities,\n\t\t\tstatus: pluginDetail.latestVersion.status,\n\t\t\tauditVerdict: pluginDetail.latestVersion.audit?.verdict ?? null,\n\t\t\timageAuditVerdict: pluginDetail.latestVersion.imageAudit?.verdict ?? null,\n\t\t\tpublishedAt: pluginDetail.latestVersion.publishedAt,\n\t\t};\n\t}\n\n\tconst versions = await client.getVersions(pluginId);\n\treturn versions.find((v) => v.version === version) ?? null;\n}\n\nfunction validateBundleIdentity(\n\tbundle: PluginBundle,\n\tpluginId: string,\n\tversion: string,\n): ApiResult<never> | null {\n\tif (bundle.manifest.id !== pluginId) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"MANIFEST_MISMATCH\",\n\t\t\t\tmessage: `Bundle manifest ID (${bundle.manifest.id}) does not match requested plugin (${pluginId})`,\n\t\t\t},\n\t\t};\n\t}\n\n\tif (bundle.manifest.version !== version) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"MANIFEST_VERSION_MISMATCH\",\n\t\t\t\tmessage: `Bundle manifest version (${bundle.manifest.version}) does not match requested version (${version})`,\n\t\t\t},\n\t\t};\n\t}\n\n\treturn null;\n}\n\n/** Store a plugin bundle's files in site-local R2 storage */\n/**\n * Storage source for an installed plugin bundle. Determines the R2\n * key prefix and is used to keep marketplace and registry installs\n * cleanly separated in object listings.\n */\nexport type PluginBundleSource = \"marketplace\" | \"registry\";\n\nfunction bundlePrefix(source: PluginBundleSource, pluginId: string, version: string): string {\n\treturn `${source}/${pluginId}/${version}`;\n}\n\nexport async function storeBundleInR2(\n\tstorage: Storage,\n\tpluginId: string,\n\tversion: string,\n\tbundle: PluginBundle,\n\tsource: PluginBundleSource = \"marketplace\",\n): Promise<void> {\n\tvalidatePluginIdentifier(pluginId, \"plugin ID\");\n\tvalidateVersion(version);\n\tconst prefix = bundlePrefix(source, pluginId, version);\n\n\t// Store manifest\n\tawait storage.upload({\n\t\tkey: `${prefix}/manifest.json`,\n\t\tbody: new TextEncoder().encode(JSON.stringify(bundle.manifest)),\n\t\tcontentType: \"application/json\",\n\t});\n\n\t// Store backend code\n\tawait storage.upload({\n\t\tkey: `${prefix}/backend.js`,\n\t\tbody: new TextEncoder().encode(bundle.backendCode),\n\t\tcontentType: \"application/javascript\",\n\t});\n\n\t// Store admin code if present\n\tif (bundle.adminCode) {\n\t\tawait storage.upload({\n\t\t\tkey: `${prefix}/admin.js`,\n\t\t\tbody: new TextEncoder().encode(bundle.adminCode),\n\t\t\tcontentType: \"application/javascript\",\n\t\t});\n\t}\n}\n\n/** Read a ReadableStream to string */\nasync function streamToText(stream: ReadableStream<Uint8Array>): Promise<string> {\n\treturn new Response(stream).text();\n}\n\n/**\n * Load a plugin bundle from site-local R2 storage.\n *\n * `source` selects the R2 key prefix: marketplace plugins are stored\n * under `marketplace/<id>/<version>/`, registry plugins under\n * `registry/<id>/<version>/`. Defaults to `\"marketplace\"` for\n * backwards compatibility with pre-registry call sites.\n */\nexport async function loadBundleFromR2(\n\tstorage: Storage,\n\tpluginId: string,\n\tversion: string,\n\tsource: PluginBundleSource = \"marketplace\",\n): Promise<{ manifest: PluginManifest; backendCode: string; adminCode?: string } | null> {\n\tvalidatePluginIdentifier(pluginId, \"plugin ID\");\n\tvalidateVersion(version);\n\tconst prefix = bundlePrefix(source, pluginId, version);\n\n\ttry {\n\t\tconst manifestResult = await storage.download(`${prefix}/manifest.json`);\n\t\tconst backendResult = await storage.download(`${prefix}/backend.js`);\n\n\t\tconst manifestText = await streamToText(manifestResult.body);\n\t\tconst backendCode = await streamToText(backendResult.body);\n\t\tconst parsed: unknown = JSON.parse(manifestText);\n\t\tconst result = pluginManifestSchema.safeParse(parsed);\n\t\tif (!result.success) return null;\n\t\tconst manifest = reconcileManifestAccess(result.data);\n\n\t\t// Try to load admin code (optional)\n\t\tlet adminCode: string | undefined;\n\t\ttry {\n\t\t\tconst adminResult = await storage.download(`${prefix}/admin.js`);\n\t\t\tadminCode = await streamToText(adminResult.body);\n\t\t} catch {\n\t\t\t// admin.js is optional\n\t\t}\n\n\t\treturn { manifest, backendCode, adminCode };\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/** Delete a plugin bundle from site-local R2 storage */\nexport async function deleteBundleFromR2(\n\tstorage: Storage,\n\tpluginId: string,\n\tversion: string,\n\tsource: PluginBundleSource = \"marketplace\",\n): Promise<void> {\n\tvalidatePluginIdentifier(pluginId, \"plugin ID\");\n\tvalidateVersion(version);\n\tconst prefix = bundlePrefix(source, pluginId, version);\n\tconst files = [\"manifest.json\", \"backend.js\", \"admin.js\"];\n\n\tfor (const file of files) {\n\t\ttry {\n\t\t\tawait storage.delete(`${prefix}/${file}`);\n\t\t} catch {\n\t\t\t// Ignore missing files\n\t\t}\n\t}\n}\n\n// ── Install ────────────────────────────────────────────────────────\n\nexport async function handleMarketplaceInstall(\n\tdb: Kysely<Database>,\n\tstorage: Storage | null,\n\tsandboxRunner: SandboxRunner | null,\n\tmarketplaceUrl: string | undefined,\n\tpluginId: string,\n\topts?: {\n\t\tversion?: string;\n\t\tconfiguredPluginIds?: Set<string>;\n\t\tsiteOrigin?: string;\n\t\t/**\n\t\t * When true, sandbox: false bypass mode is active. The sandbox runner\n\t\t * is the noop runner (isAvailable() === false) but the runtime will\n\t\t * load the marketplace plugin in-process via syncMarketplacePlugins().\n\t\t * Skip the SANDBOX_NOT_AVAILABLE gate so the install can proceed.\n\t\t */\n\t\tsandboxBypassed?: boolean;\n\t\tconfirmMcpTools?: boolean;\n\t},\n): Promise<ApiResult<MarketplaceInstallResult>> {\n\tconst client = getClient(marketplaceUrl, opts?.siteOrigin);\n\tif (!client) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"MARKETPLACE_NOT_CONFIGURED\",\n\t\t\t\tmessage: \"Marketplace is not configured\",\n\t\t\t},\n\t\t};\n\t}\n\n\tif (!storage) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"STORAGE_NOT_CONFIGURED\",\n\t\t\t\tmessage: \"Storage is required for marketplace plugin installation\",\n\t\t\t},\n\t\t};\n\t}\n\n\t// Sandbox availability check: skip when sandbox: false bypass is active.\n\t// The runtime's syncMarketplacePlugins() will load the plugin in-process.\n\tif (!opts?.sandboxBypassed && (!sandboxRunner || !sandboxRunner.isAvailable())) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"SANDBOX_NOT_AVAILABLE\",\n\t\t\t\tmessage: \"Sandbox runner is required for marketplace plugins\",\n\t\t\t},\n\t\t};\n\t}\n\n\ttry {\n\t\t// Check if already installed\n\t\tconst stateRepo = new PluginStateRepository(db);\n\t\tconst existing = await stateRepo.get(pluginId);\n\t\tif (existing && existing.source === \"marketplace\") {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"ALREADY_INSTALLED\",\n\t\t\t\t\tmessage: `Plugin ${pluginId} is already installed`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Block installation if a configured (trusted) plugin with the same ID exists.\n\t\t// Without this check, the sandboxed plugin could shadow the trusted plugin's\n\t\t// route handlers while auth decisions are made against the trusted plugin's metadata.\n\t\tif (opts?.configuredPluginIds?.has(pluginId)) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"PLUGIN_ID_CONFLICT\",\n\t\t\t\t\tmessage: `Cannot install marketplace plugin \"${pluginId}\" — a configured plugin with the same ID already exists`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Fetch plugin detail from marketplace\n\t\tconst pluginDetail = await client.getPlugin(pluginId);\n\t\tconst version = opts?.version ?? pluginDetail.latestVersion?.version;\n\t\tif (!version) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NO_VERSION\",\n\t\t\t\t\tmessage: `No published versions found for plugin ${pluginId}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst versionMetadata = await resolveVersionMetadata(client, pluginId, pluginDetail, version);\n\t\tif (!versionMetadata) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NO_VERSION\",\n\t\t\t\t\tmessage: `Version ${version} was not found for plugin ${pluginId}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Block installation of plugins that haven't passed audit.\n\t\t// Both \"fail\" (explicitly malicious) and \"warn\" (audit error or\n\t\t// inconclusive) are non-installable — only \"pass\" or null (no audit\n\t\t// ran) are allowed through.\n\t\tif (versionMetadata.auditVerdict === \"fail\" || versionMetadata.auditVerdict === \"warn\") {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"AUDIT_FAILED\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\tversionMetadata.auditVerdict === \"fail\"\n\t\t\t\t\t\t\t? \"Plugin failed security audit and cannot be installed\"\n\t\t\t\t\t\t\t: \"Plugin audit was inconclusive and cannot be installed until reviewed\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Download and extract bundle\n\t\tconst bundle = await client.downloadBundle(pluginId, version);\n\n\t\t// Verify checksum matches marketplace-published checksum\n\t\tif (versionMetadata.checksum && bundle.checksum !== versionMetadata.checksum) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"CHECKSUM_MISMATCH\",\n\t\t\t\t\tmessage: \"Bundle checksum does not match marketplace record. Download may be corrupted.\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst bundleIdentityError = validateBundleIdentity(bundle, pluginId, version);\n\t\tif (bundleIdentityError) return bundleIdentityError;\n\n\t\tif ((bundle.manifest.mcp?.tools.length ?? 0) > 0 && !opts?.confirmMcpTools) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"MCP_TOOL_CONSENT_REQUIRED\",\n\t\t\t\t\tmessage: \"Plugin MCP tools require explicit consent\",\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tmcpTools: bundle.manifest.mcp?.tools.map(\n\t\t\t\t\t\t\t({ inputSchema: _, outputSchema: __, ...tool }) => tool,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Store bundle in site-local R2\n\t\tawait storeBundleInR2(storage, pluginId, version, bundle);\n\n\t\t// Write plugin state\n\t\tawait stateRepo.upsert(pluginId, version, \"active\", {\n\t\t\tsource: \"marketplace\",\n\t\t\tmarketplaceVersion: version,\n\t\t\tdisplayName: pluginDetail.name,\n\t\t\tdescription: pluginDetail.description ?? undefined,\n\t\t});\n\n\t\tawait syncDeclaredStorageIndexes(db, [bundle.manifest]);\n\n\t\t// Fire-and-forget install stat\n\t\tclient.reportInstall(pluginId, version).catch(() => {\n\t\t\t// Intentional: never fails the install\n\t\t});\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\tpluginId,\n\t\t\t\tversion,\n\t\t\t\tcapabilities: bundle.manifest.capabilities,\n\t\t\t},\n\t\t};\n\t} catch (err) {\n\t\tif (err instanceof MarketplaceUnavailableError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"MARKETPLACE_UNAVAILABLE\",\n\t\t\t\t\tmessage: \"Plugin marketplace is currently unavailable\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (err instanceof MarketplaceError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: err.code ?? \"MARKETPLACE_ERROR\",\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (err instanceof EmDashStorageError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: err.code ?? \"STORAGE_ERROR\",\n\t\t\t\t\tmessage: \"Storage error while installing plugin\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (err && typeof err === \"object\" && \"code\" in err) {\n\t\t\tconst code = (err as { code?: unknown }).code;\n\t\t\tif (typeof code === \"string\" && code.trim()) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode,\n\t\t\t\t\t\tmessage: \"Failed to install plugin from marketplace\",\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tconsole.error(\"Failed to install marketplace plugin:\", err);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"INSTALL_FAILED\",\n\t\t\t\tmessage: \"Failed to install plugin from marketplace\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n// ── Update ─────────────────────────────────────────────────────────\n\nexport async function handleMarketplaceUpdate(\n\tdb: Kysely<Database>,\n\tstorage: Storage | null,\n\tsandboxRunner: SandboxRunner | null,\n\tmarketplaceUrl: string | undefined,\n\tpluginId: string,\n\topts?: {\n\t\tversion?: string;\n\t\tconfirmCapabilityChanges?: boolean;\n\t\tconfirmRouteVisibilityChanges?: boolean;\n\t\tconfirmMcpTools?: boolean;\n\t\t/**\n\t\t * When true, sandbox: false bypass mode is active. The sandbox runner\n\t\t * is the noop runner (isAvailable() === false) but the runtime will\n\t\t * load the marketplace plugin in-process via syncMarketplacePlugins().\n\t\t * Skip the SANDBOX_NOT_AVAILABLE gate so the update can proceed.\n\t\t */\n\t\tsandboxBypassed?: boolean;\n\t},\n): Promise<ApiResult<MarketplaceUpdateResult>> {\n\tconst client = getClient(marketplaceUrl);\n\tif (!client) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"MARKETPLACE_NOT_CONFIGURED\", message: \"Marketplace is not configured\" },\n\t\t};\n\t}\n\tif (!storage) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"STORAGE_NOT_CONFIGURED\", message: \"Storage is required\" },\n\t\t};\n\t}\n\t// Sandbox availability check: skip when sandbox: false bypass is active.\n\t// The runtime's syncMarketplacePlugins() will load the plugin in-process.\n\tif (!opts?.sandboxBypassed && (!sandboxRunner || !sandboxRunner.isAvailable())) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"SANDBOX_NOT_AVAILABLE\", message: \"Sandbox runner is required\" },\n\t\t};\n\t}\n\n\ttry {\n\t\tconst stateRepo = new PluginStateRepository(db);\n\t\tconst existing = await stateRepo.get(pluginId);\n\t\tif (!existing || existing.source !== \"marketplace\") {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `No marketplace plugin found: ${pluginId}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst oldVersion = existing.marketplaceVersion ?? existing.version;\n\n\t\t// Get target version\n\t\tconst pluginDetail = await client.getPlugin(pluginId);\n\t\tconst newVersion = opts?.version ?? pluginDetail.latestVersion?.version;\n\t\tif (!newVersion) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"NO_VERSION\", message: \"No newer version available\" },\n\t\t\t};\n\t\t}\n\n\t\tif (newVersion === oldVersion) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"ALREADY_UP_TO_DATE\", message: \"Plugin is already up to date\" },\n\t\t\t};\n\t\t}\n\n\t\tconst versionMetadata = await resolveVersionMetadata(\n\t\t\tclient,\n\t\t\tpluginId,\n\t\t\tpluginDetail,\n\t\t\tnewVersion,\n\t\t);\n\t\tif (!versionMetadata) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NO_VERSION\",\n\t\t\t\t\tmessage: `Version ${newVersion} was not found for plugin ${pluginId}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Download new bundle\n\t\tconst bundle = await client.downloadBundle(pluginId, newVersion);\n\n\t\t// Verify checksum matches marketplace-published checksum for this version\n\t\tif (versionMetadata.checksum && bundle.checksum !== versionMetadata.checksum) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"CHECKSUM_MISMATCH\",\n\t\t\t\t\tmessage: \"Bundle checksum does not match marketplace record. Download may be corrupted.\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst bundleIdentityError = validateBundleIdentity(bundle, pluginId, newVersion);\n\t\tif (bundleIdentityError) return bundleIdentityError;\n\n\t\t// Diff capabilities and route visibility against old version\n\t\tconst oldBundle = await loadBundleFromR2(storage, pluginId, oldVersion);\n\t\tconst oldCaps = oldBundle?.manifest.capabilities ?? [];\n\t\tconst capabilityChanges = diffCapabilities(oldCaps, bundle.manifest.capabilities);\n\t\tconst hasEscalation = capabilityChanges.added.length > 0;\n\n\t\t// If capabilities escalated, require explicit confirmation\n\t\tif (hasEscalation && !opts?.confirmCapabilityChanges) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"CAPABILITY_ESCALATION\",\n\t\t\t\t\tmessage: \"Plugin update requires new capabilities\",\n\t\t\t\t\tdetails: { capabilityChanges },\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Diff route visibility — routes going from private to public are a\n\t\t// security-sensitive change that exposes unauthenticated endpoints.\n\t\tconst routeVisibilityChanges = diffRouteVisibility(oldBundle?.manifest, bundle.manifest);\n\t\tconst hasNewPublicRoutes = routeVisibilityChanges.newlyPublic.length > 0;\n\n\t\tif (hasNewPublicRoutes && !opts?.confirmRouteVisibilityChanges) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"ROUTE_VISIBILITY_ESCALATION\",\n\t\t\t\t\tmessage: \"Plugin update exposes new public (unauthenticated) routes\",\n\t\t\t\t\tdetails: { routeVisibilityChanges, capabilityChanges },\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst oldMcpTools = [...(oldBundle?.manifest.mcp?.tools ?? [])].toSorted((a, b) =>\n\t\t\ta.name.localeCompare(b.name),\n\t\t);\n\t\tconst newMcpTools = [...(bundle.manifest.mcp?.tools ?? [])].toSorted((a, b) =>\n\t\t\ta.name.localeCompare(b.name),\n\t\t);\n\t\tif (JSON.stringify(oldMcpTools) !== JSON.stringify(newMcpTools) && !opts?.confirmMcpTools) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"MCP_TOOL_CONSENT_REQUIRED\",\n\t\t\t\t\tmessage: \"Plugin update changes its MCP tools\",\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tmcpTools: newMcpTools.map(({ inputSchema: _, outputSchema: __, ...tool }) => tool),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Store new bundle\n\t\tawait storeBundleInR2(storage, pluginId, newVersion, bundle);\n\n\t\t// Update state\n\t\tawait stateRepo.upsert(pluginId, newVersion, \"active\", {\n\t\t\tsource: \"marketplace\",\n\t\t\tmarketplaceVersion: newVersion,\n\t\t\tdisplayName: pluginDetail.name,\n\t\t\tdescription: pluginDetail.description ?? undefined,\n\t\t\tmcpToolsEnabled: false,\n\t\t\tmcpToolsConsent: null,\n\t\t});\n\n\t\tawait syncDeclaredStorageIndexes(db, [bundle.manifest]);\n\n\t\t// Clean up old bundle from R2 (best-effort)\n\t\tdeleteBundleFromR2(storage, pluginId, oldVersion).catch(() => {});\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\tpluginId,\n\t\t\t\toldVersion,\n\t\t\t\tnewVersion,\n\t\t\t\tcapabilityChanges,\n\t\t\t\trouteVisibilityChanges: hasNewPublicRoutes ? routeVisibilityChanges : undefined,\n\t\t\t},\n\t\t};\n\t} catch (err) {\n\t\tif (err instanceof MarketplaceUnavailableError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"MARKETPLACE_UNAVAILABLE\", message: \"Marketplace is unavailable\" },\n\t\t\t};\n\t\t}\n\t\tif (err instanceof MarketplaceError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: err.code ?? \"MARKETPLACE_ERROR\", message: err.message },\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Failed to update marketplace plugin:\", err);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"UPDATE_FAILED\", message: \"Failed to update plugin\" },\n\t\t};\n\t}\n}\n\n// ── Uninstall ──────────────────────────────────────────────────────\n\nexport async function handleMarketplaceUninstall(\n\tdb: Kysely<Database>,\n\tstorage: Storage | null,\n\tpluginId: string,\n\topts?: { deleteData?: boolean },\n): Promise<ApiResult<MarketplaceUninstallResult>> {\n\ttry {\n\t\tconst stateRepo = new PluginStateRepository(db);\n\t\tconst existing = await stateRepo.get(pluginId);\n\t\tif (!existing || existing.source !== \"marketplace\") {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `No marketplace plugin found: ${pluginId}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst version = existing.marketplaceVersion ?? existing.version;\n\n\t\t// Delete bundle from site R2\n\t\tif (storage) {\n\t\t\tawait deleteBundleFromR2(storage, pluginId, version);\n\t\t}\n\n\t\t// Optionally delete plugin storage data\n\t\tlet dataDeleted = false;\n\t\tif (opts?.deleteData) {\n\t\t\ttry {\n\t\t\t\tawait db.deleteFrom(\"_plugin_storage\").where(\"plugin_id\", \"=\", pluginId).execute();\n\t\t\t\tdataDeleted = true;\n\t\t\t} catch {\n\t\t\t\t// Plugin storage table may not have data for this plugin\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tawait removeAllPluginIndexes(db, pluginId);\n\t\t} catch {\n\t\t\t// Nothing to drop, or tracking table predates the feature\n\t\t}\n\n\t\t// Delete state row\n\t\tawait stateRepo.delete(pluginId);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { pluginId, dataDeleted },\n\t\t};\n\t} catch (err) {\n\t\tconsole.error(\"Failed to uninstall marketplace plugin:\", err);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"UNINSTALL_FAILED\",\n\t\t\t\tmessage: \"Failed to uninstall plugin\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n// ── Update check ───────────────────────────────────────────────────\n\nexport async function handleMarketplaceUpdateCheck(\n\tdb: Kysely<Database>,\n\tmarketplaceUrl: string | undefined,\n): Promise<ApiResult<{ items: MarketplaceUpdateCheck[] }>> {\n\tconst client = getClient(marketplaceUrl);\n\tif (!client) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"MARKETPLACE_NOT_CONFIGURED\", message: \"Marketplace is not configured\" },\n\t\t};\n\t}\n\n\ttry {\n\t\tconst stateRepo = new PluginStateRepository(db);\n\t\tconst marketplacePlugins = await stateRepo.getMarketplacePlugins();\n\n\t\tconst items: MarketplaceUpdateCheck[] = [];\n\n\t\tfor (const plugin of marketplacePlugins) {\n\t\t\ttry {\n\t\t\t\tconst detail = await client.getPlugin(plugin.pluginId);\n\t\t\t\tconst latest = detail.latestVersion?.version;\n\t\t\t\tconst installed = plugin.marketplaceVersion ?? plugin.version;\n\n\t\t\t\tif (!latest) continue;\n\n\t\t\t\tconst hasUpdate = latest !== installed;\n\t\t\t\tlet capabilityChanges: { added: string[]; removed: string[] } | undefined;\n\t\t\t\tlet hasCapabilityChanges = false;\n\n\t\t\t\tif (hasUpdate && detail.latestVersion) {\n\t\t\t\t\tconst oldCaps = detail.capabilities ?? [];\n\t\t\t\t\tconst newCaps = detail.latestVersion.capabilities ?? [];\n\t\t\t\t\tcapabilityChanges = diffCapabilities(oldCaps, newCaps);\n\t\t\t\t\thasCapabilityChanges =\n\t\t\t\t\t\tcapabilityChanges.added.length > 0 || capabilityChanges.removed.length > 0;\n\t\t\t\t}\n\n\t\t\t\titems.push({\n\t\t\t\t\tpluginId: plugin.pluginId,\n\t\t\t\t\tinstalled,\n\t\t\t\t\tlatest: latest ?? installed,\n\t\t\t\t\thasUpdate,\n\t\t\t\t\thasCapabilityChanges,\n\t\t\t\t\tcapabilityChanges: hasCapabilityChanges ? capabilityChanges : undefined,\n\t\t\t\t\t// Route visibility changes require downloading both bundles to compare\n\t\t\t\t\t// manifests, which is too expensive for a preview check. The actual\n\t\t\t\t\t// enforcement happens at update time in handleMarketplaceUpdate.\n\t\t\t\t\thasRouteVisibilityChanges: false,\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\t// Skip plugins that can't be checked (marketplace down, plugin delisted)\n\t\t\t\tconsole.warn(`Failed to check updates for ${plugin.pluginId}:`, err);\n\t\t\t}\n\t\t}\n\n\t\treturn { success: true, data: { items } };\n\t} catch (err) {\n\t\tif (err instanceof MarketplaceUnavailableError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"MARKETPLACE_UNAVAILABLE\", message: \"Marketplace is unavailable\" },\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Failed to check marketplace updates:\", err);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"UPDATE_CHECK_FAILED\", message: \"Failed to check for updates\" },\n\t\t};\n\t}\n}\n\n// ── Proxy ──────────────────────────────────────────────────────────\n\nexport async function handleMarketplaceSearch(\n\tmarketplaceUrl: string | undefined,\n\tquery?: string,\n\topts?: MarketplaceSearchOpts,\n): Promise<ApiResult<unknown>> {\n\tconst client = getClient(marketplaceUrl);\n\tif (!client) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"MARKETPLACE_NOT_CONFIGURED\", message: \"Marketplace is not configured\" },\n\t\t};\n\t}\n\n\ttry {\n\t\tconst result = await client.search(query, opts);\n\t\treturn { success: true, data: result };\n\t} catch (err) {\n\t\tif (err instanceof MarketplaceUnavailableError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"MARKETPLACE_UNAVAILABLE\", message: \"Marketplace is unavailable\" },\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Failed to search marketplace:\", err);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"SEARCH_FAILED\", message: \"Failed to search marketplace\" },\n\t\t};\n\t}\n}\n\nexport async function handleMarketplaceGetPlugin(\n\tmarketplaceUrl: string | undefined,\n\tpluginId: string,\n): Promise<ApiResult<unknown>> {\n\tconst client = getClient(marketplaceUrl);\n\tif (!client) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"MARKETPLACE_NOT_CONFIGURED\", message: \"Marketplace is not configured\" },\n\t\t};\n\t}\n\n\ttry {\n\t\tconst result = await client.getPlugin(pluginId);\n\t\treturn { success: true, data: result };\n\t} catch (err) {\n\t\tif (err instanceof MarketplaceError && err.status === 404) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"NOT_FOUND\", message: `Plugin not found: ${pluginId}` },\n\t\t\t};\n\t\t}\n\t\tif (err instanceof MarketplaceUnavailableError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"MARKETPLACE_UNAVAILABLE\", message: \"Marketplace is unavailable\" },\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Failed to get marketplace plugin:\", err);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"GET_PLUGIN_FAILED\", message: \"Failed to get plugin details\" },\n\t\t};\n\t}\n}\n\n// ── Theme proxy handlers ──────────────────────────────────────────\n\nexport async function handleThemeSearch(\n\tmarketplaceUrl: string | undefined,\n\tquery?: string,\n\topts?: MarketplaceThemeSearchOpts,\n): Promise<ApiResult<unknown>> {\n\tconst client = getClient(marketplaceUrl);\n\tif (!client) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"MARKETPLACE_NOT_CONFIGURED\", message: \"Marketplace is not configured\" },\n\t\t};\n\t}\n\n\ttry {\n\t\tconst result = await client.searchThemes(query, opts);\n\t\treturn { success: true, data: result };\n\t} catch (err) {\n\t\tif (err instanceof MarketplaceUnavailableError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"MARKETPLACE_UNAVAILABLE\", message: \"Marketplace is unavailable\" },\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Failed to search themes:\", err);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"THEME_SEARCH_FAILED\", message: \"Failed to search themes\" },\n\t\t};\n\t}\n}\n\nexport async function handleThemeGetDetail(\n\tmarketplaceUrl: string | undefined,\n\tthemeId: string,\n): Promise<ApiResult<unknown>> {\n\tconst client = getClient(marketplaceUrl);\n\tif (!client) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"MARKETPLACE_NOT_CONFIGURED\", message: \"Marketplace is not configured\" },\n\t\t};\n\t}\n\n\ttry {\n\t\tconst result = await client.getTheme(themeId);\n\t\treturn { success: true, data: result };\n\t} catch (err) {\n\t\tif (err instanceof MarketplaceError && err.status === 404) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"NOT_FOUND\", message: `Theme not found: ${themeId}` },\n\t\t\t};\n\t\t}\n\t\tif (err instanceof MarketplaceUnavailableError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"MARKETPLACE_UNAVAILABLE\", message: \"Marketplace is unavailable\" },\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"Failed to get marketplace theme:\", err);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"GET_THEME_FAILED\", message: \"Failed to get theme details\" },\n\t\t};\n\t}\n}\n","import { n as verificationError } from \"./errors-CI-j3m_y.js\";\nimport { pluginManifestSchema, reconcileManifestAccess } from \"@emdash-cms/plugin-types\";\nimport { createGzipDecoder } from \"modern-tar\";\n\n//#region src/bundle-limits.ts\n/** Maximum accepted gzip payload size. */\nconst MAX_BUNDLE_COMPRESSED_BYTES = 384 * 1024;\n/** Maximum aggregate size of regular-file contents. */\nconst MAX_BUNDLE_SIZE = 256 * 1024;\n/** Maximum size of one regular file. */\nconst MAX_BUNDLE_FILE_BYTES = 128 * 1024;\n/** Maximum number of regular files. */\nconst MAX_BUNDLE_FILE_COUNT = 20;\n/** Maximum total tar entries, including harmless directory entries. */\nconst MAX_BUNDLE_TAR_ENTRY_COUNT = 32;\n/**\n* Maximum tar stream size after decompression. This includes USTAR headers,\n* file padding, and the end marker in addition to the regular-file contents.\n*/\nconst MAX_BUNDLE_DECOMPRESSED_BYTES = MAX_BUNDLE_SIZE + MAX_BUNDLE_TAR_ENTRY_COUNT * 512 + MAX_BUNDLE_FILE_COUNT * 511 + 2 * 512;\n\n//#endregion\n//#region src/bundle.ts\nconst TAR_BLOCK_BYTES = 512;\nconst TAR_END_BYTES = TAR_BLOCK_BYTES * 2;\nconst OCTAL_PATTERN = /^[0-7]+$/;\nconst WINDOWS_DRIVE_PATTERN = /^[a-zA-Z]:/;\nconst decoder = new TextDecoder(\"utf-8\", {\n\tfatal: true,\n\tignoreBOM: false\n});\nasync function validatePluginBundle(compressed, options = {}) {\n\tif (compressed.byteLength > MAX_BUNDLE_COMPRESSED_BYTES) return verificationError(\"BUNDLE_COMPRESSED_SIZE_EXCEEDED\", \"The compressed plugin bundle exceeds the size limit.\");\n\tconst decompressed = await decompressBundle(compressed);\n\tif (!decompressed.success) return decompressed;\n\tconst files = parseTar(decompressed.value);\n\tif (!files.success) return files;\n\tconst manifestFile = files.value.get(\"manifest.json\");\n\tif (!manifestFile) return verificationError(\"BUNDLE_MISSING_MANIFEST\", \"The plugin bundle is missing manifest.json.\");\n\tconst backend = files.value.get(\"backend.js\");\n\tif (!backend) return verificationError(\"BUNDLE_MISSING_BACKEND\", \"The plugin bundle is missing backend.js.\");\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(decoder.decode(manifestFile.data));\n\t} catch {\n\t\treturn verificationError(\"BUNDLE_INVALID_MANIFEST\", \"The plugin bundle manifest is not valid JSON.\");\n\t}\n\tconst validated = pluginManifestSchema.safeParse(parsed);\n\tif (!validated.success) return verificationError(\"BUNDLE_INVALID_MANIFEST\", \"The plugin bundle manifest failed schema validation.\");\n\tconst manifest = reconcileManifestAccess(validated.data);\n\tif (options.expectedSlug !== void 0 && manifest.id !== options.expectedSlug) return verificationError(\"BUNDLE_ID_MISMATCH\", \"The plugin bundle manifest id does not match the expected plugin.\");\n\tif (options.expectedVersion !== void 0 && manifest.version !== options.expectedVersion) return verificationError(\"BUNDLE_VERSION_MISMATCH\", \"The plugin bundle manifest version does not match the expected version.\");\n\tconst result = {\n\t\tmanifest,\n\t\tdeclaredAccess: manifest.declaredAccess ?? {},\n\t\tbackend: backend.data\n\t};\n\tconst admin = files.value.get(\"admin.js\");\n\tif (admin) result.admin = admin.data;\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: result\n\t};\n}\nasync function decompressBundle(bytes) {\n\tconst source = new ReadableStream({ start(controller) {\n\t\tcontroller.enqueue(bytes);\n\t\tcontroller.close();\n\t} });\n\tlet reader;\n\ttry {\n\t\treader = source.pipeThrough(createGzipDecoder()).getReader();\n\t} catch {\n\t\treturn verificationError(\"BUNDLE_INVALID_ARCHIVE\", \"The plugin bundle is not valid gzip data.\");\n\t}\n\tconst chunks = [];\n\tlet total = 0;\n\ttry {\n\t\twhile (true) {\n\t\t\tconst { done, value } = await reader.read();\n\t\t\tif (done) break;\n\t\t\tif (!value) continue;\n\t\t\ttotal += value.byteLength;\n\t\t\tif (total > MAX_BUNDLE_DECOMPRESSED_BYTES) {\n\t\t\t\tawait reader.cancel().catch(() => void 0);\n\t\t\t\treturn verificationError(\"BUNDLE_DECOMPRESSED_SIZE_EXCEEDED\", \"The decompressed plugin bundle exceeds the size limit.\");\n\t\t\t}\n\t\t\tchunks.push(value);\n\t\t}\n\t} catch {\n\t\treturn verificationError(\"BUNDLE_INVALID_ARCHIVE\", \"The plugin bundle is not valid gzip data.\");\n\t}\n\tconst output = new Uint8Array(total);\n\tlet offset = 0;\n\tfor (const chunk of chunks) {\n\t\toutput.set(chunk, offset);\n\t\toffset += chunk.byteLength;\n\t}\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: output\n\t};\n}\nfunction parseTar(bytes) {\n\tif (bytes.byteLength < TAR_END_BYTES || bytes.byteLength % TAR_BLOCK_BYTES !== 0) return invalidArchive();\n\tconst files = /* @__PURE__ */ new Map();\n\tconst rawPaths = /* @__PURE__ */ new Set();\n\tconst normalizedPaths = /* @__PURE__ */ new Set();\n\tlet offset = 0;\n\tlet fileCount = 0;\n\tlet entryCount = 0;\n\tlet totalFileBytes = 0;\n\tlet ended = false;\n\twhile (offset + TAR_BLOCK_BYTES <= bytes.byteLength) {\n\t\tconst header = bytes.subarray(offset, offset + TAR_BLOCK_BYTES);\n\t\tif (isZeroBlock(header)) {\n\t\t\tif (!isZeroBlock(bytes.subarray(offset + TAR_BLOCK_BYTES, offset + TAR_END_BYTES))) return invalidArchive();\n\t\t\tif (bytes.subarray(offset + TAR_END_BYTES).some((byte) => byte !== 0)) return invalidArchive();\n\t\t\tended = true;\n\t\t\tbreak;\n\t\t}\n\t\tif (!validChecksum(header)) return invalidArchive();\n\t\tentryCount += 1;\n\t\tif (entryCount > MAX_BUNDLE_TAR_ENTRY_COUNT) return verificationError(\"BUNDLE_FILE_COUNT_EXCEEDED\", \"The plugin bundle contains too many archive entries.\");\n\t\tconst rawName = readTarPath(header);\n\t\tif (!rawName.success) return rawName;\n\t\tconst typeFlag = header[156];\n\t\tconst type = typeFlag === 0 ? \"file\" : String.fromCharCode(typeFlag ?? 0);\n\t\tconst isDirectory = type === \"5\";\n\t\tconst normalized = normalizePath(rawName.value, isDirectory);\n\t\tif (!normalized.success) return normalized;\n\t\tif (rawPaths.has(rawName.value) || normalizedPaths.has(normalized.value)) return verificationError(\"BUNDLE_PATH_COLLISION\", \"The plugin bundle contains duplicate or ambiguous paths.\");\n\t\trawPaths.add(rawName.value);\n\t\tnormalizedPaths.add(normalized.value);\n\t\tconst size = readOctal(header.subarray(124, 136));\n\t\tif (size === null || !Number.isSafeInteger(size)) return invalidArchive();\n\t\tconst bodyStart = offset + TAR_BLOCK_BYTES;\n\t\tconst nextOffset = bodyStart + Math.ceil(size / TAR_BLOCK_BYTES) * TAR_BLOCK_BYTES;\n\t\tif (nextOffset > bytes.byteLength) return invalidArchive();\n\t\tif (isDirectory) {\n\t\t\tif (size !== 0) return invalidArchive();\n\t\t} else if (type === \"file\" || type === \"0\") {\n\t\t\tfileCount += 1;\n\t\t\tif (fileCount > MAX_BUNDLE_FILE_COUNT) return verificationError(\"BUNDLE_FILE_COUNT_EXCEEDED\", \"The plugin bundle contains too many files.\");\n\t\t\tif (size > MAX_BUNDLE_FILE_BYTES) return verificationError(\"BUNDLE_FILE_SIZE_EXCEEDED\", \"A file in the plugin bundle exceeds the per-file size limit.\");\n\t\t\ttotalFileBytes += size;\n\t\t\tif (totalFileBytes > MAX_BUNDLE_SIZE) return verificationError(\"BUNDLE_DECOMPRESSED_SIZE_EXCEEDED\", \"The plugin bundle file contents exceed the size limit.\");\n\t\t\tfiles.set(normalized.value, {\n\t\t\t\tname: normalized.value,\n\t\t\t\tdata: bytes.slice(bodyStart, bodyStart + size)\n\t\t\t});\n\t\t} else return verificationError(\"BUNDLE_UNSUPPORTED_ENTRY\", \"The plugin bundle contains an unsupported archive entry type.\");\n\t\toffset = nextOffset;\n\t}\n\tif (!ended) return invalidArchive();\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: files\n\t};\n}\nfunction readTarPath(header) {\n\tconst name = readTarString(header.subarray(0, 100));\n\tconst prefix = readTarString(header.subarray(345, 500));\n\tif (name === null || prefix === null || name.length === 0) return verificationError(\"BUNDLE_INVALID_PATH\", \"The plugin bundle contains a malformed path.\");\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: prefix ? `${prefix}/${name}` : name\n\t};\n}\nfunction readTarString(field) {\n\tconst terminator = field.indexOf(0);\n\tconst end = terminator === -1 ? field.length : terminator;\n\tif (terminator !== -1 && field.subarray(terminator + 1).some((byte) => byte !== 0)) return null;\n\ttry {\n\t\treturn decoder.decode(field.subarray(0, end));\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction normalizePath(raw, isDirectory) {\n\tif (raw.includes(\"\\\\\") || raw.startsWith(\"/\") || WINDOWS_DRIVE_PATTERN.test(raw) || hasControlCharacter(raw) || raw.endsWith(\"/\") !== isDirectory) return verificationError(\"BUNDLE_INVALID_PATH\", \"The plugin bundle contains an unsafe path.\");\n\tconst parts = raw.split(\"/\");\n\tif (isDirectory) parts.pop();\n\tconst normalized = [];\n\tfor (const part of parts) {\n\t\tif (part === \".\") continue;\n\t\tif (part === \"\" || part === \"..\") return verificationError(\"BUNDLE_INVALID_PATH\", \"The plugin bundle contains an unsafe path.\");\n\t\tnormalized.push(part.normalize(\"NFC\"));\n\t}\n\tif (normalized.length === 0) return verificationError(\"BUNDLE_INVALID_PATH\", \"The plugin bundle contains a malformed path.\");\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: normalized.join(\"/\")\n\t};\n}\nfunction hasControlCharacter(value) {\n\tfor (const character of value) {\n\t\tconst codePoint = character.codePointAt(0);\n\t\tif (codePoint !== void 0 && (codePoint <= 31 || codePoint === 127)) return true;\n\t}\n\treturn false;\n}\nfunction readOctal(field) {\n\tconst text = new TextDecoder().decode(field).replaceAll(\"\\0\", \"\").trim();\n\tif (!OCTAL_PATTERN.test(text)) return null;\n\tconst value = Number.parseInt(text, 8);\n\treturn Number.isSafeInteger(value) ? value : null;\n}\nfunction validChecksum(header) {\n\tconst expected = readOctal(header.subarray(148, 156));\n\tif (expected === null) return false;\n\tlet actual = 0;\n\tfor (let index = 0; index < header.length; index += 1) actual += index >= 148 && index < 156 ? 32 : header[index] ?? 0;\n\treturn actual === expected;\n}\nfunction isZeroBlock(block) {\n\treturn block.byteLength === TAR_BLOCK_BYTES && block.every((byte) => byte === 0);\n}\nfunction invalidArchive() {\n\treturn verificationError(\"BUNDLE_INVALID_ARCHIVE\", \"The plugin bundle is not a valid tar archive.\");\n}\n\n//#endregion\nexport { validatePluginBundle };\n//# sourceMappingURL=bundle.js.map","import type { VerificationErrorCode } from \"@emdash-cms/registry-verification\";\nimport { validatePluginBundle } from \"@emdash-cms/registry-verification/bundle\";\nimport {\n\tcomputeArtifactDigestCandidates,\n\tverifyMultihash,\n} from \"@emdash-cms/registry-verification/checksum\";\n\nimport { pluginManifestSchema, reconcileManifestAccess } from \"../plugins/manifest-schema.js\";\nimport type { PluginBundle } from \"../plugins/marketplace.js\";\n\nconst bundleDecoder = new TextDecoder(\"utf-8\", { fatal: true });\n\nexport type RegistryArtifactVerificationCode =\n\t| VerificationErrorCode\n\t| \"BUNDLE_INVALID_CODE_ENCODING\"\n\t| \"BUNDLE_RUNTIME_UNSUPPORTED\";\n\nexport type RegistryArtifactVerificationResult =\n\t| {\n\t\t\tsuccess: true;\n\t\t\tvalue: {\n\t\t\t\tbundle: PluginBundle;\n\t\t\t\tartifactDigest: Uint8Array;\n\t\t\t\tartifactDigests: readonly Uint8Array[];\n\t\t\t};\n\t }\n\t| {\n\t\t\tsuccess: false;\n\t\t\terror: { code: RegistryArtifactVerificationCode; message: string };\n\t };\n\nexport async function validateRegistryArtifact(\n\tbytes: Uint8Array,\n\tchecksum: string,\n\tslug: string,\n\tversion: string,\n): Promise<RegistryArtifactVerificationResult> {\n\tconst checksumReport = await verifyMultihash(bytes, checksum);\n\tif (!checksumReport.success) return checksumReport;\n\tconst [artifactDigest, ...artifactDigests] = await computeArtifactDigestCandidates(bytes);\n\n\tconst bundleReport = await validatePluginBundle(bytes, {\n\t\texpectedSlug: slug,\n\t\texpectedVersion: version,\n\t});\n\tif (!bundleReport.success) return bundleReport;\n\n\tconst manifest = pluginManifestSchema.safeParse(bundleReport.value.manifest);\n\tif (!manifest.success) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"BUNDLE_RUNTIME_UNSUPPORTED\",\n\t\t\t\tmessage: \"The plugin bundle uses manifest features unsupported by this EmDash version.\",\n\t\t\t},\n\t\t};\n\t}\n\n\ttry {\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tvalue: {\n\t\t\t\tbundle: {\n\t\t\t\t\tmanifest: reconcileManifestAccess(manifest.data),\n\t\t\t\t\tbackendCode: bundleDecoder.decode(bundleReport.value.backend),\n\t\t\t\t\tadminCode:\n\t\t\t\t\t\tbundleReport.value.admin === undefined\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: bundleDecoder.decode(bundleReport.value.admin),\n\t\t\t\t\tchecksum,\n\t\t\t\t},\n\t\t\t\tartifactDigest,\n\t\t\t\tartifactDigests,\n\t\t\t},\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"BUNDLE_INVALID_CODE_ENCODING\",\n\t\t\t\tmessage: \"Plugin bundle code must be valid UTF-8.\",\n\t\t\t},\n\t\t};\n\t}\n}\n","import { createRequire } from \"node:module\";\nimport { NSID, PackageProfile, PackageProfileExtension, PackageRelease, PackageReleaseExtension, RECORD_SCOPED_BLOB_CACHE_TYPE } from \"@emdash-cms/registry-lexicons\";\nimport { canonicalizeDeclaredAccess, isPluginSlug, isPluginVersion, pluginManifestSchema, reconcileManifestAccess } from \"@emdash-cms/plugin-types\";\nimport { createGzipDecoder } from \"modern-tar\";\n\n//#region \\0rolldown/runtime.js\nvar __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);\nvar __require = /* @__PURE__ */ createRequire(\"file:///emdash-registry-verification.js\");\n\n//#endregion\n//#region src/errors.ts\n/** Stable, machine-readable failures returned by this package. */\nconst VERIFICATION_ERROR_CODES = [\n\t\"AUTH_METHOD_UNSUPPORTED\",\n\t\"BLOB_METADATA_MISMATCH\",\n\t\"BLOB_REF_INVALID\",\n\t\"BUNDLE_COMPRESSED_SIZE_EXCEEDED\",\n\t\"BUNDLE_DECOMPRESSED_SIZE_EXCEEDED\",\n\t\"BUNDLE_FILE_COUNT_EXCEEDED\",\n\t\"BUNDLE_FILE_SIZE_EXCEEDED\",\n\t\"BUNDLE_ID_MISMATCH\",\n\t\"BUNDLE_INVALID_ARCHIVE\",\n\t\"BUNDLE_INVALID_MANIFEST\",\n\t\"BUNDLE_INVALID_PATH\",\n\t\"BUNDLE_MISSING_BACKEND\",\n\t\"BUNDLE_MISSING_MANIFEST\",\n\t\"BUNDLE_PATH_COLLISION\",\n\t\"BUNDLE_UNSUPPORTED_ENTRY\",\n\t\"BUNDLE_VERSION_MISMATCH\",\n\t\"CHECKSUM_MISMATCH\",\n\t\"FETCH_FAILED\",\n\t\"HOST_REJECTED\",\n\t\"INVALID_MULTIHASH\",\n\t\"INVALID_URL\",\n\t\"PDS_RESOLUTION_FAILED\",\n\t\"PROFILE_EXTENSION_INVALID\",\n\t\"PROFILE_EXTENSION_MISSING\",\n\t\"PROFILE_ID_MISMATCH\",\n\t\"PROFILE_LEXICON_INVALID\",\n\t\"PROFILE_POLICY_INVALID\",\n\t\"PROFILE_REPOSITORY_INVALID\",\n\t\"PROVENANCE_REQUIRED\",\n\t\"PROVENANCE_UNVERIFIABLE\",\n\t\"REDIRECT_LIMIT_EXCEEDED\",\n\t\"REDIRECT_LOCATION_MISSING\",\n\t\"RESOURCE_SIZE_EXCEEDED\",\n\t\"RESOURCE_STATUS_ERROR\",\n\t\"RESOURCE_TIMEOUT\",\n\t\"RELEASE_EXTENSION_INVALID\",\n\t\"RELEASE_EXTENSION_MISSING\",\n\t\"RELEASE_ARTIFACT_SOURCE_MISSING\",\n\t\"RELEASE_LEXICON_INVALID\",\n\t\"RELEASE_PACKAGE_MISMATCH\",\n\t\"RELEASE_RKEY_MISMATCH\",\n\t\"RELEASE_VERSION_INVALID\",\n\t\"RELEASE_VERSION_MISMATCH\",\n\t\"UNSUPPORTED_MULTIHASH\"\n];\nfunction verificationError(code, message, details) {\n\treturn {\n\t\tsuccess: false,\n\t\terror: {\n\t\t\tcode,\n\t\t\tmessage,\n\t\t\t...details === void 0 ? {} : { details }\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/checksum.ts\nconst SHA2_256_CODE = 18;\nconst SHA2_256_LENGTH = 32;\nconst BASE32_ALPHABET = \"abcdefghijklmnopqrstuvwxyz234567\";\n/** Derive the required artifact checksum from a raw sha2-256 blob CID. */\nfunction multihashFromBlobCid(value) {\n\tif (!value.startsWith(\"b\")) return verificationError(\"BLOB_REF_INVALID\", \"The blob reference CID is malformed.\");\n\tconst bytes = decodeBase32(value.slice(1));\n\tif (bytes === null || bytes.length !== 36 || bytes[0] !== 1 || bytes[1] !== 85) return verificationError(\"BLOB_REF_INVALID\", \"Blob references must use a CIDv1 raw sha2-256 CID.\");\n\tconst checksum = `b${encodeBase32(bytes.slice(2))}`;\n\tif (!decodeMultihash(checksum).success) return verificationError(\"BLOB_REF_INVALID\", \"Blob references must use a CIDv1 raw sha2-256 CID.\");\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: checksum\n\t};\n}\n/** Decodes a lowercase base32 multibase-encoded multihash. */\nfunction decodeMultihash(value) {\n\tif (!value.startsWith(\"b\")) return verificationError(\"INVALID_MULTIHASH\", \"Checksums must be lowercase base32 multibase-encoded multihashes.\");\n\tconst bytes = decodeBase32(value.slice(1));\n\tif (bytes === null) return verificationError(\"INVALID_MULTIHASH\", \"The multibase checksum is malformed.\");\n\tconst code = readVarint(bytes, 0);\n\tif (code === null) return verificationError(\"INVALID_MULTIHASH\", \"The multihash algorithm code is malformed.\");\n\tconst length = readVarint(bytes, code.nextOffset);\n\tif (length === null || length.value !== bytes.length - length.nextOffset) return verificationError(\"INVALID_MULTIHASH\", \"The multihash digest length is malformed.\");\n\tif (code.value !== SHA2_256_CODE) return verificationError(\"UNSUPPORTED_MULTIHASH\", \"The multihash algorithm is not supported.\");\n\tif (length.value !== SHA2_256_LENGTH) return verificationError(\"INVALID_MULTIHASH\", \"The sha2-256 digest must be 32 bytes.\");\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: {\n\t\t\talgorithm: \"sha2-256\",\n\t\t\tdigest: bytes.slice(length.nextOffset)\n\t\t}\n\t};\n}\nasync function computeMultihash(bytes, algorithm = \"sha2-256\") {\n\tif (algorithm !== \"sha2-256\") return verificationError(\"UNSUPPORTED_MULTIHASH\", \"The multihash algorithm is not supported.\");\n\ttry {\n\t\tconst digest = new Uint8Array(await crypto.subtle.digest(\"SHA-256\", new Uint8Array(bytes)));\n\t\tconst multihash = new Uint8Array(2 + digest.length);\n\t\tmultihash[0] = SHA2_256_CODE;\n\t\tmultihash[1] = digest.length;\n\t\tmultihash.set(digest, 2);\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tvalue: `b${encodeBase32(multihash)}`\n\t\t};\n\t} catch {\n\t\treturn verificationError(\"UNSUPPORTED_MULTIHASH\", \"The sha2-256 algorithm is unavailable.\");\n\t}\n}\nasync function computeArtifactDigestCandidates(bytes) {\n\tconst [sha256, sha384, sha512] = await Promise.all([\n\t\tcrypto.subtle.digest(\"SHA-256\", new Uint8Array(bytes)),\n\t\tcrypto.subtle.digest(\"SHA-384\", new Uint8Array(bytes)),\n\t\tcrypto.subtle.digest(\"SHA-512\", new Uint8Array(bytes))\n\t]);\n\treturn [\n\t\tnew Uint8Array(sha256),\n\t\tnew Uint8Array(sha384),\n\t\tnew Uint8Array(sha512)\n\t];\n}\nasync function verifyMultihash(bytes, expected) {\n\tconst decoded = decodeMultihash(expected);\n\tif (!decoded.success) return decoded;\n\tconst actual = await computeDigest(bytes, decoded.value.algorithm);\n\tif (!actual.success) return actual;\n\tif (!compareDigestBytes(actual.value, decoded.value.digest)) return verificationError(\"CHECKSUM_MISMATCH\", \"The resource bytes do not match the expected checksum.\");\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: true\n\t};\n}\n/**\n* Compare public checksum digest bytes without early exit. Digests are public\n* integrity metadata, so a portable byte loop is preferable to a Node-only\n* timing primitive while still avoiding an ordinary equality short circuit.\n*/\nfunction compareDigestBytes(left, right) {\n\tlet difference = left.length ^ right.length;\n\tconst maximumLength = Math.max(left.length, right.length);\n\tfor (let index = 0; index < maximumLength; index += 1) difference |= (left[index] ?? 0) ^ (right[index] ?? 0);\n\treturn difference === 0;\n}\nasync function computeDigest(bytes, algorithm) {\n\tif (algorithm !== \"sha2-256\") return verificationError(\"UNSUPPORTED_MULTIHASH\", \"The multihash algorithm is not supported.\");\n\ttry {\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tvalue: new Uint8Array(await crypto.subtle.digest(\"SHA-256\", new Uint8Array(bytes)))\n\t\t};\n\t} catch {\n\t\treturn verificationError(\"UNSUPPORTED_MULTIHASH\", \"The sha2-256 algorithm is unavailable.\");\n\t}\n}\nfunction readVarint(bytes, offset) {\n\tlet value = 0;\n\tlet shift = 0;\n\tfor (let index = offset; index < bytes.length && index < offset + 5; index += 1) {\n\t\tconst byte = bytes[index];\n\t\tif (byte === void 0) return null;\n\t\tvalue |= (byte & 127) << shift;\n\t\tif ((byte & 128) === 0) return {\n\t\t\tvalue,\n\t\t\tnextOffset: index + 1\n\t\t};\n\t\tshift += 7;\n\t}\n\treturn null;\n}\nfunction encodeBase32(bytes) {\n\tlet result = \"\";\n\tlet buffer = 0;\n\tlet bits = 0;\n\tfor (const byte of bytes) {\n\t\tbuffer = buffer << 8 | byte;\n\t\tbits += 8;\n\t\twhile (bits >= 5) {\n\t\t\tresult += BASE32_ALPHABET[buffer >>> bits - 5 & 31] ?? \"\";\n\t\t\tbits -= 5;\n\t\t}\n\t}\n\tif (bits > 0) result += BASE32_ALPHABET[buffer << 5 - bits & 31] ?? \"\";\n\treturn result;\n}\nfunction decodeBase32(value) {\n\tif (value.length === 0) return null;\n\tlet buffer = 0;\n\tlet bits = 0;\n\tconst output = [];\n\tfor (const character of value) {\n\t\tconst digit = BASE32_ALPHABET.indexOf(character);\n\t\tif (digit === -1) return null;\n\t\tbuffer = buffer << 5 | digit;\n\t\tbits += 5;\n\t\tif (bits >= 8) {\n\t\t\toutput.push(buffer >>> bits - 8 & 255);\n\t\t\tbits -= 8;\n\t\t}\n\t}\n\tif (bits > 0 && (buffer & (1 << bits) - 1) !== 0) return null;\n\treturn new Uint8Array(output);\n}\n\n//#endregion\n//#region src/auth.ts\nconst UNSUPPORTED_AUTH_MESSAGE = \"This release requires an authentication method the client does not support.\";\nfunction unsupportedAuthDetails(auth) {\n\tif (!isRecord$3(auth) || typeof auth.hint_url !== \"string\" || auth.hint_url.length > 2048) return;\n\ttry {\n\t\tconst url = new URL(auth.hint_url);\n\t\tif (url.protocol !== \"https:\" || url.username || url.password) return void 0;\n\t\treturn { hintUrl: url.href };\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction isRecord$3(value) {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\n//#endregion\n//#region src/fetch.ts\nconst DIGITS = /^\\d+$/;\nconst IPV4_LITERAL = /^\\d{1,3}(?:\\.\\d{1,3}){3}$/;\nconst IPV4_PART = /^\\d{1,3}$/;\nconst IPV6_PART = /^[0-9a-f]{1,4}$/i;\nconst TRAILING_DOT = /\\.+$/;\nconst DEFAULT_FETCH_LIMITS = {\n\theaderTimeoutMs: 1e4,\n\ttotalTimeoutMs: 3e4,\n\tmaxBytes: 25 * 1024 * 1024,\n\tmaxRedirects: 3\n};\nasync function fetchVerifiedResource(value, options) {\n\tconst limits = {\n\t\theaderTimeoutMs: options.headerTimeoutMs ?? DEFAULT_FETCH_LIMITS.headerTimeoutMs,\n\t\ttotalTimeoutMs: options.totalTimeoutMs ?? DEFAULT_FETCH_LIMITS.totalTimeoutMs,\n\t\tmaxBytes: options.maxBytes ?? DEFAULT_FETCH_LIMITS.maxBytes,\n\t\tmaxRedirects: options.maxRedirects ?? DEFAULT_FETCH_LIMITS.maxRedirects\n\t};\n\tif (!areValidLimits(limits)) return verificationError(\"INVALID_URL\", \"Fetch limits must be positive integers.\");\n\tconst startedAt = Date.now();\n\tlet currentUrl = parseAndValidateUrl(value, void 0, options.allowHttpLocalhost === true);\n\tif (!currentUrl.success) return currentUrl;\n\tfor (let redirects = 0;; redirects += 1) {\n\t\tconst remaining = limits.totalTimeoutMs - (Date.now() - startedAt);\n\t\tif (remaining <= 0) return verificationError(\"RESOURCE_TIMEOUT\", \"The resource fetch exceeded its total timeout.\");\n\t\tconst host = isAllowedLoopback(currentUrl.value, options.allowHttpLocalhost === true) ? {\n\t\t\tsuccess: true,\n\t\t\tvalue: true\n\t\t} : await validateHost(currentUrl.value, options.resolveHostname, remaining);\n\t\tif (!host.success) return host;\n\t\tconst remainingAfterResolution = limits.totalTimeoutMs - (Date.now() - startedAt);\n\t\tif (remainingAfterResolution <= 0) return verificationError(\"RESOURCE_TIMEOUT\", \"The resource fetch exceeded its total timeout.\");\n\t\tconst response = await fetchResponse(options.fetch, currentUrl.value, Math.min(remainingAfterResolution, limits.headerTimeoutMs));\n\t\tif (!response.success) return response;\n\t\tif (isRedirect(response.value.status)) {\n\t\t\tif (redirects >= limits.maxRedirects) return verificationError(\"REDIRECT_LIMIT_EXCEEDED\", \"The resource exceeded the redirect limit.\");\n\t\t\tconst location = response.value.headers.get(\"location\");\n\t\t\tif (location === null) return verificationError(\"REDIRECT_LOCATION_MISSING\", \"The redirect response has no location header.\");\n\t\t\tcurrentUrl = parseAndValidateUrl(location, currentUrl.value, options.allowHttpLocalhost === true);\n\t\t\tif (!currentUrl.success) return currentUrl;\n\t\t\tcontinue;\n\t\t}\n\t\tif (!response.value.ok && !options.allowedStatuses?.includes(response.value.status)) return verificationError(\"RESOURCE_STATUS_ERROR\", `The resource returned HTTP ${response.value.status}.`);\n\t\tconst contentLength = response.value.headers.get(\"content-length\");\n\t\tif (contentLength !== null && (!DIGITS.test(contentLength) || Number(contentLength) > limits.maxBytes)) return verificationError(\"RESOURCE_SIZE_EXCEEDED\", \"The resource exceeds the byte limit.\");\n\t\tconst bytes = await readResponse(response.value, limits.maxBytes, startedAt, limits.totalTimeoutMs);\n\t\tif (!bytes.success) return bytes;\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tvalue: {\n\t\t\t\tbytes: bytes.value,\n\t\t\t\turl: currentUrl.value,\n\t\t\t\tstatus: response.value.status,\n\t\t\t\theaders: response.value.headers\n\t\t\t}\n\t\t};\n\t}\n}\nfunction parseAndValidateUrl(value, base, allowHttpLocalhost = false) {\n\tlet url;\n\ttry {\n\t\turl = new URL(value, base);\n\t} catch {\n\t\treturn verificationError(\"INVALID_URL\", \"The resource URL is invalid.\");\n\t}\n\tif (url.protocol !== \"https:\" && !isAllowedLoopback(url, allowHttpLocalhost) || url.username !== \"\" || url.password !== \"\") return verificationError(\"INVALID_URL\", \"Resource URLs must use HTTPS and cannot include credentials.\");\n\tif (!isAllowedLoopback(url, allowHttpLocalhost) && (isIpLiteral(url.hostname) || isLocalHostname(url.hostname))) return verificationError(\"HOST_REJECTED\", \"The resource host is not permitted.\");\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: url\n\t};\n}\nfunction isAllowedLoopback(url, enabled) {\n\tif (!enabled || url.protocol !== \"http:\" && url.protocol !== \"https:\") return false;\n\tconst hostname = url.hostname.toLowerCase().replace(TRAILING_DOT, \"\");\n\treturn hostname === \"localhost\" || hostname.endsWith(\".localhost\") || hostname === \"127.0.0.1\" || hostname === \"[::1]\" || hostname === \"::1\";\n}\nasync function validateHost(url, resolver, timeoutMs) {\n\ttry {\n\t\tconst addresses = await withTimeout(Promise.resolve().then(() => resolver(url.hostname)), timeoutMs);\n\t\tif (addresses.length === 0 || addresses.some(isForbiddenAddress)) return verificationError(\"HOST_REJECTED\", \"The resource host resolved to a forbidden address.\");\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tvalue: true\n\t\t};\n\t} catch (error) {\n\t\tif (isAbortError(error)) return verificationError(\"RESOURCE_TIMEOUT\", \"The resource fetch exceeded its total timeout.\");\n\t\treturn verificationError(\"HOST_REJECTED\", \"The resource host could not be validated.\");\n\t}\n}\nasync function fetchResponse(fetchImplementation, url, timeoutMs) {\n\tconst controller = new AbortController();\n\ttry {\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tvalue: await withTimeout(Promise.resolve().then(() => fetchImplementation(url, {\n\t\t\t\tmethod: \"GET\",\n\t\t\t\tredirect: \"manual\",\n\t\t\t\tsignal: controller.signal\n\t\t\t})), timeoutMs, () => controller.abort())\n\t\t};\n\t} catch (error) {\n\t\tif (controller.signal.aborted || isAbortError(error)) return verificationError(\"RESOURCE_TIMEOUT\", \"The resource response headers timed out.\");\n\t\treturn verificationError(\"FETCH_FAILED\", \"The resource request failed.\");\n\t}\n}\nasync function readResponse(response, maximumBytes, startedAt, totalTimeoutMs) {\n\tif (response.body === null) return {\n\t\tsuccess: true,\n\t\tvalue: new Uint8Array()\n\t};\n\tconst reader = response.body.getReader();\n\tconst chunks = [];\n\tlet length = 0;\n\ttry {\n\t\tfor (;;) {\n\t\t\tconst remaining = totalTimeoutMs - (Date.now() - startedAt);\n\t\t\tif (remaining <= 0) {\n\t\t\t\tawait reader.cancel();\n\t\t\t\treturn verificationError(\"RESOURCE_TIMEOUT\", \"The resource fetch exceeded its total timeout.\");\n\t\t\t}\n\t\t\tconst chunk = await readWithTimeout(reader, remaining);\n\t\t\tif (!chunk.success) {\n\t\t\t\tawait reader.cancel();\n\t\t\t\treturn chunk;\n\t\t\t}\n\t\t\tif (chunk.value.done) break;\n\t\t\tconst value = chunk.value.value;\n\t\t\tlength += value.length;\n\t\t\tif (length > maximumBytes) {\n\t\t\t\tawait reader.cancel();\n\t\t\t\treturn verificationError(\"RESOURCE_SIZE_EXCEEDED\", \"The resource exceeds the byte limit.\");\n\t\t\t}\n\t\t\tchunks.push(value);\n\t\t}\n\t} catch {\n\t\treturn verificationError(\"FETCH_FAILED\", \"The resource response could not be read.\");\n\t} finally {\n\t\treader.releaseLock();\n\t}\n\tconst output = new Uint8Array(length);\n\tlet offset = 0;\n\tfor (const chunk of chunks) {\n\t\toutput.set(chunk, offset);\n\t\toffset += chunk.length;\n\t}\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: output\n\t};\n}\nasync function readWithTimeout(reader, timeoutMs) {\n\ttry {\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tvalue: await withTimeout(Promise.resolve().then(() => reader.read()), timeoutMs)\n\t\t};\n\t} catch (error) {\n\t\tif (isAbortError(error)) return verificationError(\"RESOURCE_TIMEOUT\", \"The resource fetch exceeded its total timeout.\");\n\t\treturn verificationError(\"FETCH_FAILED\", \"The resource response could not be read.\");\n\t}\n}\n/**\n* Every operation has both fulfillment and rejection handlers, so an operation\n* that loses the timeout race cannot later become an unhandled rejection.\n*/\nfunction withTimeout(operation, timeoutMs, onTimeout) {\n\treturn new Promise((resolve, reject) => {\n\t\tlet settled = false;\n\t\tconst timeout = setTimeout(() => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tonTimeout?.();\n\t\t\treject(new DOMException(\"Timed out\", \"AbortError\"));\n\t\t}, timeoutMs);\n\t\toperation.then((value) => {\n\t\t\tif (settled) return void 0;\n\t\t\tsettled = true;\n\t\t\tclearTimeout(timeout);\n\t\t\tresolve(value);\n\t\t}, (error) => {\n\t\t\tif (settled) return void 0;\n\t\t\tsettled = true;\n\t\t\tclearTimeout(timeout);\n\t\t\treject(error);\n\t\t});\n\t});\n}\nfunction areValidLimits(limits) {\n\treturn Object.values(limits).every((value) => Number.isSafeInteger(value) && value > 0);\n}\nfunction isRedirect(status) {\n\treturn status === 301 || status === 302 || status === 303 || status === 307 || status === 308;\n}\nfunction isAbortError(error) {\n\treturn error instanceof DOMException && error.name === \"AbortError\";\n}\nfunction isIpLiteral(hostname) {\n\treturn IPV4_LITERAL.test(hostname) || hostname.includes(\":\");\n}\nfunction isLocalHostname(hostname) {\n\tconst normalized = hostname.toLowerCase();\n\treturn normalized === \"localhost\" || normalized.endsWith(\".localhost\") || normalized.endsWith(\".local\") || normalized.endsWith(\".internal\");\n}\nfunction isForbiddenAddress(address) {\n\tconst ipv4 = parseIpv4(address);\n\tif (ipv4 !== null) {\n\t\tconst [a, b] = ipv4;\n\t\treturn a === 0 || a === 10 || a === 127 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && (b === 0 || b === 168) || a === 198 && (b === 18 || b === 19) || a >= 224;\n\t}\n\tconst ipv6 = parseIpv6(address);\n\tif (ipv6 === null) return true;\n\tconst first = ipv6[0];\n\tconst isUnspecified = ipv6.every((part) => part === 0);\n\tconst isLoopback = ipv6.slice(0, 7).every((part) => part === 0) && ipv6[7] === 1;\n\tconst isPrivate = (first & 65024) === 64512;\n\tconst isLinkLocal = (first & 65472) === 65152;\n\tconst isMulticast = (first & 65280) === 65280;\n\tif (ipv6.slice(0, 5).every((part) => part === 0) && ipv6[5] === 65535) return isForbiddenAddress(`${ipv6[6] >>> 8}.${ipv6[6] & 255}.${ipv6[7] >>> 8}.${ipv6[7] & 255}`);\n\treturn isUnspecified || isLoopback || isPrivate || isLinkLocal || isMulticast;\n}\nfunction parseIpv4(value) {\n\tconst parts = value.split(\".\");\n\tif (parts.length !== 4) return null;\n\tconst numbers = parts.map((part) => IPV4_PART.test(part) ? Number(part) : NaN);\n\tif (numbers.some((part) => !Number.isInteger(part) || part < 0 || part > 255)) return null;\n\treturn [\n\t\tnumbers[0],\n\t\tnumbers[1],\n\t\tnumbers[2],\n\t\tnumbers[3]\n\t];\n}\nfunction parseIpv6(value) {\n\tif (value.includes(\":::\") || value.split(\"::\").length > 2) return null;\n\tconst [before = \"\", after = \"\"] = value.split(\"::\");\n\tconst head = before === \"\" ? [] : before.split(\":\");\n\tconst tail = after === \"\" ? [] : after.split(\":\");\n\tconst parts = [...head, ...tail];\n\tif (parts.some((part) => !IPV6_PART.test(part)) || parts.length > 8) return null;\n\tif (!value.includes(\"::\") && parts.length !== 8) return null;\n\tconst zeroes = value.includes(\"::\") ? 8 - parts.length : 0;\n\treturn [\n\t\t...head,\n\t\t...Array.from({ length: zeroes }).fill(\"0\"),\n\t\t...tail\n\t].map((part) => Number.parseInt(part, 16));\n}\n\n//#endregion\n//#region src/artifact.ts\nconst DID_DOCUMENT_MAX_BYTES = 256 * 1024;\nconst PLC_DID_PATTERN = /^did:plc:[a-z2-7]{24}$/;\nconst CID_PATTERN = /^b[a-z2-7]+$/;\nconst UNSAFE_PATH_SEGMENT = /[/\\\\?#]/;\nasync function fetchReleaseArtifact(input, options) {\n\tconst deadline = Date.now() + (options.totalTimeoutMs ?? DEFAULT_FETCH_LIMITS.totalTimeoutMs);\n\tconst { artifact } = input;\n\tif (!artifact.blob && !artifact.url) return verificationError(\"RELEASE_ARTIFACT_SOURCE_MISSING\", \"The release artifact must provide a blob or URL.\");\n\tif (artifact.requiresAuth === true || input.auth !== void 0) return unsupportedAuth$1(input.auth);\n\tconst blobCid = modernBlobCid(artifact.blob);\n\tconst blobMetadata = blobCid && artifact.blob && \"ref\" in artifact.blob ? artifact.blob : void 0;\n\tif (artifact.blob && !blobCid) return verificationError(\"BLOB_REF_INVALID\", \"Legacy blob references are not supported.\");\n\tif (blobCid) {\n\t\tconst expected = multihashFromBlobCid(blobCid);\n\t\tif (!expected.success) return expected;\n\t\tif (expected.value !== artifact.checksum) return verificationError(\"CHECKSUM_MISMATCH\", \"The artifact checksum does not match its blob reference CID.\");\n\t}\n\tlet lastError;\n\tfor (const cache of input.artifactCaches ?? []) {\n\t\tconst serviceEndpoint = recordScopedCacheEndpoint(cache);\n\t\tif (!serviceEndpoint || !blobCid) continue;\n\t\tconst cacheUrl = recordScopedBlobCacheUrl(serviceEndpoint, input.record, blobCid);\n\t\tif (!cacheUrl.success) {\n\t\t\tlastError = cacheUrl.error;\n\t\t\tcontinue;\n\t\t}\n\t\tconst attemptOptions = withinDeadline(options, deadline);\n\t\tif (!attemptOptions) return timedOut();\n\t\tconst result = await fetchAndVerify(\"artifact-cache\", cacheUrl.value, artifact.checksum, withBlobSizeLimit(attemptOptions, blobMetadata), blobMetadata);\n\t\tif (result.success) return result;\n\t\tlastError = result.error;\n\t}\n\tif (blobCid) {\n\t\tconst resolutionOptions = withinDeadline(options, deadline);\n\t\tif (!resolutionOptions) return timedOut();\n\t\tconst pds = input.pdsEndpoint ? {\n\t\t\tsuccess: true,\n\t\t\tvalue: input.pdsEndpoint\n\t\t} : await resolvePublisherPdsEndpoint(input.record.did, resolutionOptions);\n\t\tif (pds.success) {\n\t\t\tconst url = blobUrl(pds.value, input.record.did, blobCid);\n\t\t\tif (url.success) {\n\t\t\t\tconst attemptOptions = withinDeadline(options, deadline);\n\t\t\t\tif (!attemptOptions) return timedOut();\n\t\t\t\tconst result = await fetchAndVerify(\"blob\", url.value, artifact.checksum, withBlobSizeLimit(attemptOptions, blobMetadata), blobMetadata);\n\t\t\t\tif (result.success) return result;\n\t\t\t\tlastError = result.error;\n\t\t\t} else lastError = url.error;\n\t\t} else lastError = pds.error;\n\t}\n\tif (artifact.url) {\n\t\tconst attemptOptions = withinDeadline(options, deadline);\n\t\tif (!attemptOptions) return timedOut();\n\t\tconst result = await fetchAndVerify(\"url\", artifact.url, artifact.checksum, withBlobSizeLimit(attemptOptions, blobMetadata), blobMetadata);\n\t\tif (result.success) return result;\n\t\tlastError = result.error;\n\t}\n\treturn lastError ? {\n\t\tsuccess: false,\n\t\terror: lastError\n\t} : verificationError(\"FETCH_FAILED\", \"The release artifact could not be fetched.\");\n}\nfunction recordScopedBlobCacheUrl(serviceEndpoint, record, blobCid) {\n\ttry {\n\t\tconst endpoint = new URL(serviceEndpoint);\n\t\tif (endpoint.protocol !== \"https:\" || endpoint.username || endpoint.password || endpoint.pathname !== \"/\" || endpoint.search || endpoint.hash) throw new Error();\n\t\tconst segments = [\n\t\t\t\"r\",\n\t\t\trecord.did,\n\t\t\trecord.collection,\n\t\t\trecord.rkey,\n\t\t\trecord.cid,\n\t\t\tblobCid\n\t\t];\n\t\tif (!CID_PATTERN.test(record.cid) || !CID_PATTERN.test(blobCid) || segments.some((segment) => !isSafePathSegment(segment))) throw new Error();\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tvalue: new URL(segments.join(\"/\"), endpoint)\n\t\t};\n\t} catch {\n\t\treturn verificationError(\"INVALID_URL\", \"The record-scoped blob cache endpoint is invalid.\");\n\t}\n}\nfunction recordScopedImageCacheUrl(serviceEndpoint, preset, record, blobCid) {\n\tconst raw = recordScopedBlobCacheUrl(serviceEndpoint, record, blobCid);\n\tif (!raw.success) return raw;\n\tconst url = new URL(raw.value);\n\turl.pathname = `/img/${preset}${url.pathname}`;\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: url\n\t};\n}\nasync function resolvePublisherPdsEndpoint(publisherDid, options) {\n\tconst documentUrl = didDocumentUrl(publisherDid);\n\tif (!documentUrl) return verificationError(\"PDS_RESOLUTION_FAILED\", \"The publisher DID is not supported.\");\n\tconst fetched = await fetchVerifiedResource(documentUrl, {\n\t\t...options,\n\t\tmaxBytes: DID_DOCUMENT_MAX_BYTES\n\t});\n\tif (!fetched.success) return verificationError(\"PDS_RESOLUTION_FAILED\", \"The publisher DID document could not be fetched.\");\n\tlet document;\n\ttry {\n\t\tdocument = JSON.parse(new TextDecoder().decode(fetched.value.bytes));\n\t} catch {\n\t\treturn verificationError(\"PDS_RESOLUTION_FAILED\", \"The publisher DID document is malformed.\");\n\t}\n\tif (!isRecord$2(document) || document.id !== publisherDid || !Array.isArray(document.service)) return verificationError(\"PDS_RESOLUTION_FAILED\", \"The publisher DID document has no valid PDS service.\");\n\tconst service = document.service.find((value) => isRecord$2(value) && (value.id === `${publisherDid}#atproto_pds` || value.id === \"#atproto_pds\") && value.type === \"AtprotoPersonalDataServer\" && typeof value.serviceEndpoint === \"string\");\n\tif (!isRecord$2(service) || typeof service.serviceEndpoint !== \"string\") return verificationError(\"PDS_RESOLUTION_FAILED\", \"The publisher DID document has no valid PDS service.\");\n\ttry {\n\t\tconst endpoint = new URL(service.serviceEndpoint);\n\t\tif (!(options.allowHttpLocalhost === true && endpoint.protocol === \"http:\" && (endpoint.hostname === \"localhost\" || endpoint.hostname === \"127.0.0.1\")) && endpoint.protocol !== \"https:\" || endpoint.username || endpoint.password) throw new Error();\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tvalue: endpoint.href\n\t\t};\n\t} catch {\n\t\treturn verificationError(\"PDS_RESOLUTION_FAILED\", \"The publisher DID document has no valid PDS service.\");\n\t}\n}\nasync function fetchAndVerify(source, url, checksum, options, blobMetadata) {\n\tconst fetched = await fetchVerifiedResource(url, options);\n\tif (!fetched.success) return blobMetadata && fetched.error.code === \"RESOURCE_SIZE_EXCEEDED\" ? verificationError(\"BLOB_METADATA_MISMATCH\", \"The fetched artifact size does not match its signed blob metadata.\") : fetched;\n\tconst verified = await verifyMultihash(fetched.value.bytes, checksum);\n\tif (!verified.success) return verified;\n\tconst contentType = fetched.value.headers.get(\"content-type\")?.split(\";\", 1)[0]?.trim();\n\tif (blobMetadata && (fetched.value.bytes.byteLength !== blobMetadata.size || contentType !== void 0 && contentType !== blobMetadata.mimeType)) return verificationError(\"BLOB_METADATA_MISMATCH\", \"The fetched artifact does not match its signed blob metadata.\");\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: {\n\t\t\tbytes: fetched.value.bytes,\n\t\t\tsource,\n\t\t\turl: fetched.value.url\n\t\t}\n\t};\n}\nfunction withBlobSizeLimit(options, blobMetadata) {\n\tif (!blobMetadata) return options;\n\treturn {\n\t\t...options,\n\t\tmaxBytes: Math.min(options.maxBytes ?? DEFAULT_FETCH_LIMITS.maxBytes, blobMetadata.size)\n\t};\n}\nfunction blobUrl(pdsEndpoint, publisherDid, cid) {\n\ttry {\n\t\tconst url = new URL(\"/xrpc/com.atproto.sync.getBlob\", pdsEndpoint);\n\t\turl.searchParams.set(\"did\", publisherDid);\n\t\turl.searchParams.set(\"cid\", cid);\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tvalue: url\n\t\t};\n\t} catch {\n\t\treturn verificationError(\"PDS_RESOLUTION_FAILED\", \"The publisher PDS endpoint is invalid.\");\n\t}\n}\nfunction didDocumentUrl(did) {\n\tif (PLC_DID_PATTERN.test(did)) return `https://plc.directory/${encodeURIComponent(did)}`;\n\tif (!did.startsWith(\"did:web:\")) return null;\n\ttry {\n\t\tconst parts = did.slice(8).split(\":\").map(decodeURIComponent);\n\t\tconst host = parts.shift();\n\t\tif (!host || parts.some((part) => part === \"\" || part === \".\" || part === \"..\")) return null;\n\t\tconst path = parts.length === 0 ? \"/.well-known/did.json\" : `/${parts.join(\"/\")}/did.json`;\n\t\treturn new URL(path, `https://${host}`).href;\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction unsupportedAuth$1(auth) {\n\treturn verificationError(\"AUTH_METHOD_UNSUPPORTED\", UNSUPPORTED_AUTH_MESSAGE, unsupportedAuthDetails(auth));\n}\nfunction withinDeadline(options, deadline) {\n\tconst remaining = deadline - Date.now();\n\tif (remaining <= 0) return null;\n\treturn {\n\t\t...options,\n\t\ttotalTimeoutMs: remaining\n\t};\n}\nfunction timedOut() {\n\treturn verificationError(\"RESOURCE_TIMEOUT\", \"Artifact retrieval exceeded its total timeout.\");\n}\nfunction isRecord$2(value) {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction modernBlobCid(blob) {\n\tif (!blob || !(\"ref\" in blob) || typeof blob.ref?.$link !== \"string\") return null;\n\treturn blob.ref.$link;\n}\nfunction recordScopedCacheEndpoint(value) {\n\tif (!isRecord$2(value) || value.$type !== RECORD_SCOPED_BLOB_CACHE_TYPE) return null;\n\treturn typeof value.serviceEndpoint === \"string\" ? value.serviceEndpoint : null;\n}\nfunction isSafePathSegment(value) {\n\tif (value.length === 0 || UNSAFE_PATH_SEGMENT.test(value)) return false;\n\tfor (const character of value) {\n\t\tconst codePoint = character.codePointAt(0);\n\t\tif (codePoint !== void 0 && (codePoint <= 31 || codePoint === 127)) return false;\n\t}\n\treturn true;\n}\n\n//#endregion\n//#region src/bundle-limits.ts\n/** Maximum accepted gzip payload size. */\nconst MAX_BUNDLE_COMPRESSED_BYTES = 384 * 1024;\n/** Maximum aggregate size of regular-file contents. */\nconst MAX_BUNDLE_SIZE = 256 * 1024;\n/** Maximum size of one regular file. */\nconst MAX_BUNDLE_FILE_BYTES = 128 * 1024;\n/** Maximum number of regular files. */\nconst MAX_BUNDLE_FILE_COUNT = 20;\n/** Maximum total tar entries, including harmless directory entries. */\nconst MAX_BUNDLE_TAR_ENTRY_COUNT = 32;\n/**\n* Maximum tar stream size after decompression. This includes USTAR headers,\n* file padding, and the end marker in addition to the regular-file contents.\n*/\nconst MAX_BUNDLE_DECOMPRESSED_BYTES = MAX_BUNDLE_SIZE + MAX_BUNDLE_TAR_ENTRY_COUNT * 512 + MAX_BUNDLE_FILE_COUNT * 511 + 2 * 512;\n\n//#endregion\n//#region src/bundle.ts\nconst TAR_BLOCK_BYTES = 512;\nconst TAR_END_BYTES = TAR_BLOCK_BYTES * 2;\nconst OCTAL_PATTERN = /^[0-7]+$/;\nconst WINDOWS_DRIVE_PATTERN = /^[a-zA-Z]:/;\nconst decoder$1 = new TextDecoder(\"utf-8\", {\n\tfatal: true,\n\tignoreBOM: false\n});\nasync function validatePluginBundle(compressed, options = {}) {\n\tif (compressed.byteLength > MAX_BUNDLE_COMPRESSED_BYTES) return verificationError(\"BUNDLE_COMPRESSED_SIZE_EXCEEDED\", \"The compressed plugin bundle exceeds the size limit.\");\n\tconst decompressed = await decompressBundle(compressed);\n\tif (!decompressed.success) return decompressed;\n\tconst files = parseTar(decompressed.value);\n\tif (!files.success) return files;\n\tconst manifestFile = files.value.get(\"manifest.json\");\n\tif (!manifestFile) return verificationError(\"BUNDLE_MISSING_MANIFEST\", \"The plugin bundle is missing manifest.json.\");\n\tconst backend = files.value.get(\"backend.js\");\n\tif (!backend) return verificationError(\"BUNDLE_MISSING_BACKEND\", \"The plugin bundle is missing backend.js.\");\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(decoder$1.decode(manifestFile.data));\n\t} catch {\n\t\treturn verificationError(\"BUNDLE_INVALID_MANIFEST\", \"The plugin bundle manifest is not valid JSON.\");\n\t}\n\tconst validated = pluginManifestSchema.safeParse(parsed);\n\tif (!validated.success) return verificationError(\"BUNDLE_INVALID_MANIFEST\", \"The plugin bundle manifest failed schema validation.\");\n\tconst manifest = reconcileManifestAccess(validated.data);\n\tif (options.expectedSlug !== void 0 && manifest.id !== options.expectedSlug) return verificationError(\"BUNDLE_ID_MISMATCH\", \"The plugin bundle manifest id does not match the expected plugin.\");\n\tif (options.expectedVersion !== void 0 && manifest.version !== options.expectedVersion) return verificationError(\"BUNDLE_VERSION_MISMATCH\", \"The plugin bundle manifest version does not match the expected version.\");\n\tconst result = {\n\t\tmanifest,\n\t\tdeclaredAccess: manifest.declaredAccess ?? {},\n\t\tbackend: backend.data\n\t};\n\tconst admin = files.value.get(\"admin.js\");\n\tif (admin) result.admin = admin.data;\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: result\n\t};\n}\nasync function decompressBundle(bytes) {\n\tconst source = new ReadableStream({ start(controller) {\n\t\tcontroller.enqueue(bytes);\n\t\tcontroller.close();\n\t} });\n\tlet reader;\n\ttry {\n\t\treader = source.pipeThrough(createGzipDecoder()).getReader();\n\t} catch {\n\t\treturn verificationError(\"BUNDLE_INVALID_ARCHIVE\", \"The plugin bundle is not valid gzip data.\");\n\t}\n\tconst chunks = [];\n\tlet total = 0;\n\ttry {\n\t\twhile (true) {\n\t\t\tconst { done, value } = await reader.read();\n\t\t\tif (done) break;\n\t\t\tif (!value) continue;\n\t\t\ttotal += value.byteLength;\n\t\t\tif (total > MAX_BUNDLE_DECOMPRESSED_BYTES) {\n\t\t\t\tawait reader.cancel().catch(() => void 0);\n\t\t\t\treturn verificationError(\"BUNDLE_DECOMPRESSED_SIZE_EXCEEDED\", \"The decompressed plugin bundle exceeds the size limit.\");\n\t\t\t}\n\t\t\tchunks.push(value);\n\t\t}\n\t} catch {\n\t\treturn verificationError(\"BUNDLE_INVALID_ARCHIVE\", \"The plugin bundle is not valid gzip data.\");\n\t}\n\tconst output = new Uint8Array(total);\n\tlet offset = 0;\n\tfor (const chunk of chunks) {\n\t\toutput.set(chunk, offset);\n\t\toffset += chunk.byteLength;\n\t}\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: output\n\t};\n}\nfunction parseTar(bytes) {\n\tif (bytes.byteLength < TAR_END_BYTES || bytes.byteLength % TAR_BLOCK_BYTES !== 0) return invalidArchive();\n\tconst files = /* @__PURE__ */ new Map();\n\tconst rawPaths = /* @__PURE__ */ new Set();\n\tconst normalizedPaths = /* @__PURE__ */ new Set();\n\tlet offset = 0;\n\tlet fileCount = 0;\n\tlet entryCount = 0;\n\tlet totalFileBytes = 0;\n\tlet ended = false;\n\twhile (offset + TAR_BLOCK_BYTES <= bytes.byteLength) {\n\t\tconst header = bytes.subarray(offset, offset + TAR_BLOCK_BYTES);\n\t\tif (isZeroBlock(header)) {\n\t\t\tif (!isZeroBlock(bytes.subarray(offset + TAR_BLOCK_BYTES, offset + TAR_END_BYTES))) return invalidArchive();\n\t\t\tif (bytes.subarray(offset + TAR_END_BYTES).some((byte) => byte !== 0)) return invalidArchive();\n\t\t\tended = true;\n\t\t\tbreak;\n\t\t}\n\t\tif (!validChecksum(header)) return invalidArchive();\n\t\tentryCount += 1;\n\t\tif (entryCount > MAX_BUNDLE_TAR_ENTRY_COUNT) return verificationError(\"BUNDLE_FILE_COUNT_EXCEEDED\", \"The plugin bundle contains too many archive entries.\");\n\t\tconst rawName = readTarPath(header);\n\t\tif (!rawName.success) return rawName;\n\t\tconst typeFlag = header[156];\n\t\tconst type = typeFlag === 0 ? \"file\" : String.fromCharCode(typeFlag ?? 0);\n\t\tconst isDirectory = type === \"5\";\n\t\tconst normalized = normalizePath(rawName.value, isDirectory);\n\t\tif (!normalized.success) return normalized;\n\t\tif (rawPaths.has(rawName.value) || normalizedPaths.has(normalized.value)) return verificationError(\"BUNDLE_PATH_COLLISION\", \"The plugin bundle contains duplicate or ambiguous paths.\");\n\t\trawPaths.add(rawName.value);\n\t\tnormalizedPaths.add(normalized.value);\n\t\tconst size = readOctal(header.subarray(124, 136));\n\t\tif (size === null || !Number.isSafeInteger(size)) return invalidArchive();\n\t\tconst bodyStart = offset + TAR_BLOCK_BYTES;\n\t\tconst nextOffset = bodyStart + Math.ceil(size / TAR_BLOCK_BYTES) * TAR_BLOCK_BYTES;\n\t\tif (nextOffset > bytes.byteLength) return invalidArchive();\n\t\tif (isDirectory) {\n\t\t\tif (size !== 0) return invalidArchive();\n\t\t} else if (type === \"file\" || type === \"0\") {\n\t\t\tfileCount += 1;\n\t\t\tif (fileCount > MAX_BUNDLE_FILE_COUNT) return verificationError(\"BUNDLE_FILE_COUNT_EXCEEDED\", \"The plugin bundle contains too many files.\");\n\t\t\tif (size > MAX_BUNDLE_FILE_BYTES) return verificationError(\"BUNDLE_FILE_SIZE_EXCEEDED\", \"A file in the plugin bundle exceeds the per-file size limit.\");\n\t\t\ttotalFileBytes += size;\n\t\t\tif (totalFileBytes > MAX_BUNDLE_SIZE) return verificationError(\"BUNDLE_DECOMPRESSED_SIZE_EXCEEDED\", \"The plugin bundle file contents exceed the size limit.\");\n\t\t\tfiles.set(normalized.value, {\n\t\t\t\tname: normalized.value,\n\t\t\t\tdata: bytes.slice(bodyStart, bodyStart + size)\n\t\t\t});\n\t\t} else return verificationError(\"BUNDLE_UNSUPPORTED_ENTRY\", \"The plugin bundle contains an unsupported archive entry type.\");\n\t\toffset = nextOffset;\n\t}\n\tif (!ended) return invalidArchive();\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: files\n\t};\n}\nfunction readTarPath(header) {\n\tconst name = readTarString(header.subarray(0, 100));\n\tconst prefix = readTarString(header.subarray(345, 500));\n\tif (name === null || prefix === null || name.length === 0) return verificationError(\"BUNDLE_INVALID_PATH\", \"The plugin bundle contains a malformed path.\");\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: prefix ? `${prefix}/${name}` : name\n\t};\n}\nfunction readTarString(field) {\n\tconst terminator = field.indexOf(0);\n\tconst end = terminator === -1 ? field.length : terminator;\n\tif (terminator !== -1 && field.subarray(terminator + 1).some((byte) => byte !== 0)) return null;\n\ttry {\n\t\treturn decoder$1.decode(field.subarray(0, end));\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction normalizePath(raw, isDirectory) {\n\tif (raw.includes(\"\\\\\") || raw.startsWith(\"/\") || WINDOWS_DRIVE_PATTERN.test(raw) || hasControlCharacter(raw) || raw.endsWith(\"/\") !== isDirectory) return verificationError(\"BUNDLE_INVALID_PATH\", \"The plugin bundle contains an unsafe path.\");\n\tconst parts = raw.split(\"/\");\n\tif (isDirectory) parts.pop();\n\tconst normalized = [];\n\tfor (const part of parts) {\n\t\tif (part === \".\") continue;\n\t\tif (part === \"\" || part === \"..\") return verificationError(\"BUNDLE_INVALID_PATH\", \"The plugin bundle contains an unsafe path.\");\n\t\tnormalized.push(part.normalize(\"NFC\"));\n\t}\n\tif (normalized.length === 0) return verificationError(\"BUNDLE_INVALID_PATH\", \"The plugin bundle contains a malformed path.\");\n\treturn {\n\t\tsuccess: true,\n\t\tvalue: normalized.join(\"/\")\n\t};\n}\nfunction hasControlCharacter(value) {\n\tfor (const character of value) {\n\t\tconst codePoint = character.codePointAt(0);\n\t\tif (codePoint !== void 0 && (codePoint <= 31 || codePoint === 127)) return true;\n\t}\n\treturn false;\n}\nfunction readOctal(field) {\n\tconst text = new TextDecoder().decode(field).replaceAll(\"\\0\", \"\").trim();\n\tif (!OCTAL_PATTERN.test(text)) return null;\n\tconst value = Number.parseInt(text, 8);\n\treturn Number.isSafeInteger(value) ? value : null;\n}\nfunction validChecksum(header) {\n\tconst expected = readOctal(header.subarray(148, 156));\n\tif (expected === null) return false;\n\tlet actual = 0;\n\tfor (let index = 0; index < header.length; index += 1) actual += index >= 148 && index < 156 ? 32 : header[index] ?? 0;\n\treturn actual === expected;\n}\nfunction isZeroBlock(block) {\n\treturn block.byteLength === TAR_BLOCK_BYTES && block.every((byte) => byte === 0);\n}\nfunction invalidArchive() {\n\treturn verificationError(\"BUNDLE_INVALID_ARCHIVE\", \"The plugin bundle is not a valid tar archive.\");\n}\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+protobuf-specs@0.5.1/node_modules/@sigstore/protobuf-specs/dist/__generated__/envelope.js\nvar require_envelope = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.Signature = exports.Envelope = void 0;\n\texports.Envelope = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tpayload: isSet(object.payload) ? Buffer.from(bytesFromBase64(object.payload)) : Buffer.alloc(0),\n\t\t\t\tpayloadType: isSet(object.payloadType) ? globalThis.String(object.payloadType) : \"\",\n\t\t\t\tsignatures: globalThis.Array.isArray(object?.signatures) ? object.signatures.map((e) => exports.Signature.fromJSON(e)) : []\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.payload.length !== 0) obj.payload = base64FromBytes(message.payload);\n\t\t\tif (message.payloadType !== \"\") obj.payloadType = message.payloadType;\n\t\t\tif (message.signatures?.length) obj.signatures = message.signatures.map((e) => exports.Signature.toJSON(e));\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.Signature = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tsig: isSet(object.sig) ? Buffer.from(bytesFromBase64(object.sig)) : Buffer.alloc(0),\n\t\t\t\tkeyid: isSet(object.keyid) ? globalThis.String(object.keyid) : \"\"\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.sig.length !== 0) obj.sig = base64FromBytes(message.sig);\n\t\t\tif (message.keyid !== \"\") obj.keyid = message.keyid;\n\t\t\treturn obj;\n\t\t}\n\t};\n\tfunction bytesFromBase64(b64) {\n\t\treturn Uint8Array.from(globalThis.Buffer.from(b64, \"base64\"));\n\t}\n\tfunction base64FromBytes(arr) {\n\t\treturn globalThis.Buffer.from(arr).toString(\"base64\");\n\t}\n\tfunction isSet(value) {\n\t\treturn value !== null && value !== void 0;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+protobuf-specs@0.5.1/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/timestamp.js\nvar require_timestamp$2 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.Timestamp = void 0;\n\texports.Timestamp = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tseconds: isSet(object.seconds) ? globalThis.String(object.seconds) : \"0\",\n\t\t\t\tnanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.seconds !== \"0\") obj.seconds = message.seconds;\n\t\t\tif (message.nanos !== 0) obj.nanos = Math.round(message.nanos);\n\t\t\treturn obj;\n\t\t}\n\t};\n\tfunction isSet(value) {\n\t\treturn value !== null && value !== void 0;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+protobuf-specs@0.5.1/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_common.js\nvar require_sigstore_common = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.TimeRange = exports.X509CertificateChain = exports.SubjectAlternativeName = exports.X509Certificate = exports.DistinguishedName = exports.ObjectIdentifierValuePair = exports.ObjectIdentifier = exports.PublicKeyIdentifier = exports.PublicKey = exports.RFC3161SignedTimestamp = exports.LogId = exports.MessageSignature = exports.HashOutput = exports.SubjectAlternativeNameType = exports.PublicKeyDetails = exports.HashAlgorithm = void 0;\n\texports.hashAlgorithmFromJSON = hashAlgorithmFromJSON;\n\texports.hashAlgorithmToJSON = hashAlgorithmToJSON;\n\texports.publicKeyDetailsFromJSON = publicKeyDetailsFromJSON;\n\texports.publicKeyDetailsToJSON = publicKeyDetailsToJSON;\n\texports.subjectAlternativeNameTypeFromJSON = subjectAlternativeNameTypeFromJSON;\n\texports.subjectAlternativeNameTypeToJSON = subjectAlternativeNameTypeToJSON;\n\tconst timestamp_1 = require_timestamp$2();\n\t/**\n\t* Only a subset of the secure hash standard algorithms are supported.\n\t* See <https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf> for more\n\t* details.\n\t* UNSPECIFIED SHOULD not be used, primary reason for inclusion is to force\n\t* any proto JSON serialization to emit the used hash algorithm, as default\n\t* option is to *omit* the default value of an enum (which is the first\n\t* value, represented by '0'.\n\t*/\n\tvar HashAlgorithm;\n\t(function(HashAlgorithm) {\n\t\tHashAlgorithm[HashAlgorithm[\"HASH_ALGORITHM_UNSPECIFIED\"] = 0] = \"HASH_ALGORITHM_UNSPECIFIED\";\n\t\tHashAlgorithm[HashAlgorithm[\"SHA2_256\"] = 1] = \"SHA2_256\";\n\t\tHashAlgorithm[HashAlgorithm[\"SHA2_384\"] = 2] = \"SHA2_384\";\n\t\tHashAlgorithm[HashAlgorithm[\"SHA2_512\"] = 3] = \"SHA2_512\";\n\t\t/**\n\t\t* SHA3_256 - Used for LMS\n\t\t*\n\t\t* @deprecated\n\t\t*/\n\t\tHashAlgorithm[HashAlgorithm[\"SHA3_256\"] = 4] = \"SHA3_256\";\n\t\t/**\n\t\t* SHA3_384 - Used for LMS\n\t\t*\n\t\t* @deprecated\n\t\t*/\n\t\tHashAlgorithm[HashAlgorithm[\"SHA3_384\"] = 5] = \"SHA3_384\";\n\t})(HashAlgorithm || (exports.HashAlgorithm = HashAlgorithm = {}));\n\tfunction hashAlgorithmFromJSON(object) {\n\t\tswitch (object) {\n\t\t\tcase 0:\n\t\t\tcase \"HASH_ALGORITHM_UNSPECIFIED\": return HashAlgorithm.HASH_ALGORITHM_UNSPECIFIED;\n\t\t\tcase 1:\n\t\t\tcase \"SHA2_256\": return HashAlgorithm.SHA2_256;\n\t\t\tcase 2:\n\t\t\tcase \"SHA2_384\": return HashAlgorithm.SHA2_384;\n\t\t\tcase 3:\n\t\t\tcase \"SHA2_512\": return HashAlgorithm.SHA2_512;\n\t\t\tcase 4:\n\t\t\tcase \"SHA3_256\": return HashAlgorithm.SHA3_256;\n\t\t\tcase 5:\n\t\t\tcase \"SHA3_384\": return HashAlgorithm.SHA3_384;\n\t\t\tdefault: throw new globalThis.Error(\"Unrecognized enum value \" + object + \" for enum HashAlgorithm\");\n\t\t}\n\t}\n\tfunction hashAlgorithmToJSON(object) {\n\t\tswitch (object) {\n\t\t\tcase HashAlgorithm.HASH_ALGORITHM_UNSPECIFIED: return \"HASH_ALGORITHM_UNSPECIFIED\";\n\t\t\tcase HashAlgorithm.SHA2_256: return \"SHA2_256\";\n\t\t\tcase HashAlgorithm.SHA2_384: return \"SHA2_384\";\n\t\t\tcase HashAlgorithm.SHA2_512: return \"SHA2_512\";\n\t\t\tcase HashAlgorithm.SHA3_256: return \"SHA3_256\";\n\t\t\tcase HashAlgorithm.SHA3_384: return \"SHA3_384\";\n\t\t\tdefault: throw new globalThis.Error(\"Unrecognized enum value \" + object + \" for enum HashAlgorithm\");\n\t\t}\n\t}\n\t/**\n\t* Details of a specific public key, capturing the the key encoding method,\n\t* and signature algorithm.\n\t*\n\t* PublicKeyDetails captures the public key/hash algorithm combinations\n\t* recommended in the Sigstore ecosystem.\n\t*\n\t* This is modelled as a linear set as we want to provide a small number of\n\t* opinionated options instead of allowing every possible permutation.\n\t*\n\t* Any changes to this enum MUST be reflected in the algorithm registry.\n\t*\n\t* See: <https://github.com/sigstore/architecture-docs/blob/main/algorithm-registry.md>\n\t*\n\t* To avoid the possibility of contradicting formats such as PKCS1 with\n\t* ED25519 the valid permutations are listed as a linear set instead of a\n\t* cartesian set (i.e one combined variable instead of two, one for encoding\n\t* and one for the signature algorithm).\n\t*/\n\tvar PublicKeyDetails;\n\t(function(PublicKeyDetails) {\n\t\tPublicKeyDetails[PublicKeyDetails[\"PUBLIC_KEY_DETAILS_UNSPECIFIED\"] = 0] = \"PUBLIC_KEY_DETAILS_UNSPECIFIED\";\n\t\t/**\n\t\t* PKCS1_RSA_PKCS1V5 - RSA\n\t\t*\n\t\t* @deprecated\n\t\t*/\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKCS1_RSA_PKCS1V5\"] = 1] = \"PKCS1_RSA_PKCS1V5\";\n\t\t/**\n\t\t* PKCS1_RSA_PSS - See RFC8017\n\t\t*\n\t\t* @deprecated\n\t\t*/\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKCS1_RSA_PSS\"] = 2] = \"PKCS1_RSA_PSS\";\n\t\t/** @deprecated */\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_RSA_PKCS1V5\"] = 3] = \"PKIX_RSA_PKCS1V5\";\n\t\t/** @deprecated */\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_RSA_PSS\"] = 4] = \"PKIX_RSA_PSS\";\n\t\t/** PKIX_RSA_PKCS1V15_2048_SHA256 - RSA public key in PKIX format, PKCS#1v1.5 signature */\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_RSA_PKCS1V15_2048_SHA256\"] = 9] = \"PKIX_RSA_PKCS1V15_2048_SHA256\";\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_RSA_PKCS1V15_3072_SHA256\"] = 10] = \"PKIX_RSA_PKCS1V15_3072_SHA256\";\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_RSA_PKCS1V15_4096_SHA256\"] = 11] = \"PKIX_RSA_PKCS1V15_4096_SHA256\";\n\t\t/** PKIX_RSA_PSS_2048_SHA256 - RSA public key in PKIX format, RSASSA-PSS signature */\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_RSA_PSS_2048_SHA256\"] = 16] = \"PKIX_RSA_PSS_2048_SHA256\";\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_RSA_PSS_3072_SHA256\"] = 17] = \"PKIX_RSA_PSS_3072_SHA256\";\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_RSA_PSS_4096_SHA256\"] = 18] = \"PKIX_RSA_PSS_4096_SHA256\";\n\t\t/**\n\t\t* PKIX_ECDSA_P256_HMAC_SHA_256 - ECDSA\n\t\t*\n\t\t* @deprecated\n\t\t*/\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_ECDSA_P256_HMAC_SHA_256\"] = 6] = \"PKIX_ECDSA_P256_HMAC_SHA_256\";\n\t\t/** PKIX_ECDSA_P256_SHA_256 - See NIST FIPS 186-4 */\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_ECDSA_P256_SHA_256\"] = 5] = \"PKIX_ECDSA_P256_SHA_256\";\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_ECDSA_P384_SHA_384\"] = 12] = \"PKIX_ECDSA_P384_SHA_384\";\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_ECDSA_P521_SHA_512\"] = 13] = \"PKIX_ECDSA_P521_SHA_512\";\n\t\t/** PKIX_ED25519 - Ed 25519 */\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_ED25519\"] = 7] = \"PKIX_ED25519\";\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_ED25519_PH\"] = 8] = \"PKIX_ED25519_PH\";\n\t\t/**\n\t\t* PKIX_ECDSA_P384_SHA_256 - These algorithms are deprecated and should not be used, but they\n\t\t* were/are being used by most Sigstore clients implementations.\n\t\t*\n\t\t* @deprecated\n\t\t*/\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_ECDSA_P384_SHA_256\"] = 19] = \"PKIX_ECDSA_P384_SHA_256\";\n\t\t/** @deprecated */\n\t\tPublicKeyDetails[PublicKeyDetails[\"PKIX_ECDSA_P521_SHA_256\"] = 20] = \"PKIX_ECDSA_P521_SHA_256\";\n\t\t/**\n\t\t* LMS_SHA256 - LMS and LM-OTS\n\t\t*\n\t\t* These algorithms are deprecated and should not be used.\n\t\t* There are no plans to support SLH-DSA at this time.\n\t\t*\n\t\t* USER WARNING: LMS and LM-OTS are both stateful signature schemes.\n\t\t* Using them correctly requires discretion and careful consideration\n\t\t* to ensure that individual secret keys are not used more than once.\n\t\t* In addition, LM-OTS is a single-use scheme, meaning that it\n\t\t* MUST NOT be used for more than one signature per LM-OTS key.\n\t\t* If you cannot maintain these invariants, you MUST NOT use these\n\t\t* schemes.\n\t\t*\n\t\t* @deprecated\n\t\t*/\n\t\tPublicKeyDetails[PublicKeyDetails[\"LMS_SHA256\"] = 14] = \"LMS_SHA256\";\n\t\t/** @deprecated */\n\t\tPublicKeyDetails[PublicKeyDetails[\"LMOTS_SHA256\"] = 15] = \"LMOTS_SHA256\";\n\t\t/**\n\t\t* ML_DSA_44 - ML-DSA\n\t\t*\n\t\t* These ML_DSA_44, ML_DSA_65 and ML-DSA_87 algorithms are the pure variants\n\t\t* that take data to sign rather than the prehash variants (HashML-DSA), which\n\t\t* take digests. While considered quantum-resistant, their usage\n\t\t* involves tradeoffs in that signatures and keys are much larger, and\n\t\t* this makes deployments more costly.\n\t\t*\n\t\t* USER WARNING: ML_DSA_44, ML_DSA_65 and ML_DSA_87 are experimental algorithms.\n\t\t* In the future they MAY be used by private Sigstore deployments, but\n\t\t* they are not yet fully functional. This warning will be removed when\n\t\t* these algorithms are widely supported by Sigstore clients and servers,\n\t\t* but care should still be taken for production environments.\n\t\t*\n\t\t* See NIST FIPS 204, RFC 9881 for algorithm identifiers\n\t\t*/\n\t\tPublicKeyDetails[PublicKeyDetails[\"ML_DSA_44\"] = 23] = \"ML_DSA_44\";\n\t\tPublicKeyDetails[PublicKeyDetails[\"ML_DSA_65\"] = 21] = \"ML_DSA_65\";\n\t\tPublicKeyDetails[PublicKeyDetails[\"ML_DSA_87\"] = 22] = \"ML_DSA_87\";\n\t})(PublicKeyDetails || (exports.PublicKeyDetails = PublicKeyDetails = {}));\n\tfunction publicKeyDetailsFromJSON(object) {\n\t\tswitch (object) {\n\t\t\tcase 0:\n\t\t\tcase \"PUBLIC_KEY_DETAILS_UNSPECIFIED\": return PublicKeyDetails.PUBLIC_KEY_DETAILS_UNSPECIFIED;\n\t\t\tcase 1:\n\t\t\tcase \"PKCS1_RSA_PKCS1V5\": return PublicKeyDetails.PKCS1_RSA_PKCS1V5;\n\t\t\tcase 2:\n\t\t\tcase \"PKCS1_RSA_PSS\": return PublicKeyDetails.PKCS1_RSA_PSS;\n\t\t\tcase 3:\n\t\t\tcase \"PKIX_RSA_PKCS1V5\": return PublicKeyDetails.PKIX_RSA_PKCS1V5;\n\t\t\tcase 4:\n\t\t\tcase \"PKIX_RSA_PSS\": return PublicKeyDetails.PKIX_RSA_PSS;\n\t\t\tcase 9:\n\t\t\tcase \"PKIX_RSA_PKCS1V15_2048_SHA256\": return PublicKeyDetails.PKIX_RSA_PKCS1V15_2048_SHA256;\n\t\t\tcase 10:\n\t\t\tcase \"PKIX_RSA_PKCS1V15_3072_SHA256\": return PublicKeyDetails.PKIX_RSA_PKCS1V15_3072_SHA256;\n\t\t\tcase 11:\n\t\t\tcase \"PKIX_RSA_PKCS1V15_4096_SHA256\": return PublicKeyDetails.PKIX_RSA_PKCS1V15_4096_SHA256;\n\t\t\tcase 16:\n\t\t\tcase \"PKIX_RSA_PSS_2048_SHA256\": return PublicKeyDetails.PKIX_RSA_PSS_2048_SHA256;\n\t\t\tcase 17:\n\t\t\tcase \"PKIX_RSA_PSS_3072_SHA256\": return PublicKeyDetails.PKIX_RSA_PSS_3072_SHA256;\n\t\t\tcase 18:\n\t\t\tcase \"PKIX_RSA_PSS_4096_SHA256\": return PublicKeyDetails.PKIX_RSA_PSS_4096_SHA256;\n\t\t\tcase 6:\n\t\t\tcase \"PKIX_ECDSA_P256_HMAC_SHA_256\": return PublicKeyDetails.PKIX_ECDSA_P256_HMAC_SHA_256;\n\t\t\tcase 5:\n\t\t\tcase \"PKIX_ECDSA_P256_SHA_256\": return PublicKeyDetails.PKIX_ECDSA_P256_SHA_256;\n\t\t\tcase 12:\n\t\t\tcase \"PKIX_ECDSA_P384_SHA_384\": return PublicKeyDetails.PKIX_ECDSA_P384_SHA_384;\n\t\t\tcase 13:\n\t\t\tcase \"PKIX_ECDSA_P521_SHA_512\": return PublicKeyDetails.PKIX_ECDSA_P521_SHA_512;\n\t\t\tcase 7:\n\t\t\tcase \"PKIX_ED25519\": return PublicKeyDetails.PKIX_ED25519;\n\t\t\tcase 8:\n\t\t\tcase \"PKIX_ED25519_PH\": return PublicKeyDetails.PKIX_ED25519_PH;\n\t\t\tcase 19:\n\t\t\tcase \"PKIX_ECDSA_P384_SHA_256\": return PublicKeyDetails.PKIX_ECDSA_P384_SHA_256;\n\t\t\tcase 20:\n\t\t\tcase \"PKIX_ECDSA_P521_SHA_256\": return PublicKeyDetails.PKIX_ECDSA_P521_SHA_256;\n\t\t\tcase 14:\n\t\t\tcase \"LMS_SHA256\": return PublicKeyDetails.LMS_SHA256;\n\t\t\tcase 15:\n\t\t\tcase \"LMOTS_SHA256\": return PublicKeyDetails.LMOTS_SHA256;\n\t\t\tcase 23:\n\t\t\tcase \"ML_DSA_44\": return PublicKeyDetails.ML_DSA_44;\n\t\t\tcase 21:\n\t\t\tcase \"ML_DSA_65\": return PublicKeyDetails.ML_DSA_65;\n\t\t\tcase 22:\n\t\t\tcase \"ML_DSA_87\": return PublicKeyDetails.ML_DSA_87;\n\t\t\tdefault: throw new globalThis.Error(\"Unrecognized enum value \" + object + \" for enum PublicKeyDetails\");\n\t\t}\n\t}\n\tfunction publicKeyDetailsToJSON(object) {\n\t\tswitch (object) {\n\t\t\tcase PublicKeyDetails.PUBLIC_KEY_DETAILS_UNSPECIFIED: return \"PUBLIC_KEY_DETAILS_UNSPECIFIED\";\n\t\t\tcase PublicKeyDetails.PKCS1_RSA_PKCS1V5: return \"PKCS1_RSA_PKCS1V5\";\n\t\t\tcase PublicKeyDetails.PKCS1_RSA_PSS: return \"PKCS1_RSA_PSS\";\n\t\t\tcase PublicKeyDetails.PKIX_RSA_PKCS1V5: return \"PKIX_RSA_PKCS1V5\";\n\t\t\tcase PublicKeyDetails.PKIX_RSA_PSS: return \"PKIX_RSA_PSS\";\n\t\t\tcase PublicKeyDetails.PKIX_RSA_PKCS1V15_2048_SHA256: return \"PKIX_RSA_PKCS1V15_2048_SHA256\";\n\t\t\tcase PublicKeyDetails.PKIX_RSA_PKCS1V15_3072_SHA256: return \"PKIX_RSA_PKCS1V15_3072_SHA256\";\n\t\t\tcase PublicKeyDetails.PKIX_RSA_PKCS1V15_4096_SHA256: return \"PKIX_RSA_PKCS1V15_4096_SHA256\";\n\t\t\tcase PublicKeyDetails.PKIX_RSA_PSS_2048_SHA256: return \"PKIX_RSA_PSS_2048_SHA256\";\n\t\t\tcase PublicKeyDetails.PKIX_RSA_PSS_3072_SHA256: return \"PKIX_RSA_PSS_3072_SHA256\";\n\t\t\tcase PublicKeyDetails.PKIX_RSA_PSS_4096_SHA256: return \"PKIX_RSA_PSS_4096_SHA256\";\n\t\t\tcase PublicKeyDetails.PKIX_ECDSA_P256_HMAC_SHA_256: return \"PKIX_ECDSA_P256_HMAC_SHA_256\";\n\t\t\tcase PublicKeyDetails.PKIX_ECDSA_P256_SHA_256: return \"PKIX_ECDSA_P256_SHA_256\";\n\t\t\tcase PublicKeyDetails.PKIX_ECDSA_P384_SHA_384: return \"PKIX_ECDSA_P384_SHA_384\";\n\t\t\tcase PublicKeyDetails.PKIX_ECDSA_P521_SHA_512: return \"PKIX_ECDSA_P521_SHA_512\";\n\t\t\tcase PublicKeyDetails.PKIX_ED25519: return \"PKIX_ED25519\";\n\t\t\tcase PublicKeyDetails.PKIX_ED25519_PH: return \"PKIX_ED25519_PH\";\n\t\t\tcase PublicKeyDetails.PKIX_ECDSA_P384_SHA_256: return \"PKIX_ECDSA_P384_SHA_256\";\n\t\t\tcase PublicKeyDetails.PKIX_ECDSA_P521_SHA_256: return \"PKIX_ECDSA_P521_SHA_256\";\n\t\t\tcase PublicKeyDetails.LMS_SHA256: return \"LMS_SHA256\";\n\t\t\tcase PublicKeyDetails.LMOTS_SHA256: return \"LMOTS_SHA256\";\n\t\t\tcase PublicKeyDetails.ML_DSA_44: return \"ML_DSA_44\";\n\t\t\tcase PublicKeyDetails.ML_DSA_65: return \"ML_DSA_65\";\n\t\t\tcase PublicKeyDetails.ML_DSA_87: return \"ML_DSA_87\";\n\t\t\tdefault: throw new globalThis.Error(\"Unrecognized enum value \" + object + \" for enum PublicKeyDetails\");\n\t\t}\n\t}\n\tvar SubjectAlternativeNameType;\n\t(function(SubjectAlternativeNameType) {\n\t\tSubjectAlternativeNameType[SubjectAlternativeNameType[\"SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED\"] = 0] = \"SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED\";\n\t\tSubjectAlternativeNameType[SubjectAlternativeNameType[\"EMAIL\"] = 1] = \"EMAIL\";\n\t\tSubjectAlternativeNameType[SubjectAlternativeNameType[\"URI\"] = 2] = \"URI\";\n\t\t/**\n\t\t* OTHER_NAME - OID 1.3.6.1.4.1.57264.1.7\n\t\t* See https://github.com/sigstore/fulcio/blob/main/docs/oid-info.md#1361415726417--othername-san\n\t\t* for more details.\n\t\t*/\n\t\tSubjectAlternativeNameType[SubjectAlternativeNameType[\"OTHER_NAME\"] = 3] = \"OTHER_NAME\";\n\t})(SubjectAlternativeNameType || (exports.SubjectAlternativeNameType = SubjectAlternativeNameType = {}));\n\tfunction subjectAlternativeNameTypeFromJSON(object) {\n\t\tswitch (object) {\n\t\t\tcase 0:\n\t\t\tcase \"SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED\": return SubjectAlternativeNameType.SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED;\n\t\t\tcase 1:\n\t\t\tcase \"EMAIL\": return SubjectAlternativeNameType.EMAIL;\n\t\t\tcase 2:\n\t\t\tcase \"URI\": return SubjectAlternativeNameType.URI;\n\t\t\tcase 3:\n\t\t\tcase \"OTHER_NAME\": return SubjectAlternativeNameType.OTHER_NAME;\n\t\t\tdefault: throw new globalThis.Error(\"Unrecognized enum value \" + object + \" for enum SubjectAlternativeNameType\");\n\t\t}\n\t}\n\tfunction subjectAlternativeNameTypeToJSON(object) {\n\t\tswitch (object) {\n\t\t\tcase SubjectAlternativeNameType.SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED: return \"SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED\";\n\t\t\tcase SubjectAlternativeNameType.EMAIL: return \"EMAIL\";\n\t\t\tcase SubjectAlternativeNameType.URI: return \"URI\";\n\t\t\tcase SubjectAlternativeNameType.OTHER_NAME: return \"OTHER_NAME\";\n\t\t\tdefault: throw new globalThis.Error(\"Unrecognized enum value \" + object + \" for enum SubjectAlternativeNameType\");\n\t\t}\n\t}\n\texports.HashOutput = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\talgorithm: isSet(object.algorithm) ? hashAlgorithmFromJSON(object.algorithm) : 0,\n\t\t\t\tdigest: isSet(object.digest) ? Buffer.from(bytesFromBase64(object.digest)) : Buffer.alloc(0)\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.algorithm !== 0) obj.algorithm = hashAlgorithmToJSON(message.algorithm);\n\t\t\tif (message.digest.length !== 0) obj.digest = base64FromBytes(message.digest);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.MessageSignature = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tmessageDigest: isSet(object.messageDigest) ? exports.HashOutput.fromJSON(object.messageDigest) : void 0,\n\t\t\t\tsignature: isSet(object.signature) ? Buffer.from(bytesFromBase64(object.signature)) : Buffer.alloc(0)\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.messageDigest !== void 0) obj.messageDigest = exports.HashOutput.toJSON(message.messageDigest);\n\t\t\tif (message.signature.length !== 0) obj.signature = base64FromBytes(message.signature);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.LogId = {\n\t\tfromJSON(object) {\n\t\t\treturn { keyId: isSet(object.keyId) ? Buffer.from(bytesFromBase64(object.keyId)) : Buffer.alloc(0) };\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.keyId.length !== 0) obj.keyId = base64FromBytes(message.keyId);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.RFC3161SignedTimestamp = {\n\t\tfromJSON(object) {\n\t\t\treturn { signedTimestamp: isSet(object.signedTimestamp) ? Buffer.from(bytesFromBase64(object.signedTimestamp)) : Buffer.alloc(0) };\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.signedTimestamp.length !== 0) obj.signedTimestamp = base64FromBytes(message.signedTimestamp);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.PublicKey = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\trawBytes: isSet(object.rawBytes) ? Buffer.from(bytesFromBase64(object.rawBytes)) : void 0,\n\t\t\t\tkeyDetails: isSet(object.keyDetails) ? publicKeyDetailsFromJSON(object.keyDetails) : 0,\n\t\t\t\tvalidFor: isSet(object.validFor) ? exports.TimeRange.fromJSON(object.validFor) : void 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.rawBytes !== void 0) obj.rawBytes = base64FromBytes(message.rawBytes);\n\t\t\tif (message.keyDetails !== 0) obj.keyDetails = publicKeyDetailsToJSON(message.keyDetails);\n\t\t\tif (message.validFor !== void 0) obj.validFor = exports.TimeRange.toJSON(message.validFor);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.PublicKeyIdentifier = {\n\t\tfromJSON(object) {\n\t\t\treturn { hint: isSet(object.hint) ? globalThis.String(object.hint) : \"\" };\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.hint !== \"\") obj.hint = message.hint;\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.ObjectIdentifier = {\n\t\tfromJSON(object) {\n\t\t\treturn { id: globalThis.Array.isArray(object?.id) ? object.id.map((e) => globalThis.Number(e)) : [] };\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.id?.length) obj.id = message.id.map((e) => Math.round(e));\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.ObjectIdentifierValuePair = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\toid: isSet(object.oid) ? exports.ObjectIdentifier.fromJSON(object.oid) : void 0,\n\t\t\t\tvalue: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0)\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.oid !== void 0) obj.oid = exports.ObjectIdentifier.toJSON(message.oid);\n\t\t\tif (message.value.length !== 0) obj.value = base64FromBytes(message.value);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.DistinguishedName = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\torganization: isSet(object.organization) ? globalThis.String(object.organization) : \"\",\n\t\t\t\tcommonName: isSet(object.commonName) ? globalThis.String(object.commonName) : \"\"\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.organization !== \"\") obj.organization = message.organization;\n\t\t\tif (message.commonName !== \"\") obj.commonName = message.commonName;\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.X509Certificate = {\n\t\tfromJSON(object) {\n\t\t\treturn { rawBytes: isSet(object.rawBytes) ? Buffer.from(bytesFromBase64(object.rawBytes)) : Buffer.alloc(0) };\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.rawBytes.length !== 0) obj.rawBytes = base64FromBytes(message.rawBytes);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.SubjectAlternativeName = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\ttype: isSet(object.type) ? subjectAlternativeNameTypeFromJSON(object.type) : 0,\n\t\t\t\tidentity: isSet(object.regexp) ? {\n\t\t\t\t\t$case: \"regexp\",\n\t\t\t\t\tregexp: globalThis.String(object.regexp)\n\t\t\t\t} : isSet(object.value) ? {\n\t\t\t\t\t$case: \"value\",\n\t\t\t\t\tvalue: globalThis.String(object.value)\n\t\t\t\t} : void 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.type !== 0) obj.type = subjectAlternativeNameTypeToJSON(message.type);\n\t\t\tif (message.identity?.$case === \"regexp\") obj.regexp = message.identity.regexp;\n\t\t\telse if (message.identity?.$case === \"value\") obj.value = message.identity.value;\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.X509CertificateChain = {\n\t\tfromJSON(object) {\n\t\t\treturn { certificates: globalThis.Array.isArray(object?.certificates) ? object.certificates.map((e) => exports.X509Certificate.fromJSON(e)) : [] };\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.certificates?.length) obj.certificates = message.certificates.map((e) => exports.X509Certificate.toJSON(e));\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.TimeRange = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tstart: isSet(object.start) ? fromJsonTimestamp(object.start) : void 0,\n\t\t\t\tend: isSet(object.end) ? fromJsonTimestamp(object.end) : void 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.start !== void 0) obj.start = message.start.toISOString();\n\t\t\tif (message.end !== void 0) obj.end = message.end.toISOString();\n\t\t\treturn obj;\n\t\t}\n\t};\n\tfunction bytesFromBase64(b64) {\n\t\treturn Uint8Array.from(globalThis.Buffer.from(b64, \"base64\"));\n\t}\n\tfunction base64FromBytes(arr) {\n\t\treturn globalThis.Buffer.from(arr).toString(\"base64\");\n\t}\n\tfunction fromTimestamp(t) {\n\t\tlet millis = (globalThis.Number(t.seconds) || 0) * 1e3;\n\t\tmillis += (t.nanos || 0) / 1e6;\n\t\treturn new globalThis.Date(millis);\n\t}\n\tfunction fromJsonTimestamp(o) {\n\t\tif (o instanceof globalThis.Date) return o;\n\t\telse if (typeof o === \"string\") return new globalThis.Date(o);\n\t\telse return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));\n\t}\n\tfunction isSet(value) {\n\t\treturn value !== null && value !== void 0;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+protobuf-specs@0.5.1/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_rekor.js\nvar require_sigstore_rekor = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.TransparencyLogEntry = exports.InclusionPromise = exports.InclusionProof = exports.Checkpoint = exports.KindVersion = void 0;\n\tconst sigstore_common_1 = require_sigstore_common();\n\texports.KindVersion = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tkind: isSet(object.kind) ? globalThis.String(object.kind) : \"\",\n\t\t\t\tversion: isSet(object.version) ? globalThis.String(object.version) : \"\"\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.kind !== \"\") obj.kind = message.kind;\n\t\t\tif (message.version !== \"\") obj.version = message.version;\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.Checkpoint = {\n\t\tfromJSON(object) {\n\t\t\treturn { envelope: isSet(object.envelope) ? globalThis.String(object.envelope) : \"\" };\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.envelope !== \"\") obj.envelope = message.envelope;\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.InclusionProof = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tlogIndex: isSet(object.logIndex) ? globalThis.String(object.logIndex) : \"0\",\n\t\t\t\trootHash: isSet(object.rootHash) ? Buffer.from(bytesFromBase64(object.rootHash)) : Buffer.alloc(0),\n\t\t\t\ttreeSize: isSet(object.treeSize) ? globalThis.String(object.treeSize) : \"0\",\n\t\t\t\thashes: globalThis.Array.isArray(object?.hashes) ? object.hashes.map((e) => Buffer.from(bytesFromBase64(e))) : [],\n\t\t\t\tcheckpoint: isSet(object.checkpoint) ? exports.Checkpoint.fromJSON(object.checkpoint) : void 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.logIndex !== \"0\") obj.logIndex = message.logIndex;\n\t\t\tif (message.rootHash.length !== 0) obj.rootHash = base64FromBytes(message.rootHash);\n\t\t\tif (message.treeSize !== \"0\") obj.treeSize = message.treeSize;\n\t\t\tif (message.hashes?.length) obj.hashes = message.hashes.map((e) => base64FromBytes(e));\n\t\t\tif (message.checkpoint !== void 0) obj.checkpoint = exports.Checkpoint.toJSON(message.checkpoint);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.InclusionPromise = {\n\t\tfromJSON(object) {\n\t\t\treturn { signedEntryTimestamp: isSet(object.signedEntryTimestamp) ? Buffer.from(bytesFromBase64(object.signedEntryTimestamp)) : Buffer.alloc(0) };\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.signedEntryTimestamp.length !== 0) obj.signedEntryTimestamp = base64FromBytes(message.signedEntryTimestamp);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.TransparencyLogEntry = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tlogIndex: isSet(object.logIndex) ? globalThis.String(object.logIndex) : \"0\",\n\t\t\t\tlogId: isSet(object.logId) ? sigstore_common_1.LogId.fromJSON(object.logId) : void 0,\n\t\t\t\tkindVersion: isSet(object.kindVersion) ? exports.KindVersion.fromJSON(object.kindVersion) : void 0,\n\t\t\t\tintegratedTime: isSet(object.integratedTime) ? globalThis.String(object.integratedTime) : \"0\",\n\t\t\t\tinclusionPromise: isSet(object.inclusionPromise) ? exports.InclusionPromise.fromJSON(object.inclusionPromise) : void 0,\n\t\t\t\tinclusionProof: isSet(object.inclusionProof) ? exports.InclusionProof.fromJSON(object.inclusionProof) : void 0,\n\t\t\t\tcanonicalizedBody: isSet(object.canonicalizedBody) ? Buffer.from(bytesFromBase64(object.canonicalizedBody)) : Buffer.alloc(0)\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.logIndex !== \"0\") obj.logIndex = message.logIndex;\n\t\t\tif (message.logId !== void 0) obj.logId = sigstore_common_1.LogId.toJSON(message.logId);\n\t\t\tif (message.kindVersion !== void 0) obj.kindVersion = exports.KindVersion.toJSON(message.kindVersion);\n\t\t\tif (message.integratedTime !== \"0\") obj.integratedTime = message.integratedTime;\n\t\t\tif (message.inclusionPromise !== void 0) obj.inclusionPromise = exports.InclusionPromise.toJSON(message.inclusionPromise);\n\t\t\tif (message.inclusionProof !== void 0) obj.inclusionProof = exports.InclusionProof.toJSON(message.inclusionProof);\n\t\t\tif (message.canonicalizedBody.length !== 0) obj.canonicalizedBody = base64FromBytes(message.canonicalizedBody);\n\t\t\treturn obj;\n\t\t}\n\t};\n\tfunction bytesFromBase64(b64) {\n\t\treturn Uint8Array.from(globalThis.Buffer.from(b64, \"base64\"));\n\t}\n\tfunction base64FromBytes(arr) {\n\t\treturn globalThis.Buffer.from(arr).toString(\"base64\");\n\t}\n\tfunction isSet(value) {\n\t\treturn value !== null && value !== void 0;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+protobuf-specs@0.5.1/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_bundle.js\nvar require_sigstore_bundle = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.Bundle = exports.VerificationMaterial = exports.TimestampVerificationData = void 0;\n\tconst envelope_1 = require_envelope();\n\tconst sigstore_common_1 = require_sigstore_common();\n\tconst sigstore_rekor_1 = require_sigstore_rekor();\n\texports.TimestampVerificationData = {\n\t\tfromJSON(object) {\n\t\t\treturn { rfc3161Timestamps: globalThis.Array.isArray(object?.rfc3161Timestamps) ? object.rfc3161Timestamps.map((e) => sigstore_common_1.RFC3161SignedTimestamp.fromJSON(e)) : [] };\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.rfc3161Timestamps?.length) obj.rfc3161Timestamps = message.rfc3161Timestamps.map((e) => sigstore_common_1.RFC3161SignedTimestamp.toJSON(e));\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.VerificationMaterial = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tcontent: isSet(object.publicKey) ? {\n\t\t\t\t\t$case: \"publicKey\",\n\t\t\t\t\tpublicKey: sigstore_common_1.PublicKeyIdentifier.fromJSON(object.publicKey)\n\t\t\t\t} : isSet(object.x509CertificateChain) ? {\n\t\t\t\t\t$case: \"x509CertificateChain\",\n\t\t\t\t\tx509CertificateChain: sigstore_common_1.X509CertificateChain.fromJSON(object.x509CertificateChain)\n\t\t\t\t} : isSet(object.certificate) ? {\n\t\t\t\t\t$case: \"certificate\",\n\t\t\t\t\tcertificate: sigstore_common_1.X509Certificate.fromJSON(object.certificate)\n\t\t\t\t} : void 0,\n\t\t\t\ttlogEntries: globalThis.Array.isArray(object?.tlogEntries) ? object.tlogEntries.map((e) => sigstore_rekor_1.TransparencyLogEntry.fromJSON(e)) : [],\n\t\t\t\ttimestampVerificationData: isSet(object.timestampVerificationData) ? exports.TimestampVerificationData.fromJSON(object.timestampVerificationData) : void 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.content?.$case === \"publicKey\") obj.publicKey = sigstore_common_1.PublicKeyIdentifier.toJSON(message.content.publicKey);\n\t\t\telse if (message.content?.$case === \"x509CertificateChain\") obj.x509CertificateChain = sigstore_common_1.X509CertificateChain.toJSON(message.content.x509CertificateChain);\n\t\t\telse if (message.content?.$case === \"certificate\") obj.certificate = sigstore_common_1.X509Certificate.toJSON(message.content.certificate);\n\t\t\tif (message.tlogEntries?.length) obj.tlogEntries = message.tlogEntries.map((e) => sigstore_rekor_1.TransparencyLogEntry.toJSON(e));\n\t\t\tif (message.timestampVerificationData !== void 0) obj.timestampVerificationData = exports.TimestampVerificationData.toJSON(message.timestampVerificationData);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.Bundle = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tmediaType: isSet(object.mediaType) ? globalThis.String(object.mediaType) : \"\",\n\t\t\t\tverificationMaterial: isSet(object.verificationMaterial) ? exports.VerificationMaterial.fromJSON(object.verificationMaterial) : void 0,\n\t\t\t\tcontent: isSet(object.messageSignature) ? {\n\t\t\t\t\t$case: \"messageSignature\",\n\t\t\t\t\tmessageSignature: sigstore_common_1.MessageSignature.fromJSON(object.messageSignature)\n\t\t\t\t} : isSet(object.dsseEnvelope) ? {\n\t\t\t\t\t$case: \"dsseEnvelope\",\n\t\t\t\t\tdsseEnvelope: envelope_1.Envelope.fromJSON(object.dsseEnvelope)\n\t\t\t\t} : void 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.mediaType !== \"\") obj.mediaType = message.mediaType;\n\t\t\tif (message.verificationMaterial !== void 0) obj.verificationMaterial = exports.VerificationMaterial.toJSON(message.verificationMaterial);\n\t\t\tif (message.content?.$case === \"messageSignature\") obj.messageSignature = sigstore_common_1.MessageSignature.toJSON(message.content.messageSignature);\n\t\t\telse if (message.content?.$case === \"dsseEnvelope\") obj.dsseEnvelope = envelope_1.Envelope.toJSON(message.content.dsseEnvelope);\n\t\t\treturn obj;\n\t\t}\n\t};\n\tfunction isSet(value) {\n\t\treturn value !== null && value !== void 0;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+protobuf-specs@0.5.1/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js\nvar require_sigstore_trustroot = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.ClientTrustConfig = exports.ServiceConfiguration = exports.Service = exports.SigningConfig = exports.TrustedRoot = exports.CertificateAuthority = exports.TransparencyLogInstance = exports.ServiceSelector = void 0;\n\texports.serviceSelectorFromJSON = serviceSelectorFromJSON;\n\texports.serviceSelectorToJSON = serviceSelectorToJSON;\n\tconst sigstore_common_1 = require_sigstore_common();\n\t/**\n\t* ServiceSelector specifies how a client SHOULD select a set of\n\t* Services to connect to. A client SHOULD throw an error if\n\t* the value is SERVICE_SELECTOR_UNDEFINED.\n\t*/\n\tvar ServiceSelector;\n\t(function(ServiceSelector) {\n\t\tServiceSelector[ServiceSelector[\"SERVICE_SELECTOR_UNDEFINED\"] = 0] = \"SERVICE_SELECTOR_UNDEFINED\";\n\t\t/**\n\t\t* ALL - Clients SHOULD select all Services based on supported API version\n\t\t* and validity window.\n\t\t*/\n\t\tServiceSelector[ServiceSelector[\"ALL\"] = 1] = \"ALL\";\n\t\t/**\n\t\t* ANY - Clients SHOULD select one Service based on supported API version\n\t\t* and validity window. It is up to the client implementation to\n\t\t* decide how to select the Service, e.g. random or round-robin.\n\t\t*/\n\t\tServiceSelector[ServiceSelector[\"ANY\"] = 2] = \"ANY\";\n\t\t/**\n\t\t* EXACT - Clients SHOULD select a specific number of Services based on\n\t\t* supported API version and validity window, using the provided\n\t\t* `count`. It is up to the client implementation to decide how to\n\t\t* select the Service, e.g. random or round-robin.\n\t\t*/\n\t\tServiceSelector[ServiceSelector[\"EXACT\"] = 3] = \"EXACT\";\n\t})(ServiceSelector || (exports.ServiceSelector = ServiceSelector = {}));\n\tfunction serviceSelectorFromJSON(object) {\n\t\tswitch (object) {\n\t\t\tcase 0:\n\t\t\tcase \"SERVICE_SELECTOR_UNDEFINED\": return ServiceSelector.SERVICE_SELECTOR_UNDEFINED;\n\t\t\tcase 1:\n\t\t\tcase \"ALL\": return ServiceSelector.ALL;\n\t\t\tcase 2:\n\t\t\tcase \"ANY\": return ServiceSelector.ANY;\n\t\t\tcase 3:\n\t\t\tcase \"EXACT\": return ServiceSelector.EXACT;\n\t\t\tdefault: throw new globalThis.Error(\"Unrecognized enum value \" + object + \" for enum ServiceSelector\");\n\t\t}\n\t}\n\tfunction serviceSelectorToJSON(object) {\n\t\tswitch (object) {\n\t\t\tcase ServiceSelector.SERVICE_SELECTOR_UNDEFINED: return \"SERVICE_SELECTOR_UNDEFINED\";\n\t\t\tcase ServiceSelector.ALL: return \"ALL\";\n\t\t\tcase ServiceSelector.ANY: return \"ANY\";\n\t\t\tcase ServiceSelector.EXACT: return \"EXACT\";\n\t\t\tdefault: throw new globalThis.Error(\"Unrecognized enum value \" + object + \" for enum ServiceSelector\");\n\t\t}\n\t}\n\texports.TransparencyLogInstance = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tbaseUrl: isSet(object.baseUrl) ? globalThis.String(object.baseUrl) : \"\",\n\t\t\t\thashAlgorithm: isSet(object.hashAlgorithm) ? (0, sigstore_common_1.hashAlgorithmFromJSON)(object.hashAlgorithm) : 0,\n\t\t\t\tpublicKey: isSet(object.publicKey) ? sigstore_common_1.PublicKey.fromJSON(object.publicKey) : void 0,\n\t\t\t\tlogId: isSet(object.logId) ? sigstore_common_1.LogId.fromJSON(object.logId) : void 0,\n\t\t\t\tcheckpointKeyId: isSet(object.checkpointKeyId) ? sigstore_common_1.LogId.fromJSON(object.checkpointKeyId) : void 0,\n\t\t\t\toperator: isSet(object.operator) ? globalThis.String(object.operator) : \"\"\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.baseUrl !== \"\") obj.baseUrl = message.baseUrl;\n\t\t\tif (message.hashAlgorithm !== 0) obj.hashAlgorithm = (0, sigstore_common_1.hashAlgorithmToJSON)(message.hashAlgorithm);\n\t\t\tif (message.publicKey !== void 0) obj.publicKey = sigstore_common_1.PublicKey.toJSON(message.publicKey);\n\t\t\tif (message.logId !== void 0) obj.logId = sigstore_common_1.LogId.toJSON(message.logId);\n\t\t\tif (message.checkpointKeyId !== void 0) obj.checkpointKeyId = sigstore_common_1.LogId.toJSON(message.checkpointKeyId);\n\t\t\tif (message.operator !== \"\") obj.operator = message.operator;\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.CertificateAuthority = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tsubject: isSet(object.subject) ? sigstore_common_1.DistinguishedName.fromJSON(object.subject) : void 0,\n\t\t\t\turi: isSet(object.uri) ? globalThis.String(object.uri) : \"\",\n\t\t\t\tcertChain: isSet(object.certChain) ? sigstore_common_1.X509CertificateChain.fromJSON(object.certChain) : void 0,\n\t\t\t\tvalidFor: isSet(object.validFor) ? sigstore_common_1.TimeRange.fromJSON(object.validFor) : void 0,\n\t\t\t\toperator: isSet(object.operator) ? globalThis.String(object.operator) : \"\"\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.subject !== void 0) obj.subject = sigstore_common_1.DistinguishedName.toJSON(message.subject);\n\t\t\tif (message.uri !== \"\") obj.uri = message.uri;\n\t\t\tif (message.certChain !== void 0) obj.certChain = sigstore_common_1.X509CertificateChain.toJSON(message.certChain);\n\t\t\tif (message.validFor !== void 0) obj.validFor = sigstore_common_1.TimeRange.toJSON(message.validFor);\n\t\t\tif (message.operator !== \"\") obj.operator = message.operator;\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.TrustedRoot = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tmediaType: isSet(object.mediaType) ? globalThis.String(object.mediaType) : \"\",\n\t\t\t\ttlogs: globalThis.Array.isArray(object?.tlogs) ? object.tlogs.map((e) => exports.TransparencyLogInstance.fromJSON(e)) : [],\n\t\t\t\tcertificateAuthorities: globalThis.Array.isArray(object?.certificateAuthorities) ? object.certificateAuthorities.map((e) => exports.CertificateAuthority.fromJSON(e)) : [],\n\t\t\t\tctlogs: globalThis.Array.isArray(object?.ctlogs) ? object.ctlogs.map((e) => exports.TransparencyLogInstance.fromJSON(e)) : [],\n\t\t\t\ttimestampAuthorities: globalThis.Array.isArray(object?.timestampAuthorities) ? object.timestampAuthorities.map((e) => exports.CertificateAuthority.fromJSON(e)) : []\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.mediaType !== \"\") obj.mediaType = message.mediaType;\n\t\t\tif (message.tlogs?.length) obj.tlogs = message.tlogs.map((e) => exports.TransparencyLogInstance.toJSON(e));\n\t\t\tif (message.certificateAuthorities?.length) obj.certificateAuthorities = message.certificateAuthorities.map((e) => exports.CertificateAuthority.toJSON(e));\n\t\t\tif (message.ctlogs?.length) obj.ctlogs = message.ctlogs.map((e) => exports.TransparencyLogInstance.toJSON(e));\n\t\t\tif (message.timestampAuthorities?.length) obj.timestampAuthorities = message.timestampAuthorities.map((e) => exports.CertificateAuthority.toJSON(e));\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.SigningConfig = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tmediaType: isSet(object.mediaType) ? globalThis.String(object.mediaType) : \"\",\n\t\t\t\tcaUrls: globalThis.Array.isArray(object?.caUrls) ? object.caUrls.map((e) => exports.Service.fromJSON(e)) : [],\n\t\t\t\toidcUrls: globalThis.Array.isArray(object?.oidcUrls) ? object.oidcUrls.map((e) => exports.Service.fromJSON(e)) : [],\n\t\t\t\trekorTlogUrls: globalThis.Array.isArray(object?.rekorTlogUrls) ? object.rekorTlogUrls.map((e) => exports.Service.fromJSON(e)) : [],\n\t\t\t\trekorTlogConfig: isSet(object.rekorTlogConfig) ? exports.ServiceConfiguration.fromJSON(object.rekorTlogConfig) : void 0,\n\t\t\t\ttsaUrls: globalThis.Array.isArray(object?.tsaUrls) ? object.tsaUrls.map((e) => exports.Service.fromJSON(e)) : [],\n\t\t\t\ttsaConfig: isSet(object.tsaConfig) ? exports.ServiceConfiguration.fromJSON(object.tsaConfig) : void 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.mediaType !== \"\") obj.mediaType = message.mediaType;\n\t\t\tif (message.caUrls?.length) obj.caUrls = message.caUrls.map((e) => exports.Service.toJSON(e));\n\t\t\tif (message.oidcUrls?.length) obj.oidcUrls = message.oidcUrls.map((e) => exports.Service.toJSON(e));\n\t\t\tif (message.rekorTlogUrls?.length) obj.rekorTlogUrls = message.rekorTlogUrls.map((e) => exports.Service.toJSON(e));\n\t\t\tif (message.rekorTlogConfig !== void 0) obj.rekorTlogConfig = exports.ServiceConfiguration.toJSON(message.rekorTlogConfig);\n\t\t\tif (message.tsaUrls?.length) obj.tsaUrls = message.tsaUrls.map((e) => exports.Service.toJSON(e));\n\t\t\tif (message.tsaConfig !== void 0) obj.tsaConfig = exports.ServiceConfiguration.toJSON(message.tsaConfig);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.Service = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\turl: isSet(object.url) ? globalThis.String(object.url) : \"\",\n\t\t\t\tmajorApiVersion: isSet(object.majorApiVersion) ? globalThis.Number(object.majorApiVersion) : 0,\n\t\t\t\tvalidFor: isSet(object.validFor) ? sigstore_common_1.TimeRange.fromJSON(object.validFor) : void 0,\n\t\t\t\toperator: isSet(object.operator) ? globalThis.String(object.operator) : \"\"\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.url !== \"\") obj.url = message.url;\n\t\t\tif (message.majorApiVersion !== 0) obj.majorApiVersion = Math.round(message.majorApiVersion);\n\t\t\tif (message.validFor !== void 0) obj.validFor = sigstore_common_1.TimeRange.toJSON(message.validFor);\n\t\t\tif (message.operator !== \"\") obj.operator = message.operator;\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.ServiceConfiguration = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tselector: isSet(object.selector) ? serviceSelectorFromJSON(object.selector) : 0,\n\t\t\t\tcount: isSet(object.count) ? globalThis.Number(object.count) : 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.selector !== 0) obj.selector = serviceSelectorToJSON(message.selector);\n\t\t\tif (message.count !== 0) obj.count = Math.round(message.count);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.ClientTrustConfig = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tmediaType: isSet(object.mediaType) ? globalThis.String(object.mediaType) : \"\",\n\t\t\t\ttrustedRoot: isSet(object.trustedRoot) ? exports.TrustedRoot.fromJSON(object.trustedRoot) : void 0,\n\t\t\t\tsigningConfig: isSet(object.signingConfig) ? exports.SigningConfig.fromJSON(object.signingConfig) : void 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.mediaType !== \"\") obj.mediaType = message.mediaType;\n\t\t\tif (message.trustedRoot !== void 0) obj.trustedRoot = exports.TrustedRoot.toJSON(message.trustedRoot);\n\t\t\tif (message.signingConfig !== void 0) obj.signingConfig = exports.SigningConfig.toJSON(message.signingConfig);\n\t\t\treturn obj;\n\t\t}\n\t};\n\tfunction isSet(value) {\n\t\treturn value !== null && value !== void 0;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+protobuf-specs@0.5.1/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_verification.js\nvar require_sigstore_verification = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.Input = exports.Artifact = exports.ArtifactVerificationOptions_ObserverTimestampOptions = exports.ArtifactVerificationOptions_TlogIntegratedTimestampOptions = exports.ArtifactVerificationOptions_TimestampAuthorityOptions = exports.ArtifactVerificationOptions_CtlogOptions = exports.ArtifactVerificationOptions_TlogOptions = exports.ArtifactVerificationOptions = exports.PublicKeyIdentities = exports.CertificateIdentities = exports.CertificateIdentity = void 0;\n\tconst sigstore_bundle_1 = require_sigstore_bundle();\n\tconst sigstore_common_1 = require_sigstore_common();\n\tconst sigstore_trustroot_1 = require_sigstore_trustroot();\n\texports.CertificateIdentity = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tissuer: isSet(object.issuer) ? globalThis.String(object.issuer) : \"\",\n\t\t\t\tsan: isSet(object.san) ? sigstore_common_1.SubjectAlternativeName.fromJSON(object.san) : void 0,\n\t\t\t\toids: globalThis.Array.isArray(object?.oids) ? object.oids.map((e) => sigstore_common_1.ObjectIdentifierValuePair.fromJSON(e)) : []\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.issuer !== \"\") obj.issuer = message.issuer;\n\t\t\tif (message.san !== void 0) obj.san = sigstore_common_1.SubjectAlternativeName.toJSON(message.san);\n\t\t\tif (message.oids?.length) obj.oids = message.oids.map((e) => sigstore_common_1.ObjectIdentifierValuePair.toJSON(e));\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.CertificateIdentities = {\n\t\tfromJSON(object) {\n\t\t\treturn { identities: globalThis.Array.isArray(object?.identities) ? object.identities.map((e) => exports.CertificateIdentity.fromJSON(e)) : [] };\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.identities?.length) obj.identities = message.identities.map((e) => exports.CertificateIdentity.toJSON(e));\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.PublicKeyIdentities = {\n\t\tfromJSON(object) {\n\t\t\treturn { publicKeys: globalThis.Array.isArray(object?.publicKeys) ? object.publicKeys.map((e) => sigstore_common_1.PublicKey.fromJSON(e)) : [] };\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.publicKeys?.length) obj.publicKeys = message.publicKeys.map((e) => sigstore_common_1.PublicKey.toJSON(e));\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.ArtifactVerificationOptions = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tsigners: isSet(object.certificateIdentities) ? {\n\t\t\t\t\t$case: \"certificateIdentities\",\n\t\t\t\t\tcertificateIdentities: exports.CertificateIdentities.fromJSON(object.certificateIdentities)\n\t\t\t\t} : isSet(object.publicKeys) ? {\n\t\t\t\t\t$case: \"publicKeys\",\n\t\t\t\t\tpublicKeys: exports.PublicKeyIdentities.fromJSON(object.publicKeys)\n\t\t\t\t} : void 0,\n\t\t\t\ttlogOptions: isSet(object.tlogOptions) ? exports.ArtifactVerificationOptions_TlogOptions.fromJSON(object.tlogOptions) : void 0,\n\t\t\t\tctlogOptions: isSet(object.ctlogOptions) ? exports.ArtifactVerificationOptions_CtlogOptions.fromJSON(object.ctlogOptions) : void 0,\n\t\t\t\ttsaOptions: isSet(object.tsaOptions) ? exports.ArtifactVerificationOptions_TimestampAuthorityOptions.fromJSON(object.tsaOptions) : void 0,\n\t\t\t\tintegratedTsOptions: isSet(object.integratedTsOptions) ? exports.ArtifactVerificationOptions_TlogIntegratedTimestampOptions.fromJSON(object.integratedTsOptions) : void 0,\n\t\t\t\tobserverOptions: isSet(object.observerOptions) ? exports.ArtifactVerificationOptions_ObserverTimestampOptions.fromJSON(object.observerOptions) : void 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.signers?.$case === \"certificateIdentities\") obj.certificateIdentities = exports.CertificateIdentities.toJSON(message.signers.certificateIdentities);\n\t\t\telse if (message.signers?.$case === \"publicKeys\") obj.publicKeys = exports.PublicKeyIdentities.toJSON(message.signers.publicKeys);\n\t\t\tif (message.tlogOptions !== void 0) obj.tlogOptions = exports.ArtifactVerificationOptions_TlogOptions.toJSON(message.tlogOptions);\n\t\t\tif (message.ctlogOptions !== void 0) obj.ctlogOptions = exports.ArtifactVerificationOptions_CtlogOptions.toJSON(message.ctlogOptions);\n\t\t\tif (message.tsaOptions !== void 0) obj.tsaOptions = exports.ArtifactVerificationOptions_TimestampAuthorityOptions.toJSON(message.tsaOptions);\n\t\t\tif (message.integratedTsOptions !== void 0) obj.integratedTsOptions = exports.ArtifactVerificationOptions_TlogIntegratedTimestampOptions.toJSON(message.integratedTsOptions);\n\t\t\tif (message.observerOptions !== void 0) obj.observerOptions = exports.ArtifactVerificationOptions_ObserverTimestampOptions.toJSON(message.observerOptions);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.ArtifactVerificationOptions_TlogOptions = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tthreshold: isSet(object.threshold) ? globalThis.Number(object.threshold) : 0,\n\t\t\t\tperformOnlineVerification: isSet(object.performOnlineVerification) ? globalThis.Boolean(object.performOnlineVerification) : false,\n\t\t\t\tdisable: isSet(object.disable) ? globalThis.Boolean(object.disable) : false\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.threshold !== 0) obj.threshold = Math.round(message.threshold);\n\t\t\tif (message.performOnlineVerification !== false) obj.performOnlineVerification = message.performOnlineVerification;\n\t\t\tif (message.disable !== false) obj.disable = message.disable;\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.ArtifactVerificationOptions_CtlogOptions = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tthreshold: isSet(object.threshold) ? globalThis.Number(object.threshold) : 0,\n\t\t\t\tdisable: isSet(object.disable) ? globalThis.Boolean(object.disable) : false\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.threshold !== 0) obj.threshold = Math.round(message.threshold);\n\t\t\tif (message.disable !== false) obj.disable = message.disable;\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.ArtifactVerificationOptions_TimestampAuthorityOptions = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tthreshold: isSet(object.threshold) ? globalThis.Number(object.threshold) : 0,\n\t\t\t\tdisable: isSet(object.disable) ? globalThis.Boolean(object.disable) : false\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.threshold !== 0) obj.threshold = Math.round(message.threshold);\n\t\t\tif (message.disable !== false) obj.disable = message.disable;\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.ArtifactVerificationOptions_TlogIntegratedTimestampOptions = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tthreshold: isSet(object.threshold) ? globalThis.Number(object.threshold) : 0,\n\t\t\t\tdisable: isSet(object.disable) ? globalThis.Boolean(object.disable) : false\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.threshold !== 0) obj.threshold = Math.round(message.threshold);\n\t\t\tif (message.disable !== false) obj.disable = message.disable;\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.ArtifactVerificationOptions_ObserverTimestampOptions = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tthreshold: isSet(object.threshold) ? globalThis.Number(object.threshold) : 0,\n\t\t\t\tdisable: isSet(object.disable) ? globalThis.Boolean(object.disable) : false\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.threshold !== 0) obj.threshold = Math.round(message.threshold);\n\t\t\tif (message.disable !== false) obj.disable = message.disable;\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.Artifact = {\n\t\tfromJSON(object) {\n\t\t\treturn { data: isSet(object.artifactUri) ? {\n\t\t\t\t$case: \"artifactUri\",\n\t\t\t\tartifactUri: globalThis.String(object.artifactUri)\n\t\t\t} : isSet(object.artifact) ? {\n\t\t\t\t$case: \"artifact\",\n\t\t\t\tartifact: Buffer.from(bytesFromBase64(object.artifact))\n\t\t\t} : isSet(object.artifactDigest) ? {\n\t\t\t\t$case: \"artifactDigest\",\n\t\t\t\tartifactDigest: sigstore_common_1.HashOutput.fromJSON(object.artifactDigest)\n\t\t\t} : void 0 };\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.data?.$case === \"artifactUri\") obj.artifactUri = message.data.artifactUri;\n\t\t\telse if (message.data?.$case === \"artifact\") obj.artifact = base64FromBytes(message.data.artifact);\n\t\t\telse if (message.data?.$case === \"artifactDigest\") obj.artifactDigest = sigstore_common_1.HashOutput.toJSON(message.data.artifactDigest);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.Input = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tartifactTrustRoot: isSet(object.artifactTrustRoot) ? sigstore_trustroot_1.TrustedRoot.fromJSON(object.artifactTrustRoot) : void 0,\n\t\t\t\tartifactVerificationOptions: isSet(object.artifactVerificationOptions) ? exports.ArtifactVerificationOptions.fromJSON(object.artifactVerificationOptions) : void 0,\n\t\t\t\tbundle: isSet(object.bundle) ? sigstore_bundle_1.Bundle.fromJSON(object.bundle) : void 0,\n\t\t\t\tartifact: isSet(object.artifact) ? exports.Artifact.fromJSON(object.artifact) : void 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.artifactTrustRoot !== void 0) obj.artifactTrustRoot = sigstore_trustroot_1.TrustedRoot.toJSON(message.artifactTrustRoot);\n\t\t\tif (message.artifactVerificationOptions !== void 0) obj.artifactVerificationOptions = exports.ArtifactVerificationOptions.toJSON(message.artifactVerificationOptions);\n\t\t\tif (message.bundle !== void 0) obj.bundle = sigstore_bundle_1.Bundle.toJSON(message.bundle);\n\t\t\tif (message.artifact !== void 0) obj.artifact = exports.Artifact.toJSON(message.artifact);\n\t\t\treturn obj;\n\t\t}\n\t};\n\tfunction bytesFromBase64(b64) {\n\t\treturn Uint8Array.from(globalThis.Buffer.from(b64, \"base64\"));\n\t}\n\tfunction base64FromBytes(arr) {\n\t\treturn globalThis.Buffer.from(arr).toString(\"base64\");\n\t}\n\tfunction isSet(value) {\n\t\treturn value !== null && value !== void 0;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+protobuf-specs@0.5.1/node_modules/@sigstore/protobuf-specs/dist/index.js\nvar require_dist$3 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tvar __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {\n\t\tif (k2 === void 0) k2 = k;\n\t\tvar desc = Object.getOwnPropertyDescriptor(m, k);\n\t\tif (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn m[k];\n\t\t\t}\n\t\t};\n\t\tObject.defineProperty(o, k2, desc);\n\t}) : (function(o, m, k, k2) {\n\t\tif (k2 === void 0) k2 = k;\n\t\to[k2] = m[k];\n\t}));\n\tvar __exportStar = exports && exports.__exportStar || function(m, exports$2) {\n\t\tfor (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports$2, p)) __createBinding(exports$2, m, p);\n\t};\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\t__exportStar(require_envelope(), exports);\n\t__exportStar(require_sigstore_bundle(), exports);\n\t__exportStar(require_sigstore_common(), exports);\n\t__exportStar(require_sigstore_rekor(), exports);\n\t__exportStar(require_sigstore_trustroot(), exports);\n\t__exportStar(require_sigstore_verification(), exports);\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+bundle@5.0.0/node_modules/@sigstore/bundle/dist/bundle.js\nvar require_bundle$1 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.BUNDLE_V03_MEDIA_TYPE = exports.BUNDLE_V03_LEGACY_MEDIA_TYPE = exports.BUNDLE_V02_MEDIA_TYPE = exports.BUNDLE_V01_MEDIA_TYPE = void 0;\n\texports.isBundleWithCertificateChain = isBundleWithCertificateChain;\n\texports.isBundleWithPublicKey = isBundleWithPublicKey;\n\texports.isBundleWithMessageSignature = isBundleWithMessageSignature;\n\texports.isBundleWithDsseEnvelope = isBundleWithDsseEnvelope;\n\texports.BUNDLE_V01_MEDIA_TYPE = \"application/vnd.dev.sigstore.bundle+json;version=0.1\";\n\texports.BUNDLE_V02_MEDIA_TYPE = \"application/vnd.dev.sigstore.bundle+json;version=0.2\";\n\texports.BUNDLE_V03_LEGACY_MEDIA_TYPE = \"application/vnd.dev.sigstore.bundle+json;version=0.3\";\n\texports.BUNDLE_V03_MEDIA_TYPE = \"application/vnd.dev.sigstore.bundle.v0.3+json\";\n\tfunction isBundleWithCertificateChain(b) {\n\t\treturn b.verificationMaterial.content.$case === \"x509CertificateChain\";\n\t}\n\tfunction isBundleWithPublicKey(b) {\n\t\treturn b.verificationMaterial.content.$case === \"publicKey\";\n\t}\n\tfunction isBundleWithMessageSignature(b) {\n\t\treturn b.content.$case === \"messageSignature\";\n\t}\n\tfunction isBundleWithDsseEnvelope(b) {\n\t\treturn b.content.$case === \"dsseEnvelope\";\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+bundle@5.0.0/node_modules/@sigstore/bundle/dist/build.js\nvar require_build = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.toMessageSignatureBundle = toMessageSignatureBundle;\n\texports.toDSSEBundle = toDSSEBundle;\n\tconst protobuf_specs_1 = require_dist$3();\n\tconst bundle_1 = require_bundle$1();\n\tfunction toMessageSignatureBundle(options) {\n\t\treturn {\n\t\t\tmediaType: options.certificateChain ? bundle_1.BUNDLE_V02_MEDIA_TYPE : bundle_1.BUNDLE_V03_MEDIA_TYPE,\n\t\t\tcontent: {\n\t\t\t\t$case: \"messageSignature\",\n\t\t\t\tmessageSignature: {\n\t\t\t\t\tmessageDigest: {\n\t\t\t\t\t\talgorithm: protobuf_specs_1.HashAlgorithm.SHA2_256,\n\t\t\t\t\t\tdigest: options.digest\n\t\t\t\t\t},\n\t\t\t\t\tsignature: options.signature\n\t\t\t\t}\n\t\t\t},\n\t\t\tverificationMaterial: toVerificationMaterial(options)\n\t\t};\n\t}\n\tfunction toDSSEBundle(options) {\n\t\treturn {\n\t\t\tmediaType: options.certificateChain ? bundle_1.BUNDLE_V02_MEDIA_TYPE : bundle_1.BUNDLE_V03_MEDIA_TYPE,\n\t\t\tcontent: {\n\t\t\t\t$case: \"dsseEnvelope\",\n\t\t\t\tdsseEnvelope: toEnvelope(options)\n\t\t\t},\n\t\t\tverificationMaterial: toVerificationMaterial(options)\n\t\t};\n\t}\n\tfunction toEnvelope(options) {\n\t\treturn {\n\t\t\tpayloadType: options.artifactType,\n\t\t\tpayload: options.artifact,\n\t\t\tsignatures: [toSignature(options)]\n\t\t};\n\t}\n\tfunction toSignature(options) {\n\t\treturn {\n\t\t\tkeyid: options.keyHint || \"\",\n\t\t\tsig: options.signature\n\t\t};\n\t}\n\tfunction toVerificationMaterial(options) {\n\t\treturn {\n\t\t\tcontent: toKeyContent(options),\n\t\t\ttlogEntries: [],\n\t\t\ttimestampVerificationData: { rfc3161Timestamps: [] }\n\t\t};\n\t}\n\tfunction toKeyContent(options) {\n\t\tif (options.certificate) if (options.certificateChain) return {\n\t\t\t$case: \"x509CertificateChain\",\n\t\t\tx509CertificateChain: { certificates: [{ rawBytes: options.certificate }] }\n\t\t};\n\t\telse return {\n\t\t\t$case: \"certificate\",\n\t\t\tcertificate: { rawBytes: options.certificate }\n\t\t};\n\t\telse return {\n\t\t\t$case: \"publicKey\",\n\t\t\tpublicKey: { hint: options.keyHint || \"\" }\n\t\t};\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+bundle@5.0.0/node_modules/@sigstore/bundle/dist/error.js\nvar require_error$3 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.ValidationError = void 0;\n\tvar ValidationError = class extends Error {\n\t\tfields;\n\t\tconstructor(message, fields) {\n\t\t\tsuper(message);\n\t\t\tthis.fields = fields;\n\t\t}\n\t};\n\texports.ValidationError = ValidationError;\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+bundle@5.0.0/node_modules/@sigstore/bundle/dist/validate.js\nvar require_validate = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.assertBundle = assertBundle;\n\texports.assertBundleV01 = assertBundleV01;\n\texports.isBundleV01 = isBundleV01;\n\texports.assertBundleV02 = assertBundleV02;\n\texports.assertBundleLatest = assertBundleLatest;\n\tconst error_1 = require_error$3();\n\tfunction assertBundle(b) {\n\t\tconst invalidValues = validateBundleBase(b);\n\t\tif (invalidValues.length > 0) throw new error_1.ValidationError(\"invalid bundle\", invalidValues);\n\t}\n\tfunction assertBundleV01(b) {\n\t\tconst invalidValues = [];\n\t\tinvalidValues.push(...validateBundleBase(b));\n\t\tinvalidValues.push(...validateInclusionPromise(b));\n\t\tif (invalidValues.length > 0) throw new error_1.ValidationError(\"invalid v0.1 bundle\", invalidValues);\n\t}\n\tfunction isBundleV01(b) {\n\t\ttry {\n\t\t\tassertBundleV01(b);\n\t\t\treturn true;\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t}\n\tfunction assertBundleV02(b) {\n\t\tconst invalidValues = [];\n\t\tinvalidValues.push(...validateBundleBase(b));\n\t\tinvalidValues.push(...validateInclusionProof(b));\n\t\tif (invalidValues.length > 0) throw new error_1.ValidationError(\"invalid v0.2 bundle\", invalidValues);\n\t}\n\tfunction assertBundleLatest(b) {\n\t\tconst invalidValues = [];\n\t\tinvalidValues.push(...validateBundleBase(b));\n\t\tinvalidValues.push(...validateInclusionProof(b));\n\t\tinvalidValues.push(...validateNoCertificateChain(b));\n\t\tif (invalidValues.length > 0) throw new error_1.ValidationError(\"invalid bundle\", invalidValues);\n\t}\n\tfunction validateBundleBase(b) {\n\t\tconst invalidValues = [];\n\t\tif (b.mediaType === void 0 || !b.mediaType.match(/^application\\/vnd\\.dev\\.sigstore\\.bundle\\+json;version=\\d\\.\\d/) && !b.mediaType.match(/^application\\/vnd\\.dev\\.sigstore\\.bundle\\.v\\d\\.\\d\\+json/)) invalidValues.push(\"mediaType\");\n\t\tif (b.content === void 0) invalidValues.push(\"content\");\n\t\telse switch (b.content.$case) {\n\t\t\tcase \"messageSignature\":\n\t\t\t\tif (b.content.messageSignature.messageDigest === void 0) invalidValues.push(\"content.messageSignature.messageDigest\");\n\t\t\t\telse if (b.content.messageSignature.messageDigest.digest.length === 0) invalidValues.push(\"content.messageSignature.messageDigest.digest\");\n\t\t\t\tif (b.content.messageSignature.signature.length === 0) invalidValues.push(\"content.messageSignature.signature\");\n\t\t\t\tbreak;\n\t\t\tcase \"dsseEnvelope\":\n\t\t\t\tif (b.content.dsseEnvelope.payload.length === 0) invalidValues.push(\"content.dsseEnvelope.payload\");\n\t\t\t\tif (b.content.dsseEnvelope.signatures.length !== 1) invalidValues.push(\"content.dsseEnvelope.signatures\");\n\t\t\t\telse if (b.content.dsseEnvelope.signatures[0].sig.length === 0) invalidValues.push(\"content.dsseEnvelope.signatures[0].sig\");\n\t\t\t\tbreak;\n\t\t}\n\t\tif (b.verificationMaterial === void 0) invalidValues.push(\"verificationMaterial\");\n\t\telse {\n\t\t\tif (b.verificationMaterial.content === void 0) invalidValues.push(\"verificationMaterial.content\");\n\t\t\telse switch (b.verificationMaterial.content.$case) {\n\t\t\t\tcase \"x509CertificateChain\":\n\t\t\t\t\tif (b.verificationMaterial.content.x509CertificateChain.certificates.length === 0) invalidValues.push(\"verificationMaterial.content.x509CertificateChain.certificates\");\n\t\t\t\t\tb.verificationMaterial.content.x509CertificateChain.certificates.forEach((cert, i) => {\n\t\t\t\t\t\tif (cert.rawBytes.length === 0) invalidValues.push(`verificationMaterial.content.x509CertificateChain.certificates[${i}].rawBytes`);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"certificate\":\n\t\t\t\t\tif (b.verificationMaterial.content.certificate.rawBytes.length === 0) invalidValues.push(\"verificationMaterial.content.certificate.rawBytes\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (b.verificationMaterial.tlogEntries === void 0) invalidValues.push(\"verificationMaterial.tlogEntries\");\n\t\t\telse if (b.verificationMaterial.tlogEntries.length > 0) b.verificationMaterial.tlogEntries.forEach((entry, i) => {\n\t\t\t\tif (entry.logId === void 0) invalidValues.push(`verificationMaterial.tlogEntries[${i}].logId`);\n\t\t\t\tif (entry.kindVersion === void 0) invalidValues.push(`verificationMaterial.tlogEntries[${i}].kindVersion`);\n\t\t\t});\n\t\t}\n\t\treturn invalidValues;\n\t}\n\tfunction validateInclusionPromise(b) {\n\t\tconst invalidValues = [];\n\t\tif (b.verificationMaterial && b.verificationMaterial.tlogEntries?.length > 0) b.verificationMaterial.tlogEntries.forEach((entry, i) => {\n\t\t\tif (entry.inclusionPromise === void 0) invalidValues.push(`verificationMaterial.tlogEntries[${i}].inclusionPromise`);\n\t\t});\n\t\treturn invalidValues;\n\t}\n\tfunction validateInclusionProof(b) {\n\t\tconst invalidValues = [];\n\t\tif (b.verificationMaterial && b.verificationMaterial.tlogEntries?.length > 0) b.verificationMaterial.tlogEntries.forEach((entry, i) => {\n\t\t\tif (entry.inclusionProof === void 0) invalidValues.push(`verificationMaterial.tlogEntries[${i}].inclusionProof`);\n\t\t\telse if (entry.inclusionProof.checkpoint === void 0) invalidValues.push(`verificationMaterial.tlogEntries[${i}].inclusionProof.checkpoint`);\n\t\t});\n\t\treturn invalidValues;\n\t}\n\tfunction validateNoCertificateChain(b) {\n\t\tconst invalidValues = [];\n\t\t/* istanbul ignore next */\n\t\tif (b.verificationMaterial?.content?.$case === \"x509CertificateChain\") invalidValues.push(\"verificationMaterial.content.$case\");\n\t\treturn invalidValues;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+bundle@5.0.0/node_modules/@sigstore/bundle/dist/serialized.js\nvar require_serialized = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.envelopeToJSON = exports.envelopeFromJSON = exports.bundleToJSON = exports.bundleFromJSON = void 0;\n\tconst protobuf_specs_1 = require_dist$3();\n\tconst bundle_1 = require_bundle$1();\n\tconst validate_1 = require_validate();\n\tconst bundleFromJSON = (obj) => {\n\t\tconst bundle = protobuf_specs_1.Bundle.fromJSON(obj);\n\t\tswitch (bundle.mediaType) {\n\t\t\tcase bundle_1.BUNDLE_V01_MEDIA_TYPE:\n\t\t\t\t(0, validate_1.assertBundleV01)(bundle);\n\t\t\t\tbreak;\n\t\t\tcase bundle_1.BUNDLE_V02_MEDIA_TYPE:\n\t\t\t\t(0, validate_1.assertBundleV02)(bundle);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t(0, validate_1.assertBundleLatest)(bundle);\n\t\t\t\tbreak;\n\t\t}\n\t\treturn bundle;\n\t};\n\texports.bundleFromJSON = bundleFromJSON;\n\tconst bundleToJSON = (bundle) => {\n\t\treturn protobuf_specs_1.Bundle.toJSON(bundle);\n\t};\n\texports.bundleToJSON = bundleToJSON;\n\tconst envelopeFromJSON = (obj) => {\n\t\treturn protobuf_specs_1.Envelope.fromJSON(obj);\n\t};\n\texports.envelopeFromJSON = envelopeFromJSON;\n\tconst envelopeToJSON = (envelope) => {\n\t\treturn protobuf_specs_1.Envelope.toJSON(envelope);\n\t};\n\texports.envelopeToJSON = envelopeToJSON;\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+bundle@5.0.0/node_modules/@sigstore/bundle/dist/index.js\nvar require_dist$2 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.isBundleV01 = exports.assertBundleV02 = exports.assertBundleV01 = exports.assertBundleLatest = exports.assertBundle = exports.envelopeToJSON = exports.envelopeFromJSON = exports.bundleToJSON = exports.bundleFromJSON = exports.ValidationError = exports.isBundleWithPublicKey = exports.isBundleWithMessageSignature = exports.isBundleWithDsseEnvelope = exports.isBundleWithCertificateChain = exports.BUNDLE_V03_MEDIA_TYPE = exports.BUNDLE_V03_LEGACY_MEDIA_TYPE = exports.BUNDLE_V02_MEDIA_TYPE = exports.BUNDLE_V01_MEDIA_TYPE = exports.toMessageSignatureBundle = exports.toDSSEBundle = void 0;\n\tvar build_1 = require_build();\n\tObject.defineProperty(exports, \"toDSSEBundle\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn build_1.toDSSEBundle;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"toMessageSignatureBundle\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn build_1.toMessageSignatureBundle;\n\t\t}\n\t});\n\tvar bundle_1 = require_bundle$1();\n\tObject.defineProperty(exports, \"BUNDLE_V01_MEDIA_TYPE\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn bundle_1.BUNDLE_V01_MEDIA_TYPE;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"BUNDLE_V02_MEDIA_TYPE\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn bundle_1.BUNDLE_V02_MEDIA_TYPE;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"BUNDLE_V03_LEGACY_MEDIA_TYPE\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn bundle_1.BUNDLE_V03_LEGACY_MEDIA_TYPE;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"BUNDLE_V03_MEDIA_TYPE\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn bundle_1.BUNDLE_V03_MEDIA_TYPE;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"isBundleWithCertificateChain\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn bundle_1.isBundleWithCertificateChain;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"isBundleWithDsseEnvelope\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn bundle_1.isBundleWithDsseEnvelope;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"isBundleWithMessageSignature\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn bundle_1.isBundleWithMessageSignature;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"isBundleWithPublicKey\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn bundle_1.isBundleWithPublicKey;\n\t\t}\n\t});\n\tvar error_1 = require_error$3();\n\tObject.defineProperty(exports, \"ValidationError\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn error_1.ValidationError;\n\t\t}\n\t});\n\tvar serialized_1 = require_serialized();\n\tObject.defineProperty(exports, \"bundleFromJSON\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn serialized_1.bundleFromJSON;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"bundleToJSON\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn serialized_1.bundleToJSON;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"envelopeFromJSON\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn serialized_1.envelopeFromJSON;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"envelopeToJSON\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn serialized_1.envelopeToJSON;\n\t\t}\n\t});\n\tvar validate_1 = require_validate();\n\tObject.defineProperty(exports, \"assertBundle\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn validate_1.assertBundle;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"assertBundleLatest\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn validate_1.assertBundleLatest;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"assertBundleV01\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn validate_1.assertBundleV01;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"assertBundleV02\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn validate_1.assertBundleV02;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"isBundleV01\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn validate_1.isBundleV01;\n\t\t}\n\t});\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/stream.js\nvar require_stream = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.ByteStream = void 0;\n\tvar StreamError = class extends Error {};\n\tvar ByteStream = class ByteStream {\n\t\tstatic BLOCK_SIZE = 1024;\n\t\tbuf;\n\t\tview;\n\t\tstart = 0;\n\t\tconstructor(buffer) {\n\t\t\tif (buffer) {\n\t\t\t\tthis.buf = buffer;\n\t\t\t\tthis.view = Buffer.from(buffer);\n\t\t\t} else {\n\t\t\t\tthis.buf = Buffer.alloc(0);\n\t\t\t\tthis.view = Buffer.from(this.buf);\n\t\t\t}\n\t\t}\n\t\tget buffer() {\n\t\t\treturn this.view.subarray(0, this.start);\n\t\t}\n\t\tget length() {\n\t\t\treturn this.view.byteLength;\n\t\t}\n\t\tget position() {\n\t\t\treturn this.start;\n\t\t}\n\t\tseek(position) {\n\t\t\tthis.start = position;\n\t\t}\n\t\tslice(start, len) {\n\t\t\tconst end = start + len;\n\t\t\tif (end > this.length) throw new StreamError(\"request past end of buffer\");\n\t\t\treturn this.view.subarray(start, end);\n\t\t}\n\t\tappendChar(char) {\n\t\t\tthis.ensureCapacity(1);\n\t\t\tthis.view[this.start] = char;\n\t\t\tthis.start += 1;\n\t\t}\n\t\tappendUint16(num) {\n\t\t\tthis.ensureCapacity(2);\n\t\t\tconst value = new Uint16Array([num]);\n\t\t\tconst view = new Uint8Array(value.buffer);\n\t\t\tthis.view[this.start] = view[1];\n\t\t\tthis.view[this.start + 1] = view[0];\n\t\t\tthis.start += 2;\n\t\t}\n\t\tappendUint24(num) {\n\t\t\tthis.ensureCapacity(3);\n\t\t\tconst value = new Uint32Array([num]);\n\t\t\tconst view = new Uint8Array(value.buffer);\n\t\t\tthis.view[this.start] = view[2];\n\t\t\tthis.view[this.start + 1] = view[1];\n\t\t\tthis.view[this.start + 2] = view[0];\n\t\t\tthis.start += 3;\n\t\t}\n\t\tappendView(view) {\n\t\t\tthis.ensureCapacity(view.length);\n\t\t\tthis.view.set(view, this.start);\n\t\t\tthis.start += view.length;\n\t\t}\n\t\tgetBlock(size) {\n\t\t\tif (size <= 0) return Buffer.alloc(0);\n\t\t\tif (this.start + size > this.view.length) throw new Error(\"request past end of buffer\");\n\t\t\tconst result = this.view.subarray(this.start, this.start + size);\n\t\t\tthis.start += size;\n\t\t\treturn result;\n\t\t}\n\t\tgetUint8() {\n\t\t\treturn this.getBlock(1)[0];\n\t\t}\n\t\tgetUint16() {\n\t\t\tconst block = this.getBlock(2);\n\t\t\treturn block[0] << 8 | block[1];\n\t\t}\n\t\tensureCapacity(size) {\n\t\t\tif (this.start + size > this.view.byteLength) {\n\t\t\t\tconst blockSize = ByteStream.BLOCK_SIZE + (size > ByteStream.BLOCK_SIZE ? size : 0);\n\t\t\t\tthis.realloc(this.view.byteLength + blockSize);\n\t\t\t}\n\t\t}\n\t\trealloc(size) {\n\t\t\tconst newArray = Buffer.alloc(size);\n\t\t\tconst newView = Buffer.from(newArray);\n\t\t\tnewView.set(this.view);\n\t\t\tthis.buf = newArray;\n\t\t\tthis.view = newView;\n\t\t}\n\t};\n\texports.ByteStream = ByteStream;\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/asn1/error.js\nvar require_error$2 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.ASN1TypeError = exports.ASN1ParseError = void 0;\n\tvar ASN1ParseError = class extends Error {};\n\texports.ASN1ParseError = ASN1ParseError;\n\tvar ASN1TypeError = class extends Error {};\n\texports.ASN1TypeError = ASN1TypeError;\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/asn1/length.js\nvar require_length = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.decodeLength = decodeLength;\n\texports.encodeLength = encodeLength;\n\tconst error_1 = require_error$2();\n\tfunction decodeLength(stream) {\n\t\tconst buf = stream.getUint8();\n\t\tif ((buf & 128) === 0) return buf;\n\t\tconst byteCount = buf & 127;\n\t\tif (byteCount > 6) throw new error_1.ASN1ParseError(\"length exceeds 6 byte limit\");\n\t\tlet len = 0;\n\t\tfor (let i = 0; i < byteCount; i++) {\n\t\t\tconst byte = stream.getUint8();\n\t\t\tif (i === 0 && byte === 0) throw new error_1.ASN1ParseError(\"non-minimal length encoding\");\n\t\t\tlen = len * 256 + byte;\n\t\t}\n\t\tif (len === 0) throw new error_1.ASN1ParseError(\"indefinite length encoding not supported\");\n\t\tif (len < 128) throw new error_1.ASN1ParseError(\"non-minimal length encoding\");\n\t\treturn len;\n\t}\n\tfunction encodeLength(len) {\n\t\tif (len < 128) return Buffer.from([len]);\n\t\tlet val = BigInt(len);\n\t\tconst bytes = [];\n\t\twhile (val > 0n) {\n\t\t\tbytes.unshift(Number(val & 255n));\n\t\t\tval = val >> 8n;\n\t\t}\n\t\treturn Buffer.from([128 | bytes.length, ...bytes]);\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/asn1/parse.js\nvar require_parse = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.parseInteger = parseInteger;\n\texports.parseStringASCII = parseStringASCII;\n\texports.parseTime = parseTime;\n\texports.parseOID = parseOID;\n\texports.parseBoolean = parseBoolean;\n\texports.parseBitString = parseBitString;\n\tconst error_1 = require_error$2();\n\tconst RE_TIME_SHORT_YEAR = /^(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\.\\d{3})?Z$/;\n\tconst RE_TIME_LONG_YEAR = /^(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\.\\d{3})?Z$/;\n\tfunction parseInteger(buf) {\n\t\tlet pos = 0;\n\t\tconst end = buf.length;\n\t\tlet val = buf[pos];\n\t\tconst neg = val > 127;\n\t\tconst pad = neg ? 255 : 0;\n\t\twhile (val == pad && ++pos < end) val = buf[pos];\n\t\tif (end - pos === 0) return BigInt(neg ? -1 : 0);\n\t\tval = neg ? val - 256 : val;\n\t\tlet n = BigInt(val);\n\t\tfor (let i = pos + 1; i < end; ++i) n = n * BigInt(256) + BigInt(buf[i]);\n\t\treturn n;\n\t}\n\tfunction parseStringASCII(buf) {\n\t\treturn buf.toString(\"ascii\");\n\t}\n\tfunction parseTime(buf, shortYear) {\n\t\tconst timeStr = parseStringASCII(buf);\n\t\tconst m = shortYear ? RE_TIME_SHORT_YEAR.exec(timeStr) : RE_TIME_LONG_YEAR.exec(timeStr);\n\t\tif (!m) throw new Error(\"invalid time\");\n\t\tif (shortYear) {\n\t\t\tlet year = Number(m[1]);\n\t\t\tyear += year >= 50 ? 1900 : 2e3;\n\t\t\tm[1] = year.toString();\n\t\t}\n\t\treturn /* @__PURE__ */ new Date(`${m[1]}-${m[2]}-${m[3]}T${m[4]}:${m[5]}:${m[6]}Z`);\n\t}\n\tfunction parseOID(buf) {\n\t\tlet pos = 0;\n\t\tconst end = buf.length;\n\t\tlet n = buf[pos++];\n\t\tlet oid = `${Math.floor(n / 40)}.${n % 40}`;\n\t\tlet val = 0n;\n\t\tfor (; pos < end; ++pos) {\n\t\t\tn = buf[pos];\n\t\t\tval = (val << 7n) + BigInt(n & 127);\n\t\t\tif ((n & 128) === 0) {\n\t\t\t\toid += `.${val}`;\n\t\t\t\tval = 0n;\n\t\t\t}\n\t\t}\n\t\treturn oid;\n\t}\n\tfunction parseBoolean(buf) {\n\t\tif (buf.length !== 1) throw new error_1.ASN1ParseError(\"invalid boolean\");\n\t\tswitch (buf[0]) {\n\t\t\tcase 0: return false;\n\t\t\tcase 255: return true;\n\t\t\tdefault: throw new error_1.ASN1ParseError(\"invalid boolean\");\n\t\t}\n\t}\n\tfunction parseBitString(buf) {\n\t\tconst unused = buf[0];\n\t\tif (unused > 7) throw new error_1.ASN1ParseError(\"invalid bit string\");\n\t\tconst start = 1;\n\t\tconst end = buf.length;\n\t\tconst bits = [];\n\t\tfor (let i = start; i < end; ++i) {\n\t\t\tconst byte = buf[i];\n\t\t\tconst skip = i === end - 1 ? unused : 0;\n\t\t\tfor (let j = 7; j >= skip; --j) bits.push(byte >> j & 1);\n\t\t}\n\t\treturn bits;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/asn1/tag.js\nvar require_tag = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.ASN1Tag = void 0;\n\tconst error_1 = require_error$2();\n\tconst UNIVERSAL_TAG = {\n\t\tBOOLEAN: 1,\n\t\tINTEGER: 2,\n\t\tBIT_STRING: 3,\n\t\tOCTET_STRING: 4,\n\t\tOBJECT_IDENTIFIER: 6,\n\t\tSEQUENCE: 16,\n\t\tSET: 17,\n\t\tPRINTABLE_STRING: 19,\n\t\tUTC_TIME: 23,\n\t\tGENERALIZED_TIME: 24\n\t};\n\tconst TAG_CLASS = {\n\t\tUNIVERSAL: 0,\n\t\tAPPLICATION: 1,\n\t\tCONTEXT_SPECIFIC: 2,\n\t\tPRIVATE: 3\n\t};\n\tvar ASN1Tag = class {\n\t\tnumber;\n\t\tconstructed;\n\t\tclass;\n\t\tconstructor(enc) {\n\t\t\tthis.number = enc & 31;\n\t\t\tthis.constructed = (enc & 32) === 32;\n\t\t\tthis.class = enc >> 6;\n\t\t\tif (this.number === 31) throw new error_1.ASN1ParseError(\"long form tags not supported\");\n\t\t\tif (this.class === TAG_CLASS.UNIVERSAL && this.number === 0) throw new error_1.ASN1ParseError(\"unsupported tag 0x00\");\n\t\t}\n\t\tisUniversal() {\n\t\t\treturn this.class === TAG_CLASS.UNIVERSAL;\n\t\t}\n\t\tisContextSpecific(num) {\n\t\t\tconst res = this.class === TAG_CLASS.CONTEXT_SPECIFIC;\n\t\t\treturn num !== void 0 ? res && this.number === num : res;\n\t\t}\n\t\tisBoolean() {\n\t\t\treturn this.isUniversal() && this.number === UNIVERSAL_TAG.BOOLEAN;\n\t\t}\n\t\tisInteger() {\n\t\t\treturn this.isUniversal() && this.number === UNIVERSAL_TAG.INTEGER;\n\t\t}\n\t\tisBitString() {\n\t\t\treturn this.isUniversal() && this.number === UNIVERSAL_TAG.BIT_STRING;\n\t\t}\n\t\tisOctetString() {\n\t\t\treturn this.isUniversal() && this.number === UNIVERSAL_TAG.OCTET_STRING;\n\t\t}\n\t\tisOID() {\n\t\t\treturn this.isUniversal() && this.number === UNIVERSAL_TAG.OBJECT_IDENTIFIER;\n\t\t}\n\t\tisUTCTime() {\n\t\t\treturn this.isUniversal() && this.number === UNIVERSAL_TAG.UTC_TIME;\n\t\t}\n\t\tisGeneralizedTime() {\n\t\t\treturn this.isUniversal() && this.number === UNIVERSAL_TAG.GENERALIZED_TIME;\n\t\t}\n\t\ttoDER() {\n\t\t\treturn this.number | (this.constructed ? 32 : 0) | this.class << 6;\n\t\t}\n\t};\n\texports.ASN1Tag = ASN1Tag;\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/asn1/obj.js\nvar require_obj = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.ASN1Obj = void 0;\n\tconst stream_1 = require_stream();\n\tconst error_1 = require_error$2();\n\tconst length_1 = require_length();\n\tconst parse_1 = require_parse();\n\tconst tag_1 = require_tag();\n\tvar ASN1Obj = class {\n\t\ttag;\n\t\tsubs;\n\t\tvalue;\n\t\tconstructor(tag, value, subs) {\n\t\t\tthis.tag = tag;\n\t\t\tthis.value = value;\n\t\t\tthis.subs = subs;\n\t\t}\n\t\tstatic parseBuffer(buf) {\n\t\t\tconst stream = new stream_1.ByteStream(buf);\n\t\t\tconst obj = parseStream(stream);\n\t\t\tif (stream.position !== stream.length) throw new error_1.ASN1ParseError(\"invalid trailing data\");\n\t\t\treturn obj;\n\t\t}\n\t\ttoDER() {\n\t\t\tconst valueStream = new stream_1.ByteStream();\n\t\t\tif (this.subs.length > 0) for (const sub of this.subs) valueStream.appendView(sub.toDER());\n\t\t\telse valueStream.appendView(this.value);\n\t\t\tconst value = valueStream.buffer;\n\t\t\tconst obj = new stream_1.ByteStream();\n\t\t\tobj.appendChar(this.tag.toDER());\n\t\t\tobj.appendView((0, length_1.encodeLength)(value.length));\n\t\t\tobj.appendView(value);\n\t\t\treturn obj.buffer;\n\t\t}\n\t\ttoBoolean() {\n\t\t\tif (!this.tag.isBoolean()) throw new error_1.ASN1TypeError(\"not a boolean\");\n\t\t\treturn (0, parse_1.parseBoolean)(this.value);\n\t\t}\n\t\ttoInteger() {\n\t\t\tif (!this.tag.isInteger()) throw new error_1.ASN1TypeError(\"not an integer\");\n\t\t\treturn (0, parse_1.parseInteger)(this.value);\n\t\t}\n\t\ttoOID() {\n\t\t\tif (!this.tag.isOID()) throw new error_1.ASN1TypeError(\"not an OID\");\n\t\t\treturn (0, parse_1.parseOID)(this.value);\n\t\t}\n\t\ttoDate() {\n\t\t\tswitch (true) {\n\t\t\t\tcase this.tag.isUTCTime(): return (0, parse_1.parseTime)(this.value, true);\n\t\t\t\tcase this.tag.isGeneralizedTime(): return (0, parse_1.parseTime)(this.value, false);\n\t\t\t\tdefault: throw new error_1.ASN1TypeError(\"not a date\");\n\t\t\t}\n\t\t}\n\t\ttoBitString() {\n\t\t\tif (!this.tag.isBitString()) throw new error_1.ASN1TypeError(\"not a bit string\");\n\t\t\treturn (0, parse_1.parseBitString)(this.value);\n\t\t}\n\t};\n\texports.ASN1Obj = ASN1Obj;\n\tconst MAX_DEPTH = 100;\n\tfunction parseStream(stream, depth = 0) {\n\t\tif (depth > MAX_DEPTH) throw new error_1.ASN1ParseError(\"maximum nesting depth exceeded\");\n\t\tconst tag = new tag_1.ASN1Tag(stream.getUint8());\n\t\tconst len = (0, length_1.decodeLength)(stream);\n\t\tconst value = stream.slice(stream.position, len);\n\t\tconst start = stream.position;\n\t\tlet subs = [];\n\t\tif (tag.constructed) subs = collectSubs(stream, len, depth);\n\t\telse if (tag.isOctetString()) try {\n\t\t\tsubs = collectSubs(stream, len, depth);\n\t\t} catch (e) {}\n\t\tif (subs.length === 0) stream.seek(start + len);\n\t\treturn new ASN1Obj(tag, value, subs);\n\t}\n\tfunction collectSubs(stream, len, depth) {\n\t\tconst end = stream.position + len;\n\t\t/* istanbul ignore if */\n\t\tif (end > stream.length) throw new error_1.ASN1ParseError(\"invalid length\");\n\t\tconst subs = [];\n\t\twhile (stream.position < end) subs.push(parseStream(stream, depth + 1));\n\t\tif (stream.position !== end) throw new error_1.ASN1ParseError(\"invalid length\");\n\t\treturn subs;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/asn1/index.js\nvar require_asn1 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.ASN1Obj = void 0;\n\tvar obj_1 = require_obj();\n\tObject.defineProperty(exports, \"ASN1Obj\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn obj_1.ASN1Obj;\n\t\t}\n\t});\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/crypto.js\nvar require_crypto = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tvar __importDefault = exports && exports.__importDefault || function(mod) {\n\t\treturn mod && mod.__esModule ? mod : { \"default\": mod };\n\t};\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.createPublicKey = createPublicKey;\n\texports.digest = digest;\n\texports.verify = verify;\n\texports.bufferEqual = bufferEqual;\n\tconst crypto_1 = __importDefault(__require(\"crypto\"));\n\tfunction createPublicKey(key, type = \"spki\") {\n\t\tif (typeof key === \"string\") if (key.startsWith(\"-----\")) return crypto_1.default.createPublicKey(key);\n\t\telse return crypto_1.default.createPublicKey({\n\t\t\tkey: Buffer.from(key, \"base64\"),\n\t\t\tformat: \"der\",\n\t\t\ttype\n\t\t});\n\t\telse return crypto_1.default.createPublicKey({\n\t\t\tkey,\n\t\t\tformat: \"der\",\n\t\t\ttype\n\t\t});\n\t}\n\tfunction digest(algorithm, ...data) {\n\t\tconst hash = crypto_1.default.createHash(algorithm);\n\t\tfor (const d of data) hash.update(d);\n\t\treturn hash.digest();\n\t}\n\tfunction algorithmForKey(key) {\n\t\tif (!(key instanceof crypto_1.default.KeyObject) || key.type !== \"public\") return false;\n\t\tswitch (key.asymmetricKeyType) {\n\t\t\tcase \"ec\": switch (key.asymmetricKeyDetails?.namedCurve) {\n\t\t\t\tcase \"prime256v1\": return \"sha256\";\n\t\t\t\tcase \"secp384r1\": return \"sha384\";\n\t\t\t\tcase \"secp521r1\": return \"sha512\";\n\t\t\t\tdefault: return false;\n\t\t\t}\n\t\t\tcase \"ed25519\": return;\n\t\t\tdefault: return false;\n\t\t}\n\t}\n\tfunction verify(data, key, signature, algorithm) {\n\t\ttry {\n\t\t\tif (algorithm === void 0) {\n\t\t\t\talgorithm = algorithmForKey(key);\n\t\t\t\tif (algorithm === false) return false;\n\t\t\t}\n\t\t\treturn crypto_1.default.verify(algorithm, data, key, signature);\n\t\t} catch (e) {\n\t\t\t/* istanbul ignore next */\n\t\t\treturn false;\n\t\t}\n\t}\n\tfunction bufferEqual(a, b) {\n\t\ttry {\n\t\t\treturn crypto_1.default.timingSafeEqual(a, b);\n\t\t} catch {\n\t\t\t/* istanbul ignore next */\n\t\t\treturn false;\n\t\t}\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/dsse.js\nvar require_dsse$3 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.preAuthEncoding = preAuthEncoding;\n\tconst PAE_PREFIX = \"DSSEv1\";\n\tfunction preAuthEncoding(payloadType, payload) {\n\t\tconst typeBytes = Buffer.from(payloadType, \"utf-8\");\n\t\treturn Buffer.concat([\n\t\t\tBuffer.from(`${PAE_PREFIX} ${typeBytes.length} `, \"ascii\"),\n\t\t\ttypeBytes,\n\t\t\tBuffer.from(` ${payload.length} `, \"ascii\"),\n\t\t\tpayload\n\t\t]);\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/encoding.js\nvar require_encoding = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.base64Encode = base64Encode;\n\texports.base64Decode = base64Decode;\n\tconst BASE64_ENCODING = \"base64\";\n\tconst UTF8_ENCODING = \"utf-8\";\n\tfunction base64Encode(str) {\n\t\treturn Buffer.from(str, UTF8_ENCODING).toString(BASE64_ENCODING);\n\t}\n\tfunction base64Decode(str) {\n\t\treturn Buffer.from(str, BASE64_ENCODING).toString(UTF8_ENCODING);\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/json.js\nvar require_json = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.canonicalize = canonicalize;\n\tfunction canonicalize(object) {\n\t\tlet buffer = \"\";\n\t\tif (object === null || typeof object !== \"object\" || object.toJSON != null) buffer += JSON.stringify(object);\n\t\telse if (Array.isArray(object)) {\n\t\t\tbuffer += \"[\";\n\t\t\tlet first = true;\n\t\t\tobject.forEach((element) => {\n\t\t\t\tif (!first) buffer += \",\";\n\t\t\t\tfirst = false;\n\t\t\t\tbuffer += canonicalize(element);\n\t\t\t});\n\t\t\tbuffer += \"]\";\n\t\t} else {\n\t\t\tbuffer += \"{\";\n\t\t\tlet first = true;\n\t\t\tObject.keys(object).sort().forEach((property) => {\n\t\t\t\tif (!first) buffer += \",\";\n\t\t\t\tfirst = false;\n\t\t\t\tbuffer += JSON.stringify(property);\n\t\t\t\tbuffer += \":\";\n\t\t\t\tbuffer += canonicalize(object[property]);\n\t\t\t});\n\t\t\tbuffer += \"}\";\n\t\t}\n\t\treturn buffer;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/pem.js\nvar require_pem = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.toDER = toDER;\n\texports.fromDER = fromDER;\n\tconst PEM_HEADER = /-----BEGIN (.*)-----/;\n\tconst PEM_FOOTER = /-----END (.*)-----/;\n\tfunction toDER(certificate) {\n\t\tlet der = \"\";\n\t\tcertificate.split(\"\\n\").forEach((line) => {\n\t\t\tif (line.match(PEM_HEADER) || line.match(PEM_FOOTER)) return;\n\t\t\tder += line;\n\t\t});\n\t\treturn Buffer.from(der, \"base64\");\n\t}\n\tfunction fromDER(certificate, type = \"CERTIFICATE\") {\n\t\tconst lines = certificate.toString(\"base64\").match(/.{1,64}/g) || \"\";\n\t\treturn [\n\t\t\t`-----BEGIN ${type}-----`,\n\t\t\t...lines,\n\t\t\t`-----END ${type}-----`\n\t\t].join(\"\\n\").concat(\"\\n\");\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/oid.js\nvar require_oid = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.SHA2_HASH_ALGOS = exports.RSA_SIGNATURE_ALGOS = exports.ECDSA_SIGNATURE_ALGOS = void 0;\n\texports.ECDSA_SIGNATURE_ALGOS = {\n\t\t\"1.2.840.10045.4.3.1\": \"sha224\",\n\t\t\"1.2.840.10045.4.3.2\": \"sha256\",\n\t\t\"1.2.840.10045.4.3.3\": \"sha384\",\n\t\t\"1.2.840.10045.4.3.4\": \"sha512\"\n\t};\n\texports.RSA_SIGNATURE_ALGOS = {\n\t\t\"1.2.840.113549.1.1.14\": \"sha224\",\n\t\t\"1.2.840.113549.1.1.11\": \"sha256\",\n\t\t\"1.2.840.113549.1.1.12\": \"sha384\",\n\t\t\"1.2.840.113549.1.1.13\": \"sha512\"\n\t};\n\texports.SHA2_HASH_ALGOS = {\n\t\t\"2.16.840.1.101.3.4.2.1\": \"sha256\",\n\t\t\"2.16.840.1.101.3.4.2.2\": \"sha384\",\n\t\t\"2.16.840.1.101.3.4.2.3\": \"sha512\"\n\t};\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/rfc3161/error.js\nvar require_error$1 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.RFC3161TimestampVerificationError = void 0;\n\tvar RFC3161TimestampVerificationError = class extends Error {};\n\texports.RFC3161TimestampVerificationError = RFC3161TimestampVerificationError;\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/rfc3161/tstinfo.js\nvar require_tstinfo = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tvar __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {\n\t\tif (k2 === void 0) k2 = k;\n\t\tvar desc = Object.getOwnPropertyDescriptor(m, k);\n\t\tif (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn m[k];\n\t\t\t}\n\t\t};\n\t\tObject.defineProperty(o, k2, desc);\n\t}) : (function(o, m, k, k2) {\n\t\tif (k2 === void 0) k2 = k;\n\t\to[k2] = m[k];\n\t}));\n\tvar __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {\n\t\tObject.defineProperty(o, \"default\", {\n\t\t\tenumerable: true,\n\t\t\tvalue: v\n\t\t});\n\t}) : function(o, v) {\n\t\to[\"default\"] = v;\n\t});\n\tvar __importStar = exports && exports.__importStar || (function() {\n\t\tvar ownKeys = function(o) {\n\t\t\townKeys = Object.getOwnPropertyNames || function(o) {\n\t\t\t\tvar ar = [];\n\t\t\t\tfor (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n\t\t\t\treturn ar;\n\t\t\t};\n\t\t\treturn ownKeys(o);\n\t\t};\n\t\treturn function(mod) {\n\t\t\tif (mod && mod.__esModule) return mod;\n\t\t\tvar result = {};\n\t\t\tif (mod != null) {\n\t\t\t\tfor (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n\t\t\t}\n\t\t\t__setModuleDefault(result, mod);\n\t\t\treturn result;\n\t\t};\n\t})();\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.TSTInfo = void 0;\n\tconst crypto = __importStar(require_crypto());\n\tconst oid_1 = require_oid();\n\tconst error_1 = require_error$1();\n\tvar TSTInfo = class {\n\t\troot;\n\t\tconstructor(asn1) {\n\t\t\tthis.root = asn1;\n\t\t}\n\t\tget version() {\n\t\t\treturn this.root.subs[0].toInteger();\n\t\t}\n\t\tget genTime() {\n\t\t\treturn this.root.subs[4].toDate();\n\t\t}\n\t\tget messageImprintHashAlgorithm() {\n\t\t\tconst oid = this.messageImprintObj.subs[0].subs[0].toOID();\n\t\t\treturn oid_1.SHA2_HASH_ALGOS[oid];\n\t\t}\n\t\tget messageImprintHashedMessage() {\n\t\t\treturn this.messageImprintObj.subs[1].value;\n\t\t}\n\t\tget raw() {\n\t\t\treturn this.root.toDER();\n\t\t}\n\t\tverify(data) {\n\t\t\tconst digest = crypto.digest(this.messageImprintHashAlgorithm, data);\n\t\t\tif (!crypto.bufferEqual(digest, this.messageImprintHashedMessage)) throw new error_1.RFC3161TimestampVerificationError(\"message imprint does not match artifact\");\n\t\t}\n\t\tget messageImprintObj() {\n\t\t\treturn this.root.subs[2];\n\t\t}\n\t};\n\texports.TSTInfo = TSTInfo;\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/rfc3161/timestamp.js\nvar require_timestamp$1 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tvar __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {\n\t\tif (k2 === void 0) k2 = k;\n\t\tvar desc = Object.getOwnPropertyDescriptor(m, k);\n\t\tif (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn m[k];\n\t\t\t}\n\t\t};\n\t\tObject.defineProperty(o, k2, desc);\n\t}) : (function(o, m, k, k2) {\n\t\tif (k2 === void 0) k2 = k;\n\t\to[k2] = m[k];\n\t}));\n\tvar __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {\n\t\tObject.defineProperty(o, \"default\", {\n\t\t\tenumerable: true,\n\t\t\tvalue: v\n\t\t});\n\t}) : function(o, v) {\n\t\to[\"default\"] = v;\n\t});\n\tvar __importStar = exports && exports.__importStar || (function() {\n\t\tvar ownKeys = function(o) {\n\t\t\townKeys = Object.getOwnPropertyNames || function(o) {\n\t\t\t\tvar ar = [];\n\t\t\t\tfor (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n\t\t\t\treturn ar;\n\t\t\t};\n\t\t\treturn ownKeys(o);\n\t\t};\n\t\treturn function(mod) {\n\t\t\tif (mod && mod.__esModule) return mod;\n\t\t\tvar result = {};\n\t\t\tif (mod != null) {\n\t\t\t\tfor (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n\t\t\t}\n\t\t\t__setModuleDefault(result, mod);\n\t\t\treturn result;\n\t\t};\n\t})();\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.RFC3161Timestamp = void 0;\n\tconst asn1_1 = require_asn1();\n\tconst crypto = __importStar(require_crypto());\n\tconst oid_1 = require_oid();\n\tconst error_1 = require_error$1();\n\tconst tstinfo_1 = require_tstinfo();\n\tconst OID_PKCS9_CONTENT_TYPE_SIGNED_DATA = \"1.2.840.113549.1.7.2\";\n\tconst OID_PKCS9_CONTENT_TYPE_TSTINFO = \"1.2.840.113549.1.9.16.1.4\";\n\tconst OID_PKCS9_MESSAGE_DIGEST_KEY = \"1.2.840.113549.1.9.4\";\n\tvar RFC3161Timestamp = class RFC3161Timestamp {\n\t\troot;\n\t\tconstructor(asn1) {\n\t\t\tthis.root = asn1;\n\t\t}\n\t\tstatic parse(der) {\n\t\t\treturn new RFC3161Timestamp(asn1_1.ASN1Obj.parseBuffer(der));\n\t\t}\n\t\tget status() {\n\t\t\treturn this.pkiStatusInfoObj.subs[0].toInteger();\n\t\t}\n\t\tget contentType() {\n\t\t\treturn this.contentTypeObj.toOID();\n\t\t}\n\t\tget eContentType() {\n\t\t\treturn this.eContentTypeObj.toOID();\n\t\t}\n\t\tget signingTime() {\n\t\t\treturn this.tstInfo.genTime;\n\t\t}\n\t\tget signerIssuer() {\n\t\t\treturn this.signerSidObj.subs[0].value;\n\t\t}\n\t\tget signerSerialNumber() {\n\t\t\treturn this.signerSidObj.subs[1].value;\n\t\t}\n\t\tget signerDigestAlgorithm() {\n\t\t\tconst oid = this.signerDigestAlgorithmObj.subs[0].toOID();\n\t\t\treturn oid_1.SHA2_HASH_ALGOS[oid];\n\t\t}\n\t\tget signatureAlgorithm() {\n\t\t\tconst oid = this.signatureAlgorithmObj.subs[0].toOID();\n\t\t\treturn oid_1.ECDSA_SIGNATURE_ALGOS[oid];\n\t\t}\n\t\tget signatureValue() {\n\t\t\treturn this.signatureValueObj.value;\n\t\t}\n\t\tget tstInfo() {\n\t\t\treturn new tstinfo_1.TSTInfo(this.eContentObj.subs[0].subs[0]);\n\t\t}\n\t\tverify(data, publicKey) {\n\t\t\tif (!this.timeStampTokenObj) throw new error_1.RFC3161TimestampVerificationError(\"timeStampToken is missing\");\n\t\t\tif (this.contentType !== OID_PKCS9_CONTENT_TYPE_SIGNED_DATA) throw new error_1.RFC3161TimestampVerificationError(`incorrect content type: ${this.contentType}`);\n\t\t\tif (this.eContentType !== OID_PKCS9_CONTENT_TYPE_TSTINFO) throw new error_1.RFC3161TimestampVerificationError(`incorrect encapsulated content type: ${this.eContentType}`);\n\t\t\tthis.tstInfo.verify(data);\n\t\t\tthis.verifyMessageDigest();\n\t\t\tthis.verifySignature(publicKey);\n\t\t}\n\t\tverifyMessageDigest() {\n\t\t\tconst tstInfoDigest = crypto.digest(this.signerDigestAlgorithm, this.tstInfo.raw);\n\t\t\tconst expectedDigest = this.messageDigestAttributeObj.subs[1].subs[0].value;\n\t\t\tif (!crypto.bufferEqual(tstInfoDigest, expectedDigest)) throw new error_1.RFC3161TimestampVerificationError(\"signed data does not match tstInfo\");\n\t\t}\n\t\tverifySignature(key) {\n\t\t\tconst signedAttrs = this.signedAttrsObj.toDER();\n\t\t\tsignedAttrs[0] = 49;\n\t\t\tif (!crypto.verify(signedAttrs, key, this.signatureValue, this.signatureAlgorithm)) throw new error_1.RFC3161TimestampVerificationError(\"signature verification failed\");\n\t\t}\n\t\tget pkiStatusInfoObj() {\n\t\t\treturn this.root.subs[0];\n\t\t}\n\t\tget timeStampTokenObj() {\n\t\t\treturn this.root.subs[1];\n\t\t}\n\t\tget contentTypeObj() {\n\t\t\treturn this.timeStampTokenObj.subs[0];\n\t\t}\n\t\tget signedDataObj() {\n\t\t\treturn this.timeStampTokenObj.subs.find((sub) => sub.tag.isContextSpecific(0)).subs[0];\n\t\t}\n\t\tget encapContentInfoObj() {\n\t\t\treturn this.signedDataObj.subs[2];\n\t\t}\n\t\tget signerInfosObj() {\n\t\t\tconst sd = this.signedDataObj;\n\t\t\treturn sd.subs[sd.subs.length - 1];\n\t\t}\n\t\tget signerInfoObj() {\n\t\t\treturn this.signerInfosObj.subs[0];\n\t\t}\n\t\tget eContentTypeObj() {\n\t\t\treturn this.encapContentInfoObj.subs[0];\n\t\t}\n\t\tget eContentObj() {\n\t\t\treturn this.encapContentInfoObj.subs[1];\n\t\t}\n\t\tget signedAttrsObj() {\n\t\t\treturn this.signerInfoObj.subs.find((sub) => sub.tag.isContextSpecific(0));\n\t\t}\n\t\tget messageDigestAttributeObj() {\n\t\t\treturn this.signedAttrsObj.subs.find((sub) => sub.subs[0].tag.isOID() && sub.subs[0].toOID() === OID_PKCS9_MESSAGE_DIGEST_KEY);\n\t\t}\n\t\tget signerSidObj() {\n\t\t\treturn this.signerInfoObj.subs[1];\n\t\t}\n\t\tget signerDigestAlgorithmObj() {\n\t\t\treturn this.signerInfoObj.subs[2];\n\t\t}\n\t\tget signatureAlgorithmObj() {\n\t\t\treturn this.signerInfoObj.subs[4];\n\t\t}\n\t\tget signatureValueObj() {\n\t\t\treturn this.signerInfoObj.subs[5];\n\t\t}\n\t};\n\texports.RFC3161Timestamp = RFC3161Timestamp;\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/rfc3161/index.js\nvar require_rfc3161 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.RFC3161Timestamp = void 0;\n\tvar timestamp_1 = require_timestamp$1();\n\tObject.defineProperty(exports, \"RFC3161Timestamp\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn timestamp_1.RFC3161Timestamp;\n\t\t}\n\t});\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/x509/sct.js\nvar require_sct$1 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tvar __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {\n\t\tif (k2 === void 0) k2 = k;\n\t\tvar desc = Object.getOwnPropertyDescriptor(m, k);\n\t\tif (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn m[k];\n\t\t\t}\n\t\t};\n\t\tObject.defineProperty(o, k2, desc);\n\t}) : (function(o, m, k, k2) {\n\t\tif (k2 === void 0) k2 = k;\n\t\to[k2] = m[k];\n\t}));\n\tvar __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {\n\t\tObject.defineProperty(o, \"default\", {\n\t\t\tenumerable: true,\n\t\t\tvalue: v\n\t\t});\n\t}) : function(o, v) {\n\t\to[\"default\"] = v;\n\t});\n\tvar __importStar = exports && exports.__importStar || (function() {\n\t\tvar ownKeys = function(o) {\n\t\t\townKeys = Object.getOwnPropertyNames || function(o) {\n\t\t\t\tvar ar = [];\n\t\t\t\tfor (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n\t\t\t\treturn ar;\n\t\t\t};\n\t\t\treturn ownKeys(o);\n\t\t};\n\t\treturn function(mod) {\n\t\t\tif (mod && mod.__esModule) return mod;\n\t\t\tvar result = {};\n\t\t\tif (mod != null) {\n\t\t\t\tfor (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n\t\t\t}\n\t\t\t__setModuleDefault(result, mod);\n\t\t\treturn result;\n\t\t};\n\t})();\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.SignedCertificateTimestamp = void 0;\n\tconst crypto = __importStar(require_crypto());\n\tconst stream_1 = require_stream();\n\tvar SignedCertificateTimestamp = class SignedCertificateTimestamp {\n\t\tversion;\n\t\tlogID;\n\t\ttimestamp;\n\t\textensions;\n\t\thashAlgorithm;\n\t\tsignatureAlgorithm;\n\t\tsignature;\n\t\tconstructor(options) {\n\t\t\tthis.version = options.version;\n\t\t\tthis.logID = options.logID;\n\t\t\tthis.timestamp = options.timestamp;\n\t\t\tthis.extensions = options.extensions;\n\t\t\tthis.hashAlgorithm = options.hashAlgorithm;\n\t\t\tthis.signatureAlgorithm = options.signatureAlgorithm;\n\t\t\tthis.signature = options.signature;\n\t\t}\n\t\tget datetime() {\n\t\t\treturn new Date(Number(this.timestamp.readBigInt64BE()));\n\t\t}\n\t\tget algorithm() {\n\t\t\tswitch (this.hashAlgorithm) {\n\t\t\t\tcase 0: return \"none\";\n\t\t\t\tcase 1: return \"md5\";\n\t\t\t\tcase 2: return \"sha1\";\n\t\t\t\tcase 3: return \"sha224\";\n\t\t\t\tcase 4: return \"sha256\";\n\t\t\t\tcase 5: return \"sha384\";\n\t\t\t\tcase 6: return \"sha512\";\n\t\t\t\tdefault: return \"unknown\";\n\t\t\t}\n\t\t}\n\t\tverify(preCert, key) {\n\t\t\tconst stream = new stream_1.ByteStream();\n\t\t\tstream.appendChar(this.version);\n\t\t\tstream.appendChar(0);\n\t\t\tstream.appendView(this.timestamp);\n\t\t\tstream.appendUint16(1);\n\t\t\tstream.appendView(preCert);\n\t\t\tstream.appendUint16(this.extensions.byteLength);\n\t\t\t/* istanbul ignore next - extensions are very uncommon */\n\t\t\tif (this.extensions.byteLength > 0) stream.appendView(this.extensions);\n\t\t\treturn crypto.verify(stream.buffer, key, this.signature, this.algorithm);\n\t\t}\n\t\tstatic parse(buf) {\n\t\t\tconst stream = new stream_1.ByteStream(buf);\n\t\t\tconst version = stream.getUint8();\n\t\t\tconst logID = stream.getBlock(32);\n\t\t\tconst timestamp = stream.getBlock(8);\n\t\t\tconst extenstionLength = stream.getUint16();\n\t\t\tconst extensions = stream.getBlock(extenstionLength);\n\t\t\tconst hashAlgorithm = stream.getUint8();\n\t\t\tconst signatureAlgorithm = stream.getUint8();\n\t\t\tconst sigLength = stream.getUint16();\n\t\t\tconst signature = stream.getBlock(sigLength);\n\t\t\tif (stream.position !== buf.length) throw new Error(\"SCT buffer length mismatch\");\n\t\t\treturn new SignedCertificateTimestamp({\n\t\t\t\tversion,\n\t\t\t\tlogID,\n\t\t\t\ttimestamp,\n\t\t\t\textensions,\n\t\t\t\thashAlgorithm,\n\t\t\t\tsignatureAlgorithm,\n\t\t\t\tsignature\n\t\t\t});\n\t\t}\n\t};\n\texports.SignedCertificateTimestamp = SignedCertificateTimestamp;\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/x509/ext.js\nvar require_ext = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.X509SCTExtension = exports.X509SubjectKeyIDExtension = exports.X509AuthorityKeyIDExtension = exports.X509SubjectAlternativeNameExtension = exports.X509KeyUsageExtension = exports.X509BasicConstraintsExtension = exports.X509Extension = void 0;\n\tconst stream_1 = require_stream();\n\tconst sct_1 = require_sct$1();\n\tvar X509Extension = class {\n\t\troot;\n\t\tconstructor(asn1) {\n\t\t\tthis.root = asn1;\n\t\t}\n\t\tget oid() {\n\t\t\treturn this.root.subs[0].toOID();\n\t\t}\n\t\tget critical() {\n\t\t\treturn this.root.subs.length === 3 ? this.root.subs[1].toBoolean() : false;\n\t\t}\n\t\tget value() {\n\t\t\treturn this.extnValueObj.value;\n\t\t}\n\t\tget valueObj() {\n\t\t\treturn this.extnValueObj;\n\t\t}\n\t\tget extnValueObj() {\n\t\t\treturn this.root.subs[this.root.subs.length - 1];\n\t\t}\n\t};\n\texports.X509Extension = X509Extension;\n\tvar X509BasicConstraintsExtension = class extends X509Extension {\n\t\tget isCA() {\n\t\t\treturn this.sequence.subs[0]?.toBoolean() ?? false;\n\t\t}\n\t\tget pathLenConstraint() {\n\t\t\treturn this.sequence.subs.length > 1 ? this.sequence.subs[1].toInteger() : void 0;\n\t\t}\n\t\tget sequence() {\n\t\t\treturn this.extnValueObj.subs[0];\n\t\t}\n\t};\n\texports.X509BasicConstraintsExtension = X509BasicConstraintsExtension;\n\tvar X509KeyUsageExtension = class extends X509Extension {\n\t\tget digitalSignature() {\n\t\t\treturn this.bitString[0] === 1;\n\t\t}\n\t\tget keyCertSign() {\n\t\t\treturn this.bitString[5] === 1;\n\t\t}\n\t\tget crlSign() {\n\t\t\treturn this.bitString[6] === 1;\n\t\t}\n\t\tget bitString() {\n\t\t\treturn this.extnValueObj.subs[0].toBitString();\n\t\t}\n\t};\n\texports.X509KeyUsageExtension = X509KeyUsageExtension;\n\tvar X509SubjectAlternativeNameExtension = class extends X509Extension {\n\t\tget rfc822Name() {\n\t\t\treturn this.findGeneralName(1)?.value.toString(\"ascii\");\n\t\t}\n\t\tget uri() {\n\t\t\treturn this.findGeneralName(6)?.value.toString(\"ascii\");\n\t\t}\n\t\totherName(oid) {\n\t\t\tconst otherName = this.findGeneralName(0);\n\t\t\tif (otherName === void 0) return;\n\t\t\tif (otherName.subs[0].toOID() !== oid) return;\n\t\t\treturn otherName.subs[1].subs[0].value.toString(\"ascii\");\n\t\t}\n\t\tfindGeneralName(tag) {\n\t\t\treturn this.generalNames.find((gn) => gn.tag.isContextSpecific(tag));\n\t\t}\n\t\tget generalNames() {\n\t\t\treturn this.extnValueObj.subs[0].subs;\n\t\t}\n\t};\n\texports.X509SubjectAlternativeNameExtension = X509SubjectAlternativeNameExtension;\n\tvar X509AuthorityKeyIDExtension = class extends X509Extension {\n\t\tget keyIdentifier() {\n\t\t\treturn this.findSequenceMember(0)?.value;\n\t\t}\n\t\tfindSequenceMember(tag) {\n\t\t\treturn this.sequence.subs.find((el) => el.tag.isContextSpecific(tag));\n\t\t}\n\t\tget sequence() {\n\t\t\treturn this.extnValueObj.subs[0];\n\t\t}\n\t};\n\texports.X509AuthorityKeyIDExtension = X509AuthorityKeyIDExtension;\n\tvar X509SubjectKeyIDExtension = class extends X509Extension {\n\t\tget keyIdentifier() {\n\t\t\treturn this.extnValueObj.subs[0].value;\n\t\t}\n\t};\n\texports.X509SubjectKeyIDExtension = X509SubjectKeyIDExtension;\n\tvar X509SCTExtension = class extends X509Extension {\n\t\tconstructor(asn1) {\n\t\t\tsuper(asn1);\n\t\t}\n\t\tget signedCertificateTimestamps() {\n\t\t\tconst buf = this.extnValueObj.subs[0].value;\n\t\t\tconst stream = new stream_1.ByteStream(buf);\n\t\t\tconst end = stream.getUint16() + 2;\n\t\t\tconst sctList = [];\n\t\t\twhile (stream.position < end) {\n\t\t\t\tconst sctLength = stream.getUint16();\n\t\t\t\tconst sct = stream.getBlock(sctLength);\n\t\t\t\tsctList.push(sct_1.SignedCertificateTimestamp.parse(sct));\n\t\t\t}\n\t\t\tif (stream.position !== end) throw new Error(\"SCT list length does not match actual length\");\n\t\t\treturn sctList;\n\t\t}\n\t};\n\texports.X509SCTExtension = X509SCTExtension;\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/x509/cert.js\nvar require_cert = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tvar __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {\n\t\tif (k2 === void 0) k2 = k;\n\t\tvar desc = Object.getOwnPropertyDescriptor(m, k);\n\t\tif (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn m[k];\n\t\t\t}\n\t\t};\n\t\tObject.defineProperty(o, k2, desc);\n\t}) : (function(o, m, k, k2) {\n\t\tif (k2 === void 0) k2 = k;\n\t\to[k2] = m[k];\n\t}));\n\tvar __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {\n\t\tObject.defineProperty(o, \"default\", {\n\t\t\tenumerable: true,\n\t\t\tvalue: v\n\t\t});\n\t}) : function(o, v) {\n\t\to[\"default\"] = v;\n\t});\n\tvar __importStar = exports && exports.__importStar || (function() {\n\t\tvar ownKeys = function(o) {\n\t\t\townKeys = Object.getOwnPropertyNames || function(o) {\n\t\t\t\tvar ar = [];\n\t\t\t\tfor (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n\t\t\t\treturn ar;\n\t\t\t};\n\t\t\treturn ownKeys(o);\n\t\t};\n\t\treturn function(mod) {\n\t\t\tif (mod && mod.__esModule) return mod;\n\t\t\tvar result = {};\n\t\t\tif (mod != null) {\n\t\t\t\tfor (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n\t\t\t}\n\t\t\t__setModuleDefault(result, mod);\n\t\t\treturn result;\n\t\t};\n\t})();\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.X509Certificate = exports.EXTENSION_OID_SCT = void 0;\n\tconst asn1_1 = require_asn1();\n\tconst crypto = __importStar(require_crypto());\n\tconst oid_1 = require_oid();\n\tconst pem = __importStar(require_pem());\n\tconst ext_1 = require_ext();\n\tconst EXTENSION_OID_SUBJECT_KEY_ID = \"2.5.29.14\";\n\tconst EXTENSION_OID_KEY_USAGE = \"2.5.29.15\";\n\tconst EXTENSION_OID_SUBJECT_ALT_NAME = \"2.5.29.17\";\n\tconst EXTENSION_OID_BASIC_CONSTRAINTS = \"2.5.29.19\";\n\tconst EXTENSION_OID_AUTHORITY_KEY_ID = \"2.5.29.35\";\n\texports.EXTENSION_OID_SCT = \"1.3.6.1.4.1.11129.2.4.2\";\n\tvar X509Certificate = class X509Certificate {\n\t\troot;\n\t\tconstructor(asn1) {\n\t\t\tthis.root = asn1;\n\t\t}\n\t\tstatic parse(cert) {\n\t\t\tconst der = typeof cert === \"string\" ? pem.toDER(cert) : cert;\n\t\t\treturn new X509Certificate(asn1_1.ASN1Obj.parseBuffer(der));\n\t\t}\n\t\tget tbsCertificate() {\n\t\t\treturn this.tbsCertificateObj;\n\t\t}\n\t\tget version() {\n\t\t\treturn `v${(this.versionObj.subs[0].toInteger() + BigInt(1)).toString()}`;\n\t\t}\n\t\tget serialNumber() {\n\t\t\treturn this.serialNumberObj.value;\n\t\t}\n\t\tget notBefore() {\n\t\t\treturn this.validityObj.subs[0].toDate();\n\t\t}\n\t\tget notAfter() {\n\t\t\treturn this.validityObj.subs[1].toDate();\n\t\t}\n\t\tget issuer() {\n\t\t\treturn this.issuerObj.value;\n\t\t}\n\t\tget subject() {\n\t\t\treturn this.subjectObj.value;\n\t\t}\n\t\tget publicKey() {\n\t\t\treturn this.subjectPublicKeyInfoObj.toDER();\n\t\t}\n\t\tget signatureAlgorithm() {\n\t\t\tconst oid = this.signatureAlgorithmObj.subs[0].toOID();\n\t\t\tif (oid_1.RSA_SIGNATURE_ALGOS[oid]) return oid_1.RSA_SIGNATURE_ALGOS[oid];\n\t\t\treturn oid_1.ECDSA_SIGNATURE_ALGOS[oid];\n\t\t}\n\t\tget signatureValue() {\n\t\t\treturn this.signatureValueObj.value.subarray(1);\n\t\t}\n\t\tget subjectAltName() {\n\t\t\tconst ext = this.extSubjectAltName;\n\t\t\treturn ext?.uri || ext?.rfc822Name;\n\t\t}\n\t\tget extensions() {\n\t\t\t/* istanbul ignore next */\n\t\t\treturn (this.extensionsObj?.subs[0])?.subs || [];\n\t\t}\n\t\tget extKeyUsage() {\n\t\t\tconst ext = this.findExtension(EXTENSION_OID_KEY_USAGE);\n\t\t\treturn ext ? new ext_1.X509KeyUsageExtension(ext) : void 0;\n\t\t}\n\t\tget extBasicConstraints() {\n\t\t\tconst ext = this.findExtension(EXTENSION_OID_BASIC_CONSTRAINTS);\n\t\t\treturn ext ? new ext_1.X509BasicConstraintsExtension(ext) : void 0;\n\t\t}\n\t\tget extSubjectAltName() {\n\t\t\tconst ext = this.findExtension(EXTENSION_OID_SUBJECT_ALT_NAME);\n\t\t\treturn ext ? new ext_1.X509SubjectAlternativeNameExtension(ext) : void 0;\n\t\t}\n\t\tget extAuthorityKeyID() {\n\t\t\tconst ext = this.findExtension(EXTENSION_OID_AUTHORITY_KEY_ID);\n\t\t\treturn ext ? new ext_1.X509AuthorityKeyIDExtension(ext) : void 0;\n\t\t}\n\t\tget extSubjectKeyID() {\n\t\t\tconst ext = this.findExtension(EXTENSION_OID_SUBJECT_KEY_ID);\n\t\t\treturn ext ? new ext_1.X509SubjectKeyIDExtension(ext) : void 0;\n\t\t}\n\t\tget extSCT() {\n\t\t\tconst ext = this.findExtension(exports.EXTENSION_OID_SCT);\n\t\t\treturn ext ? new ext_1.X509SCTExtension(ext) : void 0;\n\t\t}\n\t\tget isCA() {\n\t\t\tconst ca = this.extBasicConstraints?.isCA || false;\n\t\t\t/* istanbul ignore else */\n\t\t\tif (this.extKeyUsage) return ca && this.extKeyUsage.keyCertSign;\n\t\t\t/* istanbul ignore next */\n\t\t\treturn ca;\n\t\t}\n\t\textension(oid) {\n\t\t\tconst ext = this.findExtension(oid);\n\t\t\treturn ext ? new ext_1.X509Extension(ext) : void 0;\n\t\t}\n\t\tverify(issuerCertificate) {\n\t\t\tconst publicKey = issuerCertificate?.publicKey || this.publicKey;\n\t\t\tconst key = crypto.createPublicKey(publicKey);\n\t\t\treturn crypto.verify(this.tbsCertificate.toDER(), key, this.signatureValue, this.signatureAlgorithm);\n\t\t}\n\t\tvalidForDate(date) {\n\t\t\treturn this.notBefore <= date && date <= this.notAfter;\n\t\t}\n\t\tequals(other) {\n\t\t\treturn this.root.toDER().equals(other.root.toDER());\n\t\t}\n\t\tclone() {\n\t\t\tconst der = this.root.toDER();\n\t\t\tconst clone = Buffer.alloc(der.length);\n\t\t\tder.copy(clone);\n\t\t\treturn X509Certificate.parse(clone);\n\t\t}\n\t\tfindExtension(oid) {\n\t\t\treturn this.extensions.find((ext) => ext.subs[0].toOID() === oid);\n\t\t}\n\t\tget tbsCertificateObj() {\n\t\t\treturn this.root.subs[0];\n\t\t}\n\t\tget signatureAlgorithmObj() {\n\t\t\treturn this.root.subs[1];\n\t\t}\n\t\tget signatureValueObj() {\n\t\t\treturn this.root.subs[2];\n\t\t}\n\t\tget versionObj() {\n\t\t\treturn this.tbsCertificateObj.subs[0];\n\t\t}\n\t\tget serialNumberObj() {\n\t\t\treturn this.tbsCertificateObj.subs[1];\n\t\t}\n\t\tget issuerObj() {\n\t\t\treturn this.tbsCertificateObj.subs[3];\n\t\t}\n\t\tget validityObj() {\n\t\t\treturn this.tbsCertificateObj.subs[4];\n\t\t}\n\t\tget subjectObj() {\n\t\t\treturn this.tbsCertificateObj.subs[5];\n\t\t}\n\t\tget subjectPublicKeyInfoObj() {\n\t\t\treturn this.tbsCertificateObj.subs[6];\n\t\t}\n\t\tget extensionsObj() {\n\t\t\treturn this.tbsCertificateObj.subs.find((sub) => sub.tag.isContextSpecific(3));\n\t\t}\n\t};\n\texports.X509Certificate = X509Certificate;\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/x509/index.js\nvar require_x509 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.X509SCTExtension = exports.X509Certificate = exports.EXTENSION_OID_SCT = void 0;\n\tvar cert_1 = require_cert();\n\tObject.defineProperty(exports, \"EXTENSION_OID_SCT\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn cert_1.EXTENSION_OID_SCT;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"X509Certificate\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn cert_1.X509Certificate;\n\t\t}\n\t});\n\tvar ext_1 = require_ext();\n\tObject.defineProperty(exports, \"X509SCTExtension\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn ext_1.X509SCTExtension;\n\t\t}\n\t});\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+core@4.0.1_patch_hash=2900ec704c3abfc6962eb2edecaa946b783a97e13084c4c30b1be0df5b30ae4d/node_modules/@sigstore/core/dist/index.js\nvar require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tvar __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {\n\t\tif (k2 === void 0) k2 = k;\n\t\tvar desc = Object.getOwnPropertyDescriptor(m, k);\n\t\tif (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn m[k];\n\t\t\t}\n\t\t};\n\t\tObject.defineProperty(o, k2, desc);\n\t}) : (function(o, m, k, k2) {\n\t\tif (k2 === void 0) k2 = k;\n\t\to[k2] = m[k];\n\t}));\n\tvar __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {\n\t\tObject.defineProperty(o, \"default\", {\n\t\t\tenumerable: true,\n\t\t\tvalue: v\n\t\t});\n\t}) : function(o, v) {\n\t\to[\"default\"] = v;\n\t});\n\tvar __importStar = exports && exports.__importStar || (function() {\n\t\tvar ownKeys = function(o) {\n\t\t\townKeys = Object.getOwnPropertyNames || function(o) {\n\t\t\t\tvar ar = [];\n\t\t\t\tfor (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n\t\t\t\treturn ar;\n\t\t\t};\n\t\t\treturn ownKeys(o);\n\t\t};\n\t\treturn function(mod) {\n\t\t\tif (mod && mod.__esModule) return mod;\n\t\t\tvar result = {};\n\t\t\tif (mod != null) {\n\t\t\t\tfor (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n\t\t\t}\n\t\t\t__setModuleDefault(result, mod);\n\t\t\treturn result;\n\t\t};\n\t})();\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.X509SCTExtension = exports.X509Certificate = exports.EXTENSION_OID_SCT = exports.ByteStream = exports.RFC3161Timestamp = exports.pem = exports.json = exports.encoding = exports.dsse = exports.crypto = exports.ASN1Obj = void 0;\n\tvar asn1_1 = require_asn1();\n\tObject.defineProperty(exports, \"ASN1Obj\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn asn1_1.ASN1Obj;\n\t\t}\n\t});\n\texports.crypto = __importStar(require_crypto());\n\texports.dsse = __importStar(require_dsse$3());\n\texports.encoding = __importStar(require_encoding());\n\texports.json = __importStar(require_json());\n\texports.pem = __importStar(require_pem());\n\tvar rfc3161_1 = require_rfc3161();\n\tObject.defineProperty(exports, \"RFC3161Timestamp\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn rfc3161_1.RFC3161Timestamp;\n\t\t}\n\t});\n\tvar stream_1 = require_stream();\n\tObject.defineProperty(exports, \"ByteStream\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn stream_1.ByteStream;\n\t\t}\n\t});\n\tvar x509_1 = require_x509();\n\tObject.defineProperty(exports, \"EXTENSION_OID_SCT\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn x509_1.EXTENSION_OID_SCT;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"X509Certificate\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn x509_1.X509Certificate;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"X509SCTExtension\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn x509_1.X509SCTExtension;\n\t\t}\n\t});\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/bundle/dsse.js\nvar require_dsse$2 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.DSSESignatureContent = void 0;\n\tconst core_1 = require_dist$1();\n\tvar DSSESignatureContent = class {\n\t\tenv;\n\t\tconstructor(env) {\n\t\t\tthis.env = env;\n\t\t}\n\t\tcompareDigest(digest) {\n\t\t\treturn core_1.crypto.bufferEqual(digest, core_1.crypto.digest(\"sha256\", this.env.payload));\n\t\t}\n\t\tcompareSignedDigest(digest) {\n\t\t\treturn core_1.crypto.bufferEqual(digest, core_1.crypto.digest(\"sha256\", this.preAuthEncoding));\n\t\t}\n\t\tcompareSignature(signature) {\n\t\t\treturn core_1.crypto.bufferEqual(signature, this.signature);\n\t\t}\n\t\tverifySignature(key) {\n\t\t\treturn core_1.crypto.verify(this.preAuthEncoding, key, this.signature);\n\t\t}\n\t\tget signature() {\n\t\t\treturn this.env.signatures.length > 0 ? this.env.signatures[0].sig : Buffer.from(\"\");\n\t\t}\n\t\tget preAuthEncoding() {\n\t\t\treturn core_1.dsse.preAuthEncoding(this.env.payloadType, this.env.payload);\n\t\t}\n\t};\n\texports.DSSESignatureContent = DSSESignatureContent;\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/bundle/message.js\nvar require_message = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.MessageSignatureContent = void 0;\n\tconst core_1 = require_dist$1();\n\tconst protobuf_specs_1 = require_dist$3();\n\tconst HASH_ALGORITHM_MAP = {\n\t\t[protobuf_specs_1.HashAlgorithm.HASH_ALGORITHM_UNSPECIFIED]: \"sha256\",\n\t\t[protobuf_specs_1.HashAlgorithm.SHA2_256]: \"sha256\",\n\t\t[protobuf_specs_1.HashAlgorithm.SHA2_384]: \"sha384\",\n\t\t[protobuf_specs_1.HashAlgorithm.SHA2_512]: \"sha512\",\n\t\t[protobuf_specs_1.HashAlgorithm.SHA3_256]: \"sha3-256\",\n\t\t[protobuf_specs_1.HashAlgorithm.SHA3_384]: \"sha3-384\"\n\t};\n\tvar MessageSignatureContent = class {\n\t\tsignature;\n\t\tmessageDigest;\n\t\tartifact;\n\t\thashAlgorithm;\n\t\tconstructor(messageSignature, artifact) {\n\t\t\tthis.signature = messageSignature.signature;\n\t\t\tthis.messageDigest = messageSignature.messageDigest.digest;\n\t\t\tthis.artifact = artifact;\n\t\t\tthis.hashAlgorithm = HASH_ALGORITHM_MAP[messageSignature.messageDigest.algorithm] ?? \"sha256\";\n\t\t}\n\t\tcompareSignature(signature) {\n\t\t\treturn core_1.crypto.bufferEqual(signature, this.signature);\n\t\t}\n\t\tcompareDigest(digest) {\n\t\t\treturn core_1.crypto.bufferEqual(digest, this.messageDigest);\n\t\t}\n\t\tcompareSignedDigest(digest) {\n\t\t\treturn this.compareDigest(digest);\n\t\t}\n\t\tverifySignature(key) {\n\t\t\treturn core_1.crypto.verify(this.artifact, key, this.signature, this.hashAlgorithm);\n\t\t}\n\t};\n\texports.MessageSignatureContent = MessageSignatureContent;\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/bundle/index.js\nvar require_bundle = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.toSignedEntity = toSignedEntity;\n\texports.signatureContent = signatureContent;\n\tconst core_1 = require_dist$1();\n\tconst dsse_1 = require_dsse$2();\n\tconst message_1 = require_message();\n\tfunction toSignedEntity(bundle, artifact) {\n\t\tconst { tlogEntries, timestampVerificationData } = bundle.verificationMaterial;\n\t\tconst timestamps = [];\n\t\tfor (const entry of tlogEntries) if (entry.integratedTime && entry.integratedTime !== \"0\") timestamps.push({\n\t\t\t$case: \"transparency-log\",\n\t\t\ttlogEntry: entry\n\t\t});\n\t\tfor (const ts of timestampVerificationData?.rfc3161Timestamps ?? []) timestamps.push({\n\t\t\t$case: \"timestamp-authority\",\n\t\t\ttimestamp: core_1.RFC3161Timestamp.parse(Buffer.from(ts.signedTimestamp))\n\t\t});\n\t\treturn {\n\t\t\tsignature: signatureContent(bundle, artifact),\n\t\t\tkey: key(bundle),\n\t\t\ttlogEntries,\n\t\t\ttimestamps\n\t\t};\n\t}\n\tfunction signatureContent(bundle, artifact) {\n\t\tswitch (bundle.content.$case) {\n\t\t\tcase \"dsseEnvelope\": return new dsse_1.DSSESignatureContent(bundle.content.dsseEnvelope);\n\t\t\tcase \"messageSignature\": return new message_1.MessageSignatureContent(bundle.content.messageSignature, artifact);\n\t\t}\n\t}\n\tfunction key(bundle) {\n\t\tswitch (bundle.verificationMaterial.content.$case) {\n\t\t\tcase \"publicKey\": return {\n\t\t\t\t$case: \"public-key\",\n\t\t\t\thint: bundle.verificationMaterial.content.publicKey.hint\n\t\t\t};\n\t\t\tcase \"x509CertificateChain\": return {\n\t\t\t\t$case: \"certificate\",\n\t\t\t\tcertificate: core_1.X509Certificate.parse(Buffer.from(bundle.verificationMaterial.content.x509CertificateChain.certificates[0].rawBytes))\n\t\t\t};\n\t\t\tcase \"certificate\": return {\n\t\t\t\t$case: \"certificate\",\n\t\t\t\tcertificate: core_1.X509Certificate.parse(Buffer.from(bundle.verificationMaterial.content.certificate.rawBytes))\n\t\t\t};\n\t\t}\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/error.js\nvar require_error = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.PolicyError = exports.VerificationError = void 0;\n\tvar BaseError = class extends Error {\n\t\tcode;\n\t\tcause;\n\t\tconstructor({ code, message, cause }) {\n\t\t\tsuper(message);\n\t\t\tthis.code = code;\n\t\t\tthis.cause = cause;\n\t\t\tthis.name = this.constructor.name;\n\t\t}\n\t};\n\tvar VerificationError = class extends BaseError {};\n\texports.VerificationError = VerificationError;\n\tvar PolicyError = class extends BaseError {};\n\texports.PolicyError = PolicyError;\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/trust/filter.js\nvar require_filter = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.filterCertAuthorities = filterCertAuthorities;\n\texports.filterTLogAuthorities = filterTLogAuthorities;\n\tfunction filterCertAuthorities(certAuthorities, timestamp) {\n\t\treturn certAuthorities.filter((ca) => {\n\t\t\treturn ca.validFor.start <= timestamp && ca.validFor.end >= timestamp;\n\t\t});\n\t}\n\tfunction filterTLogAuthorities(tlogAuthorities, criteria) {\n\t\treturn tlogAuthorities.filter((tlog) => {\n\t\t\tif (criteria.logID && !tlog.logID.equals(criteria.logID)) return false;\n\t\t\treturn tlog.validFor.start <= criteria.targetDate && criteria.targetDate <= tlog.validFor.end;\n\t\t});\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/trust/index.js\nvar require_trust = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.filterTLogAuthorities = exports.filterCertAuthorities = void 0;\n\texports.toTrustMaterial = toTrustMaterial;\n\tconst core_1 = require_dist$1();\n\tconst protobuf_specs_1 = require_dist$3();\n\tconst error_1 = require_error();\n\tconst BEGINNING_OF_TIME = /* @__PURE__ */ new Date(0);\n\tconst END_OF_TIME = /* @__PURE__ */ new Date(864e13);\n\tvar filter_1 = require_filter();\n\tObject.defineProperty(exports, \"filterCertAuthorities\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn filter_1.filterCertAuthorities;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"filterTLogAuthorities\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn filter_1.filterTLogAuthorities;\n\t\t}\n\t});\n\tfunction toTrustMaterial(root, keys) {\n\t\tconst keyFinder = typeof keys === \"function\" ? keys : keyLocator(keys);\n\t\treturn {\n\t\t\tcertificateAuthorities: root.certificateAuthorities.map(createCertAuthority),\n\t\t\ttimestampAuthorities: root.timestampAuthorities.map(createCertAuthority),\n\t\t\ttlogs: root.tlogs.map(createTLogAuthority),\n\t\t\tctlogs: root.ctlogs.map(createTLogAuthority),\n\t\t\tpublicKey: keyFinder\n\t\t};\n\t}\n\tfunction createTLogAuthority(tlogInstance) {\n\t\tconst keyDetails = tlogInstance.publicKey.keyDetails;\n\t\tconst keyType = keyDetails === protobuf_specs_1.PublicKeyDetails.PKCS1_RSA_PKCS1V5 || keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V5 || keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V15_2048_SHA256 || keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V15_3072_SHA256 || keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V15_4096_SHA256 ? \"pkcs1\" : \"spki\";\n\t\t/* istanbul ignore next */\n\t\treturn {\n\t\t\tbaseURL: tlogInstance.baseUrl,\n\t\t\tlogID: tlogInstance.checkpointKeyId ? tlogInstance.checkpointKeyId.keyId : tlogInstance.logId.keyId,\n\t\t\tpublicKey: core_1.crypto.createPublicKey(tlogInstance.publicKey.rawBytes, keyType),\n\t\t\tvalidFor: {\n\t\t\t\tstart: tlogInstance.publicKey.validFor?.start || BEGINNING_OF_TIME,\n\t\t\t\tend: tlogInstance.publicKey.validFor?.end || END_OF_TIME\n\t\t\t}\n\t\t};\n\t}\n\tfunction createCertAuthority(ca) {\n\t\t/* istanbul ignore next */\n\t\treturn {\n\t\t\tcertChain: ca.certChain.certificates.map((cert) => {\n\t\t\t\treturn core_1.X509Certificate.parse(Buffer.from(cert.rawBytes));\n\t\t\t}),\n\t\t\tvalidFor: {\n\t\t\t\tstart: ca.validFor?.start || BEGINNING_OF_TIME,\n\t\t\t\tend: ca.validFor?.end || END_OF_TIME\n\t\t\t}\n\t\t};\n\t}\n\tfunction keyLocator(keys) {\n\t\treturn (hint) => {\n\t\t\tconst key = (keys || {})[hint];\n\t\t\tif (!key) throw new error_1.VerificationError({\n\t\t\t\tcode: \"PUBLIC_KEY_ERROR\",\n\t\t\t\tmessage: `key not found: ${hint}`\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tpublicKey: core_1.crypto.createPublicKey(key.rawBytes),\n\t\t\t\tvalidFor: (date) => {\n\t\t\t\t\t/* istanbul ignore next */\n\t\t\t\t\treturn (key.validFor?.start || BEGINNING_OF_TIME) <= date && (key.validFor?.end || END_OF_TIME) >= date;\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/key/certificate.js\nvar require_certificate = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.CertificateChainVerifier = void 0;\n\texports.verifyCertificateChain = verifyCertificateChain;\n\tconst error_1 = require_error();\n\tconst trust_1 = require_trust();\n\tfunction verifyCertificateChain(timestamp, leaf, certificateAuthorities) {\n\t\tconst cas = (0, trust_1.filterCertAuthorities)(certificateAuthorities, timestamp);\n\t\tlet error;\n\t\tfor (const ca of cas) try {\n\t\t\treturn new CertificateChainVerifier({\n\t\t\t\ttrustedCerts: ca.certChain,\n\t\t\t\tuntrustedCert: leaf,\n\t\t\t\ttimestamp\n\t\t\t}).verify();\n\t\t} catch (err) {\n\t\t\terror = err;\n\t\t}\n\t\tthrow new error_1.VerificationError({\n\t\t\tcode: \"CERTIFICATE_ERROR\",\n\t\t\tmessage: \"Failed to verify certificate chain\",\n\t\t\tcause: error\n\t\t});\n\t}\n\tvar CertificateChainVerifier = class {\n\t\tuntrustedCert;\n\t\ttrustedCerts;\n\t\tlocalCerts;\n\t\ttimestamp;\n\t\tconstructor(opts) {\n\t\t\tthis.untrustedCert = opts.untrustedCert;\n\t\t\tthis.trustedCerts = opts.trustedCerts;\n\t\t\tthis.localCerts = dedupeCertificates([...opts.trustedCerts, opts.untrustedCert]);\n\t\t\tthis.timestamp = opts.timestamp;\n\t\t}\n\t\tverify() {\n\t\t\tconst certificatePath = this.sort();\n\t\t\tthis.checkPath(certificatePath);\n\t\t\tif (!certificatePath.every((cert) => cert.validForDate(this.timestamp))) throw new error_1.VerificationError({\n\t\t\t\tcode: \"CERTIFICATE_ERROR\",\n\t\t\t\tmessage: \"certificate is not valid or expired at the specified date\"\n\t\t\t});\n\t\t\treturn certificatePath;\n\t\t}\n\t\tsort() {\n\t\t\tconst leafCert = this.untrustedCert;\n\t\t\tlet paths = this.buildPaths(leafCert);\n\t\t\tpaths = paths.filter((path) => path.some((cert) => this.trustedCerts.includes(cert)));\n\t\t\tif (paths.length === 0) throw new error_1.VerificationError({\n\t\t\t\tcode: \"CERTIFICATE_ERROR\",\n\t\t\t\tmessage: \"no trusted certificate path found\"\n\t\t\t});\n\t\t\treturn [leafCert, ...paths.reduce((prev, curr) => prev.length < curr.length ? prev : curr)].slice(0, -1);\n\t\t}\n\t\tbuildPaths(certificate) {\n\t\t\tconst paths = [];\n\t\t\tconst issuers = this.findIssuer(certificate);\n\t\t\tif (issuers.length === 0) throw new error_1.VerificationError({\n\t\t\t\tcode: \"CERTIFICATE_ERROR\",\n\t\t\t\tmessage: \"no valid certificate path found\"\n\t\t\t});\n\t\t\tfor (let i = 0; i < issuers.length; i++) {\n\t\t\t\tconst issuer = issuers[i];\n\t\t\t\tif (issuer.equals(certificate)) {\n\t\t\t\t\tpaths.push([certificate]);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst subPaths = this.buildPaths(issuer);\n\t\t\t\tfor (let j = 0; j < subPaths.length; j++) paths.push([issuer, ...subPaths[j]]);\n\t\t\t}\n\t\t\treturn paths;\n\t\t}\n\t\tfindIssuer(certificate) {\n\t\t\tlet issuers = [];\n\t\t\tlet keyIdentifier;\n\t\t\tif (certificate.subject.equals(certificate.issuer)) {\n\t\t\t\tif (certificate.verify()) return [certificate];\n\t\t\t}\n\t\t\tif (certificate.extAuthorityKeyID) keyIdentifier = certificate.extAuthorityKeyID.keyIdentifier;\n\t\t\tthis.localCerts.forEach((possibleIssuer) => {\n\t\t\t\tif (keyIdentifier) {\n\t\t\t\t\t/* istanbul ignore else */\n\t\t\t\t\tif (possibleIssuer.extSubjectKeyID) {\n\t\t\t\t\t\tif (possibleIssuer.extSubjectKeyID.keyIdentifier.equals(keyIdentifier)) issuers.push(possibleIssuer);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (possibleIssuer.subject.equals(certificate.issuer)) issuers.push(possibleIssuer);\n\t\t\t});\n\t\t\tissuers = issuers.filter((issuer) => {\n\t\t\t\ttry {\n\t\t\t\t\treturn certificate.verify(issuer);\n\t\t\t\t} catch (ex) {\n\t\t\t\t\t/* istanbul ignore next - should never error */\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn issuers;\n\t\t}\n\t\tcheckPath(path) {\n\t\t\t/* istanbul ignore if */\n\t\t\tif (path.length < 1) throw new error_1.VerificationError({\n\t\t\t\tcode: \"CERTIFICATE_ERROR\",\n\t\t\t\tmessage: \"certificate chain must contain at least one certificate\"\n\t\t\t});\n\t\t\tif (!path.slice(1).every((cert) => cert.isCA)) throw new error_1.VerificationError({\n\t\t\t\tcode: \"CERTIFICATE_ERROR\",\n\t\t\t\tmessage: \"intermediate certificate is not a CA\"\n\t\t\t});\n\t\t\tfor (let i = path.length - 2; i >= 0; i--)\n /* istanbul ignore if */\n\t\t\tif (!path[i].issuer.equals(path[i + 1].subject)) throw new error_1.VerificationError({\n\t\t\t\tcode: \"CERTIFICATE_ERROR\",\n\t\t\t\tmessage: \"incorrect certificate name chaining\"\n\t\t\t});\n\t\t\tfor (let i = 0; i < path.length; i++) {\n\t\t\t\tconst cert = path[i];\n\t\t\t\tif (cert.extBasicConstraints?.isCA) {\n\t\t\t\t\tconst pathLength = cert.extBasicConstraints.pathLenConstraint;\n\t\t\t\t\tif (pathLength !== void 0 && pathLength < i - 1) throw new error_1.VerificationError({\n\t\t\t\t\t\tcode: \"CERTIFICATE_ERROR\",\n\t\t\t\t\t\tmessage: \"path length constraint exceeded\"\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\texports.CertificateChainVerifier = CertificateChainVerifier;\n\tfunction dedupeCertificates(certs) {\n\t\tfor (let i = 0; i < certs.length; i++) for (let j = i + 1; j < certs.length; j++) if (certs[i].equals(certs[j])) {\n\t\t\tcerts.splice(j, 1);\n\t\t\tj--;\n\t\t}\n\t\treturn certs;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/key/sct.js\nvar require_sct = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.verifySCTs = verifySCTs;\n\tconst core_1 = require_dist$1();\n\tconst error_1 = require_error();\n\tconst trust_1 = require_trust();\n\tfunction verifySCTs(cert, issuer, ctlogs) {\n\t\tlet extSCT;\n\t\tconst clone = cert.clone();\n\t\tfor (let i = 0; i < clone.extensions.length; i++) {\n\t\t\tconst ext = clone.extensions[i];\n\t\t\tif (ext.subs[0].toOID() === core_1.EXTENSION_OID_SCT) {\n\t\t\t\textSCT = new core_1.X509SCTExtension(ext);\n\t\t\t\tclone.extensions.splice(i, 1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!extSCT) return [];\n\t\t/* istanbul ignore if -- too difficult to fabricate test case for this */\n\t\tif (extSCT.signedCertificateTimestamps.length === 0) return [];\n\t\tconst preCert = new core_1.ByteStream();\n\t\tconst issuerId = core_1.crypto.digest(\"sha256\", issuer.publicKey);\n\t\tpreCert.appendView(issuerId);\n\t\tconst tbs = clone.tbsCertificate.toDER();\n\t\tpreCert.appendUint24(tbs.length);\n\t\tpreCert.appendView(tbs);\n\t\treturn extSCT.signedCertificateTimestamps.map((sct) => {\n\t\t\tif (!(0, trust_1.filterTLogAuthorities)(ctlogs, {\n\t\t\t\tlogID: sct.logID,\n\t\t\t\ttargetDate: sct.datetime\n\t\t\t}).some((log) => sct.verify(preCert.buffer, log.publicKey))) throw new error_1.VerificationError({\n\t\t\t\tcode: \"CERTIFICATE_ERROR\",\n\t\t\t\tmessage: \"SCT verification failed\"\n\t\t\t});\n\t\t\treturn sct.logID;\n\t\t});\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/key/index.js\nvar require_key = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.verifyPublicKey = verifyPublicKey;\n\texports.verifyCertificate = verifyCertificate;\n\tconst core_1 = require_dist$1();\n\tconst error_1 = require_error();\n\tconst certificate_1 = require_certificate();\n\tconst sct_1 = require_sct();\n\tconst OID_FULCIO_ISSUER_V1 = \"1.3.6.1.4.1.57264.1.1\";\n\tconst OID_FULCIO_ISSUER_V2 = \"1.3.6.1.4.1.57264.1.8\";\n\tfunction verifyPublicKey(hint, timestamps, trustMaterial) {\n\t\tconst key = trustMaterial.publicKey(hint);\n\t\ttimestamps.forEach((timestamp) => {\n\t\t\tif (!key.validFor(timestamp)) throw new error_1.VerificationError({\n\t\t\t\tcode: \"PUBLIC_KEY_ERROR\",\n\t\t\t\tmessage: `Public key is not valid for timestamp: ${timestamp.toISOString()}`\n\t\t\t});\n\t\t});\n\t\treturn { key: key.publicKey };\n\t}\n\tfunction verifyCertificate(leaf, timestamps, trustMaterial) {\n\t\tlet path = [];\n\t\ttimestamps.forEach((timestamp) => {\n\t\t\tpath = (0, certificate_1.verifyCertificateChain)(timestamp, leaf, trustMaterial.certificateAuthorities);\n\t\t});\n\t\treturn {\n\t\t\tscts: (0, sct_1.verifySCTs)(path[0], path[1], trustMaterial.ctlogs),\n\t\t\tsigner: getSigner(path[0])\n\t\t};\n\t}\n\tfunction getSigner(cert) {\n\t\tlet issuer;\n\t\tconst issuerExtension = cert.extension(OID_FULCIO_ISSUER_V2);\n\t\t/* istanbul ignore next */\n\t\tif (issuerExtension) issuer = issuerExtension.valueObj.subs?.[0]?.value.toString(\"ascii\");\n\t\telse issuer = cert.extension(OID_FULCIO_ISSUER_V1)?.value.toString(\"ascii\");\n\t\tconst oids = cert.extensions.map((ext) => {\n\t\t\treturn {\n\t\t\t\toid: { id: ext.subs[0].toOID().split(\".\").map(Number) },\n\t\t\t\tvalue: ext.subs[ext.subs.length - 1].value\n\t\t\t};\n\t\t});\n\t\tconst identity = {\n\t\t\textensions: { issuer },\n\t\t\tsubjectAlternativeName: cert.subjectAltName,\n\t\t\toids\n\t\t};\n\t\treturn {\n\t\t\tkey: core_1.crypto.createPublicKey(cert.publicKey),\n\t\t\tidentity\n\t\t};\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/policy.js\nvar require_policy = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.verifySubjectAlternativeName = verifySubjectAlternativeName;\n\texports.verifyExtensions = verifyExtensions;\n\texports.verifyOIDs = verifyOIDs;\n\tconst error_1 = require_error();\n\tfunction verifySubjectAlternativeName(policyIdentity, signerIdentity) {\n\t\tif (signerIdentity === void 0 || !signerIdentity.match(policyIdentity)) throw new error_1.PolicyError({\n\t\t\tcode: \"UNTRUSTED_SIGNER_ERROR\",\n\t\t\tmessage: `certificate identity error - expected ${policyIdentity}, got ${signerIdentity}`\n\t\t});\n\t}\n\tfunction verifyExtensions(policyExtensions, signerExtensions = {}) {\n\t\tlet key;\n\t\tfor (key in policyExtensions) if (signerExtensions[key] !== policyExtensions[key]) throw new error_1.PolicyError({\n\t\t\tcode: \"UNTRUSTED_SIGNER_ERROR\",\n\t\t\tmessage: `invalid certificate extension - expected ${key}=${policyExtensions[key]}, got ${key}=${signerExtensions[key]}`\n\t\t});\n\t}\n\tfunction verifyOIDs(policyOIDs, signerOIDs = []) {\n\t\tfor (const policyOID of policyOIDs) if (!signerOIDs.find((signerOID) => oidEquals(policyOID.oid?.id, signerOID.oid?.id) && policyOID.value.equals(signerOID.value))) {\n\t\t\tconst oid = policyOID.oid?.id.join(\".\") ?? \"<unknown>\";\n\t\t\tthrow new error_1.PolicyError({\n\t\t\t\tcode: \"UNTRUSTED_SIGNER_ERROR\",\n\t\t\t\tmessage: `invalid certificate extension - missing OID ${oid}`\n\t\t\t});\n\t\t}\n\t}\n\tfunction oidEquals(a, b) {\n\t\tif (a === void 0 || b === void 0) return false;\n\t\treturn a.length === b.length && a.every((v, i) => v === b[i]);\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/timestamp/tsa.js\nvar require_tsa = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.verifyRFC3161Timestamp = verifyRFC3161Timestamp;\n\tconst core_1 = require_dist$1();\n\tconst error_1 = require_error();\n\tconst certificate_1 = require_certificate();\n\tconst trust_1 = require_trust();\n\tfunction verifyRFC3161Timestamp(timestamp, data, timestampAuthorities) {\n\t\tconst signingTime = timestamp.signingTime;\n\t\ttimestampAuthorities = (0, trust_1.filterCertAuthorities)(timestampAuthorities, signingTime);\n\t\ttimestampAuthorities = filterCAsBySerialAndIssuer(timestampAuthorities, {\n\t\t\tserialNumber: timestamp.signerSerialNumber,\n\t\t\tissuer: timestamp.signerIssuer\n\t\t});\n\t\tif (!timestampAuthorities.some((ca) => {\n\t\t\ttry {\n\t\t\t\tverifyTimestampForCA(timestamp, data, ca);\n\t\t\t\treturn true;\n\t\t\t} catch (e) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t})) throw new error_1.VerificationError({\n\t\t\tcode: \"TIMESTAMP_ERROR\",\n\t\t\tmessage: \"timestamp could not be verified\"\n\t\t});\n\t}\n\tfunction verifyTimestampForCA(timestamp, data, ca) {\n\t\tconst [leaf, ...cas] = ca.certChain;\n\t\tconst signingKey = core_1.crypto.createPublicKey(leaf.publicKey);\n\t\tconst signingTime = timestamp.signingTime;\n\t\ttry {\n\t\t\tnew certificate_1.CertificateChainVerifier({\n\t\t\t\tuntrustedCert: leaf,\n\t\t\t\ttrustedCerts: cas,\n\t\t\t\ttimestamp: signingTime\n\t\t\t}).verify();\n\t\t} catch (e) {\n\t\t\tthrow new error_1.VerificationError({\n\t\t\t\tcode: \"TIMESTAMP_ERROR\",\n\t\t\t\tmessage: \"invalid certificate chain\"\n\t\t\t});\n\t\t}\n\t\ttimestamp.verify(data, signingKey);\n\t}\n\tfunction filterCAsBySerialAndIssuer(timestampAuthorities, criteria) {\n\t\treturn timestampAuthorities.filter((ca) => ca.certChain.length > 0 && core_1.crypto.bufferEqual(ca.certChain[0].serialNumber, criteria.serialNumber) && core_1.crypto.bufferEqual(ca.certChain[0].issuer, criteria.issuer));\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/timestamp/index.js\nvar require_timestamp = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.getTSATimestamp = getTSATimestamp;\n\texports.getTLogTimestamp = getTLogTimestamp;\n\tconst tsa_1 = require_tsa();\n\tfunction getTSATimestamp(timestamp, data, timestampAuthorities) {\n\t\t(0, tsa_1.verifyRFC3161Timestamp)(timestamp, data, timestampAuthorities);\n\t\treturn {\n\t\t\ttype: \"timestamp-authority\",\n\t\t\tlogID: timestamp.signerSerialNumber,\n\t\t\ttimestamp: timestamp.signingTime\n\t\t};\n\t}\n\tfunction getTLogTimestamp(entry) {\n\t\tif (!entry.inclusionPromise) return;\n\t\treturn {\n\t\t\ttype: \"transparency-log\",\n\t\t\tlogID: entry.logId.keyId,\n\t\t\ttimestamp: /* @__PURE__ */ new Date(Number(entry.integratedTime) * 1e3)\n\t\t};\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+protobuf-specs@0.5.1/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/verifier.js\nvar require_verifier$1 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.Signature = exports.Verifier = exports.PublicKey = void 0;\n\tconst sigstore_common_1 = require_sigstore_common();\n\texports.PublicKey = {\n\t\tfromJSON(object) {\n\t\t\treturn { rawBytes: isSet(object.rawBytes) ? Buffer.from(bytesFromBase64(object.rawBytes)) : Buffer.alloc(0) };\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.rawBytes.length !== 0) obj.rawBytes = base64FromBytes(message.rawBytes);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.Verifier = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tverifier: isSet(object.publicKey) ? {\n\t\t\t\t\t$case: \"publicKey\",\n\t\t\t\t\tpublicKey: exports.PublicKey.fromJSON(object.publicKey)\n\t\t\t\t} : isSet(object.x509Certificate) ? {\n\t\t\t\t\t$case: \"x509Certificate\",\n\t\t\t\t\tx509Certificate: sigstore_common_1.X509Certificate.fromJSON(object.x509Certificate)\n\t\t\t\t} : void 0,\n\t\t\t\tkeyDetails: isSet(object.keyDetails) ? (0, sigstore_common_1.publicKeyDetailsFromJSON)(object.keyDetails) : 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.verifier?.$case === \"publicKey\") obj.publicKey = exports.PublicKey.toJSON(message.verifier.publicKey);\n\t\t\telse if (message.verifier?.$case === \"x509Certificate\") obj.x509Certificate = sigstore_common_1.X509Certificate.toJSON(message.verifier.x509Certificate);\n\t\t\tif (message.keyDetails !== 0) obj.keyDetails = (0, sigstore_common_1.publicKeyDetailsToJSON)(message.keyDetails);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.Signature = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tcontent: isSet(object.content) ? Buffer.from(bytesFromBase64(object.content)) : Buffer.alloc(0),\n\t\t\t\tverifier: isSet(object.verifier) ? exports.Verifier.fromJSON(object.verifier) : void 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.content.length !== 0) obj.content = base64FromBytes(message.content);\n\t\t\tif (message.verifier !== void 0) obj.verifier = exports.Verifier.toJSON(message.verifier);\n\t\t\treturn obj;\n\t\t}\n\t};\n\tfunction bytesFromBase64(b64) {\n\t\treturn Uint8Array.from(globalThis.Buffer.from(b64, \"base64\"));\n\t}\n\tfunction base64FromBytes(arr) {\n\t\treturn globalThis.Buffer.from(arr).toString(\"base64\");\n\t}\n\tfunction isSet(value) {\n\t\treturn value !== null && value !== void 0;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+protobuf-specs@0.5.1/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/dsse.js\nvar require_dsse$1 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.DSSELogEntryV002 = exports.DSSERequestV002 = void 0;\n\tconst envelope_1 = require_envelope();\n\tconst sigstore_common_1 = require_sigstore_common();\n\tconst verifier_1 = require_verifier$1();\n\texports.DSSERequestV002 = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tenvelope: isSet(object.envelope) ? envelope_1.Envelope.fromJSON(object.envelope) : void 0,\n\t\t\t\tverifiers: globalThis.Array.isArray(object?.verifiers) ? object.verifiers.map((e) => verifier_1.Verifier.fromJSON(e)) : []\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.envelope !== void 0) obj.envelope = envelope_1.Envelope.toJSON(message.envelope);\n\t\t\tif (message.verifiers?.length) obj.verifiers = message.verifiers.map((e) => verifier_1.Verifier.toJSON(e));\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.DSSELogEntryV002 = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tpayloadHash: isSet(object.payloadHash) ? sigstore_common_1.HashOutput.fromJSON(object.payloadHash) : void 0,\n\t\t\t\tsignatures: globalThis.Array.isArray(object?.signatures) ? object.signatures.map((e) => verifier_1.Signature.fromJSON(e)) : []\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.payloadHash !== void 0) obj.payloadHash = sigstore_common_1.HashOutput.toJSON(message.payloadHash);\n\t\t\tif (message.signatures?.length) obj.signatures = message.signatures.map((e) => verifier_1.Signature.toJSON(e));\n\t\t\treturn obj;\n\t\t}\n\t};\n\tfunction isSet(value) {\n\t\treturn value !== null && value !== void 0;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+protobuf-specs@0.5.1/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/hashedrekord.js\nvar require_hashedrekord$1 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.HashedRekordLogEntryV002 = exports.HashedRekordRequestV002 = void 0;\n\tconst sigstore_common_1 = require_sigstore_common();\n\tconst verifier_1 = require_verifier$1();\n\texports.HashedRekordRequestV002 = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tdigest: isSet(object.digest) ? Buffer.from(bytesFromBase64(object.digest)) : Buffer.alloc(0),\n\t\t\t\tsignature: isSet(object.signature) ? verifier_1.Signature.fromJSON(object.signature) : void 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.digest.length !== 0) obj.digest = base64FromBytes(message.digest);\n\t\t\tif (message.signature !== void 0) obj.signature = verifier_1.Signature.toJSON(message.signature);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.HashedRekordLogEntryV002 = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tdata: isSet(object.data) ? sigstore_common_1.HashOutput.fromJSON(object.data) : void 0,\n\t\t\t\tsignature: isSet(object.signature) ? verifier_1.Signature.fromJSON(object.signature) : void 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.data !== void 0) obj.data = sigstore_common_1.HashOutput.toJSON(message.data);\n\t\t\tif (message.signature !== void 0) obj.signature = verifier_1.Signature.toJSON(message.signature);\n\t\t\treturn obj;\n\t\t}\n\t};\n\tfunction bytesFromBase64(b64) {\n\t\treturn Uint8Array.from(globalThis.Buffer.from(b64, \"base64\"));\n\t}\n\tfunction base64FromBytes(arr) {\n\t\treturn globalThis.Buffer.from(arr).toString(\"base64\");\n\t}\n\tfunction isSet(value) {\n\t\treturn value !== null && value !== void 0;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+protobuf-specs@0.5.1/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/entry.js\nvar require_entry = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.CreateEntryRequest = exports.Spec = exports.Entry = void 0;\n\tconst dsse_1 = require_dsse$1();\n\tconst hashedrekord_1 = require_hashedrekord$1();\n\texports.Entry = {\n\t\tfromJSON(object) {\n\t\t\treturn {\n\t\t\t\tkind: isSet(object.kind) ? globalThis.String(object.kind) : \"\",\n\t\t\t\tapiVersion: isSet(object.apiVersion) ? globalThis.String(object.apiVersion) : \"\",\n\t\t\t\tspec: isSet(object.spec) ? exports.Spec.fromJSON(object.spec) : void 0\n\t\t\t};\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.kind !== \"\") obj.kind = message.kind;\n\t\t\tif (message.apiVersion !== \"\") obj.apiVersion = message.apiVersion;\n\t\t\tif (message.spec !== void 0) obj.spec = exports.Spec.toJSON(message.spec);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.Spec = {\n\t\tfromJSON(object) {\n\t\t\treturn { spec: isSet(object.hashedRekordV002) ? {\n\t\t\t\t$case: \"hashedRekordV002\",\n\t\t\t\thashedRekordV002: hashedrekord_1.HashedRekordLogEntryV002.fromJSON(object.hashedRekordV002)\n\t\t\t} : isSet(object.dsseV002) ? {\n\t\t\t\t$case: \"dsseV002\",\n\t\t\t\tdsseV002: dsse_1.DSSELogEntryV002.fromJSON(object.dsseV002)\n\t\t\t} : void 0 };\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.spec?.$case === \"hashedRekordV002\") obj.hashedRekordV002 = hashedrekord_1.HashedRekordLogEntryV002.toJSON(message.spec.hashedRekordV002);\n\t\t\telse if (message.spec?.$case === \"dsseV002\") obj.dsseV002 = dsse_1.DSSELogEntryV002.toJSON(message.spec.dsseV002);\n\t\t\treturn obj;\n\t\t}\n\t};\n\texports.CreateEntryRequest = {\n\t\tfromJSON(object) {\n\t\t\treturn { spec: isSet(object.hashedRekordRequestV002) ? {\n\t\t\t\t$case: \"hashedRekordRequestV002\",\n\t\t\t\thashedRekordRequestV002: hashedrekord_1.HashedRekordRequestV002.fromJSON(object.hashedRekordRequestV002)\n\t\t\t} : isSet(object.dsseRequestV002) ? {\n\t\t\t\t$case: \"dsseRequestV002\",\n\t\t\t\tdsseRequestV002: dsse_1.DSSERequestV002.fromJSON(object.dsseRequestV002)\n\t\t\t} : void 0 };\n\t\t},\n\t\ttoJSON(message) {\n\t\t\tconst obj = {};\n\t\t\tif (message.spec?.$case === \"hashedRekordRequestV002\") obj.hashedRekordRequestV002 = hashedrekord_1.HashedRekordRequestV002.toJSON(message.spec.hashedRekordRequestV002);\n\t\t\telse if (message.spec?.$case === \"dsseRequestV002\") obj.dsseRequestV002 = dsse_1.DSSERequestV002.toJSON(message.spec.dsseRequestV002);\n\t\t\treturn obj;\n\t\t}\n\t};\n\tfunction isSet(value) {\n\t\treturn value !== null && value !== void 0;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+protobuf-specs@0.5.1/node_modules/@sigstore/protobuf-specs/dist/rekor/v2/index.js\nvar require_v2 = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tvar __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {\n\t\tif (k2 === void 0) k2 = k;\n\t\tvar desc = Object.getOwnPropertyDescriptor(m, k);\n\t\tif (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn m[k];\n\t\t\t}\n\t\t};\n\t\tObject.defineProperty(o, k2, desc);\n\t}) : (function(o, m, k, k2) {\n\t\tif (k2 === void 0) k2 = k;\n\t\to[k2] = m[k];\n\t}));\n\tvar __exportStar = exports && exports.__exportStar || function(m, exports$1) {\n\t\tfor (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);\n\t};\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\t__exportStar(require_dsse$1(), exports);\n\t__exportStar(require_entry(), exports);\n\t__exportStar(require_hashedrekord$1(), exports);\n\t__exportStar(require_verifier$1(), exports);\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/tlog/dsse.js\nvar require_dsse = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.DSSE_API_VERSION_V1 = void 0;\n\texports.verifyDSSETLogBody = verifyDSSETLogBody;\n\texports.verifyDSSETLogBodyV2 = verifyDSSETLogBodyV2;\n\tconst error_1 = require_error();\n\texports.DSSE_API_VERSION_V1 = \"0.0.1\";\n\tfunction verifyDSSETLogBody(tlogEntry, content) {\n\t\tswitch (tlogEntry.apiVersion) {\n\t\t\tcase exports.DSSE_API_VERSION_V1: return verifyDSSE001TLogBody(tlogEntry, content);\n\t\t\tdefault: throw new error_1.VerificationError({\n\t\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\t\tmessage: `unsupported dsse version: ${tlogEntry.apiVersion}`\n\t\t\t});\n\t\t}\n\t}\n\tfunction verifyDSSETLogBodyV2(tlogEntry, content) {\n\t\tconst spec = tlogEntry.spec?.spec;\n\t\tif (!spec) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: `missing dsse spec`\n\t\t});\n\t\tswitch (spec.$case) {\n\t\t\tcase \"dsseV002\": return verifyDSSE002TLogBody(spec.dsseV002, content);\n\t\t\tdefault: throw new error_1.VerificationError({\n\t\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\t\tmessage: `unsupported version: ${spec.$case}`\n\t\t\t});\n\t\t}\n\t}\n\tfunction verifyDSSE001TLogBody(tlogEntry, content) {\n\t\tif (tlogEntry.spec.signatures?.length !== 1) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: \"signature count mismatch\"\n\t\t});\n\t\tconst tlogSig = tlogEntry.spec.signatures[0].signature;\n\t\tif (!content.compareSignature(Buffer.from(tlogSig, \"base64\"))) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: \"tlog entry signature mismatch\"\n\t\t});\n\t\tconst tlogHash = tlogEntry.spec.payloadHash?.value || \"\";\n\t\tif (!content.compareDigest(Buffer.from(tlogHash, \"hex\"))) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: \"DSSE payload hash mismatch\"\n\t\t});\n\t}\n\tfunction verifyDSSE002TLogBody(spec, content) {\n\t\tif (spec.signatures?.length !== 1) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: \"signature count mismatch\"\n\t\t});\n\t\tconst tlogSig = spec.signatures[0].content;\n\t\tif (!content.compareSignature(tlogSig)) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: \"tlog entry signature mismatch\"\n\t\t});\n\t\tconst tlogHash = spec.payloadHash?.digest || Buffer.from(\"\");\n\t\tif (!content.compareDigest(tlogHash)) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: \"DSSE payload hash mismatch\"\n\t\t});\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/tlog/hashedrekord.js\nvar require_hashedrekord = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.HASHEDREKORD_API_VERSION_V1 = void 0;\n\texports.verifyHashedRekordTLogBody = verifyHashedRekordTLogBody;\n\texports.verifyHashedRekordTLogBodyV2 = verifyHashedRekordTLogBodyV2;\n\tconst error_1 = require_error();\n\texports.HASHEDREKORD_API_VERSION_V1 = \"0.0.1\";\n\tfunction verifyHashedRekordTLogBody(tlogEntry, content) {\n\t\tswitch (tlogEntry.apiVersion) {\n\t\t\tcase exports.HASHEDREKORD_API_VERSION_V1: return verifyHashedrekord001TLogBody(tlogEntry, content);\n\t\t\tdefault: throw new error_1.VerificationError({\n\t\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\t\tmessage: `unsupported hashedrekord version: ${tlogEntry.apiVersion}`\n\t\t\t});\n\t\t}\n\t}\n\tfunction verifyHashedRekordTLogBodyV2(tlogEntry, content) {\n\t\tconst spec = tlogEntry.spec?.spec;\n\t\tif (!spec) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: `missing dsse spec`\n\t\t});\n\t\tswitch (spec.$case) {\n\t\t\tcase \"hashedRekordV002\": return verifyHashedrekord002TLogBody(spec.hashedRekordV002, content);\n\t\t\tdefault: throw new error_1.VerificationError({\n\t\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\t\tmessage: `unsupported version: ${spec.$case}`\n\t\t\t});\n\t\t}\n\t}\n\tfunction verifyHashedrekord001TLogBody(tlogEntry, content) {\n\t\tconst tlogSig = tlogEntry.spec.signature.content || \"\";\n\t\tif (!content.compareSignature(Buffer.from(tlogSig, \"base64\"))) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: \"signature mismatch\"\n\t\t});\n\t\tconst tlogDigest = tlogEntry.spec.data.hash?.value || \"\";\n\t\tif (!content.compareSignedDigest(Buffer.from(tlogDigest, \"hex\"))) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: \"digest mismatch\"\n\t\t});\n\t}\n\tfunction verifyHashedrekord002TLogBody(spec, content) {\n\t\tconst tlogSig = spec.signature?.content || Buffer.from(\"\");\n\t\tif (!content.compareSignature(tlogSig)) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: \"signature mismatch\"\n\t\t});\n\t\tconst tlogHash = spec.data?.digest || Buffer.from(\"\");\n\t\tif (!content.compareSignedDigest(tlogHash)) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: \"digest mismatch\"\n\t\t});\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/tlog/intoto.js\nvar require_intoto = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.verifyIntotoTLogBody = verifyIntotoTLogBody;\n\tconst error_1 = require_error();\n\tfunction verifyIntotoTLogBody(tlogEntry, content) {\n\t\tswitch (tlogEntry.apiVersion) {\n\t\t\tcase \"0.0.2\": return verifyIntoto002TLogBody(tlogEntry, content);\n\t\t\tdefault: throw new error_1.VerificationError({\n\t\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\t\tmessage: `unsupported intoto version: ${tlogEntry.apiVersion}`\n\t\t\t});\n\t\t}\n\t}\n\tfunction verifyIntoto002TLogBody(tlogEntry, content) {\n\t\tif (tlogEntry.spec.content.envelope.signatures?.length !== 1) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: \"signature count mismatch\"\n\t\t});\n\t\tconst tlogSig = base64Decode(tlogEntry.spec.content.envelope.signatures[0].sig);\n\t\tif (!content.compareSignature(Buffer.from(tlogSig, \"base64\"))) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: \"tlog entry signature mismatch\"\n\t\t});\n\t\tconst tlogHash = tlogEntry.spec.content.payloadHash?.value || \"\";\n\t\tif (!content.compareDigest(Buffer.from(tlogHash, \"hex\"))) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: \"DSSE payload hash mismatch\"\n\t\t});\n\t}\n\tfunction base64Decode(str) {\n\t\treturn Buffer.from(str, \"base64\").toString(\"utf-8\");\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/tlog/checkpoint.js\nvar require_checkpoint = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.LogCheckpoint = void 0;\n\texports.verifyCheckpoint = verifyCheckpoint;\n\tconst core_1 = require_dist$1();\n\tconst error_1 = require_error();\n\tconst CHECKPOINT_SEPARATOR = \"\\n\\n\";\n\tconst SIGNATURE_REGEX = /\\u2014 (\\S+) (\\S+)\\n/g;\n\tfunction verifyCheckpoint(entry, tlogs) {\n\t\tconst inclusionProof = entry.inclusionProof;\n\t\tconst signedNote = SignedNote.fromString(inclusionProof.checkpoint.envelope);\n\t\tconst checkpoint = LogCheckpoint.fromString(signedNote.note);\n\t\tif (!verifySignedNote(signedNote, tlogs)) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_INCLUSION_PROOF_ERROR\",\n\t\t\tmessage: \"invalid checkpoint signature\"\n\t\t});\n\t\treturn checkpoint;\n\t}\n\tfunction verifySignedNote(signedNote, tlogs) {\n\t\tconst data = Buffer.from(signedNote.note, \"utf-8\");\n\t\treturn signedNote.signatures.some((signature) => {\n\t\t\tconst tlog = tlogs.find((tlog) => core_1.crypto.bufferEqual(tlog.logID.subarray(0, 4), signature.keyHint) && tlog.baseURL.match(signature.name));\n\t\t\tif (!tlog) return false;\n\t\t\treturn core_1.crypto.verify(data, tlog.publicKey, signature.signature);\n\t\t});\n\t}\n\tvar SignedNote = class SignedNote {\n\t\tnote;\n\t\tsignatures;\n\t\tconstructor(note, signatures) {\n\t\t\tthis.note = note;\n\t\t\tthis.signatures = signatures;\n\t\t}\n\t\tstatic fromString(envelope) {\n\t\t\tif (!envelope.includes(CHECKPOINT_SEPARATOR)) throw new error_1.VerificationError({\n\t\t\t\tcode: \"TLOG_INCLUSION_PROOF_ERROR\",\n\t\t\t\tmessage: \"missing checkpoint separator\"\n\t\t\t});\n\t\t\tconst split = envelope.indexOf(CHECKPOINT_SEPARATOR);\n\t\t\tconst header = envelope.slice(0, split + 1);\n\t\t\tconst matches = envelope.slice(split + 2).matchAll(SIGNATURE_REGEX);\n\t\t\tconst signatures = Array.from(matches, (match) => {\n\t\t\t\tconst [, name, signature] = match;\n\t\t\t\tconst sigBytes = Buffer.from(signature, \"base64\");\n\t\t\t\tif (sigBytes.length < 5) throw new error_1.VerificationError({\n\t\t\t\t\tcode: \"TLOG_INCLUSION_PROOF_ERROR\",\n\t\t\t\t\tmessage: \"malformed checkpoint signature\"\n\t\t\t\t});\n\t\t\t\treturn {\n\t\t\t\t\tname,\n\t\t\t\t\tkeyHint: sigBytes.subarray(0, 4),\n\t\t\t\t\tsignature: sigBytes.subarray(4)\n\t\t\t\t};\n\t\t\t});\n\t\t\tif (signatures.length === 0) throw new error_1.VerificationError({\n\t\t\t\tcode: \"TLOG_INCLUSION_PROOF_ERROR\",\n\t\t\t\tmessage: \"no signatures found in checkpoint\"\n\t\t\t});\n\t\t\treturn new SignedNote(header, signatures);\n\t\t}\n\t};\n\tvar LogCheckpoint = class LogCheckpoint {\n\t\torigin;\n\t\tlogSize;\n\t\tlogHash;\n\t\trest;\n\t\tconstructor(origin, logSize, logHash, rest) {\n\t\t\tthis.origin = origin;\n\t\t\tthis.logSize = logSize;\n\t\t\tthis.logHash = logHash;\n\t\t\tthis.rest = rest;\n\t\t}\n\t\tstatic fromString(note) {\n\t\t\tconst lines = note.trimEnd().split(\"\\n\");\n\t\t\tif (lines.length < 3) throw new error_1.VerificationError({\n\t\t\t\tcode: \"TLOG_INCLUSION_PROOF_ERROR\",\n\t\t\t\tmessage: \"too few lines in checkpoint header\"\n\t\t\t});\n\t\t\tconst origin = lines[0];\n\t\t\treturn new LogCheckpoint(origin, BigInt(lines[1]), Buffer.from(lines[2], \"base64\"), lines.slice(3));\n\t\t}\n\t};\n\texports.LogCheckpoint = LogCheckpoint;\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/tlog/merkle.js\nvar require_merkle = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.verifyMerkleInclusion = verifyMerkleInclusion;\n\tconst core_1 = require_dist$1();\n\tconst error_1 = require_error();\n\tconst RFC6962_LEAF_HASH_PREFIX = Buffer.from([0]);\n\tconst RFC6962_NODE_HASH_PREFIX = Buffer.from([1]);\n\tfunction verifyMerkleInclusion(entry, checkpoint) {\n\t\tconst inclusionProof = entry.inclusionProof;\n\t\tconst logIndex = BigInt(inclusionProof.logIndex);\n\t\tconst treeSize = BigInt(checkpoint.logSize);\n\t\tif (logIndex < 0n || logIndex >= treeSize) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_INCLUSION_PROOF_ERROR\",\n\t\t\tmessage: `invalid index: ${logIndex}`\n\t\t});\n\t\tconst { inner, border } = decompInclProof(logIndex, treeSize);\n\t\tif (inclusionProof.hashes.length !== inner + border) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_INCLUSION_PROOF_ERROR\",\n\t\t\tmessage: \"invalid hash count\"\n\t\t});\n\t\tconst innerHashes = inclusionProof.hashes.slice(0, inner);\n\t\tconst borderHashes = inclusionProof.hashes.slice(inner);\n\t\tconst calculatedHash = chainBorderRight(chainInner(hashLeaf(entry.canonicalizedBody), innerHashes, logIndex), borderHashes);\n\t\tif (!core_1.crypto.bufferEqual(calculatedHash, checkpoint.logHash)) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_INCLUSION_PROOF_ERROR\",\n\t\t\tmessage: \"calculated root hash does not match inclusion proof\"\n\t\t});\n\t}\n\tfunction decompInclProof(index, size) {\n\t\tconst inner = innerProofSize(index, size);\n\t\treturn {\n\t\t\tinner,\n\t\t\tborder: onesCount(index >> BigInt(inner))\n\t\t};\n\t}\n\tfunction chainInner(seed, hashes, index) {\n\t\treturn hashes.reduce((acc, h, i) => {\n\t\t\tif (index >> BigInt(i) & BigInt(1)) return hashChildren(h, acc);\n\t\t\telse return hashChildren(acc, h);\n\t\t}, seed);\n\t}\n\tfunction chainBorderRight(seed, hashes) {\n\t\treturn hashes.reduce((acc, h) => hashChildren(h, acc), seed);\n\t}\n\tfunction innerProofSize(index, size) {\n\t\treturn bitLength(index ^ size - BigInt(1));\n\t}\n\tfunction onesCount(num) {\n\t\treturn num.toString(2).split(\"1\").length - 1;\n\t}\n\tfunction bitLength(n) {\n\t\tif (n === 0n) return 0;\n\t\treturn n.toString(2).length;\n\t}\n\tfunction hashChildren(left, right) {\n\t\treturn core_1.crypto.digest(\"sha256\", RFC6962_NODE_HASH_PREFIX, left, right);\n\t}\n\tfunction hashLeaf(leaf) {\n\t\treturn core_1.crypto.digest(\"sha256\", RFC6962_LEAF_HASH_PREFIX, leaf);\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/tlog/set.js\nvar require_set = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.verifyTLogSET = verifyTLogSET;\n\tconst core_1 = require_dist$1();\n\tconst error_1 = require_error();\n\tconst trust_1 = require_trust();\n\tfunction verifyTLogSET(entry, tlogs) {\n\t\tif (!(0, trust_1.filterTLogAuthorities)(tlogs, {\n\t\t\tlogID: entry.logId.keyId,\n\t\t\ttargetDate: /* @__PURE__ */ new Date(Number(entry.integratedTime) * 1e3)\n\t\t}).some((tlog) => {\n\t\t\tconst payload = toVerificationPayload(entry);\n\t\t\tconst data = Buffer.from(core_1.json.canonicalize(payload), \"utf8\");\n\t\t\tconst signature = entry.inclusionPromise.signedEntryTimestamp;\n\t\t\treturn core_1.crypto.verify(data, tlog.publicKey, signature);\n\t\t})) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_INCLUSION_PROMISE_ERROR\",\n\t\t\tmessage: \"inclusion promise could not be verified\"\n\t\t});\n\t}\n\tfunction toVerificationPayload(entry) {\n\t\tconst { integratedTime, logIndex, logId, canonicalizedBody } = entry;\n\t\treturn {\n\t\t\tbody: canonicalizedBody.toString(\"base64\"),\n\t\t\tintegratedTime: Number(integratedTime),\n\t\t\tlogIndex: Number(logIndex),\n\t\t\tlogID: logId.keyId.toString(\"hex\")\n\t\t};\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/tlog/index.js\nvar require_tlog = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.verifyTLogBody = verifyTLogBody;\n\texports.verifyTLogInclusion = verifyTLogInclusion;\n\tconst v2_1 = require_v2();\n\tconst error_1 = require_error();\n\tconst dsse_1 = require_dsse();\n\tconst hashedrekord_1 = require_hashedrekord();\n\tconst intoto_1 = require_intoto();\n\tconst checkpoint_1 = require_checkpoint();\n\tconst merkle_1 = require_merkle();\n\tconst set_1 = require_set();\n\tfunction verifyTLogBody(entry, sigContent) {\n\t\tconst { kind, version } = entry.kindVersion;\n\t\tconst body = JSON.parse(entry.canonicalizedBody.toString(\"utf8\"));\n\t\tif (kind !== body.kind || version !== body.apiVersion) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\tmessage: `kind/version mismatch - expected: ${kind}/${version}, received: ${body.kind}/${body.apiVersion}`\n\t\t});\n\t\tswitch (kind) {\n\t\t\tcase \"dsse\": if (version == dsse_1.DSSE_API_VERSION_V1) return (0, dsse_1.verifyDSSETLogBody)(body, sigContent);\n\t\t\telse {\n\t\t\t\tconst entryRekorV2 = v2_1.Entry.fromJSON(body);\n\t\t\t\treturn (0, dsse_1.verifyDSSETLogBodyV2)(entryRekorV2, sigContent);\n\t\t\t}\n\t\t\tcase \"intoto\": return (0, intoto_1.verifyIntotoTLogBody)(body, sigContent);\n\t\t\tcase \"hashedrekord\": if (version == hashedrekord_1.HASHEDREKORD_API_VERSION_V1) return (0, hashedrekord_1.verifyHashedRekordTLogBody)(body, sigContent);\n\t\t\telse {\n\t\t\t\tconst entryRekorV2 = v2_1.Entry.fromJSON(body);\n\t\t\t\treturn (0, hashedrekord_1.verifyHashedRekordTLogBodyV2)(entryRekorV2, sigContent);\n\t\t\t}\n\t\t\tdefault: throw new error_1.VerificationError({\n\t\t\t\tcode: \"TLOG_BODY_ERROR\",\n\t\t\t\tmessage: `unsupported kind: ${kind}`\n\t\t\t});\n\t\t}\n\t}\n\tfunction verifyTLogInclusion(entry, tlogAuthorities) {\n\t\tlet inclusionVerified = false;\n\t\tif (isTLogEntryWithInclusionPromise(entry)) {\n\t\t\t(0, set_1.verifyTLogSET)(entry, tlogAuthorities);\n\t\t\tinclusionVerified = true;\n\t\t}\n\t\tif (isTLogEntryWithInclusionProof(entry)) {\n\t\t\tconst checkpoint = (0, checkpoint_1.verifyCheckpoint)(entry, tlogAuthorities);\n\t\t\t(0, merkle_1.verifyMerkleInclusion)(entry, checkpoint);\n\t\t\tinclusionVerified = true;\n\t\t}\n\t\tif (!inclusionVerified) throw new error_1.VerificationError({\n\t\t\tcode: \"TLOG_MISSING_INCLUSION_ERROR\",\n\t\t\tmessage: \"inclusion could not be verified\"\n\t\t});\n\t}\n\tfunction isTLogEntryWithInclusionPromise(entry) {\n\t\treturn entry.inclusionPromise !== void 0;\n\t}\n\tfunction isTLogEntryWithInclusionProof(entry) {\n\t\treturn entry.inclusionProof !== void 0;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/verifier.js\nvar require_verifier = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.Verifier = void 0;\n\tconst util_1 = __require(\"util\");\n\tconst error_1 = require_error();\n\tconst key_1 = require_key();\n\tconst policy_1 = require_policy();\n\tconst timestamp_1 = require_timestamp();\n\tconst tlog_1 = require_tlog();\n\tvar Verifier = class {\n\t\ttrustMaterial;\n\t\toptions;\n\t\tconstructor(trustMaterial, options = {}) {\n\t\t\tthis.trustMaterial = trustMaterial;\n\t\t\tthis.options = {\n\t\t\t\tctlogThreshold: options.ctlogThreshold ?? 1,\n\t\t\t\ttlogThreshold: options.tlogThreshold ?? 1,\n\t\t\t\ttimestampThreshold: options.timestampThreshold ?? options.tsaThreshold ?? 1,\n\t\t\t\ttsaThreshold: 0\n\t\t\t};\n\t\t}\n\t\tverify(entity, policy) {\n\t\t\tconst timestamps = this.verifyTimestamps(entity);\n\t\t\tconst signer = this.verifySigningKey(entity, timestamps);\n\t\t\tthis.verifyTLogs(entity);\n\t\t\tthis.verifySignature(entity, signer);\n\t\t\tif (policy) this.verifyPolicy(policy, signer.identity || {});\n\t\t\treturn signer;\n\t\t}\n\t\tverifyTimestamps(entity) {\n\t\t\tconst timestamps = [];\n\t\t\tfor (const timestamp of entity.timestamps) switch (timestamp.$case) {\n\t\t\t\tcase \"timestamp-authority\":\n\t\t\t\t\ttimestamps.push((0, timestamp_1.getTSATimestamp)(timestamp.timestamp, entity.signature.signature, this.trustMaterial.timestampAuthorities));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"transparency-log\": {\n\t\t\t\t\tconst result = (0, timestamp_1.getTLogTimestamp)(timestamp.tlogEntry);\n\t\t\t\t\tif (result) timestamps.push(result);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (containsDupes(timestamps)) throw new error_1.VerificationError({\n\t\t\t\tcode: \"TIMESTAMP_ERROR\",\n\t\t\t\tmessage: \"duplicate timestamp\"\n\t\t\t});\n\t\t\tif (timestamps.length < this.options.timestampThreshold) throw new error_1.VerificationError({\n\t\t\t\tcode: \"TIMESTAMP_ERROR\",\n\t\t\t\tmessage: `expected ${this.options.timestampThreshold} timestamps, got ${timestamps.length}`\n\t\t\t});\n\t\t\treturn timestamps.map((t) => t.timestamp);\n\t\t}\n\t\tverifySigningKey({ key }, timestamps) {\n\t\t\tswitch (key.$case) {\n\t\t\t\tcase \"public-key\": return (0, key_1.verifyPublicKey)(key.hint, timestamps, this.trustMaterial);\n\t\t\t\tcase \"certificate\": {\n\t\t\t\t\tconst result = (0, key_1.verifyCertificate)(key.certificate, timestamps, this.trustMaterial);\n\t\t\t\t\t/* istanbul ignore next - no fixture */\n\t\t\t\t\tif (containsDupes(result.scts)) throw new error_1.VerificationError({\n\t\t\t\t\t\tcode: \"CERTIFICATE_ERROR\",\n\t\t\t\t\t\tmessage: \"duplicate SCT\"\n\t\t\t\t\t});\n\t\t\t\t\tif (result.scts.length < this.options.ctlogThreshold) throw new error_1.VerificationError({\n\t\t\t\t\t\tcode: \"CERTIFICATE_ERROR\",\n\t\t\t\t\t\tmessage: `expected ${this.options.ctlogThreshold} SCTs, got ${result.scts.length}`\n\t\t\t\t\t});\n\t\t\t\t\treturn result.signer;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tverifyTLogs({ signature: content, tlogEntries }) {\n\t\t\tlet tlogCount = 0;\n\t\t\ttlogEntries.forEach((entry) => {\n\t\t\t\ttlogCount++;\n\t\t\t\t(0, tlog_1.verifyTLogInclusion)(entry, this.trustMaterial.tlogs);\n\t\t\t\t(0, tlog_1.verifyTLogBody)(entry, content);\n\t\t\t});\n\t\t\tif (tlogCount < this.options.tlogThreshold) throw new error_1.VerificationError({\n\t\t\t\tcode: \"TLOG_ERROR\",\n\t\t\t\tmessage: `expected ${this.options.tlogThreshold} tlog entries, got ${tlogCount}`\n\t\t\t});\n\t\t}\n\t\tverifySignature(entity, signer) {\n\t\t\tif (!entity.signature.verifySignature(signer.key)) throw new error_1.VerificationError({\n\t\t\t\tcode: \"SIGNATURE_ERROR\",\n\t\t\t\tmessage: \"signature verification failed\"\n\t\t\t});\n\t\t}\n\t\tverifyPolicy(policy, identity) {\n\t\t\t/* istanbul ignore else */\n\t\t\tif (policy.subjectAlternativeName) (0, policy_1.verifySubjectAlternativeName)(policy.subjectAlternativeName, identity.subjectAlternativeName);\n\t\t\t/* istanbul ignore else */\n\t\t\tif (policy.extensions) (0, policy_1.verifyExtensions)(policy.extensions, identity.extensions);\n\t\t\t/* istanbul ignore if */\n\t\t\tif (policy.oids) (0, policy_1.verifyOIDs)(policy.oids, identity.oids);\n\t\t}\n\t};\n\texports.Verifier = Verifier;\n\tfunction containsDupes(arr) {\n\t\tfor (let i = 0; i < arr.length; i++) for (let j = i + 1; j < arr.length; j++) if ((0, util_1.isDeepStrictEqual)(arr[i], arr[j])) return true;\n\t\treturn false;\n\t}\n}));\n\n//#endregion\n//#region ../../node_modules/.pnpm/@sigstore+verify@4.1.0/node_modules/@sigstore/verify/dist/index.js\nvar require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\n\texports.Verifier = exports.toTrustMaterial = exports.VerificationError = exports.PolicyError = exports.toSignedEntity = void 0;\n\t/* istanbul ignore file */\n\tvar bundle_1 = require_bundle();\n\tObject.defineProperty(exports, \"toSignedEntity\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn bundle_1.toSignedEntity;\n\t\t}\n\t});\n\tvar error_1 = require_error();\n\tObject.defineProperty(exports, \"PolicyError\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn error_1.PolicyError;\n\t\t}\n\t});\n\tObject.defineProperty(exports, \"VerificationError\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn error_1.VerificationError;\n\t\t}\n\t});\n\tvar trust_1 = require_trust();\n\tObject.defineProperty(exports, \"toTrustMaterial\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn trust_1.toTrustMaterial;\n\t\t}\n\t});\n\tvar verifier_1 = require_verifier();\n\tObject.defineProperty(exports, \"Verifier\", {\n\t\tenumerable: true,\n\t\tget: function() {\n\t\t\treturn verifier_1.Verifier;\n\t\t}\n\t});\n}));\n\n//#endregion\n//#region src/repository.ts\nvar import_dist$2 = require_dist();\nvar import_dist = require_dist$2();\nvar import_dist$1 = require_dist$3();\nconst TRAILING_SLASHES_RE = /\\/+$/;\n/** Canonicalize a signed source repository URL, or return null when it is unsafe. */\nfunction canonicalizeRepositoryUrl(value) {\n\ttry {\n\t\tconst url = new URL(value);\n\t\tif (url.protocol !== \"https:\" || url.username || url.password || url.search || url.hash || url.port) return null;\n\t\tlet path = url.pathname;\n\t\tif (path !== \"/\") path = path.replace(TRAILING_SLASHES_RE, \"\") || \"/\";\n\t\treturn `https://${url.hostname.toLowerCase()}${path}`;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n//#endregion\n//#region src/trust-roots/sigstore-public-good-v1.json\nvar sigstore_public_good_v1_default = {\n\tmediaType: \"application/vnd.dev.sigstore.trustedroot+json;version=0.1\",\n\ttlogs: [{\n\t\t\"baseUrl\": \"https://rekor.sigstore.dev\",\n\t\t\"hashAlgorithm\": \"SHA2_256\",\n\t\t\"publicKey\": {\n\t\t\t\"rawBytes\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE2G2Y+2tabdTV5BcGiBIx0a9fAFwrkBbmLSGtks4L3qX6yYY0zufBnhC8Ur/iy55GhWP/9A/bY2LhC30M9+RYtw==\",\n\t\t\t\"keyDetails\": \"PKIX_ECDSA_P256_SHA_256\",\n\t\t\t\"validFor\": { \"start\": \"2021-01-12T11:53:27Z\" }\n\t\t},\n\t\t\"logId\": { \"keyId\": \"wNI9atQGlz+VWfO6LRygH4QUfY/8W4RFwiT5i5WRgB0=\" }\n\t}, {\n\t\t\"baseUrl\": \"https://log2025-1.rekor.sigstore.dev\",\n\t\t\"hashAlgorithm\": \"SHA2_256\",\n\t\t\"publicKey\": {\n\t\t\t\"rawBytes\": \"MCowBQYDK2VwAyEAt8rlp1knGwjfbcXAYPYAkn0XiLz1x8O4t0YkEhie244=\",\n\t\t\t\"keyDetails\": \"PKIX_ED25519\",\n\t\t\t\"validFor\": { \"start\": \"2025-09-23T00:00:00Z\" }\n\t\t},\n\t\t\"logId\": { \"keyId\": \"zxGZFVvd0FEmjR8WrFwMdcAJ9vtaY/QXf44Y1wUeP6A=\" }\n\t}],\n\tcertificateAuthorities: [{\n\t\t\"subject\": {\n\t\t\t\"organization\": \"sigstore.dev\",\n\t\t\t\"commonName\": \"sigstore\"\n\t\t},\n\t\t\"uri\": \"https://fulcio.sigstore.dev\",\n\t\t\"certChain\": { \"certificates\": [{ \"rawBytes\": \"MIIB+DCCAX6gAwIBAgITNVkDZoCiofPDsy7dfm6geLbuhzAKBggqhkjOPQQDAzAqMRUwEwYDVQQKEwxzaWdzdG9yZS5kZXYxETAPBgNVBAMTCHNpZ3N0b3JlMB4XDTIxMDMwNzAzMjAyOVoXDTMxMDIyMzAzMjAyOVowKjEVMBMGA1UEChMMc2lnc3RvcmUuZGV2MREwDwYDVQQDEwhzaWdzdG9yZTB2MBAGByqGSM49AgEGBSuBBAAiA2IABLSyA7Ii5k+pNO8ZEWY0ylemWDowOkNa3kL+GZE5Z5GWehL9/A9bRNA3RbrsZ5i0JcastaRL7Sp5fp/jD5dxqc/UdTVnlvS16an+2Yfswe/QuLolRUCrcOE2+2iA5+tzd6NmMGQwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQEwHQYDVR0OBBYEFMjFHQBBmiQpMlEk6w2uSu1KBtPsMB8GA1UdIwQYMBaAFMjFHQBBmiQpMlEk6w2uSu1KBtPsMAoGCCqGSM49BAMDA2gAMGUCMH8liWJfMui6vXXBhjDgY4MwslmN/TJxVe/83WrFomwmNf056y1X48F9c4m3a3ozXAIxAKjRay5/aj/jsKKGIkmQatjI8uupHr/+CxFvaJWmpYqNkLDGRU+9orzh5hI2RrcuaQ==\" }] },\n\t\t\"validFor\": {\n\t\t\t\"start\": \"2021-03-07T03:20:29Z\",\n\t\t\t\"end\": \"2022-12-31T23:59:59.999Z\"\n\t\t}\n\t}, {\n\t\t\"subject\": {\n\t\t\t\"organization\": \"sigstore.dev\",\n\t\t\t\"commonName\": \"sigstore\"\n\t\t},\n\t\t\"uri\": \"https://fulcio.s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/OlnpgangaBclYpsYBr5i+4ynB07ceb3LP0OIOZdxexX69c5iVuyJRQ+Hz05yi+UF3uBWAlHpiS5sh0+H2GHE7SXrk1EC5m1Tr19L9gg92jYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRYwB5fkUWlZql6zJChkyLQKsXF+jAfBgNVHSMEGDAWgBRYwB5fkUWlZql6zJChkyLQKsXF+jAKBggqhkjOPQQDAwNpADBmAjEAj1nHeXZp+13NWBNa+EDsDP8G1WWg1tCMWP/WHPqpaVo0jhsweNFZgSs0eE7wYI4qAjEA2WB9ot98sIkoF3vZYdd3/VtWB5b9TNMea7Ix/stJ5TfcLLeABLE4BNJOsQ4vnBHJ\" }] },\n\t\t\"validFor\": { \"start\": \"2022-04-13T20:06:15Z\" }\n\t}],\n\tctlogs: [{\n\t\t\"baseUrl\": \"https://ctfe.sigstore.dev/test\",\n\t\t\"hashAlgorithm\": \"SHA2_256\",\n\t\t\"publicKey\": {\n\t\t\t\"rawBytes\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEbfwR+RJudXscgRBRpKX1XFDy3PyudDxz/SfnRi1fT8ekpfBd2O1uoz7jr3Z8nKzxA69EUQ+eFCFI3zeubPWU7w==\",\n\t\t\t\"keyDetails\": \"PKIX_ECDSA_P256_SHA_256\",\n\t\t\t\"validFor\": {\n\t\t\t\t\"start\": \"2021-03-14T00:00:00Z\",\n\t\t\t\t\"end\": \"2022-10-31T23:59:59.999Z\"\n\t\t\t}\n\t\t},\n\t\t\"logId\": { \"keyId\": \"CGCS8ChS/2hF0dFrJ4ScRWcYrBY9wzjSbea8IgY2b3I=\" }\n\t}, {\n\t\t\"baseUrl\": \"https://ctfe.sigstore.dev/2022\",\n\t\t\"hashAlgorithm\": \"SHA2_256\",\n\t\t\"publicKey\": {\n\t\t\t\"rawBytes\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEiPSlFi0CmFTfEjCUqF9HuCEcYXNKAaYalIJmBZ8yyezPjTqhxrKBpMnaocVtLJBI1eM3uXnQzQGAJdJ4gs9Fyw==\",\n\t\t\t\"keyDetails\": \"PKIX_ECDSA_P256_SHA_256\",\n\t\t\t\"validFor\": { \"start\": \"2022-10-20T00:00:00Z\" }\n\t\t},\n\t\t\"logId\": { \"keyId\": \"3T0wasbHETJjGR4cmWc3AqJKXrjePK3/h4pygC8p7o4=\" }\n\t}],\n\ttimestampAuthorities: [{\n\t\t\"subject\": {\n\t\t\t\"organization\": \"sigstore.dev\",\n\t\t\t\"commonName\": \"sigstore-tsa-selfsigned\"\n\t\t},\n\t\t\"uri\": \"https://timestamp.sigstore.dev/api/v1/timestamp\",\n\t\t\"certChain\": { \"certificates\": [{ \"rawBytes\": \"MIICEDCCAZagAwIBAgIUOhNULwyQYe68wUMvy4qOiyojiwwwCgYIKoZIzj0EAwMwOTEVMBMGA1UEChMMc2lnc3RvcmUuZGV2MSAwHgYDVQQDExdzaWdzdG9yZS10c2Etc2VsZnNpZ25lZDAeFw0yNTA0MDgwNjU5NDNaFw0zNTA0MDYwNjU5NDNaMC4xFTATBgNVBAoTDHNpZ3N0b3JlLmRldjEVMBMGA1UEAxMMc2lnc3RvcmUtdHNhMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE4ra2Z8hKNig2T9kFjCAToGG30jky+WQv3BzL+mKvh1SKNR/UwuwsfNCg4sryoYAd8E6isovVA3M4aoNdm9QDi50Z8nTEyvqgfDPtTIwXItfiW/AFf1V7uwkbkAoj0xxco2owaDAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0OBBYEFIn9eUOHz9BlRsMCRscsc1t9tOsDMB8GA1UdIwQYMBaAFJjsAe9/u1H/1JUeb4qImFMHic6/MBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMIMAoGCCqGSM49BAMDA2gAMGUCMDtpsV/6KaO0qyF/UMsX2aSUXKQFdoGTptQGc0ftq1csulHPGG6dsmyMNd3JB+G3EQIxAOajvBcjpJmKb4Nv+2Taoj8Uc5+b6ih6FXCCKraSqupe07zqswMcXJTe1cExvHvvlw==\" }, { \"rawBytes\": \"MIIB9zCCAXygAwIBAgIUV7f0GLDOoEzIh8LXSW80OJiUp14wCgYIKoZIzj0EAwMwOTEVMBMGA1UEChMMc2lnc3RvcmUuZGV2MSAwHgYDVQQDExdzaWdzdG9yZS10c2Etc2VsZnNpZ25lZDAeFw0yNTA0MDgwNjU5NDNaFw0zNTA0MDYwNjU5NDNaMDkxFTATBgNVBAoTDHNpZ3N0b3JlLmRldjEgMB4GA1UEAxMXc2lnc3RvcmUtdHNhLXNlbGZzaWduZWQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQUQNtfRT/ou3YATa6wB/kKTe70cfJwyRIBovMnt8RcJph/COE82uyS6FmppLLL1VBPGcPfpQPYJNXzWwi8icwhKQ6W/Qe2h3oebBb2FHpwNJDqo+TMaC/tdfkv/ElJB72jRTBDMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEAMB0GA1UdDgQWBBSY7AHvf7tR/9SVHm+KiJhTB4nOvzAKBggqhkjOPQQDAwNpADBmAjEAwGEGrfGZR1cen1R8/DTVMI943LssZmJRtDp/i7SfGHmGRP6gRbuj9vOK3b67Z0QQAjEAuT2H673LQEaHTcyQSZrkp4mX7WwkmF+sVbkYY5mXN+RMH13KUEHHOqASaemYWK/E\" }] },\n\t\t\"validFor\": { \"start\": \"2025-07-04T00:00:00Z\" }\n\t}]\n};\n\n//#endregion\n//#region src/provenance.ts\nconst STATEMENT_TYPE = \"https://in-toto.io/Statement/v1\";\nconst PREDICATE_TYPE = \"https://slsa.dev/provenance/v1\";\nconst GITHUB_WORKFLOW_BUILD_TYPE = \"https://slsa-framework.github.io/github-actions-buildtypes/workflow/v1\";\nconst GITHUB_OIDC_ISSUER = \"https://token.actions.githubusercontent.com\";\nconst DSSE_PAYLOAD_TYPE = \"application/vnd.in-toto+json\";\nconst FULCIO_OID_PREFIX = \"1.3.6.1.4.1.57264.1.\";\nconst GIT_COMMIT_RE = /^[0-9a-f]{40}$/;\nconst GITHUB_WORKFLOW_PATH_RE = /^\\.github\\/workflows\\/.+\\.ya?ml$/;\nconst DECIMAL_RE = /^[1-9][0-9]*$/;\nconst BASE64_RE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;\nconst HEX_RE = /^[0-9a-f]+$/;\nconst REGEX_META_RE = /[\\\\^$.*+?()[\\]{}|]/g;\nconst SUPPORTED_SUBJECT_DIGESTS = new Map([\n\t[\"sha256\", 32],\n\t[\"sha384\", 48],\n\t[\"sha512\", 64]\n]);\nconst decoder = new TextDecoder(\"utf-8\", {\n\tfatal: true,\n\tignoreBOM: false\n});\nconst verifier = new import_dist$2.Verifier((0, import_dist$2.toTrustMaterial)(import_dist$1.TrustedRoot.fromJSON(sigstore_public_good_v1_default)), {\n\ttlogThreshold: 1,\n\tctlogThreshold: 1,\n\ttimestampThreshold: 1\n});\nvar GitHubProvenanceVerifier = class {\n\tasync verify(input) {\n\t\ttry {\n\t\t\tconst snapshot = snapshotInput(input);\n\t\t\tif (!(await verifyMultihash(snapshot.document, snapshot.reference.checksum)).success) return unverifiable();\n\t\t\tconst serializedBundle = parseJson(snapshot.document);\n\t\t\tconst expected = validateStatement(parseStatement(serializedBundle), snapshot);\n\t\t\tconst bundle = (0, import_dist.bundleFromJSON)(serializedBundle);\n\t\t\tvalidateSignerIdentity(verifier.verify((0, import_dist$2.toSignedEntity)(bundle), {\n\t\t\t\tsubjectAlternativeName: exactRegexPattern(snapshot.reference.builderId),\n\t\t\t\textensions: { issuer: GITHUB_OIDC_ISSUER }\n\t\t\t}).identity, expected);\n\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tvalue: {\n\t\t\t\t\tpredicateType: PREDICATE_TYPE,\n\t\t\t\t\tartifactDigest: expected.artifactDigest,\n\t\t\t\t\tsourceRepository: expected.repository,\n\t\t\t\t\tbuilderId: expected.builderId,\n\t\t\t\t\trepositoryId: expected.repositoryId,\n\t\t\t\t\tworkflowRef: expected.workflowRef,\n\t\t\t\t\tcommitSha: expected.commitSha,\n\t\t\t\t\tinvocationId: expected.invocationId\n\t\t\t\t}\n\t\t\t};\n\t\t} catch {\n\t\t\treturn unverifiable();\n\t\t}\n\t}\n};\nfunction snapshotInput(input) {\n\treturn {\n\t\tdocument: new Uint8Array(input.document),\n\t\treference: {\n\t\t\tbuilderId: input.reference.builderId,\n\t\t\tchecksum: input.reference.checksum,\n\t\t\tpredicateType: input.reference.predicateType,\n\t\t\tsourceRepository: input.reference.sourceRepository,\n\t\t\turl: input.reference.url\n\t\t},\n\t\tartifactDigest: new Uint8Array(input.artifactDigest),\n\t\tartifactDigests: input.artifactDigests?.map((digest) => new Uint8Array(digest)),\n\t\tprofileRepository: input.profileRepository\n\t};\n}\nfunction exactRegexPattern(value) {\n\treturn `^${value.replace(REGEX_META_RE, \"\\\\$&\")}$`;\n}\nfunction parseJson(document) {\n\treturn JSON.parse(decoder.decode(document));\n}\nfunction parseStatement(serializedBundle) {\n\tconst bundle = requireObject(serializedBundle);\n\tconst mediaType = requireString(bundle.mediaType);\n\tif (mediaType !== import_dist.BUNDLE_V03_MEDIA_TYPE && mediaType !== import_dist.BUNDLE_V03_LEGACY_MEDIA_TYPE) throw new Error(\"Unsupported Sigstore bundle format\");\n\tif (\"messageSignature\" in bundle || !(\"dsseEnvelope\" in bundle)) throw new Error(\"Only DSSE Sigstore bundles are supported\");\n\tconst envelope = requireObject(bundle.dsseEnvelope);\n\tif (requireString(envelope.payloadType) !== DSSE_PAYLOAD_TYPE) throw new Error(\"Unsupported DSSE payload type\");\n\tconst statement = requireObject(JSON.parse(decoder.decode(decodeBase64(requireString(envelope.payload)))));\n\tconst statementType = requireString(statement._type);\n\tconst predicateType = requireString(statement.predicateType);\n\tif (statementType !== STATEMENT_TYPE || predicateType !== PREDICATE_TYPE || !Array.isArray(statement.subject)) throw new Error(\"Unsupported provenance statement\");\n\treturn {\n\t\t_type: statementType,\n\t\tsubject: statement.subject,\n\t\tpredicateType,\n\t\tpredicate: requireObject(statement.predicate)\n\t};\n}\nfunction validateStatement(statement, input) {\n\tif (input.reference.predicateType !== PREDICATE_TYPE) throw new Error(\"Provenance predicate reference mismatch\");\n\tconst artifactDigest = validateArtifactSubject(statement.subject, [input.artifactDigest, ...input.artifactDigests ?? []]);\n\tconst profileRepository = requireRepository(input.profileRepository);\n\tconst referenceRepository = requireRepository(input.reference.sourceRepository);\n\tconst buildDefinition = requireObject(statement.predicate.buildDefinition);\n\tif (requireString(buildDefinition.buildType) !== GITHUB_WORKFLOW_BUILD_TYPE) throw new Error(\"Unsupported SLSA build type\");\n\tconst workflow = requireObject(requireObject(buildDefinition.externalParameters).workflow);\n\tconst attestedRepository = requireRepository(requireString(workflow.repository));\n\tif (attestedRepository !== referenceRepository || referenceRepository !== profileRepository) throw new Error(\"Repository identity mismatch\");\n\tconst workflowPath = requireString(workflow.path);\n\tconst workflowRef = requireString(workflow.ref);\n\tif (!GITHUB_WORKFLOW_PATH_RE.test(workflowPath)) throw new Error(\"Unsupported GitHub workflow path\");\n\tif (!workflowRef.startsWith(\"refs/\")) throw new Error(\"Invalid GitHub workflow ref\");\n\tconst builderId = `${attestedRepository}/${workflowPath}@${workflowRef}`;\n\tif (builderId !== input.reference.builderId) throw new Error(\"Workflow identity mismatch\");\n\tconst repositoryId = requireDecimalString(requireObject(requireObject(buildDefinition.internalParameters).github).repository_id);\n\tconst runDetails = requireObject(statement.predicate.runDetails);\n\tconst invocationId = requireHttpsUrl(requireString(requireObject(runDetails.metadata).invocationId));\n\tif (requireString(requireObject(runDetails.builder).id) !== \"https://github.com/actions/runner/github-hosted\") throw new Error(\"Unsupported GitHub Actions runner class\");\n\tconst dependencies = buildDefinition.resolvedDependencies;\n\tif (!Array.isArray(dependencies)) throw new Error(\"Missing resolved dependency\");\n\tconst expectedUri = `git+${attestedRepository}@${workflowRef}`;\n\tconst matching = dependencies.filter((dependency) => requireString(requireObject(dependency).uri) === expectedUri);\n\tif (matching.length !== 1) throw new Error(\"Ambiguous resolved dependency\");\n\tconst commitSha = requireString(requireObject(requireObject(matching[0]).digest).gitCommit);\n\tif (!GIT_COMMIT_RE.test(commitSha)) throw new Error(\"Invalid Git commit digest\");\n\treturn {\n\t\tartifactDigest,\n\t\trepository: attestedRepository,\n\t\tbuilderId,\n\t\tworkflowRef,\n\t\tcommitSha,\n\t\trepositoryId,\n\t\tinvocationId\n\t};\n}\nfunction validateArtifactSubject(subjects, artifactDigests) {\n\tfor (const value of subjects) {\n\t\tconst digest = requireObject(requireObject(value).digest);\n\t\tfor (const [algorithm, expectedLength] of SUPPORTED_SUBJECT_DIGESTS) {\n\t\t\tif (!(algorithm in digest)) continue;\n\t\t\tconst bytes = decodeHex(requireString(digest[algorithm]));\n\t\t\tif (bytes.byteLength !== expectedLength) throw new Error(\"Invalid subject digest length\");\n\t\t\tconst matched = artifactDigests.find((candidate) => compareDigestBytes(bytes, candidate));\n\t\t\tif (matched) return new Uint8Array(matched);\n\t\t}\n\t}\n\tthrow new Error(\"Artifact digest mismatch\");\n}\nfunction validateSignerIdentity(identity, expected) {\n\tif (identity?.subjectAlternativeName !== expected.builderId || identity.extensions?.issuer !== GITHUB_OIDC_ISSUER) throw new Error(\"Certificate identity mismatch\");\n\tconst oids = identity.oids ?? [];\n\tconst issuer = readRequiredOid(oids, 8);\n\tconst buildSignerUri = readRequiredOid(oids, 9);\n\tconst buildSignerDigest = readRequiredOid(oids, 10);\n\tconst sourceRepository = requireRepository(readRequiredOid(oids, 12));\n\tconst sourceDigest = readRequiredOid(oids, 13);\n\tconst sourceRef = readRequiredOid(oids, 14);\n\tconst repositoryId = readRequiredOid(oids, 15);\n\tconst buildConfigUri = readRequiredOid(oids, 18);\n\tconst buildConfigDigest = readRequiredOid(oids, 19);\n\tconst invocationId = readRequiredOid(oids, 21);\n\tif (issuer !== GITHUB_OIDC_ISSUER || buildSignerUri !== expected.builderId || buildConfigUri !== expected.builderId || buildSignerDigest !== expected.commitSha || sourceDigest !== expected.commitSha || buildConfigDigest !== expected.commitSha || sourceRepository !== expected.repository || sourceRef !== expected.workflowRef || repositoryId !== expected.repositoryId || invocationId !== expected.invocationId) throw new Error(\"Certificate and predicate identity mismatch\");\n}\nfunction readRequiredOid(oids, suffix) {\n\tconst expectedOid = `${FULCIO_OID_PREFIX}${suffix}`;\n\tconst matches = oids.filter((pair) => pair.oid?.id.join(\".\") === expectedOid);\n\tif (matches.length !== 1) throw new Error(\"Missing or duplicate Fulcio identity OID\");\n\tconst value = matches[0]?.value;\n\tif (!value) throw new Error(\"Missing Fulcio identity OID value\");\n\treturn decodeDerUtf8String(value);\n}\nfunction decodeDerUtf8String(value) {\n\tif (value[0] !== 12 || value.byteLength < 2) throw new Error(\"Malformed DER UTF8String\");\n\tconst firstLength = value[1];\n\tif (firstLength === void 0) throw new Error(\"Malformed DER UTF8String\");\n\tlet offset = 2;\n\tlet length;\n\tif (firstLength < 128) length = firstLength;\n\telse {\n\t\tconst lengthBytes = firstLength & 127;\n\t\tif (lengthBytes === 0 || lengthBytes > 2 || value.byteLength < 2 + lengthBytes) throw new Error(\"Malformed DER UTF8String length\");\n\t\tlength = 0;\n\t\tfor (let index = 0; index < lengthBytes; index += 1) length = length * 256 + (value[offset + index] ?? 0);\n\t\tif (length < 128 || lengthBytes === 2 && length < 256) throw new Error(\"Non-canonical DER UTF8String length\");\n\t\toffset += lengthBytes;\n\t}\n\tif (length === 0 || offset + length !== value.byteLength) throw new Error(\"Malformed DER UTF8String value\");\n\treturn decoder.decode(value.subarray(offset));\n}\nfunction requireRepository(value) {\n\tconst repository = canonicalizeRepositoryUrl(value);\n\tif (!repository) throw new Error(\"Invalid repository URL\");\n\treturn repository;\n}\nfunction requireHttpsUrl(value) {\n\tconst url = new URL(value);\n\tif (url.protocol !== \"https:\" || url.username || url.password || url.hash || url.port || url.toString() !== value) throw new Error(\"Invalid HTTPS URL\");\n\treturn value;\n}\nfunction requireDecimalString(value) {\n\tconst result = requireString(value);\n\tif (!DECIMAL_RE.test(result)) throw new Error(\"Invalid decimal identity\");\n\treturn result;\n}\nfunction requireObject(value) {\n\tif (!isRecord$1(value)) throw new Error(\"Expected an object\");\n\treturn value;\n}\nfunction isRecord$1(value) {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction requireString(value) {\n\tif (typeof value !== \"string\" || value.length === 0) throw new Error(\"Expected a string\");\n\treturn value;\n}\nfunction decodeBase64(value) {\n\tif (!BASE64_RE.test(value)) throw new Error(\"Invalid base64\");\n\treturn Uint8Array.from(atob(value), (character) => character.charCodeAt(0));\n}\nfunction decodeHex(value) {\n\tif (!HEX_RE.test(value) || value.length % 2 !== 0) throw new Error(\"Invalid hexadecimal digest\");\n\treturn Uint8Array.from(value.match(/.{2}/g) ?? [], (byte) => Number.parseInt(byte, 16));\n}\nfunction unverifiable() {\n\treturn verificationError(\"PROVENANCE_UNVERIFIABLE\", \"The supplied provenance could not be verified.\");\n}\n\n//#endregion\n//#region src/records.ts\nconst DEFAULT_POLICY = {\n\trequireProvenance: false,\n\tconfirmation: \"escalation-only\",\n\tapprovers: []\n};\n/** Validate signed profile/release records without evaluating provenance evidence. */\nasync function inspectPackageReleaseRecords(input) {\n\tconst profile = await parseLexicon(PackageProfile.mainSchema, input.profile);\n\tif (!profile) return failed(\"PROFILE_LEXICON_INVALID\", \"The package profile is malformed.\");\n\tif (!isPluginSlug(input.package)) return failed(\"RELEASE_PACKAGE_MISMATCH\", \"The expected package slug is invalid.\");\n\tconst expectedProfileId = `at://${input.publisherDid}/${NSID.packageProfile}/${input.package}`;\n\tif (profile.id !== expectedProfileId || profile.slug !== void 0 && profile.slug !== input.package) return failed(\"PROFILE_ID_MISMATCH\", \"The profile does not match its authoritative record identity.\");\n\tif (profile.extensions === void 0) return failed(\"PROFILE_EXTENSION_MISSING\", \"The signed repository extension is absent.\");\n\tif (!isRecord(profile.extensions)) return failed(\"PROFILE_EXTENSION_INVALID\", \"The signed repository extension is malformed.\");\n\tconst rawProfileExtension = profile.extensions[NSID.packageProfileExtension];\n\tif (rawProfileExtension === void 0) return failed(\"PROFILE_EXTENSION_MISSING\", \"The signed repository extension is absent.\");\n\tconst profileExtension = await parseLexicon(PackageProfileExtension.mainSchema, rawProfileExtension);\n\tif (!profileExtension) return failed(\"PROFILE_EXTENSION_INVALID\", \"The signed repository extension is malformed.\");\n\tconst repository = canonicalizeRepositoryUrl(profileExtension.repository);\n\tif (!repository || repository !== profileExtension.repository) return failed(\"PROFILE_REPOSITORY_INVALID\", \"The signed repository anchor is not canonical HTTPS.\");\n\tconst policy = normalizePolicy(profileExtension.releasePolicy);\n\tif (!policy) return failed(\"PROFILE_POLICY_INVALID\", \"The signed release policy is invalid.\");\n\tconst release = await parseLexicon(PackageRelease.mainSchema, input.release);\n\tif (!release) return failed(\"RELEASE_LEXICON_INVALID\", \"The package release is malformed.\");\n\tif (release.package !== input.package) return failed(\"RELEASE_PACKAGE_MISMATCH\", \"The release package does not match the requested package.\");\n\tif (!isComparablePluginVersion(release.version)) return failed(\"RELEASE_VERSION_INVALID\", \"The release version is not canonical semver.\");\n\tif (release.version !== input.version) return failed(\"RELEASE_VERSION_MISMATCH\", \"The release version does not match the requested version.\");\n\tif (input.rkey !== `${input.package}:${release.version}`) return failed(\"RELEASE_RKEY_MISMATCH\", \"The release record key does not match package and version.\");\n\tconst artifactFailure = validateArtifacts(release);\n\tif (artifactFailure) return failed(artifactFailure.code, artifactFailure.message);\n\tconst authFailure = unsupportedAuth(release);\n\tif (authFailure) return failed(authFailure.code, authFailure.message, \"not-checked\", authFailure.details);\n\tif (release.extensions === void 0) return failed(\"RELEASE_EXTENSION_MISSING\", \"The EmDash release extension is absent.\");\n\tif (!isRecord(release.extensions)) return failed(\"RELEASE_EXTENSION_INVALID\", \"The EmDash release extension is malformed.\");\n\tconst rawReleaseExtension = release.extensions[NSID.packageReleaseExtension];\n\tif (rawReleaseExtension === void 0) return failed(\"RELEASE_EXTENSION_MISSING\", \"The EmDash release extension is absent.\");\n\tconst releaseExtension = await parseLexicon(PackageReleaseExtension.mainSchema, rawReleaseExtension);\n\tif (!releaseExtension) return failed(\"RELEASE_EXTENSION_INVALID\", \"The EmDash release extension is malformed.\");\n\treturn {\n\t\tsuccess: true,\n\t\tstatus: \"inspected\",\n\t\tcode: \"VERIFIED\",\n\t\treasons: [{\n\t\t\tcode: \"VERIFIED\",\n\t\t\tmessage: \"The signed package records are valid.\"\n\t\t}],\n\t\tprovenance: { status: \"not-checked\" },\n\t\tvalue: {\n\t\t\tprofile,\n\t\t\trelease,\n\t\t\tprofileExtension,\n\t\t\treleaseExtension,\n\t\t\trepository,\n\t\t\tpolicy,\n\t\t\tdeclaredAccess: canonicalizeDeclaredAccess(releaseExtension.declaredAccess)\n\t\t}\n\t};\n}\nasync function verifyPackageReleaseRecordsInternal(input, defaultVerifier) {\n\tconst inspection = await inspectPackageReleaseRecords(input);\n\tif (!inspection.success) return inspection;\n\tconst context = inspection.value;\n\tconst { policy, release, releaseExtension, repository } = context;\n\tif (!releaseExtension.provenance) {\n\t\tif (policy.requireProvenance) return failed(\"PROVENANCE_REQUIRED\", \"The signed policy requires provenance, but the release has none.\", \"absent-required\");\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tstatus: \"unattested\",\n\t\t\tcode: \"PROVENANCE_ABSENT_OPTIONAL\",\n\t\t\treasons: [{\n\t\t\t\tcode: \"PROVENANCE_ABSENT_OPTIONAL\",\n\t\t\t\tmessage: \"The release has no provenance and the signed policy permits it.\"\n\t\t\t}],\n\t\t\tprovenance: { status: \"absent-optional\" },\n\t\t\tvalue: context\n\t\t};\n\t}\n\tif (!input.provenance) return failed(\"PROVENANCE_UNVERIFIABLE\", \"The release supplies provenance, but no verification evidence was provided.\", \"failed\");\n\tconst artifactChecksum = decodeMultihash(release.artifacts.package.checksum);\n\tif (!artifactChecksum.success) return failed(artifactChecksum.error.code, artifactChecksum.error.message, \"failed\");\n\tif (!compareDigestBytes(input.provenance.artifactDigest, artifactChecksum.value.digest)) return failed(\"CHECKSUM_MISMATCH\", \"The artifact digest does not match the signed package checksum.\", \"failed\");\n\tconst verifier = input.provenance.verifier ?? defaultVerifier;\n\tif (!verifier) return failed(\"PROVENANCE_UNVERIFIABLE\", \"The supplied provenance verifier is unavailable.\", \"failed\");\n\tlet provenanceResult;\n\ttry {\n\t\tprovenanceResult = await verifier.verify({\n\t\t\tdocument: input.provenance.document,\n\t\t\treference: releaseExtension.provenance,\n\t\t\tartifactDigest: input.provenance.artifactDigest,\n\t\t\tartifactDigests: input.provenance.artifactDigests,\n\t\t\tprofileRepository: repository\n\t\t});\n\t} catch {\n\t\treturn failed(\"PROVENANCE_UNVERIFIABLE\", \"The supplied provenance could not be verified.\", \"failed\");\n\t}\n\tif (!provenanceResult.success) return failed(provenanceResult.error.code, provenanceResult.error.message, \"failed\");\n\treturn {\n\t\tsuccess: true,\n\t\tstatus: \"verified\",\n\t\tcode: \"VERIFIED\",\n\t\treasons: [{\n\t\t\tcode: \"VERIFIED\",\n\t\t\tmessage: \"The signed records and provenance are valid.\"\n\t\t}],\n\t\tprovenance: { status: \"verified\" },\n\t\tvalue: {\n\t\t\t...context,\n\t\t\tverifiedProvenance: provenanceResult.value\n\t\t}\n\t};\n}\nfunction verifyPackageReleaseRecordsWithDefaultVerifier(input, defaultVerifier) {\n\treturn verifyPackageReleaseRecordsInternal(input, defaultVerifier);\n}\nfunction normalizePolicy(value) {\n\tif (!value) return {\n\t\t...DEFAULT_POLICY,\n\t\tapprovers: []\n\t};\n\tconst confirmation = value.confirmation ?? DEFAULT_POLICY.confirmation;\n\tif (!isConfirmation(confirmation)) return null;\n\tconst approvers = value.approvers ?? [];\n\tif (new Set(approvers).size !== approvers.length) return null;\n\treturn {\n\t\trequireProvenance: value.requireProvenance ?? false,\n\t\tconfirmation,\n\t\tapprovers: [...approvers]\n\t};\n}\nfunction isConfirmation(value) {\n\treturn value === \"always\" || value === \"escalation-only\";\n}\nfunction isComparablePluginVersion(value) {\n\tif (!isPluginVersion(value)) return false;\n\tconst prereleaseSeparator = value.indexOf(\"-\");\n\treturn value.slice(0, prereleaseSeparator === -1 ? void 0 : prereleaseSeparator).split(\".\").every((component) => Number.isSafeInteger(Number(component)));\n}\nfunction failed(code, message, provenance = \"not-checked\", details) {\n\treturn {\n\t\tsuccess: false,\n\t\tstatus: \"failed\",\n\t\tcode,\n\t\treasons: [{\n\t\t\tcode,\n\t\t\tmessage\n\t\t}],\n\t\tprovenance: { status: provenance },\n\t\t...details === void 0 ? {} : { details }\n\t};\n}\nfunction validateArtifacts(release) {\n\tconst artifacts = [\n\t\trelease.artifacts.package,\n\t\trelease.artifacts.icon,\n\t\trelease.artifacts.banner,\n\t\t...release.artifacts.screenshots ?? []\n\t];\n\tfor (const value of artifacts) {\n\t\tif (value === void 0) continue;\n\t\tif (!isRecord(value)) return {\n\t\t\tcode: \"RELEASE_LEXICON_INVALID\",\n\t\t\tmessage: \"A release artifact is malformed.\"\n\t\t};\n\t\tconst hasUrl = typeof value.url === \"string\" && value.url.length > 0;\n\t\tconst blob = value.blob;\n\t\tconst hasBlob = isRecord(blob);\n\t\tif (!hasUrl && !hasBlob) return {\n\t\t\tcode: \"RELEASE_ARTIFACT_SOURCE_MISSING\",\n\t\t\tmessage: \"Every release artifact must provide a blob or URL.\"\n\t\t};\n\t\tif (hasBlob) {\n\t\t\tconst ref = blob.ref;\n\t\t\tconst cid = isRecord(ref) ? ref.$link : void 0;\n\t\t\tif (typeof cid !== \"string\") return {\n\t\t\t\tcode: \"BLOB_REF_INVALID\",\n\t\t\t\tmessage: \"The blob reference CID is malformed.\"\n\t\t\t};\n\t\t\tconst expected = multihashFromBlobCid(cid);\n\t\t\tif (!expected.success) return expected.error;\n\t\t\tif (value.checksum !== expected.value) return {\n\t\t\t\tcode: \"CHECKSUM_MISMATCH\",\n\t\t\t\tmessage: \"The artifact checksum does not match its blob reference CID.\"\n\t\t\t};\n\t\t}\n\t}\n\treturn null;\n}\nfunction unsupportedAuth(release) {\n\tconst gated = [\n\t\trelease.artifacts.package,\n\t\trelease.artifacts.icon,\n\t\trelease.artifacts.banner,\n\t\t...release.artifacts.screenshots ?? []\n\t].some((artifact) => artifact?.requiresAuth === true);\n\tif (release.auth === void 0 && !gated) return null;\n\tconst details = unsupportedAuthDetails(release.auth);\n\treturn {\n\t\tcode: \"AUTH_METHOD_UNSUPPORTED\",\n\t\tmessage: UNSUPPORTED_AUTH_MESSAGE,\n\t\t...details === void 0 ? {} : { details }\n\t};\n}\nasync function parseLexicon(schema, value) {\n\tconst result = await schema[\"~standard\"].validate(value);\n\treturn result.issues ? null : result.value;\n}\nfunction isRecord(value) {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\n//#endregion\n//#region src/records-default.ts\n/** Validate signed profile/release records and apply the complete provenance policy. */\nfunction verifyPackageReleaseRecords(input) {\n\treturn verifyPackageReleaseRecordsWithDefaultVerifier(input, new GitHubProvenanceVerifier());\n}\n\n//#endregion\nexport { DEFAULT_FETCH_LIMITS, GitHubProvenanceVerifier, MAX_BUNDLE_COMPRESSED_BYTES, MAX_BUNDLE_DECOMPRESSED_BYTES, MAX_BUNDLE_FILE_BYTES, MAX_BUNDLE_FILE_COUNT, MAX_BUNDLE_SIZE, MAX_BUNDLE_TAR_ENTRY_COUNT, VERIFICATION_ERROR_CODES, canonicalizeRepositoryUrl, compareDigestBytes, computeArtifactDigestCandidates, computeMultihash, decodeMultihash, fetchReleaseArtifact, fetchVerifiedResource, inspectPackageReleaseRecords, multihashFromBlobCid, recordScopedBlobCacheUrl, recordScopedImageCacheUrl, resolvePublisherPdsEndpoint, validatePluginBundle, verifyMultihash, verifyPackageReleaseRecords };\n//# sourceMappingURL=index.js.map","import type {\n\tDirectPdsDidDocumentResolver,\n\tDirectPdsProfileRecord,\n\tDirectPdsReadErrorCode,\n\tDirectPdsReleaseRecord,\n} from \"@emdash-cms/registry-client/direct-pds\";\nimport { DirectPdsClient, DirectPdsReadError } from \"@emdash-cms/registry-client/direct-pds\";\nimport {\n\tfetchVerifiedResource,\n\tinspectPackageReleaseRecords,\n\tverifyMultihash,\n\tverifyPackageReleaseRecords,\n\ttype FetchImplementation,\n\ttype HostnameResolver,\n\ttype ProvenanceVerifier,\n\ttype RecordInspectionReport,\n\ttype RecordVerificationFailure,\n\ttype RecordVerificationReport,\n\ttype VerificationErrorCode,\n} from \"@emdash-cms/registry-verification\";\n\nimport { cloudflareDohResolver, ssrfSafeFetch } from \"../security/ssrf.js\";\n\nconst MAX_PROVENANCE_BYTES = 5 * 1024 * 1024;\n\nexport type AuthoritativeRecordErrorCode =\n\t| DirectPdsReadErrorCode\n\t| VerificationErrorCode\n\t| \"AUTHORITATIVE_RECORD_READ_FAILED\";\n\nexport interface AuthoritativeRecordReadOptions {\n\tfetch?: typeof fetch;\n\tdidDocumentResolver?: DirectPdsDidDocumentResolver;\n\tprovenanceFetch?: FetchImplementation;\n\tresolveHostname?: HostnameResolver;\n\tprovenanceVerifier?: ProvenanceVerifier;\n\tartifactDigests?: readonly Uint8Array[];\n}\n\nexport interface VerifiedAuthoritativeRecords {\n\tpublisherDid: string;\n\tpackageSlug: string;\n\tversion: string;\n\tprofile: DirectPdsProfileRecord;\n\trelease: DirectPdsReleaseRecord;\n\tinspection: Extract<RecordInspectionReport, { success: true }>;\n}\n\nexport type VerifiedAuthoritativeReleaseReport = Extract<\n\tRecordVerificationReport,\n\t{ success: true }\n>;\n\nexport type AuthoritativeRecordReadResult =\n\t| { success: true; value: VerifiedAuthoritativeRecords }\n\t| {\n\t\t\tsuccess: false;\n\t\t\terror: { code: AuthoritativeRecordErrorCode; message: string };\n\t };\n\nexport type AuthoritativeRecordReader = (\n\tpublisherDid: string,\n\tpackageSlug: string,\n\tversion: string,\n\toptions?: AuthoritativeRecordReadOptions,\n) => Promise<AuthoritativeRecordReadResult>;\n\nexport async function readAuthoritativePackageRelease(\n\tpublisherDid: string,\n\tpackageSlug: string,\n\tversion: string,\n\toptions: AuthoritativeRecordReadOptions = {},\n): Promise<AuthoritativeRecordReadResult> {\n\ttry {\n\t\tconst client = new DirectPdsClient({\n\t\t\tdid: publisherDid,\n\t\t\tfetch: options.fetch ?? guardedFetch,\n\t\t\tdidDocumentResolver: options.didDocumentResolver,\n\t\t});\n\t\tconst [profile, release] = await Promise.all([\n\t\t\tclient.getPackageProfile(packageSlug),\n\t\t\tclient.getPackageRelease(packageSlug, version),\n\t\t]);\n\t\tconst inspection = await inspectPackageReleaseRecords({\n\t\t\tpublisherDid,\n\t\t\tpackage: packageSlug,\n\t\t\tversion,\n\t\t\trkey: release.rkey,\n\t\t\tprofile: profile.value,\n\t\t\trelease: release.value,\n\t\t});\n\t\tif (!inspection.success) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: inspection.code,\n\t\t\t\t\tmessage: inspection.reasons[0]?.message ?? \"The signed package records are invalid.\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tvalue: { publisherDid, packageSlug, version, profile, release, inspection },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof DirectPdsReadError) {\n\t\t\treturn { success: false, error: { code: error.code, message: error.message } };\n\t\t}\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"AUTHORITATIVE_RECORD_READ_FAILED\",\n\t\t\t\tmessage: \"The publisher's signed package records could not be verified.\",\n\t\t\t},\n\t\t};\n\t}\n}\n\nexport async function verifyAuthoritativePackageRelease(\n\trecords: VerifiedAuthoritativeRecords,\n\tartifactDigest: Uint8Array,\n\toptions: AuthoritativeRecordReadOptions = {},\n): Promise<RecordVerificationReport> {\n\tconst context = records.inspection.value;\n\tconst provenanceReference = context.releaseExtension.provenance;\n\tlet document: Uint8Array | undefined;\n\tif (provenanceReference) {\n\t\tconst fetched = await fetchVerifiedResource(provenanceReference.url, {\n\t\t\tfetch: options.provenanceFetch ?? defaultProvenanceFetch,\n\t\t\tresolveHostname: options.resolveHostname ?? cloudflareDohResolver,\n\t\t\tmaxBytes: MAX_PROVENANCE_BYTES,\n\t\t});\n\t\tif (!fetched.success) {\n\t\t\treturn verificationFailure(fetched.error.code, fetched.error.message);\n\t\t}\n\t\tconst checksum = await verifyMultihash(fetched.value.bytes, provenanceReference.checksum);\n\t\tif (!checksum.success) {\n\t\t\treturn verificationFailure(checksum.error.code, checksum.error.message);\n\t\t}\n\t\tdocument = fetched.value.bytes;\n\t}\n\n\treturn verifyPackageReleaseRecords({\n\t\tpublisherDid: records.publisherDid,\n\t\tpackage: records.packageSlug,\n\t\tversion: records.version,\n\t\trkey: records.release.rkey,\n\t\tprofile: records.profile.value,\n\t\trelease: records.release.value,\n\t\tprovenance:\n\t\t\tdocument === undefined\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\tdocument,\n\t\t\t\t\t\tartifactDigest,\n\t\t\t\t\t\tartifactDigests: options.artifactDigests,\n\t\t\t\t\t\tverifier: options.provenanceVerifier,\n\t\t\t\t\t},\n\t});\n}\n\nfunction verificationFailure(\n\tcode: VerificationErrorCode,\n\tmessage: string,\n): RecordVerificationFailure {\n\treturn {\n\t\tsuccess: false,\n\t\tstatus: \"failed\",\n\t\tcode,\n\t\treasons: [{ code, message }],\n\t\tprovenance: { status: \"failed\" },\n\t};\n}\n\nconst guardedFetch: typeof fetch = async (input, init) => {\n\tconst url = input instanceof Request ? input.url : String(input);\n\treturn ssrfSafeFetch(url, init, { httpsOnly: true });\n};\n\nconst defaultProvenanceFetch: FetchImplementation = (input, init) => globalThis.fetch(input, init);\n","/**\n * Plugin identifier helpers for the experimental decentralized plugin\n * registry.\n *\n * Registry plugins are addressed by `(publisher_did, slug)`, but the\n * EmDash runtime threads a single `pluginId: string` through every\n * install primitive (R2 storage keys, `PluginStateRepository`,\n * `syncMarketplacePlugins`, sandbox cache keys). Rather than refactor\n * everything to carry a composite identifier, we normalize the registry\n * tuple to an opaque content-addressed id that satisfies the existing\n * `validatePluginIdentifier` shape (`/^[a-z][a-z0-9_-]*$/`).\n *\n * The normalized id is:\n *\n * `r_` + base32-encoded SHA-256(publisher_did + \"\\n\" + slug), truncated.\n *\n * Properties:\n *\n * - Deterministic. The same `(publisher, slug)` always produces the\n * same id, so re-resolving an installed plugin's metadata against\n * the aggregator is a straightforward lookup keyed by the columns\n * stored alongside `plugin_id` in `plugin_states`.\n * - Collision-resistant. 80 bits of truncated hash; a 50% birthday\n * collision happens around 2^40 distinct plugins, well beyond what\n * this registry will ever index.\n * - R2-safe. Lowercase alphanumerics + underscore (no hyphens), no\n * `:` or `/`. Existing sandbox cache keys (`${pluginId}:${version}`)\n * keep working because the id contains no `:`.\n * - Syntactically distinct from typical marketplace plugin ids: the\n * `r_` prefix plus exactly 16 base32 characters is unlikely to be\n * chosen as a marketplace id. Not formally guaranteed by the\n * validator -- marketplace ids may begin with `r_` and contain\n * hyphens -- so the install handler also performs an explicit\n * pre-existing-row check at the derived id and rejects any cross-\n * source collision (`PLUGIN_ID_COLLISION`).\n *\n * Reverse lookup (id → publisher + slug) requires the `plugin_states`\n * row -- the hash is one-way. That's intentional: any code path that\n * needs the human-meaningful pair already has the state row in hand.\n */\n\n/** Length (in base32 characters) of the truncated hash portion of the id. */\nconst HASH_LENGTH = 16;\n\n/** Total expected length of a registry plugin id. */\nexport const REGISTRY_PLUGIN_ID_LENGTH = 2 /* \"r_\" */ + HASH_LENGTH;\n\n/**\n * Regex matching a well-formed registry plugin id. Used by call sites\n * that need to distinguish registry installs from marketplace installs\n * without consulting the `source` column on `plugin_states`.\n *\n * The base32 alphabet here uses RFC 4648 lowercase without padding,\n * matching {@link base32Encode}'s output.\n */\nexport const REGISTRY_PLUGIN_ID_PATTERN = /^r_[a-z2-7]{16}$/;\n\nconst BASE32_ALPHABET = \"abcdefghijklmnopqrstuvwxyz234567\";\n\n/**\n * RFC 4648 base32 encoding without padding, lowercase. Implemented inline\n * rather than depending on a multibase library because (a) we only need\n * lowercase base32 here, (b) we need it to run identically in workerd,\n * Node, and the browser, and (c) the implementation is fewer lines than\n * the import statement would be.\n */\nfunction base32Encode(bytes: Uint8Array): string {\n\tlet bits = 0;\n\tlet value = 0;\n\tlet out = \"\";\n\tfor (const byte of bytes) {\n\t\tvalue = (value << 8) | byte;\n\t\tbits += 8;\n\t\twhile (bits >= 5) {\n\t\t\tbits -= 5;\n\t\t\tout += BASE32_ALPHABET[(value >>> bits) & 0x1f];\n\t\t}\n\t}\n\tif (bits > 0) {\n\t\tout += BASE32_ALPHABET[(value << (5 - bits)) & 0x1f];\n\t}\n\treturn out;\n}\n\n/**\n * Derive the normalized plugin id for a registry-published plugin.\n *\n * Throws if either input is empty or whitespace-only -- a missing DID\n * or slug is always a programming error in the install path, not a\n * recoverable runtime condition.\n */\nexport async function makeRegistryPluginId(publisherDid: string, slug: string): Promise<string> {\n\tconst did = publisherDid.trim();\n\tconst s = slug.trim();\n\tif (!did) throw new Error(\"makeRegistryPluginId: publisherDid is required\");\n\tif (!s) throw new Error(\"makeRegistryPluginId: slug is required\");\n\n\t// `\\n` separator avoids ambiguity: no canonical did:plc / did:web form\n\t// contains a literal newline, so `(\"a\", \"b\\nc\")` cannot hash to the\n\t// same bytes as `(\"a\\nb\", \"c\")`.\n\tconst input = `${did}\\n${s}`;\n\tconst hashBuffer = await crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(input));\n\tconst encoded = base32Encode(new Uint8Array(hashBuffer));\n\treturn `r_${encoded.slice(0, HASH_LENGTH)}`;\n}\n\n/**\n * Return whether `pluginId` is a well-formed registry plugin id.\n *\n * This is a syntactic check, not a database lookup -- it answers\n * \"could this id have come from `makeRegistryPluginId`?\", not \"is this\n * plugin installed?\".\n */\nexport function isRegistryPluginId(pluginId: string): boolean {\n\treturn REGISTRY_PLUGIN_ID_PATTERN.test(pluginId);\n}\n","interface VersionedRecordLabel {\n\tval?: string;\n\turi?: string;\n\tcid?: string;\n\tneg?: boolean;\n\texp?: string;\n}\n\nexport function hasCurrentRecordLabel(\n\tlabels: readonly VersionedRecordLabel[],\n\tvalue: string,\n\trecord: { uri: string; cid: string },\n\tnow = Date.now(),\n): boolean {\n\treturn labels.some((label) => {\n\t\tif (\n\t\t\tlabel.val !== value ||\n\t\t\tlabel.uri !== record.uri ||\n\t\t\tlabel.cid !== record.cid ||\n\t\t\tlabel.neg === true\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\tif (label.exp === undefined) return true;\n\t\tconst expiresAt = Date.parse(label.exp);\n\t\treturn Number.isFinite(expiresAt) && expiresAt > now;\n\t});\n}\n","/**\n * Registry installs use aggregator results only for discovery and moderation\n * metadata. The handler reads profile and release records from the publisher's\n * PDS, verifies their repository proofs, then validates the bundle checksum,\n * manifest, policy, and consent before storing or activating executable code.\n * Applicable labels can block installation but cannot supply any verified\n * record, checksum, permission, or executable byte.\n */\n\nimport { ClientResponseError, ClientValidationError } from \"@atcute/client\";\nimport type { Did } from \"@atcute/lexicons\";\nimport { canonicalizeDeclaredAccess } from \"@emdash-cms/plugin-types\";\nimport type { CanonicalDeclaredAccess } from \"@emdash-cms/plugin-types\";\nimport { checkEnvCompatibility, findSkippedEnvConstraints } from \"@emdash-cms/registry-client/env\";\nimport type { HostEnv } from \"@emdash-cms/registry-client/env\";\nimport { evaluateRegistryReleaseWithdrawal } from \"@emdash-cms/registry-client/withdrawal\";\nimport { NSID } from \"@emdash-cms/registry-lexicons\";\nimport {\n\tfetchReleaseArtifact,\n\ttype ReleaseArtifactReference,\n} from \"@emdash-cms/registry-verification/artifact\";\nimport type { Kysely } from \"kysely\";\n\nimport type { Database } from \"../../database/types.js\";\nimport type { SandboxRunner } from \"../../plugins/sandbox/types.js\";\nimport { PluginStateRepository } from \"../../plugins/state.js\";\nimport {\n\tremoveAllPluginIndexes,\n\tsyncDeclaredStorageIndexes,\n} from \"../../plugins/storage-indexes.js\";\nimport { declaredAccessToCapabilities } from \"../../plugins/types.js\";\nimport type { DeclaredAccess } from \"../../plugins/types.js\";\nimport { fetchRegistryArtifactUrl } from \"../../registry/artifact-fetch.js\";\nimport {\n\tvalidateRegistryArtifact,\n\ttype RegistryArtifactVerificationCode,\n} from \"../../registry/artifact-verification.js\";\nimport {\n\treadAuthoritativePackageRelease,\n\tverifyAuthoritativePackageRelease,\n\ttype AuthoritativeRecordErrorCode,\n\ttype AuthoritativeRecordReader,\n\ttype AuthoritativeRecordReadOptions,\n\ttype VerifiedAuthoritativeReleaseReport,\n\ttype VerifiedAuthoritativeRecords,\n} from \"../../registry/authoritative-records.js\";\nimport {\n\tcanonicalCapabilitiesForDriftCheck,\n\tcoerceRegistryConfig,\n\tparseDurationSeconds,\n\treleaseExemptFromMinimumAge,\n\tvalidateAggregatorUrl,\n} from \"../../registry/config.js\";\nimport { makeRegistryPluginId } from \"../../registry/plugin-id.js\";\nimport { hasCurrentRecordLabel } from \"../../registry/record-labels.js\";\nimport type { RegistryConfigInput } from \"../../registry/types.js\";\nimport { resolveAndValidateExternalUrlTarget } from \"../../security/ssrf.js\";\nimport { EmDashStorageError } from \"../../storage/types.js\";\nimport type { Storage } from \"../../storage/types.js\";\nimport type { ApiResult } from \"../types.js\";\nimport {\n\tdeleteBundleFromR2,\n\tdiffCapabilities,\n\tdiffRouteVisibility,\n\tloadBundleFromR2,\n\tstoreBundleInR2,\n} from \"./marketplace.js\";\n\nexport { assertSafeArtifactUrl } from \"../../registry/artifact-fetch.js\";\n\n/**\n * Whether two `declaredAccess` blocks grant exactly the same enforced access --\n * the same capabilities AND the same host allow-list. Both are lowered through\n * the canonical converter so that constraint content (`allowedHosts`), not just\n * the capability set, is part of the comparison. The capability-set consent\n * gate is blind to host scope; this is what keeps a bundle from being installed\n * with a wider (or simply different) host allow-list than its published record\n * advertised and the user consented to.\n */\nexport function enforcedAccessEqual(a: DeclaredAccess, b: DeclaredAccess): boolean {\n\tconst aa = declaredAccessToCapabilities(a);\n\tconst bb = declaredAccessToCapabilities(b);\n\treturn (\n\t\tJSON.stringify(aa.capabilities.toSorted()) === JSON.stringify(bb.capabilities.toSorted()) &&\n\t\tJSON.stringify(aa.allowedHosts.toSorted()) === JSON.stringify(bb.allowedHosts.toSorted())\n\t);\n}\n\nfunction verifiedAccessEqual(a: CanonicalDeclaredAccess, b: DeclaredAccess): boolean {\n\treturn JSON.stringify(a) === JSON.stringify(canonicalizeDeclaredAccess(b));\n}\n\n// ── Types ──────────────────────────────────────────────────────────\n\nexport interface RegistryInstallInput {\n\t/**\n\t * Publisher DID. Required. The browser is expected to resolve\n\t * `(handle, slug) → (did, slug)` via the aggregator's\n\t * `resolvePackage` XRPC before posting -- the server then skips that\n\t * round-trip and looks up the package directly.\n\t *\n\t * Passing DID rather than handle here means installs work for\n\t * publishers whose handle the aggregator couldn't resolve at view\n\t * time (handle is \"best-effort\" per the lexicon -- absent for any\n\t * publisher whose DID document didn't resolve cleanly at ingest).\n\t */\n\tdid: string;\n\t/** Package slug (rkey of the publisher's profile record). */\n\tslug: string;\n\t/** Optional explicit version. When omitted, the aggregator's latest. */\n\tversion?: string;\n\t/**\n\t * Capabilities the admin acknowledged in the consent dialog, lifted\n\t * from the release record's `declaredAccess` block. Compared against\n\t * the bundle's `manifest.declaredAccess` to detect drift between\n\t * what the admin agreed to and what the bundle actually requests.\n\t *\n\t * When omitted, drift detection is skipped -- callers that don't\n\t * surface a consent UI before posting (e.g. CI scripts) opt out.\n\t */\n\tacknowledgedDeclaredAccess?: unknown;\n\tacknowledgedMcpTools?: unknown;\n\tacknowledgedProfileCid?: string;\n\tacknowledgedReleaseCid?: string;\n}\n\nexport interface RegistryInstallResult {\n\t/** Hashed, opaque plugin id used everywhere in the runtime. */\n\tpluginId: string;\n\t/** Publisher DID resolved from the handle. */\n\tpublisherDid: string;\n\t/** Publisher slug (== the registry slug). */\n\tslug: string;\n\t/** Installed version. */\n\tversion: string;\n\t/** Capabilities surfaced from the bundle's manifest. */\n\tcapabilities: string[];\n\tdeclaredAccess: DeclaredAccess;\n\tmcpTools: RegistryMcpConsentTool[];\n\tverification: RegistryRecordVerificationSummary;\n}\n\nexport interface RegistryMcpConsentTool {\n\tname: string;\n\tdescription: string;\n\troute: string;\n\tpermission: string;\n\tdestructive: boolean;\n}\n\nexport interface RegistryRecordVerificationSummary {\n\tprofileCid: string;\n\treleaseCid: string;\n\tprovenance: \"verified\" | \"absent-optional\";\n\tpolicy: {\n\t\trequireProvenance: boolean;\n\t\tconfirmation: \"escalation-only\" | \"always\";\n\t\tapprovers: string[];\n\t};\n}\n\n// ── Helpers ────────────────────────────────────────────────────────\n\nexport function registryArtifactError(\n\tcode: RegistryArtifactVerificationCode,\n\tmessage: string,\n\toperation: \"install\" | \"update\",\n): ApiResult<never> {\n\tlet apiCode: string;\n\tswitch (code) {\n\t\tcase \"BUNDLE_ID_MISMATCH\":\n\t\t\tapiCode = operation === \"install\" ? \"MANIFEST_ID_MISMATCH\" : \"BUNDLE_IDENTITY_MISMATCH\";\n\t\t\tbreak;\n\t\tcase \"BUNDLE_VERSION_MISMATCH\":\n\t\t\tapiCode = operation === \"install\" ? \"MANIFEST_VERSION_MISMATCH\" : code;\n\t\t\tbreak;\n\t\tcase \"CHECKSUM_MISMATCH\":\n\t\tcase \"INVALID_MULTIHASH\":\n\t\tcase \"UNSUPPORTED_MULTIHASH\":\n\t\t\tapiCode = \"CHECKSUM_MISMATCH\";\n\t\t\tbreak;\n\t\tcase \"FETCH_FAILED\":\n\t\tcase \"HOST_REJECTED\":\n\t\tcase \"REDIRECT_LIMIT_EXCEEDED\":\n\t\tcase \"REDIRECT_LOCATION_MISSING\":\n\t\tcase \"RESOURCE_STATUS_ERROR\":\n\t\tcase \"RESOURCE_TIMEOUT\":\n\t\t\tapiCode = operation === \"install\" ? \"INSTALL_FAILED\" : \"UPDATE_FAILED\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tapiCode = \"INVALID_BUNDLE\";\n\t}\n\treturn {\n\t\tsuccess: false,\n\t\terror: {\n\t\t\tcode: apiCode,\n\t\t\tmessage,\n\t\t\tdetails: { verificationCode: code },\n\t\t},\n\t};\n}\n\nfunction registryRecordError(\n\tcode: AuthoritativeRecordErrorCode,\n\tmessage: string,\n): ApiResult<never> {\n\treturn {\n\t\tsuccess: false,\n\t\terror: {\n\t\t\tcode: \"RECORD_VERIFICATION_FAILED\",\n\t\t\tmessage,\n\t\t\tdetails: { verificationCode: code },\n\t\t},\n\t};\n}\n\nfunction recordConsentError(\n\tinput: { profileCid?: string; releaseCid?: string },\n\trecords: VerifiedAuthoritativeRecords,\n): ApiResult<never> | null {\n\tif (!input.profileCid || !input.releaseCid) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"RECORD_CONSENT_REQUIRED\",\n\t\t\t\tmessage: \"Verify the signed package records before confirming this action.\",\n\t\t\t},\n\t\t};\n\t}\n\tif (input.profileCid !== records.profile.cid || input.releaseCid !== records.release.cid) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"RECORD_VERIFICATION_DRIFT\",\n\t\t\t\tmessage: \"The signed package records changed after review. Verify them again.\",\n\t\t\t},\n\t\t};\n\t}\n\treturn null;\n}\n\nfunction recordVerificationSummary(\n\trecords: VerifiedAuthoritativeRecords,\n\treport: VerifiedAuthoritativeReleaseReport,\n): RegistryRecordVerificationSummary {\n\treturn {\n\t\tprofileCid: records.profile.cid,\n\t\treleaseCid: records.release.cid,\n\t\tprovenance: report.provenance.status,\n\t\tpolicy: report.value.policy,\n\t};\n}\n\n/**\n * Bytes-per-artifact cap on the gzipped tarball we'll download before\n * decompression. RFC 0001 caps a sandboxed plugin bundle at 256 KiB\n * decompressed (see `MAX_BUNDLE_SIZE` in cli/commands/bundle-utils.ts);\n * gzip on a mix of JSON manifest + JS code typically gives 0.3-0.6\n * ratio, so compressed bundles are well under 200 KiB in practice.\n * 512 KiB leaves margin for unusual file mixes that compress poorly\n * while still rejecting anything that's obviously not a legitimate\n * plugin bundle.\n */\nconst MAX_ARTIFACT_BYTES = 512 * 1024;\n\n/**\n * Maximum number of HTTP redirects followed during artifact download.\n * Each hop is independently URL-validated, so a malicious server cannot\n * redirect through a series of allowed-looking origins to reach a\n * forbidden one.\n */\nconst MAX_REDIRECTS = 5;\n\n/**\n * Wall-clock cap on any single artifact fetch attempt (per URL).\n * Defends against slow-loris artifact sources that accept the connection but\n * never finish sending headers or body.\n */\nconst ARTIFACT_FETCH_TIMEOUT_MS = 15_000;\n\n/**\n * Total wall-clock budget for the artifact-download phase across all\n * advertised caches, the publisher PDS, and the declared URL. Even with the\n * per-URL timeout, unavailable sources could otherwise tie up the install request for\n * minutes; this caps total time at a budget interactive admins can\n * tolerate. Tuned so a fast happy path takes <1s of budget per\n * attempt and a worst case still completes in under a minute.\n */\nconst ARTIFACT_TOTAL_BUDGET_MS = 45_000;\n\n/**\n * Per-request timeout applied to every aggregator XRPC call\n * (`resolvePackage`, `getLatestRelease`, `listReleases`). Matches the\n * per-URL artifact-fetch cap. Without this, a slow-loris aggregator\n * can stall the install before the artifact phase even starts.\n */\nconst AGGREGATOR_REQUEST_TIMEOUT_MS = 15_000;\n\n/**\n * Total wall-clock budget for the aggregator-discovery phase\n * (resolve + selected-release lookup). Mirrors the artifact-download\n * budget. Worst case with the pinned-version path's 20-page cap is\n * 20 + 1 calls; capping the total ensures any one stalled call\n * still bounds the whole phase.\n */\nconst AGGREGATOR_TOTAL_BUDGET_MS = 30_000;\n\nclass RegistryArtifactFetchError extends Error {\n\tconstructor(\n\t\treadonly code: RegistryArtifactVerificationCode,\n\t\tmessage: string,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"RegistryArtifactFetchError\";\n\t}\n}\n\n/** Build a fetch function that enforces a per-request and per-budget timeout. */\nfunction timedFetch(totalDeadline: number): typeof fetch {\n\treturn (input: Parameters<typeof fetch>[0], init?: Parameters<typeof fetch>[1]) => {\n\t\tconst now = Date.now();\n\t\tconst remaining = Math.max(0, totalDeadline - now);\n\t\tif (remaining === 0) {\n\t\t\treturn Promise.reject(new Error(\"Aggregator request budget exhausted\"));\n\t\t}\n\t\tconst timeout = Math.min(AGGREGATOR_REQUEST_TIMEOUT_MS, remaining);\n\t\tconst controller = new AbortController();\n\t\tconst timer = setTimeout(() => controller.abort(), timeout);\n\t\tconst callerSignal = init?.signal;\n\t\tif (callerSignal) {\n\t\t\tif (callerSignal.aborted) controller.abort(callerSignal.reason);\n\t\t\telse callerSignal.addEventListener(\"abort\", () => controller.abort(callerSignal.reason));\n\t\t}\n\t\treturn fetch(input, { ...init, signal: controller.signal }).finally(() => {\n\t\t\tclearTimeout(timer);\n\t\t});\n\t};\n}\n\nasync function fetchArtifact(\n\tartifactCaches: readonly unknown[],\n\tartifact: ReleaseArtifactReference,\n\trecord: {\n\t\tdid: string;\n\t\tcollection: string;\n\t\trkey: string;\n\t\tcid: string;\n\t},\n\tauth?: unknown,\n): Promise<Uint8Array> {\n\tconst result = await fetchReleaseArtifact(\n\t\t{\n\t\t\tartifact,\n\t\t\trecord,\n\t\t\tartifactCaches,\n\t\t\t...(auth === undefined ? {} : { auth }),\n\t\t},\n\t\t{\n\t\t\tfetch: async (url, init) => {\n\t\t\t\tif (!init.signal) throw new Error(\"Registry artifact fetch requires an abort signal\");\n\t\t\t\treturn fetchRegistryArtifactUrl(url.href, {\n\t\t\t\t\tsignal: init.signal,\n\t\t\t\t\tmaxResponseBytes: MAX_ARTIFACT_BYTES,\n\t\t\t\t});\n\t\t\t},\n\t\t\tresolveHostname: async (hostname) =>\n\t\t\t\t(await resolveAndValidateExternalUrlTarget(`https://${hostname}`)).addresses,\n\t\t\tallowHttpLocalhost: import.meta.env.DEV,\n\t\t\theaderTimeoutMs: ARTIFACT_FETCH_TIMEOUT_MS,\n\t\t\ttotalTimeoutMs: ARTIFACT_TOTAL_BUDGET_MS,\n\t\t\tmaxBytes: MAX_ARTIFACT_BYTES,\n\t\t\tmaxRedirects: MAX_REDIRECTS,\n\t\t},\n\t);\n\tif (!result.success) {\n\t\tthrow new RegistryArtifactFetchError(result.error.code, result.error.message);\n\t}\n\treturn result.value.bytes;\n}\n\n/**\n * The shape of a single env-compatibility failure returned to the admin in\n * the `ENV_INCOMPATIBLE` error's `details`.\n */\ninterface EnvIncompatibleError {\n\tcode: \"ENV_INCOMPATIBLE\";\n\tmessage: string;\n\tdetails: { requires: Record<string, string>; host: HostEnv };\n}\n\n/**\n * Gate a release's `requires` constraints against the running host\n * environment. `requires` is the lexicon-`unknown` value off the signed\n * release record — never trust its shape; `checkEnvCompatibility` guards it.\n *\n * Returns `null` when every advertised constraint is satisfied (or there are\n * none), or a structured `ENV_INCOMPATIBLE` error naming the unsatisfied\n * constraints and the host versions. The error carries the guarded `requires`\n * and `host` maps so the admin can render the same mismatch the UI gate shows.\n */\nexport function assertEnvCompatible(\n\trequires: unknown,\n\thostEnv: HostEnv,\n): EnvIncompatibleError | null {\n\t// A constraint the host can't evaluate (unknown or unparseable host\n\t// version) downgrades the gate to a no-op for that env. Log it so a\n\t// silent bypass is observable rather than invisible.\n\tfor (const skipped of findSkippedEnvConstraints(requires, hostEnv)) {\n\t\tconsole.warn(\n\t\t\t`[registry] env compatibility constraint skipped: ${skipped.key} requires ${skipped.required} but host version is ${skipped.reason}`,\n\t\t);\n\t}\n\tconst mismatches = checkEnvCompatibility(requires, hostEnv);\n\tif (mismatches.length === 0) return null;\n\tconst guarded: Record<string, string> = {};\n\tfor (const m of mismatches) guarded[m.key] = m.required;\n\tconst summary = mismatches\n\t\t.map((m) => `${m.key} requires ${m.required} but host is ${m.host}`)\n\t\t.join(\"; \");\n\treturn {\n\t\tcode: \"ENV_INCOMPATIBLE\",\n\t\tmessage: `This release is not compatible with the current environment: ${summary}.`,\n\t\tdetails: { requires: guarded, host: hostEnv },\n\t};\n}\n\n// ── Install ────────────────────────────────────────────────────────\n\nexport async function handleRegistryInstall(\n\tdb: Kysely<Database>,\n\tstorage: Storage | null,\n\tsandboxRunner: SandboxRunner | null,\n\tregistryConfigInput: RegistryConfigInput | undefined,\n\tinput: RegistryInstallInput,\n\topts?: {\n\t\tconfiguredPluginIds?: Set<string>;\n\t\thostEnv?: HostEnv;\n\t\tauthoritativeRecords?: AuthoritativeRecordReadOptions;\n\t\treadAuthoritativeRecords?: AuthoritativeRecordReader;\n\t\tverifyOnly?: boolean;\n\t},\n): Promise<ApiResult<RegistryInstallResult>> {\n\t// Accept either the bare-string shorthand or the full\n\t// `RegistryConfig` object (see `RegistryConfigInput`).\n\tconst registryConfig = coerceRegistryConfig(registryConfigInput);\n\tif (!registryConfig) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"REGISTRY_NOT_CONFIGURED\",\n\t\t\t\tmessage: \"Registry is not configured\",\n\t\t\t},\n\t\t};\n\t}\n\n\tif (!storage) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"STORAGE_NOT_CONFIGURED\",\n\t\t\t\tmessage: \"Storage is required for registry plugin installation\",\n\t\t\t},\n\t\t};\n\t}\n\n\tif (!sandboxRunner || !sandboxRunner.isAvailable()) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"SANDBOX_NOT_AVAILABLE\",\n\t\t\t\tmessage: \"Sandbox runner is required for registry plugins\",\n\t\t\t},\n\t\t};\n\t}\n\n\t// Defense in depth: validate the aggregator URL even though the same\n\t// check runs at config-normalize time. Keeps every entrypoint into\n\t// `handleRegistryInstall` safe regardless of how the caller obtained\n\t// the config.\n\ttry {\n\t\tvalidateAggregatorUrl(registryConfig.aggregatorUrl);\n\t} catch (err) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"REGISTRY_NOT_CONFIGURED\",\n\t\t\t\tmessage: err instanceof Error ? err.message : \"Invalid aggregator URL\",\n\t\t\t},\n\t\t};\n\t}\n\n\tconst { did, slug, version: requestedVersion } = input;\n\n\t// Lazy-load the discovery client. Avoids pulling @atcute/client into\n\t// every code path that imports core/api/handlers.\n\tconst { DiscoveryClient, registryLabelerPolicy } =\n\t\tawait import(\"@emdash-cms/registry-client/discovery\");\n\n\t// Every aggregator XRPC call passes through `timedFetch`, which\n\t// enforces a per-request timeout and shares a single total-budget\n\t// deadline. Defends against a slow-loris aggregator stalling the\n\t// install before the artifact phase begins.\n\tconst aggregatorDeadline = Date.now() + AGGREGATOR_TOTAL_BUDGET_MS;\n\tconst discovery = new DiscoveryClient({\n\t\taggregatorUrl: registryConfig.aggregatorUrl,\n\t\tacceptLabelers: registryConfig.acceptLabelers,\n\t\tlabelerPolicy: registryLabelerPolicy(registryConfig.acceptLabelers),\n\t\tfetch: timedFetch(aggregatorDeadline),\n\t});\n\n\t// Basic shape check on the DID. The browser is expected to send a\n\t// DID resolved via the aggregator's `resolvePackage`; reject obvious\n\t// malformations here rather than letting the XRPC call fail\n\t// opaquely. The lexicon's `did:${string}:${string}` template is the\n\t// authoritative check.\n\tif (!did.startsWith(\"did:\") || did.split(\":\").length < 3) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"INVALID_DID\",\n\t\t\t\tmessage: \"DID must be a valid atproto DID (e.g. did:plc:abc123)\",\n\t\t\t},\n\t\t};\n\t}\n\n\ttry {\n\t\t// Step 1: look up the package by DID + slug. The browser already\n\t\t// resolved any handle to a DID via `resolvePackage`; we skip that\n\t\t// round-trip and go straight to `getPackage`.\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- validated above\n\t\tconst publisherDid = did as Did;\n\t\tconst packageView = await discovery.getPackage({\n\t\t\tdid: publisherDid,\n\t\t\tslug,\n\t\t});\n\n\t\t// Step 2: select the target release.\n\t\t// For an explicit version, page through listReleases until we find\n\t\t// the matching record; the aggregator returns releases ordered by\n\t\t// semver descending. For \"latest\", use the dedicated convenience\n\t\t// endpoint which applies the aggregator's policy filter (yanked\n\t\t// exclusion etc.) server-side.\n\t\t//\n\t\t// Pagination is bounded both by total pages and by repeated-cursor\n\t\t// detection: a buggy or compromised aggregator could otherwise\n\t\t// return endless distinct cursors that never include the\n\t\t// requested version, hanging the install for the platform's\n\t\t// request-time budget.\n\t\tconst MAX_LIST_PAGES = 20; // 20 * 50 limit = 1000 releases worth\n\t\tconst latestRelease = await (async () => {\n\t\t\tif (!requestedVersion) {\n\t\t\t\treturn discovery.getLatestRelease({\n\t\t\t\t\tdid: publisherDid,\n\t\t\t\t\tpackage: slug,\n\t\t\t\t});\n\t\t\t}\n\t\t\tlet cursor: string | undefined;\n\t\t\tconst seenCursors = new Set<string>();\n\t\t\tfor (let page = 0; page < MAX_LIST_PAGES; page++) {\n\t\t\t\tif (cursor !== undefined) {\n\t\t\t\t\tif (seenCursors.has(cursor)) break;\n\t\t\t\t\tseenCursors.add(cursor);\n\t\t\t\t}\n\t\t\t\tconst result = await discovery.listReleases({\n\t\t\t\t\tdid: publisherDid,\n\t\t\t\t\tpackage: slug,\n\t\t\t\t\tcursor,\n\t\t\t\t\tlimit: 50,\n\t\t\t\t});\n\t\t\t\tfor (const r of result.releases) {\n\t\t\t\t\tif (r.version === requestedVersion) return r;\n\t\t\t\t}\n\t\t\t\tif (!result.cursor) break;\n\t\t\t\tcursor = result.cursor;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t})();\n\t\tconst releaseView = latestRelease;\n\n\t\tif (!releaseView) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NO_RELEASE\",\n\t\t\t\t\tmessage: requestedVersion\n\t\t\t\t\t\t? `Version ${requestedVersion} not found for ${publisherDid}/${slug}`\n\t\t\t\t\t\t: `No installable release found for ${publisherDid}/${slug}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// The aggregator selects the package/version and supplies mirrors and\n\t\t// moderation metadata. Its copies of the signed records are not\n\t\t// verification inputs.\n\t\tif (packageView.did !== publisherDid || packageView.slug !== slug) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"AGGREGATOR_IDENTITY_MISMATCH\",\n\t\t\t\t\tmessage: \"Aggregator returned a package view for a different publisher or slug.\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (\n\t\t\treleaseView.did !== publisherDid ||\n\t\t\treleaseView.package !== slug ||\n\t\t\t(requestedVersion !== undefined && releaseView.version !== requestedVersion)\n\t\t) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"AGGREGATOR_IDENTITY_MISMATCH\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"Aggregator returned a release view that does not match the requested package or version.\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst version = releaseView.version;\n\t\tif (evaluateRegistryReleaseWithdrawal(releaseView, discovery.labelerPolicy).withdrawn) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"RELEASE_YANKED\",\n\t\t\t\t\tmessage: \"This release has been withdrawn\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst authoritative = await (opts?.readAuthoritativeRecords ?? readAuthoritativePackageRelease)(\n\t\t\tpublisherDid,\n\t\t\tslug,\n\t\t\tversion,\n\t\t\topts?.authoritativeRecords,\n\t\t);\n\t\tif (!authoritative.success) {\n\t\t\treturn registryRecordError(authoritative.error.code, authoritative.error.message);\n\t\t}\n\t\tconst records = authoritative.value;\n\t\tconst { profile, release } = records.inspection.value;\n\t\tif (\n\t\t\tpackageView.uri !== records.profile.uri ||\n\t\t\tpackageView.cid !== records.profile.cid ||\n\t\t\treleaseView.uri !== records.release.uri ||\n\t\t\treleaseView.cid !== records.release.cid\n\t\t) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"AGGREGATOR_RECORD_MISMATCH\",\n\t\t\t\t\tmessage: \"Aggregator metadata does not match the publisher's signed records.\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (!opts?.verifyOnly) {\n\t\t\tconst consentError = recordConsentError(\n\t\t\t\t{\n\t\t\t\t\tprofileCid: input.acknowledgedProfileCid,\n\t\t\t\t\treleaseCid: input.acknowledgedReleaseCid,\n\t\t\t\t},\n\t\t\t\trecords,\n\t\t\t);\n\t\t\tif (consentError) return consentError;\n\t\t}\n\n\t\tconst packageYanked =\n\t\t\thasCurrentRecordLabel(packageView.labels ?? [], \"security:yanked\", records.profile) ||\n\t\t\thasCurrentRecordLabel(packageView.labels ?? [], \"security-yanked\", records.profile);\n\t\tif (packageYanked) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"RELEASE_YANKED\",\n\t\t\t\t\tmessage: \"This release has been withdrawn\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Environment compatibility remains an install-safety gate. Listing\n\t\t// approval says only that displayed metadata passed moderation. A release\n\t\t// may carry a `requires` block (`env:emdash`, `env:astro`, ...). Refuse\n\t\t// the install if the running host doesn't satisfy a constraint, so a\n\t\t// stale browser tab or non-UI caller can't bypass the admin's\n\t\t// disabled Install button. `requires` is lexicon-`unknown`; the\n\t\t// helper guards its shape.\n\t\tif (opts?.hostEnv) {\n\t\t\tconst envError = assertEnvCompatible(release.requires, opts.hostEnv);\n\t\t\tif (envError) return { success: false, error: envError };\n\t\t}\n\n\t\t// Step 3a: enforce the configured minimum release age. The browser\n\t\t// applies the same check up front for UX, but the gate lives here\n\t\t// -- a stale browser tab, a deep link, or a non-admin-UI caller\n\t\t// must still hit the holdback. The `minimumReleaseAgeExclude`\n\t\t// allowlist short-circuits the check for trusted publisher DIDs.\n\t\t//\n\t\t// `releaseView.indexedAt` is aggregator operational data, not part\n\t\t// of the signed release. The release schema has no publication\n\t\t// timestamp, so minimum age remains a local discovery holdback\n\t\t// rather than a cryptographic property. A missing or malformed\n\t\t// timestamp fails closed.\n\t\t// `registryConfig` is the user-supplied integration option, not\n\t\t// the normalized manifest shape, so the duration parse runs once\n\t\t// per install. Catch a malformed value here -- normally caught at\n\t\t// `normalizeRegistryConfig` time, but a future config-mutation\n\t\t// path could re-enter with a bad value -- and surface it as a\n\t\t// structured error rather than letting it bubble out as a generic\n\t\t// 500.\n\t\tconst minimumReleaseAge = registryConfig.policy?.minimumReleaseAge;\n\t\tlet minimumReleaseAgeSeconds = 0;\n\t\tif (minimumReleaseAge !== undefined) {\n\t\t\ttry {\n\t\t\t\tminimumReleaseAgeSeconds = parseDurationSeconds(minimumReleaseAge);\n\t\t\t} catch (err) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: \"REGISTRY_POLICY_INVALID\",\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\terr instanceof Error\n\t\t\t\t\t\t\t\t? err.message\n\t\t\t\t\t\t\t\t: \"Invalid minimumReleaseAge value in registry config\",\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tif (minimumReleaseAgeSeconds > 0) {\n\t\t\tconst exclude = registryConfig.policy?.minimumReleaseAgeExclude?.map((e) =>\n\t\t\t\te.trim().toLowerCase(),\n\t\t\t);\n\t\t\tconst exempt = releaseExemptFromMinimumAge(exclude, publisherDid, slug);\n\t\t\tif (!exempt) {\n\t\t\t\tconst indexedAt = Date.parse(releaseView.indexedAt);\n\t\t\t\tif (!Number.isFinite(indexedAt)) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\tcode: \"RELEASE_TIMESTAMP_INVALID\",\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\"Release record is missing a valid indexed-at timestamp; cannot evaluate minimum release age policy.\",\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tconst ageSeconds = (Date.now() - indexedAt) / 1000;\n\t\t\t\tif (ageSeconds < minimumReleaseAgeSeconds) {\n\t\t\t\t\tconst remaining = Math.ceil(minimumReleaseAgeSeconds - ageSeconds);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\tcode: \"RELEASE_TOO_NEW\",\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`This release does not meet the configured minimum release age of ` +\n\t\t\t\t\t\t\t\t`${minimumReleaseAgeSeconds}s. It will be installable in ~${remaining}s.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Derive the normalized opaque plugin id we'll use as the\n\t\t// runtime-wide identifier from here on. The publisher_did + slug\n\t\t// stay in the state row for update resolution and admin display.\n\t\tconst pluginId = await makeRegistryPluginId(publisherDid, slug);\n\n\t\t// Block installation if a configured (trusted) plugin shares this\n\t\t// id. Mirrors the marketplace install's PLUGIN_ID_CONFLICT check.\n\t\tif (opts?.configuredPluginIds?.has(pluginId)) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"PLUGIN_ID_CONFLICT\",\n\t\t\t\t\tmessage: \"A configured plugin with the same derived id already exists\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Check for an existing install (any source) under the derived id.\n\t\t// We reject all pre-existing rows -- if the row is from a registry\n\t\t// install of this same package, the caller should go through the\n\t\t// (future) update flow; if it's from any other source, the\n\t\t// pluginId collision means installing would silently mutate an\n\t\t// unrelated plugin's lifecycle row.\n\t\tconst stateRepo = new PluginStateRepository(db);\n\t\tconst existing = await stateRepo.get(pluginId);\n\t\tif (existing) {\n\t\t\tif (existing.source === \"registry\") {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: \"ALREADY_INSTALLED\",\n\t\t\t\t\t\tmessage: `Plugin ${publisherDid}/${slug} is already installed`,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"PLUGIN_ID_COLLISION\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`A non-registry plugin already exists at the derived id ${pluginId}. ` +\n\t\t\t\t\t\t\"Uninstall it before installing this registry plugin.\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Step 6: fetch bytes through an aggregator cache, the publisher PDS,\n\t\t// or the URL in the authoritative signed release. Every source remains untrusted.\n\t\tconst packageArtifact = release.artifacts.package;\n\t\tconst declaredChecksum = release.artifacts.package.checksum;\n\n\t\tif (!packageArtifact || !declaredChecksum) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"INVALID_RELEASE\",\n\t\t\t\t\tmessage: \"Release record is missing its package artifact or checksum\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tlet artifactBytes: Uint8Array;\n\t\ttry {\n\t\t\tartifactBytes = await fetchArtifact(\n\t\t\t\treleaseView.artifactCaches ?? [],\n\t\t\t\tpackageArtifact,\n\t\t\t\t{\n\t\t\t\t\tdid: publisherDid,\n\t\t\t\t\tcollection: NSID.packageRelease,\n\t\t\t\t\trkey: `${slug}:${version}`,\n\t\t\t\t\tcid: releaseView.cid,\n\t\t\t\t},\n\t\t\t\trelease.auth,\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tif (error instanceof RegistryArtifactFetchError) {\n\t\t\t\treturn registryArtifactError(error.code, error.message, \"install\");\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\n\t\t// Steps 6-7: verify the signed checksum, archive, manifest, and\n\t\t// expected package identity with the runtime-neutral verifier used\n\t\t// by the release service.\n\t\tconst artifactReport = await validateRegistryArtifact(\n\t\t\tartifactBytes,\n\t\t\tdeclaredChecksum,\n\t\t\tslug,\n\t\t\tversion,\n\t\t);\n\t\tif (!artifactReport.success) {\n\t\t\treturn registryArtifactError(\n\t\t\t\tartifactReport.error.code,\n\t\t\t\tartifactReport.error.message,\n\t\t\t\t\"install\",\n\t\t\t);\n\t\t}\n\t\tconst { bundle, artifactDigest, artifactDigests } = artifactReport.value;\n\t\tconst recordReport = await verifyAuthoritativePackageRelease(records, artifactDigest, {\n\t\t\t...opts?.authoritativeRecords,\n\t\t\tartifactDigests,\n\t\t});\n\t\tif (!recordReport.success) {\n\t\t\treturn registryRecordError(\n\t\t\t\trecordReport.code,\n\t\t\t\trecordReport.reasons[0]?.message ?? \"The release provenance is invalid.\",\n\t\t\t);\n\t\t}\n\t\tconst verification = recordVerificationSummary(records, recordReport);\n\n\t\t// Rewrite the manifest's id to the derived opaque pluginId before\n\t\t// it reaches R2 storage or the sandbox loader. The sandbox uses\n\t\t// `manifest.id` as its identity for per-plugin storage and bridge\n\t\t// calls; addressing it by the same pluginId we use in the runtime\n\t\t// cache, R2 prefix, and `_plugin_state` row keeps every layer\n\t\t// in sync and prevents registry installs from colliding with\n\t\t// marketplace plugins that happen to share the publisher's slug.\n\t\tbundle.manifest = { ...bundle.manifest, id: pluginId };\n\n\t\t// Integrity: the bundle that will run MUST declare exactly the access\n\t\t// the signed release record advertises. The consent dialog is driven\n\t\t// from the record's `declaredAccess`, so a bundle enforcing something\n\t\t// different -- a wider host allow-list, an extra capability -- would run\n\t\t// outside what the user reviewed. The capability-set consent gate below\n\t\t// is blind to constraint content (host scope), so compare the full\n\t\t// enforced access of record vs bundle here and refuse on any difference.\n\t\tif (\n\t\t\t!verifiedAccessEqual(recordReport.value.declaredAccess, bundle.manifest.declaredAccess ?? {})\n\t\t) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"DECLARED_ACCESS_DRIFT\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"The plugin bundle declares different permissions than its published record. Installation refused.\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Capability consent gate: the admin MUST acknowledge the\n\t\t// capabilities the bundle's manifest actually declares before we\n\t\t// install it. The bundle manifest is the runtime enforcement\n\t\t// currency; the exact-equality check above binds it to the\n\t\t// independently verified signed release.\n\t\t//\n\t\t// Two outcomes after normalization (filter to strings, dedupe,\n\t\t// sort):\n\t\t//\n\t\t// 1. The bundle declares no capabilities: install is allowed\n\t\t// without any acknowledgement (nothing to consent to).\n\t\t// 2. The bundle declares capabilities: install requires the\n\t\t// caller to send `acknowledgedDeclaredAccess`, and the\n\t\t// sorted lists must match exactly.\n\t\t//\n\t\t// We compare against the bundle's *capabilities* (the legacy\n\t\t// shape) for v1 because EmDash's existing sandbox enforces\n\t\t// capabilities, not the RFC's structured `declaredAccess`. Once\n\t\t// the runtime starts enforcing `declaredAccess` natively, this\n\t\t// comparison switches to that shape.\n\t\tconst actualCapabilities = canonicalCapabilitiesForDriftCheck(bundle.manifest.capabilities);\n\t\tif (!opts?.verifyOnly && actualCapabilities.length > 0) {\n\t\t\tif (input.acknowledgedDeclaredAccess === undefined) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: \"DECLARED_ACCESS_REQUIRED\",\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\"This plugin declares capabilities that require consent. Re-open the install dialog to review and acknowledge them.\",\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst acknowledged = canonicalCapabilitiesForDriftCheck(input.acknowledgedDeclaredAccess);\n\t\t\tif (\n\t\t\t\tacknowledged.length !== actualCapabilities.length ||\n\t\t\t\tacknowledged.some((cap, i) => cap !== actualCapabilities[i])\n\t\t\t) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: \"DECLARED_ACCESS_DRIFT\",\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\"Plugin manifest has changed since you consented. Re-open the install dialog to review the new permissions.\",\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tconst actualMcpTools = (bundle.manifest.mcp?.tools ?? []).map(\n\t\t\t({ inputSchema: _, outputSchema: __, ...tool }) => tool,\n\t\t);\n\t\tif (!opts?.verifyOnly && actualMcpTools.length > 0) {\n\t\t\tif (JSON.stringify(input.acknowledgedMcpTools) !== JSON.stringify(actualMcpTools)) {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: \"MCP_TOOL_CONSENT_REQUIRED\",\n\t\t\t\t\t\tmessage: \"Plugin MCP tools require explicit consent\",\n\t\t\t\t\t\tdetails: { mcpTools: actualMcpTools, verification },\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tconst result: RegistryInstallResult = {\n\t\t\tpluginId,\n\t\t\tpublisherDid,\n\t\t\tslug,\n\t\t\tversion,\n\t\t\tcapabilities: bundle.manifest.capabilities,\n\t\t\tdeclaredAccess: recordReport.value.releaseExtension.declaredAccess,\n\t\t\tmcpTools: actualMcpTools,\n\t\t\tverification,\n\t\t};\n\t\tif (opts?.verifyOnly) return { success: true, data: result };\n\n\t\t// Step 7: store in R2 under the registry prefix.\n\t\tawait storeBundleInR2(storage, pluginId, version, bundle, \"registry\");\n\n\t\t// Step 8: write plugin state.\n\t\t// Display name and description come from the *package profile*\n\t\t// (the signed record from the publisher's repo), not from the\n\t\t// bundle manifest -- the manifest carries the trust contract,\n\t\t// the profile carries the marketing copy.\n\t\t//\n\t\t// On failure, we may need to clean up the R2 bundle we just\n\t\t// wrote. But two parallel installs of the same (did, slug,\n\t\t// version) both pass the earlier `existing` check at line 822\n\t\t// (the read is not transactional with the insert), both upload\n\t\t// to the same deterministic R2 prefix (overwrites are\n\t\t// content-identical because R2 keys include the version and\n\t\t// the bundle is checksum-verified upstream), and then one wins\n\t\t// the insert while the other fails with a PK constraint\n\t\t// violation.\n\t\t//\n\t\t// If we blindly clean up R2 on every state-write failure, the\n\t\t// loser of that race would delete the winner's bundle and the\n\t\t// runtime would fail to load the plugin on the next sync.\n\t\t//\n\t\t// Instead: on state-write failure, re-query the state row. If\n\t\t// a row now exists for this pluginId, we lost the race -- the\n\t\t// winner owns the R2 bundle and we must not touch it. If the\n\t\t// row doesn't exist, the failure was a real DB error and the\n\t\t// R2 bytes are orphans; clean them up.\n\t\t//\n\t\t// Cleanup is best-effort; if it also fails, the row failure\n\t\t// still surfaces to the caller and the orphan R2 bundle costs\n\t\t// only the storage of a single checksum-verified zip.\n\t\ttry {\n\t\t\tawait stateRepo.upsert(pluginId, version, \"active\", {\n\t\t\t\tsource: \"registry\",\n\t\t\t\tdisplayName: profile.name ?? slug,\n\t\t\t\tdescription: profile.description ?? undefined,\n\t\t\t\tregistryPublisherDid: publisherDid,\n\t\t\t\tregistrySlug: slug,\n\t\t\t});\n\t\t} catch (stateErr) {\n\t\t\tlet lostRace = false;\n\t\t\ttry {\n\t\t\t\tconst winner = await stateRepo.get(pluginId);\n\t\t\t\tlostRace = winner !== undefined && winner !== null;\n\t\t\t} catch (probeErr) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[registry-install] Failed to probe state row for ${pluginId} after state-write failure; treating as orphan:`,\n\t\t\t\t\tprobeErr,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!lostRace) {\n\t\t\t\ttry {\n\t\t\t\t\tawait deleteBundleFromR2(storage, pluginId, version, \"registry\");\n\t\t\t\t} catch (cleanupErr) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`[registry-install] Failed to clean up R2 bundle for ${pluginId}@${version} after state-row write failure:`,\n\t\t\t\t\t\tcleanupErr,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow stateErr;\n\t\t}\n\n\t\tawait syncDeclaredStorageIndexes(db, [bundle.manifest]);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: result,\n\t\t};\n\t} catch (err) {\n\t\tif (err instanceof ClientValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"AGGREGATOR_RESPONSE_INVALID\",\n\t\t\t\t\tmessage: `Aggregator returned a response that does not conform to its lexicon (${err.target})`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (err instanceof ClientResponseError) {\n\t\t\tif (err.error === \"ListingUnavailable\") {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: \"LISTING_UNAVAILABLE\",\n\t\t\t\t\t\tmessage: \"This plugin is unavailable under the active registry policy\",\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: err.status === 404 ? \"AGGREGATOR_NOT_FOUND\" : \"AGGREGATOR_HTTP_ERROR\",\n\t\t\t\t\tmessage: `Aggregator returned ${err.status}: ${err.error}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (err instanceof EmDashStorageError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: err.code ?? \"STORAGE_ERROR\",\n\t\t\t\t\tmessage: \"Storage error while installing plugin\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"[registry-install] Failed:\", err);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"INSTALL_FAILED\",\n\t\t\t\tmessage: err instanceof Error ? err.message : \"Failed to install plugin from registry\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n// ── Uninstall ──────────────────────────────────────────────────────\n\nexport interface RegistryUninstallResult {\n\tpluginId: string;\n\t/** True when `_plugin_storage` rows were also deleted (opts.deleteData). */\n\tdataDeleted: boolean;\n}\n\n/**\n * Uninstall a registry-source plugin. Deletes the R2 bundle under\n * `registry/<pluginId>/<version>/`, optionally drops the plugin's\n * `_plugin_storage` rows, and removes the `_plugin_state` row. The\n * sandbox runtime is reconciled by the route's `syncRegistryPlugins`\n * call after this returns.\n *\n * Refuses to uninstall plugins whose `source` is not `\"registry\"` to\n * avoid trashing a marketplace/config plugin that happens to share the\n * pluginId namespace.\n */\nexport async function handleRegistryUninstall(\n\tdb: Kysely<Database>,\n\tstorage: Storage | null,\n\tpluginId: string,\n\topts?: { deleteData?: boolean },\n): Promise<ApiResult<RegistryUninstallResult>> {\n\ttry {\n\t\tconst stateRepo = new PluginStateRepository(db);\n\t\tconst existing = await stateRepo.get(pluginId);\n\t\tif (!existing || existing.source !== \"registry\") {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: `No registry plugin found: ${pluginId}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// `_plugin_state.version` carries the installed version directly for\n\t\t// registry-source rows (there's no shadow column like marketplace's\n\t\t// `marketplaceVersion`). Use it verbatim for the R2 prefix.\n\t\tconst version = existing.version;\n\n\t\t// Order: optional storage cleanup → bundle delete → state row delete.\n\t\t// The most failure-prone step runs first so a transient DB error\n\t\t// (deadlock, contention) cascades to the outer catch with the state\n\t\t// row and bundle intact — admin retries safely. Bundle delete is\n\t\t// idempotent on misses.\n\t\tlet dataDeleted = false;\n\t\tif (opts?.deleteData) {\n\t\t\tawait db.deleteFrom(\"_plugin_storage\").where(\"plugin_id\", \"=\", pluginId).execute();\n\t\t\tdataDeleted = true;\n\t\t}\n\n\t\tif (storage) {\n\t\t\tawait deleteBundleFromR2(storage, pluginId, version, \"registry\");\n\t\t}\n\n\t\ttry {\n\t\t\tawait removeAllPluginIndexes(db, pluginId);\n\t\t} catch {\n\t\t\t// Nothing to drop, or tracking table predates the feature\n\t\t}\n\n\t\tawait stateRepo.delete(pluginId);\n\n\t\treturn { success: true, data: { pluginId, dataDeleted } };\n\t} catch (err) {\n\t\tconsole.error(\"[registry-uninstall] Failed:\", err);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"UNINSTALL_FAILED\",\n\t\t\t\tmessage: \"Failed to uninstall plugin\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n// ── Update ─────────────────────────────────────────────────────────\n\nexport interface RegistryUpdateResult {\n\tpluginId: string;\n\toldVersion: string;\n\tnewVersion: string;\n\tcapabilityChanges: { added: string[]; removed: string[] };\n\t/** Set only when `newlyPublic` is non-empty, mirroring marketplace. */\n\trouteVisibilityChanges?: { newlyPublic: string[] };\n\tverification: RegistryRecordVerificationSummary;\n}\n\n/**\n * Update a registry-source plugin to a newer release. Mirrors\n * `handleMarketplaceUpdate`: resolves the target version via the aggregator,\n * re-runs the artifact fetch / checksum / extract pipeline, diffs capabilities\n * and route visibility against the currently installed bundle, and gates\n * escalations behind `confirmCapabilityChanges` / `confirmRouteVisibilityChanges`\n * so the admin re-consents to widened permissions.\n *\n * Refuses non-registry sources. Refuses when the stored state row is missing\n * the `(publisherDid, slug)` it needs to resolve against the aggregator.\n */\nexport async function handleRegistryUpdate(\n\tdb: Kysely<Database>,\n\tstorage: Storage | null,\n\tsandboxRunner: SandboxRunner | null,\n\tregistryConfigInput: RegistryConfigInput | undefined,\n\tpluginId: string,\n\topts?: {\n\t\tversion?: string;\n\t\tconfirmCapabilityChanges?: boolean;\n\t\tconfirmRouteVisibilityChanges?: boolean;\n\t\tconfirmMcpTools?: boolean;\n\t\tacknowledgedProfileCid?: string;\n\t\tacknowledgedReleaseCid?: string;\n\t\thostEnv?: HostEnv;\n\t\tauthoritativeRecords?: AuthoritativeRecordReadOptions;\n\t\treadAuthoritativeRecords?: AuthoritativeRecordReader;\n\t},\n): Promise<ApiResult<RegistryUpdateResult>> {\n\tconst registryConfig = coerceRegistryConfig(registryConfigInput);\n\tif (!registryConfig) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"REGISTRY_NOT_CONFIGURED\", message: \"Registry is not configured\" },\n\t\t};\n\t}\n\tif (!storage) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"STORAGE_NOT_CONFIGURED\",\n\t\t\t\tmessage: \"Storage is required for registry plugin updates\",\n\t\t\t},\n\t\t};\n\t}\n\tif (!sandboxRunner || !sandboxRunner.isAvailable()) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"SANDBOX_NOT_AVAILABLE\", message: \"Sandbox runner is required\" },\n\t\t};\n\t}\n\ttry {\n\t\tvalidateAggregatorUrl(registryConfig.aggregatorUrl);\n\t} catch (err) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"REGISTRY_NOT_CONFIGURED\",\n\t\t\t\tmessage: err instanceof Error ? err.message : \"Invalid aggregator URL\",\n\t\t\t},\n\t\t};\n\t}\n\n\ttry {\n\t\tconst stateRepo = new PluginStateRepository(db);\n\t\tconst existing = await stateRepo.get(pluginId);\n\t\tif (!existing || existing.source !== \"registry\") {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"NOT_FOUND\", message: `No registry plugin found: ${pluginId}` },\n\t\t\t};\n\t\t}\n\t\tif (!existing.registryPublisherDid || !existing.registrySlug) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"INVALID_STATE\",\n\t\t\t\t\tmessage: `Registry plugin ${pluginId} is missing publisher DID or slug in state`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconst oldVersion = existing.version;\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- existing.registryPublisherDid is a DID string written by the install handler\n\t\tconst publisherDid = existing.registryPublisherDid as Did;\n\t\tconst slug = existing.registrySlug;\n\n\t\tconst { DiscoveryClient, registryLabelerPolicy } =\n\t\t\tawait import(\"@emdash-cms/registry-client/discovery\");\n\t\tconst aggregatorDeadline = Date.now() + AGGREGATOR_TOTAL_BUDGET_MS;\n\t\tconst discovery = new DiscoveryClient({\n\t\t\taggregatorUrl: registryConfig.aggregatorUrl,\n\t\t\tacceptLabelers: registryConfig.acceptLabelers,\n\t\t\tlabelerPolicy: registryLabelerPolicy(registryConfig.acceptLabelers),\n\t\t\tfetch: timedFetch(aggregatorDeadline),\n\t\t});\n\n\t\t// Resolve target release. Explicit version → paginate listReleases;\n\t\t// otherwise getLatestRelease (aggregator applies its own filters).\n\t\tconst MAX_LIST_PAGES = 20;\n\t\tconst releaseView = await (async () => {\n\t\t\tif (!opts?.version) {\n\t\t\t\treturn discovery.getLatestRelease({ did: publisherDid, package: slug });\n\t\t\t}\n\t\t\tlet cursor: string | undefined;\n\t\t\tconst seenCursors = new Set<string>();\n\t\t\tfor (let page = 0; page < MAX_LIST_PAGES; page++) {\n\t\t\t\tif (cursor !== undefined) {\n\t\t\t\t\tif (seenCursors.has(cursor)) break;\n\t\t\t\t\tseenCursors.add(cursor);\n\t\t\t\t}\n\t\t\t\tconst result = await discovery.listReleases({\n\t\t\t\t\tdid: publisherDid,\n\t\t\t\t\tpackage: slug,\n\t\t\t\t\tcursor,\n\t\t\t\t\tlimit: 50,\n\t\t\t\t});\n\t\t\t\tfor (const r of result.releases) {\n\t\t\t\t\tif (r.version === opts.version) return r;\n\t\t\t\t}\n\t\t\t\tif (!result.cursor) break;\n\t\t\t\tcursor = result.cursor;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t})();\n\n\t\tif (!releaseView) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"NO_VERSION\",\n\t\t\t\t\tmessage: opts?.version\n\t\t\t\t\t\t? `Version ${opts.version} not found for ${publisherDid}/${slug}`\n\t\t\t\t\t\t: `No installable release found for ${publisherDid}/${slug}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// The aggregator selects the target version and supplies mirrors and\n\t\t// moderation metadata. Its release-record copy is not trusted.\n\t\tif (\n\t\t\treleaseView.did !== publisherDid ||\n\t\t\treleaseView.package !== slug ||\n\t\t\t(opts?.version !== undefined && releaseView.version !== opts.version)\n\t\t) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"AGGREGATOR_IDENTITY_MISMATCH\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"Aggregator returned a release view that does not match the requested package or version.\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconst packageView = await discovery.getPackage({ did: publisherDid, slug });\n\t\tif (!packageView || packageView.did !== publisherDid || packageView.slug !== slug) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"AGGREGATOR_IDENTITY_MISMATCH\",\n\t\t\t\t\tmessage: \"Aggregator returned a package view that does not match the installed plugin.\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst newVersion = releaseView.version;\n\t\tif (evaluateRegistryReleaseWithdrawal(releaseView, discovery.labelerPolicy).withdrawn) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"YANKED\", message: \"Release has been withdrawn\" },\n\t\t\t};\n\t\t}\n\t\tif (newVersion === oldVersion) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"ALREADY_UP_TO_DATE\",\n\t\t\t\t\tmessage: \"Plugin is already at the requested version\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconst authoritative = await (opts?.readAuthoritativeRecords ?? readAuthoritativePackageRelease)(\n\t\t\tpublisherDid,\n\t\t\tslug,\n\t\t\tnewVersion,\n\t\t\topts?.authoritativeRecords,\n\t\t);\n\t\tif (!authoritative.success) {\n\t\t\treturn registryRecordError(authoritative.error.code, authoritative.error.message);\n\t\t}\n\t\tconst records = authoritative.value;\n\t\tconst { profile, release } = records.inspection.value;\n\t\tif (\n\t\t\tpackageView.uri !== records.profile.uri ||\n\t\t\tpackageView.cid !== records.profile.cid ||\n\t\t\treleaseView.uri !== records.release.uri ||\n\t\t\treleaseView.cid !== records.release.cid\n\t\t) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"AGGREGATOR_RECORD_MISMATCH\",\n\t\t\t\t\tmessage: \"Aggregator metadata does not match the publisher's signed records.\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconst packageYanked =\n\t\t\thasCurrentRecordLabel(packageView.labels ?? [], \"security:yanked\", records.profile) ||\n\t\t\thasCurrentRecordLabel(packageView.labels ?? [], \"security-yanked\", records.profile);\n\t\tif (packageYanked) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: \"YANKED\", message: \"Package has been withdrawn\" },\n\t\t\t};\n\t\t}\n\t\tif (\n\t\t\topts?.confirmCapabilityChanges ||\n\t\t\topts?.confirmRouteVisibilityChanges ||\n\t\t\topts?.confirmMcpTools\n\t\t) {\n\t\t\tconst consentError = recordConsentError(\n\t\t\t\t{\n\t\t\t\t\tprofileCid: opts.acknowledgedProfileCid,\n\t\t\t\t\treleaseCid: opts.acknowledgedReleaseCid,\n\t\t\t\t},\n\t\t\t\trecords,\n\t\t\t);\n\t\t\tif (consentError) return consentError;\n\t\t}\n\t\t// Environment compatibility remains independent from listing approval.\n\t\t// An ungated update could otherwise\n\t\t// land a version whose `requires` the host doesn't satisfy. Same\n\t\t// guard as install; `requires` is lexicon-`unknown`.\n\t\tif (opts?.hostEnv) {\n\t\t\tconst envError = assertEnvCompatible(release.requires, opts.hostEnv);\n\t\t\tif (envError) return { success: false, error: envError };\n\t\t}\n\n\t\tconst packageArtifact = release.artifacts.package;\n\t\tconst declaredChecksum = packageArtifact?.checksum;\n\t\tif (!packageArtifact || !declaredChecksum) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"INVALID_RELEASE\",\n\t\t\t\t\tmessage: \"Release record is missing its package artifact or checksum\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tlet artifactBytes: Uint8Array;\n\t\ttry {\n\t\t\tartifactBytes = await fetchArtifact(\n\t\t\t\treleaseView.artifactCaches ?? [],\n\t\t\t\tpackageArtifact,\n\t\t\t\t{\n\t\t\t\t\tdid: publisherDid,\n\t\t\t\t\tcollection: NSID.packageRelease,\n\t\t\t\t\trkey: `${slug}:${newVersion}`,\n\t\t\t\t\tcid: releaseView.cid,\n\t\t\t\t},\n\t\t\t\trelease.auth,\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tif (error instanceof RegistryArtifactFetchError) {\n\t\t\t\treturn registryArtifactError(error.code, error.message, \"update\");\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\tconst artifactReport = await validateRegistryArtifact(\n\t\t\tartifactBytes,\n\t\t\tdeclaredChecksum,\n\t\t\tslug,\n\t\t\tnewVersion,\n\t\t);\n\t\tif (!artifactReport.success) {\n\t\t\treturn registryArtifactError(\n\t\t\t\tartifactReport.error.code,\n\t\t\t\tartifactReport.error.message,\n\t\t\t\t\"update\",\n\t\t\t);\n\t\t}\n\t\tconst { bundle, artifactDigest, artifactDigests } = artifactReport.value;\n\t\tconst recordReport = await verifyAuthoritativePackageRelease(records, artifactDigest, {\n\t\t\t...opts?.authoritativeRecords,\n\t\t\tartifactDigests,\n\t\t});\n\t\tif (!recordReport.success) {\n\t\t\treturn registryRecordError(\n\t\t\t\trecordReport.code,\n\t\t\t\trecordReport.reasons[0]?.message ?? \"The release provenance is invalid.\",\n\t\t\t);\n\t\t}\n\t\tconst verification = recordVerificationSummary(records, recordReport);\n\n\t\t// Rewrite manifest.id to the opaque pluginId so the sandbox loader\n\t\t// and R2 layout stay in sync across install and update.\n\t\tbundle.manifest = { ...bundle.manifest, id: pluginId };\n\n\t\t// Integrity: same gate as install. The new bundle must declare exactly\n\t\t// the access its signed release record advertises. Without it, an update\n\t\t// that changes only the host scope (e.g. api.good.com -> evil.com) keeps\n\t\t// the capability set identical, sails through the escalation diff below,\n\t\t// and installs a bundle enforcing a scope the record never showed.\n\t\tif (\n\t\t\t!verifiedAccessEqual(recordReport.value.declaredAccess, bundle.manifest.declaredAccess ?? {})\n\t\t) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"DECLARED_ACCESS_DRIFT\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t\"The plugin bundle declares different permissions than its published record. Update refused.\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Diff capabilities + route visibility against the currently\n\t\t// installed bundle. Loading from R2 keeps us honest: the diff is\n\t\t// against the bytes the sandbox is actually running, not whatever\n\t\t// the state row claims.\n\t\tconst oldBundle = await loadBundleFromR2(storage, pluginId, oldVersion, \"registry\");\n\t\tconst oldCaps = oldBundle?.manifest.capabilities ?? [];\n\t\tconst capabilityChanges = diffCapabilities(oldCaps, bundle.manifest.capabilities);\n\t\tconst hasEscalation = capabilityChanges.added.length > 0;\n\t\tif (hasEscalation && !opts?.confirmCapabilityChanges) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"CAPABILITY_ESCALATION\",\n\t\t\t\t\tmessage: \"Plugin update requires new capabilities\",\n\t\t\t\t\tdetails: { capabilityChanges, verification },\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst routeVisibilityChanges = diffRouteVisibility(oldBundle?.manifest, bundle.manifest);\n\t\tconst hasNewPublicRoutes = routeVisibilityChanges.newlyPublic.length > 0;\n\t\tif (hasNewPublicRoutes && !opts?.confirmRouteVisibilityChanges) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"ROUTE_VISIBILITY_ESCALATION\",\n\t\t\t\t\tmessage: \"Plugin update exposes new public (unauthenticated) routes\",\n\t\t\t\t\tdetails: { routeVisibilityChanges, capabilityChanges, verification },\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst oldMcpTools = [...(oldBundle?.manifest.mcp?.tools ?? [])].toSorted((a, b) =>\n\t\t\ta.name.localeCompare(b.name),\n\t\t);\n\t\tconst newMcpTools = [...(bundle.manifest.mcp?.tools ?? [])].toSorted((a, b) =>\n\t\t\ta.name.localeCompare(b.name),\n\t\t);\n\t\tif (JSON.stringify(oldMcpTools) !== JSON.stringify(newMcpTools) && !opts?.confirmMcpTools) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"MCP_TOOL_CONSENT_REQUIRED\",\n\t\t\t\t\tmessage: \"Plugin update changes its MCP tools\",\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tmcpTools: newMcpTools.map(({ inputSchema: _, outputSchema: __, ...tool }) => tool),\n\t\t\t\t\t\tverification,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Store new bundle. R2 prefix is deterministic per (pluginId, version),\n\t\t// so a retry of the same update is idempotent.\n\t\tawait storeBundleInR2(storage, pluginId, newVersion, bundle, \"registry\");\n\n\t\t// Refresh display metadata from the same signed profile used for\n\t\t// release-policy verification.\n\t\tawait stateRepo.upsert(pluginId, newVersion, \"active\", {\n\t\t\tsource: \"registry\",\n\t\t\tregistryPublisherDid: publisherDid,\n\t\t\tregistrySlug: slug,\n\t\t\tdisplayName: profile.name ?? slug,\n\t\t\tdescription: profile.description ?? undefined,\n\t\t\tmcpToolsEnabled: false,\n\t\t\tmcpToolsConsent: null,\n\t\t});\n\n\t\tawait syncDeclaredStorageIndexes(db, [bundle.manifest]);\n\n\t\t// Best-effort cleanup of the old bundle. Failures here don't roll\n\t\t// back the upgrade (the new bundle is already stored and committed\n\t\t// in the state row); the orphan is just storage we'll pay for.\n\t\tdeleteBundleFromR2(storage, pluginId, oldVersion, \"registry\").catch(() => {});\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\tpluginId,\n\t\t\t\toldVersion,\n\t\t\t\tnewVersion,\n\t\t\t\tcapabilityChanges,\n\t\t\t\trouteVisibilityChanges: hasNewPublicRoutes ? routeVisibilityChanges : undefined,\n\t\t\t\tverification,\n\t\t\t},\n\t\t};\n\t} catch (err) {\n\t\tif (err instanceof ClientValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"AGGREGATOR_RESPONSE_INVALID\",\n\t\t\t\t\tmessage: `Aggregator returned a response that does not conform to its lexicon (${err.target})`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (err instanceof ClientResponseError) {\n\t\t\tif (err.error === \"ListingUnavailable\") {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: \"LISTING_UNAVAILABLE\",\n\t\t\t\t\t\tmessage: \"This plugin is unavailable under the active registry policy\",\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: err.status === 404 ? \"AGGREGATOR_NOT_FOUND\" : \"AGGREGATOR_HTTP_ERROR\",\n\t\t\t\t\tmessage: `Aggregator returned ${err.status}: ${err.error}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (err instanceof EmDashStorageError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: err.code ?? \"STORAGE_ERROR\",\n\t\t\t\t\tmessage: \"Storage error while updating plugin\",\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"[registry-update] Failed:\", err);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: \"UPDATE_FAILED\",\n\t\t\t\tmessage: err instanceof Error ? err.message : \"Failed to update plugin\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n// ── Update check ───────────────────────────────────────────────────\n\nexport interface RegistryUpdateCheck {\n\tpluginId: string;\n\tinstalled: string;\n\tlatest: string;\n\thasUpdate: boolean;\n\t/**\n\t * Both diff fields are `false` here by design: computing them at\n\t * update-check time would require downloading both bundles (or\n\t * extracting from the signed release extension and the installed\n\t * R2 bundle), which is too expensive for a bulk preview. The actual\n\t * escalation gate runs at update time in `handleRegistryUpdate`.\n\t * Mirrors marketplace's `hasRouteVisibilityChanges: false`.\n\t */\n\thasCapabilityChanges: boolean;\n\thasRouteVisibilityChanges: boolean;\n}\n\n/**\n * Bulk update check across every installed registry plugin. Queries the\n * aggregator for each plugin's latest release and reports `hasUpdate`\n * based on the version comparison. Plugins whose aggregator lookup fails\n * (unreachable, delisted, malformed) are skipped silently — one bad\n * publisher must not blank the whole admin Updates list.\n */\nexport async function handleRegistryUpdateCheck(\n\tdb: Kysely<Database>,\n\tregistryConfigInput: RegistryConfigInput | undefined,\n): Promise<ApiResult<{ items: RegistryUpdateCheck[] }>> {\n\tconst registryConfig = coerceRegistryConfig(registryConfigInput);\n\tif (!registryConfig) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"REGISTRY_NOT_CONFIGURED\", message: \"Registry is not configured\" },\n\t\t};\n\t}\n\n\ttry {\n\t\tconst stateRepo = new PluginStateRepository(db);\n\t\tconst registryPlugins = await stateRepo.getRegistryPlugins();\n\t\tif (registryPlugins.length === 0) {\n\t\t\treturn { success: true, data: { items: [] } };\n\t\t}\n\n\t\tconst { DiscoveryClient, registryLabelerPolicy } =\n\t\t\tawait import(\"@emdash-cms/registry-client/discovery\");\n\t\tconst aggregatorDeadline = Date.now() + AGGREGATOR_TOTAL_BUDGET_MS;\n\t\tconst discovery = new DiscoveryClient({\n\t\t\taggregatorUrl: registryConfig.aggregatorUrl,\n\t\t\tacceptLabelers: registryConfig.acceptLabelers,\n\t\t\tlabelerPolicy: registryLabelerPolicy(registryConfig.acceptLabelers),\n\t\t\tfetch: timedFetch(aggregatorDeadline),\n\t\t});\n\n\t\tconst items: RegistryUpdateCheck[] = [];\n\t\tfor (const plugin of registryPlugins) {\n\t\t\tif (!plugin.registryPublisherDid || !plugin.registrySlug) continue;\n\t\t\ttry {\n\t\t\t\tconst releaseView = await discovery.getLatestRelease({\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- DID string was validated by the install handler\n\t\t\t\t\tdid: plugin.registryPublisherDid as Did,\n\t\t\t\t\tpackage: plugin.registrySlug,\n\t\t\t\t});\n\t\t\t\tif (evaluateRegistryReleaseWithdrawal(releaseView, discovery.labelerPolicy).withdrawn) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst latest = releaseView.version;\n\t\t\t\tif (!latest) continue;\n\t\t\t\tconst installed = plugin.version;\n\t\t\t\titems.push({\n\t\t\t\t\tpluginId: plugin.pluginId,\n\t\t\t\t\tinstalled,\n\t\t\t\t\tlatest,\n\t\t\t\t\thasUpdate: latest !== installed,\n\t\t\t\t\thasCapabilityChanges: false,\n\t\t\t\t\thasRouteVisibilityChanges: false,\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\t// Skip plugins that can't be checked. Don't fail the whole\n\t\t\t\t// list because one aggregator query went wrong.\n\t\t\t\tconsole.warn(`[registry-update-check] Skipped ${plugin.pluginId}:`, err);\n\t\t\t}\n\t\t}\n\n\t\treturn { success: true, data: { items } };\n\t} catch (err) {\n\t\tif (err instanceof ClientValidationError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: \"AGGREGATOR_RESPONSE_INVALID\",\n\t\t\t\t\tmessage: `Aggregator returned a response that does not conform to its lexicon (${err.target})`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tif (err instanceof ClientResponseError) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: err.status === 404 ? \"AGGREGATOR_NOT_FOUND\" : \"AGGREGATOR_HTTP_ERROR\",\n\t\t\t\t\tmessage: `Aggregator returned ${err.status}: ${err.error}`,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\tconsole.error(\"[registry-update-check] Failed:\", err);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: { code: \"UPDATE_CHECK_FAILED\", message: \"Failed to check for registry updates\" },\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,SAAgB,UAAU,MAA2B;AACpD,QAAO,aAAa,GAAG,KAAK,QAAQ,GAAG,KAAK,YAAY;;;;;;AAOzD,SAAgB,UAAU,KAA4D;AACrF,KAAI;EACH,MAAM,UAAUA,eAAa,IAAI;EACjC,MAAM,WAAW,QAAQ,QAAQ,IAAI;AACrC,MAAI,aAAa,GAAI,QAAO;EAE5B,MAAM,UAAU,SAAS,QAAQ,MAAM,GAAG,SAAS,EAAE,GAAG;EACxD,MAAM,YAAY,QAAQ,MAAM,WAAW,EAAE;AAE7C,MAAI,MAAM,QAAQ,IAAI,CAAC,UAAW,QAAO;AACzC,SAAO;GAAE;GAAS;GAAW;SACtB;AACP,SAAO;;;;;;;AAQT,SAAgB,YACf,KACA,MACsD;AAEtD,KAAI,CAAC,IAAK,QAAO,EAAE,OAAO,MAAM;CAEhC,MAAM,UAAU,UAAU,IAAI;AAC9B,KAAI,CAAC,QACJ,QAAO;EAAE,OAAO;EAAO,SAAS;EAAwB;AAGzD,KAAI,QAAQ,YAAY,KAAK,WAAW,QAAQ,cAAc,KAAK,UAClE,QAAO;EACN,OAAO;EACP,SAAS;EACT;AAGF,QAAO,EAAE,OAAO,MAAM;;;;;AC7CvB,SAAS,WAAW,OAAsC;AACzD,KAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;AAClD,KAAI,OAAO,UAAU,YAAY,MAAM,QAAQ,MAAM,CAAE,QAAO;A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