convex-cms 0.0.6 → 0.0.7
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/README.md +68 -101
- package/admin/src/components/BreakingChangesWarningDialog.tsx +5 -5
- package/admin/src/components/BulkOperationModal.tsx +14 -14
- package/admin/src/components/ContentEntryEditor.tsx +8 -8
- package/admin/src/components/ContentTypeFormModal.tsx +122 -82
- package/admin/src/components/Header.tsx +5 -2
- package/admin/src/components/SchemaDriftWarning.tsx +126 -0
- package/admin/src/components/TaxonomyEditor.tsx +2 -2
- package/admin/src/components/TermTree.tsx +3 -3
- package/admin/src/components/UploadDropzone.tsx +7 -7
- package/admin/src/components/VersionCompare.tsx +13 -13
- package/admin/src/components/VersionHistory.tsx +2 -2
- package/admin/src/components/VersionRollbackModal.tsx +5 -5
- package/admin/src/components/cmsds/CmsButton.tsx +2 -2
- package/admin/src/components/cmsds/CmsDialog.tsx +4 -1
- package/admin/src/components/cmsds/CmsStatusBadge.tsx +5 -5
- package/admin/src/components/fields/JsonField.tsx +1 -1
- package/admin/src/components/fields/ReferenceField.tsx +9 -9
- package/admin/src/components/fields/TagField.tsx +1 -1
- package/admin/src/contexts/SettingsConfigContext.tsx +10 -3
- package/admin/src/embed/index.tsx +29 -9
- package/admin/src/embed/pages/ContentTypeEntries.tsx +25 -0
- package/admin/src/embed/pages/Entry.tsx +114 -0
- package/admin/src/embed/pages/Media.tsx +3 -1
- package/admin/src/embed/pages/NewEntry.tsx +83 -0
- package/admin/src/embed/pages/index.ts +3 -0
- package/admin/src/pages/ContentPage.tsx +27 -20
- package/admin/src/pages/ContentTypeEntriesPage.tsx +466 -0
- package/admin/src/pages/ContentTypesPage.tsx +65 -19
- package/admin/src/pages/DashboardPage.tsx +3 -0
- package/admin/src/pages/SettingsPage.tsx +4 -4
- package/admin/src/pages/index.ts +1 -0
- package/admin/src/routes/__root.tsx +10 -10
- package/admin/src/routes/entries/$entryId.tsx +1 -1
- package/admin/src/routes/entries/type/$contentTypeId.tsx +1 -1
- package/admin/src/styles/globals.css +31 -5
- package/admin/src/styles/tailwind-config.css +25 -0
- package/admin/src/styles/theme.css +50 -0
- package/admin-dist/nitro.json +1 -1
- package/admin-dist/public/assets/CmsEmptyState-6-PLaXtD.js +1 -0
- package/admin-dist/public/assets/CmsPageHeader-SoF4Epu9.js +1 -0
- package/admin-dist/public/assets/CmsStatusBadge-D7kYaohx.js +1 -0
- package/admin-dist/public/assets/{CmsSurface-DBy5Lumx.js → CmsSurface-BvksBm6W.js} +1 -1
- package/admin-dist/public/assets/CmsToolbar-DlZPMe2B.js +1 -0
- package/admin-dist/public/assets/ContentEntryEditor-C6n9xLS9.js +4 -0
- package/admin-dist/public/assets/TaxonomyFilter-CFX1_g8s.js +1 -0
- package/admin-dist/public/assets/_contentTypeId-DTv8UoTp.js +1 -0
- package/admin-dist/public/assets/_entryId-D3lr5Dvy.js +1 -0
- package/admin-dist/public/assets/alert-BAHTL6ao.js +1 -0
- package/admin-dist/public/assets/badge-oJv4Eai8.js +1 -0
- package/admin-dist/public/assets/{circle-check-big-CpLxAvEj.js → circle-check-big-3OHxNDhO.js} +1 -1
- package/admin-dist/public/assets/command-DwgQs69u.js +1 -0
- package/admin-dist/public/assets/content-CKQ4QwW2.js +1 -0
- package/admin-dist/public/assets/content-types-BrttaLpc.js +1 -0
- package/admin-dist/public/assets/globals-CoCRjt0K.css +1 -0
- package/admin-dist/public/assets/index-DOkgTSx0.js +1 -0
- package/admin-dist/public/assets/main-DV6oxWnU.js +102 -0
- package/admin-dist/public/assets/media-B2i-mCbx.js +1 -0
- package/admin-dist/public/assets/new._contentTypeId-VF63rpic.js +1 -0
- package/admin-dist/public/assets/pencil-CX1CiTDD.js +1 -0
- package/admin-dist/public/assets/refresh-cw-Cm-YOeFI.js +1 -0
- package/admin-dist/public/assets/{rotate-ccw-BZpZtw0N.js → rotate-ccw-B45JsL5f.js} +1 -1
- package/admin-dist/public/assets/scroll-area-b3A1HHR7.js +1 -0
- package/admin-dist/public/assets/{search-BvgYr-c9.js → search-DKKh_DdH.js} +1 -1
- package/admin-dist/public/assets/settings-CGVDEV1r.js +1 -0
- package/admin-dist/public/assets/switch-BTMY8Qnk.js +1 -0
- package/admin-dist/public/assets/tabs-DUQwUoIb.js +1 -0
- package/admin-dist/public/assets/tanstack-adapter-f7AHmQ5L.js +1 -0
- package/admin-dist/public/assets/taxonomies-DvMppdiD.js +1 -0
- package/admin-dist/public/assets/trash-D7e0uKd9.js +1 -0
- package/admin-dist/public/assets/{useBreadcrumbLabel-D00rvqjw.js → useBreadcrumbLabel-CF2KYwsw.js} +1 -1
- package/admin-dist/public/assets/usePermissions-DWBImEOW.js +1 -0
- package/admin-dist/server/_chunks/_libs/@date-fns/tz.mjs +2 -2
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-avatar.mjs +1 -1
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-collection.mjs +1 -1
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-context.mjs +2 -2
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-dialog.mjs +2 -2
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-label.mjs +1 -1
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-menu.mjs +1 -1
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-popover.mjs +1 -1
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-primitive.mjs +6 -72
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-select.mjs +1 -1
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-separator.mjs +1 -1
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-slot.mjs +20 -435
- package/admin-dist/server/_chunks/_libs/@radix-ui/react-visually-hidden.mjs +30 -3
- package/admin-dist/server/_chunks/_libs/@tanstack/history.mjs +0 -376
- package/admin-dist/server/_chunks/_libs/@tanstack/react-router.mjs +168 -383
- package/admin-dist/server/_chunks/_libs/@tanstack/router-core.mjs +451 -1195
- package/admin-dist/server/_chunks/_libs/react-dom.mjs +5 -5
- package/admin-dist/server/_chunks/_libs/react.mjs +2 -2
- package/admin-dist/server/_libs/cmdk.mjs +1 -1
- package/admin-dist/server/_libs/convex.mjs +3 -3
- package/admin-dist/server/_libs/cookie-es.mjs +1 -58
- package/admin-dist/server/_libs/date-fns.mjs +1 -1
- package/admin-dist/server/_libs/lucide-react.mjs +117 -103
- package/admin-dist/server/_libs/seroval-plugins.mjs +1 -58
- package/admin-dist/server/_libs/seroval.mjs +1 -1765
- package/admin-dist/server/_libs/zod.mjs +1 -1
- package/admin-dist/server/_ssr/CmsEmptyState-BM8DghTl.mjs +38 -0
- package/admin-dist/server/_ssr/{CmsPageHeader-ClNPU7Up.mjs → CmsPageHeader-BHUmrIWD.mjs} +1 -1
- package/admin-dist/server/_ssr/{CmsStatusBadge-CojMbrY7.mjs → CmsStatusBadge-D0Zb0oRl.mjs} +7 -7
- package/admin-dist/server/_ssr/{CmsSurface-Dcv440rp.mjs → CmsSurface-B2eBr-47.mjs} +1 -1
- package/admin-dist/server/_ssr/{CmsToolbar-BKv1nL6u.mjs → CmsToolbar-BCrwg7OL.mjs} +2 -3
- package/admin-dist/server/_ssr/{ContentEntryEditor-weiXSBdZ.mjs → ContentEntryEditor-Cjfm0uhr.mjs} +46 -49
- package/admin-dist/server/_ssr/{TaxonomyFilter-BPQ57Mwk.mjs → TaxonomyFilter-C4pD0kfM.mjs} +4 -5
- package/admin-dist/server/_ssr/{_contentTypeId-DyyauLOs.mjs → _contentTypeId-CiDiX-p7.mjs} +34 -43
- package/admin-dist/server/_ssr/{_entryId-9Cafwxmw.mjs → _entryId-9GxatOkL.mjs} +35 -47
- package/admin-dist/server/_ssr/_tanstack-start-manifest_v-CC7UrHKE.mjs +4 -0
- package/admin-dist/server/_ssr/badge-EI998zba.mjs +39 -0
- package/admin-dist/server/_ssr/{command-CEf8YBxY.mjs → command-BLAWQhUw.mjs} +2 -2
- package/admin-dist/server/_ssr/{config.server-D7JHDcDv.mjs → config.server-BOr7Jxr4.mjs} +5 -14
- package/admin-dist/server/_ssr/{content-ZFWVzO25.mjs → content-BHX39L4D.mjs} +63 -63
- package/admin-dist/server/_ssr/content-types-DCzrBhTH.mjs +459 -0
- package/admin-dist/server/_ssr/{index-BlSIlH4Z.mjs → index-DwM_5VNP.mjs} +114 -30
- package/admin-dist/server/_ssr/index.mjs +3459 -62
- package/admin-dist/server/_ssr/{media-CD2_NUMw.mjs → media-CbzgTRRQ.mjs} +31 -43
- package/admin-dist/server/_ssr/{new._contentTypeId-dmZy6PBX.mjs → new._contentTypeId-6Ph-Gtlw.mjs} +33 -45
- package/admin-dist/server/_ssr/router-vd1nySeP.mjs +3041 -0
- package/admin-dist/server/_ssr/{scroll-area-BH_1K-WT.mjs → scroll-area--B9snFTJ.mjs} +1 -1
- package/admin-dist/server/_ssr/{settings-DVdsoWoh.mjs → settings-DlTO2JSj.mjs} +34 -43
- package/admin-dist/server/_ssr/{switch-DX_X8vZl.mjs → switch-C05NgNW0.mjs} +1 -1
- package/admin-dist/server/_ssr/{tabs-4FWM0sn8.mjs → tabs-DAk2J5xy.mjs} +9 -10
- package/admin-dist/server/_ssr/{tanstack-adapter-D3ZcKtbY.mjs → tanstack-adapter-DWbaPByn.mjs} +15 -1
- package/admin-dist/server/_ssr/{taxonomies-BHFfO9Yr.mjs → taxonomies-B8nqce6u.mjs} +35 -44
- package/admin-dist/server/_ssr/{trash-9tUB2KwI.mjs → trash-zdlZgpTo.mjs} +30 -39
- package/admin-dist/server/_ssr/{useBreadcrumbLabel-DVme3DSb.mjs → useBreadcrumbLabel-DpEKyG1h.mjs} +1 -1
- package/admin-dist/server/_ssr/{usePermissions-zAQj-ruE.mjs → usePermissions-olYRd9S9.mjs} +1 -1
- package/admin-dist/server/index.mjs +168 -203
- package/dist/cli/templates/cmsClient.d.ts +1 -1
- package/dist/cli/templates/cmsClient.d.ts.map +1 -1
- package/dist/cli/templates/cmsClient.js +30 -11
- package/dist/cli/templates/cmsClient.js.map +1 -1
- package/dist/cli/templates/cmsConfig.d.ts +1 -1
- package/dist/cli/templates/cmsConfig.d.ts.map +1 -1
- package/dist/cli/templates/cmsConfig.js +3 -3
- package/dist/client/admin/contentLock.d.ts +4 -4
- package/dist/client/admin/contentLock.d.ts.map +1 -1
- package/dist/client/admin/contentLock.js +1 -1
- package/dist/client/admin/contentLock.js.map +1 -1
- package/dist/client/admin/contentTypes.d.ts +328 -290
- package/dist/client/admin/contentTypes.d.ts.map +1 -1
- package/dist/client/admin/contentTypes.js +307 -9
- package/dist/client/admin/contentTypes.js.map +1 -1
- package/dist/client/admin/entries.d.ts +18 -19
- package/dist/client/admin/entries.d.ts.map +1 -1
- package/dist/client/admin/entries.js +33 -8
- package/dist/client/admin/entries.js.map +1 -1
- package/dist/client/admin/index.d.ts +694 -642
- package/dist/client/admin/index.d.ts.map +1 -1
- package/dist/client/admin/index.js +45 -5
- package/dist/client/admin/index.js.map +1 -1
- package/dist/client/admin/media.d.ts.map +1 -1
- package/dist/client/admin/taxonomies.d.ts.map +1 -1
- package/dist/client/admin/trash.d.ts +3 -4
- package/dist/client/admin/trash.d.ts.map +1 -1
- package/dist/client/admin/types.d.ts +185 -4
- package/dist/client/admin/types.d.ts.map +1 -1
- package/dist/client/admin/validators.d.ts +2009 -25
- package/dist/client/admin/validators.d.ts.map +1 -1
- package/dist/client/admin/validators.js +15 -4
- package/dist/client/admin/validators.js.map +1 -1
- package/dist/client/admin/versions.d.ts +1 -1
- package/dist/client/admin/versions.d.ts.map +1 -1
- package/dist/client/agentTools.d.ts +1 -4
- package/dist/client/agentTools.d.ts.map +1 -1
- package/dist/client/agentTools.js +9 -21
- package/dist/client/agentTools.js.map +1 -1
- package/dist/client/config.d.ts +10 -0
- package/dist/client/config.d.ts.map +1 -1
- package/dist/client/config.js +1 -0
- package/dist/client/config.js.map +1 -1
- package/dist/client/defineContent.d.ts +338 -0
- package/dist/client/defineContent.d.ts.map +1 -0
- package/dist/client/defineContent.js +368 -0
- package/dist/client/defineContent.js.map +1 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/queryBuilder.d.ts +0 -15
- package/dist/client/queryBuilder.d.ts.map +1 -1
- package/dist/client/queryBuilder.js +0 -23
- package/dist/client/queryBuilder.js.map +1 -1
- package/dist/client/registry.d.ts +77 -0
- package/dist/client/registry.d.ts.map +1 -0
- package/dist/client/registry.js +95 -0
- package/dist/client/registry.js.map +1 -0
- package/dist/client/schema/defineContentType.d.ts +36 -24
- package/dist/client/schema/defineContentType.d.ts.map +1 -1
- package/dist/client/schema/defineContentType.js +176 -128
- package/dist/client/schema/defineContentType.js.map +1 -1
- package/dist/client/schema/typedClient.d.ts.map +1 -1
- package/dist/client/schema/typedClient.js +2 -10
- package/dist/client/schema/typedClient.js.map +1 -1
- package/dist/client/schema/types.d.ts +16 -9
- package/dist/client/schema/types.d.ts.map +1 -1
- package/dist/client/schema/types.js.map +1 -1
- package/dist/client/utils/toSlug.d.ts +60 -0
- package/dist/client/utils/toSlug.d.ts.map +1 -0
- package/dist/client/utils/toSlug.js +31 -0
- package/dist/client/utils/toSlug.js.map +1 -0
- package/dist/client/wrapper.d.ts +2 -2
- package/dist/client/wrapper.d.ts.map +1 -1
- package/dist/client/wrapper.js +22 -30
- package/dist/client/wrapper.js.map +1 -1
- package/dist/component/_generated/component.d.ts +24 -28
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/authorizationHooks.d.ts +1 -1
- package/dist/component/authorizationHooks.d.ts.map +1 -1
- package/dist/component/authorizationHooks.js +2 -2
- package/dist/component/authorizationHooks.js.map +1 -1
- package/dist/component/bulkOperations.d.ts.map +1 -1
- package/dist/component/bulkOperations.js +7 -4
- package/dist/component/bulkOperations.js.map +1 -1
- package/dist/component/contentEntries.d.ts +18 -56
- package/dist/component/contentEntries.d.ts.map +1 -1
- package/dist/component/contentEntries.js +45 -137
- package/dist/component/contentEntries.js.map +1 -1
- package/dist/component/contentEntryMutations.d.ts +14 -14
- package/dist/component/contentEntryMutations.d.ts.map +1 -1
- package/dist/component/contentEntryMutations.js +40 -43
- package/dist/component/contentEntryMutations.js.map +1 -1
- package/dist/component/contentEntryValidation.d.ts +3 -3
- package/dist/component/contentEntryValidation.js +6 -9
- package/dist/component/contentEntryValidation.js.map +1 -1
- package/dist/component/contentLock.d.ts +7 -7
- package/dist/component/contentLock.js +3 -3
- package/dist/component/contentLock.js.map +1 -1
- package/dist/component/contentTypeMigration.d.ts +1 -1
- package/dist/component/contentTypeMigration.js +2 -2
- package/dist/component/contentTypeMigration.js.map +1 -1
- package/dist/component/contentTypeMutations.d.ts.map +1 -1
- package/dist/component/contentTypeMutations.js +7 -6
- package/dist/component/contentTypeMutations.js.map +1 -1
- package/dist/component/convex.config.d.ts.map +1 -1
- package/dist/component/convex.config.js +1 -1
- package/dist/component/convex.config.js.map +1 -1
- package/dist/component/eventEmitter.d.ts +0 -1
- package/dist/component/eventEmitter.d.ts.map +1 -1
- package/dist/component/eventEmitter.js.map +1 -1
- package/dist/component/exportImport.d.ts +37 -37
- package/dist/component/exportImport.d.ts.map +1 -1
- package/dist/component/exportImport.js +34 -34
- package/dist/component/exportImport.js.map +1 -1
- package/dist/component/lib/deepReferenceResolver.d.ts +2 -2
- package/dist/component/lib/deepReferenceResolver.d.ts.map +1 -1
- package/dist/component/lib/deepReferenceResolver.js +13 -8
- package/dist/component/lib/deepReferenceResolver.js.map +1 -1
- package/dist/component/lib/ragContentChunker.d.ts +3 -3
- package/dist/component/lib/ragContentChunker.d.ts.map +1 -1
- package/dist/component/lib/ragContentChunker.js +4 -4
- package/dist/component/lib/ragContentChunker.js.map +1 -1
- package/dist/component/lib/referenceResolver.d.ts.map +1 -1
- package/dist/component/lib/referenceResolver.js +10 -17
- package/dist/component/lib/referenceResolver.js.map +1 -1
- package/dist/component/mediaAssetMutations.js +4 -4
- package/dist/component/mediaAssetMutations.js.map +1 -1
- package/dist/component/ragContentIndexer.d.ts +2 -2
- package/dist/component/ragContentIndexer.d.ts.map +1 -1
- package/dist/component/ragContentIndexer.js +44 -48
- package/dist/component/ragContentIndexer.js.map +1 -1
- package/dist/component/roles.d.ts +3 -3
- package/dist/component/scheduledPublish.d.ts +4 -4
- package/dist/component/scheduledPublish.js +3 -3
- package/dist/component/scheduledPublish.js.map +1 -1
- package/dist/component/schema.d.ts +18 -18
- package/dist/component/schema.js +5 -5
- package/dist/component/schema.js.map +1 -1
- package/dist/component/trash.d.ts +6 -9
- package/dist/component/trash.d.ts.map +1 -1
- package/dist/component/trash.js +12 -36
- package/dist/component/trash.js.map +1 -1
- package/dist/component/userContext.d.ts +1 -2
- package/dist/component/userContext.d.ts.map +1 -1
- package/dist/component/userContext.js +1 -2
- package/dist/component/userContext.js.map +1 -1
- package/dist/component/validators.d.ts +27 -33
- package/dist/component/validators.d.ts.map +1 -1
- package/dist/component/validators.js +3 -5
- package/dist/component/validators.js.map +1 -1
- package/dist/component/versionMutations.d.ts +1 -1
- package/dist/component/webhookTrigger.d.ts +14 -14
- package/dist/test.d.ts +30 -30
- package/dist/test.d.ts.map +1 -1
- package/dist/test.js +24 -24
- package/dist/test.js.map +1 -1
- package/package.json +1 -1
- package/admin-dist/public/assets/CmsEmptyState-Do_erIgn.js +0 -5
- package/admin-dist/public/assets/CmsPageHeader-qDwPGi48.js +0 -1
- package/admin-dist/public/assets/CmsStatusBadge-Dd9uToHE.js +0 -1
- package/admin-dist/public/assets/CmsToolbar-D1-Y-7SK.js +0 -1
- package/admin-dist/public/assets/ContentEntryEditor-CWBiIx52.js +0 -4
- package/admin-dist/public/assets/TaxonomyFilter-CdYQawxb.js +0 -1
- package/admin-dist/public/assets/_contentTypeId-D9VMP6Gs.js +0 -1
- package/admin-dist/public/assets/_entryId-2FlCfqE7.js +0 -1
- package/admin-dist/public/assets/alert-GxZx0y5c.js +0 -1
- package/admin-dist/public/assets/badge-BAlGIjop.js +0 -1
- package/admin-dist/public/assets/command-di7XCqcv.js +0 -1
- package/admin-dist/public/assets/content-D8zELsDG.js +0 -1
- package/admin-dist/public/assets/content-types-BmzD0krT.js +0 -2
- package/admin-dist/public/assets/globals-BvFfH-v9.css +0 -1
- package/admin-dist/public/assets/index-zqfj4T_v.js +0 -1
- package/admin-dist/public/assets/label-B6PPtKR5.js +0 -1
- package/admin-dist/public/assets/link-2-W2fVnVOf.js +0 -1
- package/admin-dist/public/assets/list-F8O0lZXC.js +0 -1
- package/admin-dist/public/assets/main-dZT72bAG.js +0 -97
- package/admin-dist/public/assets/media-CETueFbV.js +0 -1
- package/admin-dist/public/assets/new._contentTypeId-BV2-TyyR.js +0 -1
- package/admin-dist/public/assets/plus-AABQIF0N.js +0 -1
- package/admin-dist/public/assets/scroll-area-CDfk-zrz.js +0 -1
- package/admin-dist/public/assets/select-BuiHcMzS.js +0 -1
- package/admin-dist/public/assets/settings-DBxbYDvn.js +0 -1
- package/admin-dist/public/assets/switch-DiJvolcs.js +0 -1
- package/admin-dist/public/assets/tabs-Cgz6G_Xy.js +0 -1
- package/admin-dist/public/assets/tanstack-adapter-BknsSgra.js +0 -1
- package/admin-dist/public/assets/taxonomies-DOErsLl5.js +0 -1
- package/admin-dist/public/assets/textarea-CgggMxUX.js +0 -1
- package/admin-dist/public/assets/trash-BU4ANuaW.js +0 -1
- package/admin-dist/public/assets/triangle-alert-lvCbwp0s.js +0 -1
- package/admin-dist/public/assets/usePermissions-D7tQowaF.js +0 -1
- package/admin-dist/server/_libs/h3-v2.mjs +0 -277
- package/admin-dist/server/_ssr/CmsButton-DbzfJru_.mjs +0 -125
- package/admin-dist/server/_ssr/CmsEmptyState-CuvcXr3Z.mjs +0 -290
- package/admin-dist/server/_ssr/_tanstack-start-manifest_v-Dk-FIYPN.mjs +0 -4
- package/admin-dist/server/_ssr/content-types-D25lUE-j.mjs +0 -1312
- package/admin-dist/server/_ssr/label-PblVvdRv.mjs +0 -22
- package/admin-dist/server/_ssr/router-x6Ab8T4s.mjs +0 -1622
- package/admin-dist/server/_ssr/select-CrfEkFJw.mjs +0 -142
- package/admin-dist/server/_ssr/textarea-CZVaroMc.mjs +0 -18
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as ee,j as e,c as I,r as a,T as O,f as es,F as ss,I as de,u as A,b as R,a as E,B as Es,k as Qe,D as ts,l as as,m as ls,n as V,E as Is,o as ve,H as is,p as be,q as Ps}from"./main-dZT72bAG.js";import{C as rs,F as ns,M as os,V as cs,T as Bs,a as Rs,b as Ge,U as $s,c as Ls}from"./tabs-Cgz6G_Xy.js";import{C as Us}from"./CmsPageHeader-qDwPGi48.js";import{C as Vs}from"./CmsToolbar-D1-Y-7SK.js";import{D as ye,d as Ne,e as Ce,I as K,c as ze,a as Xe,C as ge,f as Ye,g as Ze,b as je}from"./CmsEmptyState-Do_erIgn.js";import{C as x,X as le,B as ds}from"./badge-BAlGIjop.js";import{T as qs}from"./TaxonomyFilter-CdYQawxb.js";import{L as ms}from"./label-B6PPtKR5.js";import{V as Hs,S as Ws,a as Ks,b as Os,c as Qs,d as J}from"./select-BuiHcMzS.js";import{P as Fe,a as Gs,T as us}from"./textarea-CgggMxUX.js";import{P as Xs}from"./plus-AABQIF0N.js";import{L as Ys}from"./link-2-W2fVnVOf.js";import{R as ke}from"./rotate-ccw-BZpZtw0N.js";import{S as Je}from"./search-BvgYr-c9.js";import{u as Zs}from"./tanstack-adapter-BknsSgra.js";import"./command-di7XCqcv.js";const Js=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],et=ee("copy",Js);const st=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],we=ee("download",st);const tt=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],at=ee("ellipsis-vertical",tt);const lt=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],it=ee("ellipsis",lt);const rt=[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]],Se=ee("folder-input",rt);const nt=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ot=ee("folder-plus",nt);function X({label:s,description:r,error:l,required:i,htmlFor:o,className:m,children:d}){return e.jsxs("div",{className:I("space-y-2",m),children:[s&&e.jsxs(ms,{htmlFor:o,className:I("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",l&&"text-destructive"),children:[s,i&&e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),d,r&&!l&&e.jsx("p",{className:"text-[13px] text-muted-foreground",children:r}),l&&e.jsx("p",{className:"text-[13px] font-medium text-destructive",children:l})]})}function ct(s){return s?s.startsWith("image/")?"image":s.startsWith("video/")?"video":s.startsWith("audio/")?"audio":s==="application/pdf"||s.includes("document")||s.includes("sheet")||s.includes("presentation")||s.startsWith("text/")?"document":"other":"other"}function dt(s){if(!s||s===0)return"0 B";const r=1024,l=["B","KB","MB","GB"],i=Math.floor(Math.log(s)/Math.log(r));return`${parseFloat((s/Math.pow(r,i)).toFixed(1))} ${l[i]}`}function mt(s){return new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function ut(s,r="size-16"){const l={className:r};switch(s){case"image":return e.jsx(de,{...l});case"video":return e.jsx(cs,{...l});case"audio":return e.jsx(os,{...l});case"document":return e.jsx(ss,{...l});default:return e.jsx(ns,{...l})}}function xt({asset:s,assets:r,currentIndex:l,open:i,onOpenChange:o,onNavigate:m,onEdit:d,onDelete:f}){const k=l>0,h=l<r.length-1,y=a.useCallback(()=>{k&&m(l-1)},[k,l,m]),c=a.useCallback(()=>{h&&m(l+1)},[h,l,m]),v=a.useCallback(u=>{if(i)switch(u.key){case"ArrowLeft":u.preventDefault(),y();break;case"ArrowRight":u.preventDefault(),c();break;case"Escape":u.preventDefault(),o(!1);break}},[i,y,c,o]);a.useEffect(()=>(window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)),[v]);const N=a.useCallback(()=>{if(!s?.url)return;const u=document.createElement("a");u.href=s.url,u.download=s.name,u.target="_blank",document.body.appendChild(u),u.click(),document.body.removeChild(u)},[s]),b=a.useCallback(async()=>{s?.url&&await navigator.clipboard.writeText(s.url)},[s]);if(!s)return null;const S=ct(s.mimeType),M=S==="image",g=!!s.url;return e.jsx(ye,{open:i,onOpenChange:o,children:e.jsxs(Ne,{className:"flex h-[90vh] w-[95vw] max-w-[1400px] flex-col gap-0 overflow-hidden p-0 sm:max-w-[1400px]",showCloseButton:!1,children:[e.jsx(Hs,{children:e.jsxs(Ce,{children:["Preview: ",s.name]})}),e.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h2",{className:"truncate text-lg font-semibold",title:s.name,children:s.name}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[l+1," of ",r.length]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(x,{variant:"ghost",size:"icon",onClick:b,disabled:!s.url,title:"Copy URL",children:e.jsx(et,{className:"size-4"})}),e.jsx(x,{variant:"ghost",size:"icon",onClick:N,disabled:!s.url,title:"Download",children:e.jsx(we,{className:"size-4"})}),d&&e.jsx(x,{variant:"ghost",size:"icon",onClick:()=>d(s),title:"Edit",children:e.jsx(Fe,{className:"size-4"})}),f&&e.jsx(x,{variant:"ghost",size:"icon",onClick:()=>f(s),title:"Delete",className:"text-destructive hover:text-destructive",children:e.jsx(O,{className:"size-4"})}),e.jsx(x,{variant:"ghost",size:"icon",onClick:()=>o(!1),title:"Close (Esc)",children:e.jsx(le,{className:"size-4"})})]})]}),e.jsxs("div",{className:"flex min-h-0 flex-1",children:[e.jsxs("div",{className:"relative flex flex-1 items-center justify-center bg-zinc-950",children:[k&&e.jsx("button",{onClick:y,className:"absolute left-4 z-10 flex size-10 items-center justify-center rounded-full bg-black/50 text-white transition-colors hover:bg-black/70",title:"Previous (←)",children:e.jsx(rs,{className:"size-6"})}),h&&e.jsx("button",{onClick:c,className:"absolute right-4 z-10 flex size-10 items-center justify-center rounded-full bg-black/50 text-white transition-colors hover:bg-black/70",title:"Next (→)",children:e.jsx(es,{className:"size-6"})}),M&&g?e.jsx("img",{src:s.url,alt:s.altText||s.title||s.name,className:"max-h-full max-w-full object-contain"}):e.jsxs("div",{className:"flex flex-col items-center gap-4 text-zinc-400",children:[ut(S),e.jsx("p",{className:"text-sm",children:M&&!g?"Image URL not available":"Preview not available for this file type"}),g&&e.jsxs(x,{variant:"secondary",onClick:N,children:[e.jsx(we,{className:"mr-2 size-4"}),"Download to view"]})]})]}),e.jsx("div",{className:"w-72 shrink-0 overflow-y-auto border-l bg-background",children:e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx("h3",{className:"font-semibold",children:"File Information"}),e.jsx(U,{label:"Filename",value:s.name}),s.title&&e.jsx(U,{label:"Title",value:s.title}),s.description&&e.jsx(U,{label:"Description",value:s.description}),s.altText&&e.jsx(U,{label:"Alt Text",value:s.altText}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsx(U,{label:"Type",value:S,capitalize:!0}),s.mimeType&&e.jsx(U,{label:"MIME Type",value:s.mimeType}),e.jsx(U,{label:"Size",value:dt(s.size)}),s.width&&s.height&&e.jsx(U,{label:"Dimensions",value:`${s.width} × ${s.height} px`})]}),e.jsx("div",{className:"border-t pt-4",children:e.jsx(U,{label:"Uploaded",value:mt(s._creationTime)})}),s.tags&&s.tags.length>0&&e.jsxs("div",{className:"border-t pt-4",children:[e.jsx("p",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.tags.map(u=>e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-xs",children:u},u))})]})]})})]})]})})}function U({label:s,value:r,capitalize:l}){return e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:s}),e.jsx("p",{className:I("break-words text-sm",l&&"capitalize"),children:r})]})}function ht({mediaId:s,taxonomyId:r,taxonomyName:l="Tags",allowCreate:i=!0,disabled:o=!1,className:m=""}){const[d,f]=a.useState(""),[k,h]=a.useState(!1),[y,c]=a.useState(0),[v,N]=a.useState(!1),[b,S]=a.useState(!1),M=a.useRef(null),g=a.useRef(null),u=a.useRef(null),D=A(R.admin.getTermsByMedia,{mediaId:s,taxonomyId:r}),F=D?.map(n=>n._id)??[],p=A(R.admin.suggestTerms,{taxonomyId:r,query:d,limit:10,excludeIds:F})??[],$=E(R.admin.setMediaTerms),Q=E(R.admin.createTermAndAddToMedia);a.useEffect(()=>{function n(C){u.current&&!u.current.contains(C.target)&&h(!1)}return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[]);const q=a.useCallback(async n=>{if(!F.includes(n)){S(!0);try{await $({mediaId:s,taxonomyId:r,termIds:[...F,n]})}catch(C){console.error("Failed to add tag:",C)}finally{S(!1),f(""),h(!1),c(0),M.current?.focus()}}},[s,r,F,$]),G=a.useCallback(async n=>{S(!0);try{await $({mediaId:s,taxonomyId:r,termIds:F.filter(C=>C!==n)})}catch(C){console.error("Failed to remove tag:",C)}finally{S(!1)}},[s,r,F,$]),se=a.useCallback(async()=>{if(!(!d.trim()||!i)){N(!0);try{await Q({taxonomyId:r,name:d.trim(),mediaId:s}),f(""),h(!1),c(0)}catch(n){console.error("Failed to create tag:",n)}finally{N(!1)}}},[d,i,r,s,Q]),te=n=>{if(!o)switch(n.key){case"ArrowDown":n.preventDefault(),c(C=>C<p.length-1?C+1:C);break;case"ArrowUp":n.preventDefault(),c(C=>C>0?C-1:0);break;case"Enter":n.preventDefault(),p.length>0&&y<p.length?q(p[y]._id):d.trim()&&i&&se();break;case"Escape":h(!1);break;case"Backspace":d===""&&F.length>0&&G(F[F.length-1]);break}};a.useEffect(()=>{if(g.current&&k){const n=g.current.querySelector(`[data-index="${y}"]`);n&&n.scrollIntoView({block:"nearest"})}},[y,k]);const L=p.filter(n=>!F.includes(n._id)),ae=i&&d.trim()&&!L.some(n=>n.name.toLowerCase()===d.trim().toLowerCase());return e.jsxs("div",{className:I("space-y-2",m),children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:[e.jsx(Gs,{className:"size-4"}),l]}),e.jsxs("div",{ref:u,className:I("relative rounded-md border border-input bg-background",o&&"opacity-50"),children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-2",children:[(D??[]).map(n=>e.jsxs(ds,{variant:"secondary",className:"gap-1 pr-1",style:n.color?{backgroundColor:n.color,color:"#fff"}:void 0,children:[n.name,!o&&e.jsx(Es,{type:"button",variant:"ghost",size:"icon",className:"size-4 hover:bg-transparent",onClick:()=>G(n._id),disabled:b,"aria-label":`Remove ${n.name}`,children:e.jsx(le,{className:"size-3"})})]},n._id)),!o&&e.jsx(K,{ref:M,type:"text",className:"h-7 min-w-[120px] flex-1 border-0 bg-transparent px-1 shadow-none focus-visible:ring-0",value:d,onChange:n=>{f(n.target.value),h(!0),c(0)},onFocus:()=>h(!0),onKeyDown:te,placeholder:F.length===0?"Add tags...":"",disabled:o||v||b})]}),k&&(L.length>0||ae)&&e.jsxs("div",{ref:g,className:"absolute left-0 right-0 top-full z-50 mt-1 max-h-48 overflow-auto rounded-md border bg-popover shadow-lg",role:"listbox",children:[L.map((n,C)=>e.jsxs("div",{"data-index":C,className:I("flex cursor-pointer items-center gap-2 px-3 py-2 text-sm",C===y&&"bg-accent"),onClick:()=>q(n._id),role:"option","aria-selected":C===y,children:[n.color&&e.jsx("span",{className:"size-2.5 rounded-full",style:{backgroundColor:n.color}}),e.jsx("span",{className:"flex-1",children:n.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.usageCount," uses"]})]},n._id)),ae&&e.jsxs("div",{"data-index":L.length,className:I("flex cursor-pointer items-center gap-2 px-3 py-2 text-sm",L.length===y&&"bg-accent"),onClick:se,role:"option","aria-selected":L.length===y,children:[v?e.jsx(Qe,{className:"size-4 animate-spin"}):e.jsx(Xs,{className:"size-4"}),e.jsxs("span",{children:['Create "',d.trim(),'"']})]})]}),(b||v)&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/50",children:e.jsx(Qe,{className:"size-4 animate-spin"})})]})]})}function ft({asset:s,open:r,onOpenChange:l,onSaved:i}){const[o,m]=a.useState(""),[d,f]=a.useState(""),[k,h]=a.useState(""),[y,c]=a.useState(""),[v,N]=a.useState(""),[b,S]=a.useState(!1),[M,g]=a.useState(""),u=E(R.admin.updateMediaAsset),F=A(R.admin.listTaxonomies,{isActive:!0,paginationOpts:{numItems:50,cursor:null}})?.page??[];a.useEffect(()=>{s&&(m(s.name),f(s.title||""),h(s.description||""),c(s.altText||""),N(s.tags?.join(", ")||""),g(""))},[s]);const T=a.useCallback(async()=>{if(s){if(!o.trim()){g("Filename is required");return}S(!0),g("");try{const p=v.split(",").map($=>$.trim()).filter(Boolean);await u({id:s._id,name:o.trim(),title:d.trim()||void 0,description:k.trim()||void 0,altText:y.trim()||void 0,tags:p.length>0?p:void 0}),i?.(),l(!1)}catch(p){g(p instanceof Error?p.message:"Failed to update asset")}finally{S(!1)}}},[s,o,d,k,y,v,u,i,l]);return s?e.jsx(ze,{open:r,onOpenChange:l,title:"Edit File",size:"md",footer:e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"outline",onClick:()=>l(!1),disabled:b,children:"Cancel"}),e.jsx(x,{onClick:T,loading:b,children:"Save Changes"})]}),children:e.jsxs("div",{className:"space-y-4",children:[M&&e.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive",children:M}),e.jsx(X,{label:"Filename",required:!0,htmlFor:"asset-name",children:e.jsx(K,{id:"asset-name",value:o,onChange:p=>m(p.target.value),placeholder:"Enter filename"})}),e.jsx(X,{label:"Title",description:"A human-readable title for the file",htmlFor:"asset-title",children:e.jsx(K,{id:"asset-title",value:d,onChange:p=>f(p.target.value),placeholder:"Enter title (optional)"})}),e.jsx(X,{label:"Description",description:"A brief description of the file",htmlFor:"asset-description",children:e.jsx(us,{id:"asset-description",value:k,onChange:p=>h(p.target.value),placeholder:"Enter description (optional)",rows:3})}),e.jsx(X,{label:"Alt Text",description:"Alternative text for accessibility (important for images)",htmlFor:"asset-alt",children:e.jsx(K,{id:"asset-alt",value:y,onChange:p=>c(p.target.value),placeholder:"Describe the image content"})}),e.jsx(X,{label:"Quick Tags",description:"Comma-separated tags for simple organization",htmlFor:"asset-tags",children:e.jsx(K,{id:"asset-tags",value:v,onChange:p=>N(p.target.value),placeholder:"e.g., hero, blog, product"})}),F.length>0&&s&&e.jsxs("div",{className:"space-y-4 pt-2 border-t",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Organize with taxonomy terms"}),F.map(p=>e.jsx(ht,{mediaId:s._id,taxonomyId:p._id,taxonomyName:p.displayName,allowCreate:p.allowInlineCreation,disabled:b},p._id))]})]})}):null}function pt({folder:s,open:r,onOpenChange:l,onSaved:i}){const[o,m]=a.useState(""),[d,f]=a.useState(""),[k,h]=a.useState(!1),[y,c]=a.useState(""),v=E(R.admin.updateMediaFolder);a.useEffect(()=>{s&&(m(s.name),f(s.description||""),c(""))},[s]);const N=a.useCallback(async()=>{if(s){if(!o.trim()){c("Folder name is required");return}h(!0),c("");try{await v({id:s._id,name:o.trim(),description:d.trim()||void 0}),i?.(),l(!1)}catch(b){c(b instanceof Error?b.message:"Failed to update folder")}finally{h(!1)}}},[s,o,d,v,i,l]);return s?e.jsx(ze,{open:r,onOpenChange:l,title:"Edit Folder",size:"sm",footer:e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"outline",onClick:()=>l(!1),disabled:k,children:"Cancel"}),e.jsx(x,{onClick:N,loading:k,children:"Save Changes"})]}),children:e.jsxs("div",{className:"space-y-4",children:[y&&e.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive",children:y}),e.jsx(X,{label:"Folder Name",required:!0,htmlFor:"folder-name",children:e.jsx(K,{id:"folder-name",value:o,onChange:b=>m(b.target.value),placeholder:"Enter folder name"})}),e.jsx(X,{label:"Description",description:"A brief description of the folder contents",htmlFor:"folder-description",children:e.jsx(us,{id:"folder-description",value:d,onChange:b=>f(b.target.value),placeholder:"Enter description (optional)",rows:3})})]})}):null}function gt({asset:s,onView:r,onEdit:l,onMove:i,onDelete:o}){const m=()=>{if(!s.url)return;const f=document.createElement("a");f.href=s.url,f.download=s.name,f.target="_blank",document.body.appendChild(f),f.click(),document.body.removeChild(f)},d=async()=>{s.url&&await navigator.clipboard.writeText(s.url)};return e.jsxs(ts,{children:[e.jsx(as,{asChild:!0,children:e.jsx(x,{variant:"ghost",size:"icon-sm",className:"opacity-0 group-hover:opacity-100",onClick:f=>f.stopPropagation(),children:e.jsx(at,{className:"size-4"})})}),e.jsxs(ls,{side:"bottom",onClick:f=>f.stopPropagation(),children:[r&&e.jsxs(V,{onClick:r,children:[e.jsx(Is,{className:"mr-2 size-4"}),"View Details"]}),l&&e.jsxs(V,{onClick:l,children:[e.jsx(Fe,{className:"mr-2 size-4"}),"Edit"]}),i&&e.jsxs(V,{onClick:i,children:[e.jsx(Se,{className:"mr-2 size-4"}),"Move to..."]}),e.jsx(ve,{}),e.jsxs(V,{onClick:m,disabled:!s.url,children:[e.jsx(we,{className:"mr-2 size-4"}),"Download"]}),e.jsxs(V,{onClick:d,disabled:!s.url,children:[e.jsx(Ys,{className:"mr-2 size-4"}),"Copy URL"]}),o&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{}),e.jsxs(V,{onClick:o,className:"text-destructive focus:text-destructive",children:[e.jsx(O,{className:"mr-2 size-4"}),"Delete"]})]})]})]})}function jt({folder:s,onEdit:r,onMove:l,onDelete:i}){return e.jsxs(ts,{children:[e.jsx(as,{asChild:!0,children:e.jsx(x,{variant:"ghost",size:"icon-sm",className:"opacity-0 group-hover:opacity-100",onClick:o=>o.stopPropagation(),children:e.jsx(it,{className:"size-4"})})}),e.jsxs(ls,{align:"end",onClick:o=>o.stopPropagation(),children:[r&&e.jsxs(V,{onClick:r,children:[e.jsx(Fe,{className:"mr-2 size-4"}),"Rename"]}),l&&e.jsxs(V,{onClick:l,children:[e.jsx(Se,{className:"mr-2 size-4"}),"Move to..."]}),i&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{}),e.jsxs(V,{onClick:i,className:"text-destructive focus:text-destructive",children:[e.jsx(O,{className:"mr-2 size-4"}),"Delete"]})]})]})]})}function vt({selectedCount:s,onClear:r,onMove:l,onDelete:i,isDeleting:o}){return s===0?null:e.jsx("div",{className:"fixed inset-x-0 bottom-0 z-50 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:e.jsxs("div",{className:"mx-auto flex max-w-7xl items-center justify-between px-6 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[s," ",s===1?"file":"files"," selected"]}),e.jsxs(x,{variant:"ghost",size:"sm",onClick:r,children:[e.jsx(le,{className:"mr-1 size-4"}),"Clear"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(x,{variant:"secondary",onClick:l,disabled:o,children:[e.jsx(Se,{className:"mr-2 size-4"}),"Move to..."]}),e.jsxs(x,{variant:"danger",onClick:i,loading:o,children:[e.jsx(O,{className:"mr-2 size-4"}),"Delete"]})]})]})})}function bt({selectedCount:s,onClear:r,onRestore:l,onPermanentDelete:i,isRestoring:o,isDeleting:m}){return s===0?null:e.jsx("div",{className:"fixed inset-x-0 bottom-0 z-50 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:e.jsxs("div",{className:"mx-auto flex max-w-7xl items-center justify-between px-6 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[s," ",s===1?"file":"files"," selected"]}),e.jsxs(x,{variant:"ghost",size:"sm",onClick:r,children:[e.jsx(le,{className:"mr-1 size-4"}),"Clear"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(x,{variant:"secondary",onClick:l,loading:o,disabled:m,children:[e.jsx(ke,{className:"mr-2 size-4"}),"Restore"]}),e.jsxs(x,{variant:"danger",onClick:i,loading:m,disabled:o,children:[e.jsx(O,{className:"mr-2 size-4"}),"Delete Forever"]})]})]})})}function yt({open:s,onOpenChange:r,assetIds:l,currentFolderId:i,onMoved:o}){const[m,d]=a.useState(void 0),[f,k]=a.useState(!1),[h,y]=a.useState(""),c=A(R.admin.getMediaFolderTree,{}),v=E(R.admin.moveMediaAssets),N=a.useMemo(()=>{if(!c)return[];const g=(u,D)=>c.filter(T=>T.parentId===u).flatMap(T=>[{...T,depth:D},...g(T._id,D+1)]);return g(void 0,0)},[c]),b=async()=>{if(l.length!==0){k(!0),y("");try{await v({assetIds:l,targetFolderId:m}),o?.(),r(!1)}catch(g){y(g instanceof Error?g.message:"Failed to move files")}finally{k(!1)}}},S=m===i,M=m===void 0;return e.jsx(ze,{open:s,onOpenChange:r,title:"Move Files",description:`Select a destination folder for ${l.length} ${l.length===1?"file":"files"}`,size:"sm",footer:e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"outline",onClick:()=>r(!1),disabled:f,children:"Cancel"}),e.jsx(x,{onClick:b,loading:f,disabled:S,children:"Move Here"})]}),children:e.jsxs("div",{className:"space-y-2",children:[h&&e.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive",children:h}),e.jsxs("div",{className:"max-h-[300px] overflow-y-auto rounded-md border",children:[e.jsxs("button",{type:"button",className:I("flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-muted",M&&"bg-primary/10 text-primary",i===void 0&&"opacity-50"),onClick:()=>d(void 0),children:[e.jsx(is,{className:"size-4"}),e.jsx("span",{className:"font-medium",children:"Root (All Files)"}),i===void 0&&e.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"Current"})]}),N.map(g=>{const u=g._id===i,D=g._id===m;return e.jsxs("button",{type:"button",className:I("flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-muted",D&&"bg-primary/10 text-primary",u&&"opacity-50"),style:{paddingLeft:`${12+g.depth*20}px`},onClick:()=>d(g._id),children:[g.depth>0&&e.jsx(es,{className:"size-3 text-muted-foreground"}),e.jsx(be,{className:"size-4 text-amber-500"}),e.jsx("span",{className:"truncate",children:g.name}),u&&e.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"Current"})]},g._id)}),N.length===0&&e.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No folders yet. Create folders to organize your files."})]}),S&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Files are already in this folder"})]})})}function Nt(s){if(s===0)return"0 B";const r=1024,l=["B","KB","MB","GB"],i=Math.floor(Math.log(s)/Math.log(r));return`${parseFloat((s/Math.pow(r,i)).toFixed(1))} ${l[i]}`}function Ct(s){return new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function kt(s,r="size-6"){const l={className:r};switch(s){case"image":return e.jsx(de,{...l});case"video":return e.jsx(cs,{...l});case"audio":return e.jsx(os,{...l});case"document":return e.jsx(ss,{...l});default:return e.jsx(ns,{...l})}}function wt(s){return s?s.startsWith("image/")?"image":s.startsWith("video/")?"video":s.startsWith("audio/")?"audio":s==="application/pdf"||s.includes("document")||s.includes("sheet")||s.includes("presentation")||s.startsWith("text/")?"document":"other":"other"}function zt({api:s,navigation:r,settings:l}){a.useEffect(()=>{l&&!l.features.mediaManagement&&r.navigate("/")},[l,r]);const[i,o]=a.useState(void 0),[m,d]=a.useState(""),[f,k]=a.useState(""),[h,y]=a.useState([]),[c,v]=a.useState(new Set),[N,b]=a.useState(!1),[S,M]=a.useState(!1),[g,u]=a.useState(!1),[D,F]=a.useState(""),[T,p]=a.useState(!1),[$,Q]=a.useState(""),[q,G]=a.useState(null),[se,te]=a.useState(null),[L,ae]=a.useState(null),[n,C]=a.useState(null),[xs,Me]=a.useState(!1),[hs,De]=a.useState(!1),[fs,me]=a.useState(!1),[Te,_e]=a.useState(!1),[Ae,ps]=a.useState("library"),[Ee,Y]=a.useState(!1),[Ie,Pe]=a.useState(!1),[gs,ie]=a.useState(!1),[Z,re]=a.useState(null),w=Ae==="trash",_=A(s.listMediaAssets,{folderId:w?void 0:i,type:f||void 0,search:m||void 0,deletedOnly:w?!0:void 0,paginationOpts:{numItems:100,cursor:null}}),ue=A(s.getMediaTrashCount,{}),Be=A(s.getMediaByTerm,h[0]?{termId:h[0]}:"skip"),Re=A(s.getMediaByTerm,h[1]?{termId:h[1]}:"skip"),$e=A(s.getMediaByTerm,h[2]?{termId:h[2]}:"skip"),xe=a.useMemo(()=>{if(h.length===0)return null;const t=new Set,j=[Be,Re,$e];for(let z=0;z<h.length&&z<3;z++){const W=j[z];if(W?.page)for(const B of W.page)t.add(B)}return t},[h,Be,Re,$e]),P=A(s.listMediaFolders,{parentId:w?void 0:i,deletedOnly:w||void 0}),he=A(s.getMediaFolder,i?{id:i}:"skip"),ne=A(s.getMediaFolderTree,{}),Le=E(s.createMediaFolder),oe=E(s.deleteMediaAsset),Ue=E(s.deleteMediaFolder),ce=E(s.restoreMediaAsset),Ve=E(s.restoreMediaFolder),qe=E(s.permanentDeleteMediaAsset),He=E(s.bulkPermanentDeleteMediaAssets),We=a.useMemo(()=>{if(!i||!ne)return[];const t=[];let j=ne.find(z=>z._id===i);for(;j;){t.unshift(j);const z=j.parentId;j=z?ne.find(W=>W._id===z):void 0}return t},[i,ne]),Ke=a.useCallback(t=>{o(t),d("")},[]),js=a.useCallback(()=>{he?.parentId?o(he.parentId):o(void 0)},[he]),vs=a.useCallback(()=>{o(void 0),d("")},[]),fe=a.useCallback(t=>{v(j=>{const z=new Set(j);return z.has(t)?z.delete(t):z.add(t),z})},[]),bs=a.useCallback(()=>{_?.page&&v(new Set(_.page.map(t=>t._id)))},[_?.page]),pe=a.useCallback(()=>{v(new Set)},[]),ys=a.useCallback(t=>{ps(t),v(new Set),b(!1)},[]),Ns=a.useCallback(t=>{if(N)fe(t);else{const j=_?.page?.findIndex(z=>z._id===t)??-1;j!==-1&&G(j)}},[N,fe,_?.page]),Cs=a.useCallback(t=>{G(t)},[]),ks=a.useCallback(async()=>{if(n){Me(!0);try{n.type==="asset"?await oe({id:n.id}):await Ue({id:n.id}),C(null)}catch(t){console.error("Delete failed:",t)}finally{Me(!1)}}},[n,oe,Ue]),ws=a.useCallback(async()=>{if(c.size!==0){_e(!0);try{const t=Array.from(c).map(j=>oe({id:j}));await Promise.all(t),v(new Set),b(!1),me(!1)}catch(t){console.error("Bulk delete failed:",t)}finally{_e(!1)}}},[c,oe]),zs=a.useCallback(()=>{v(new Set),b(!1)},[]),Fs=a.useCallback(async t=>{Y(!0);try{await ce({id:t})}catch(j){console.error("Restore failed:",j)}finally{Y(!1)}},[ce]),Ss=a.useCallback(async()=>{if(c.size!==0){Y(!0);try{const t=Array.from(c).map(j=>ce({id:j}));await Promise.all(t),v(new Set),b(!1)}catch(t){console.error("Bulk restore failed:",t)}finally{Y(!1)}}},[c,ce]),Ms=a.useCallback(async t=>{Y(!0);try{await Ve({id:t})}catch(j){console.error("Restore folder failed:",j)}finally{Y(!1)}},[Ve]),Ds=a.useCallback(async()=>{if(Z){Pe(!0);try{Z==="bulk"?(await He({ids:Array.from(c)}),v(new Set),b(!1)):await qe({id:Z}),ie(!1),re(null)}catch(t){console.error("Permanent delete failed:",t)}finally{Pe(!1)}}},[Z,qe,He,c]),Oe=a.useCallback(async()=>{if(!D.trim()){Q("Folder name is required");return}p(!0),Q("");try{await Le({name:D.trim(),parentId:i}),M(!1),F("")}catch(t){Q(t instanceof Error?t.message:"Failed to create folder")}finally{p(!1)}},[D,i,Le]),Ts=a.useCallback(t=>{u(!1)},[]),_s=_===void 0||P===void 0,H=a.useMemo(()=>{const t=_?.page??[];return xe===null?t:t.filter(j=>xe.has(j._id))},[_?.page,xe]);return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx(Us,{title:"Media Library",description:"Upload, organize, and manage media assets for your content."}),e.jsx(Bs,{value:Ae,onValueChange:t=>ys(t),children:e.jsxs(Rs,{children:[e.jsxs(Ge,{value:"library",children:[e.jsx(de,{className:"mr-1.5 size-4"}),"Library"]}),e.jsxs(Ge,{value:"trash",children:[e.jsx(O,{className:"mr-1.5 size-4"}),"Trash",ue&&ue.total>0&&e.jsx(ds,{variant:"secondary",className:"ml-1.5",children:ue.total})]})]})}),!w&&e.jsxs("nav",{className:"flex items-center gap-1","aria-label":"Folder navigation",children:[e.jsxs("button",{className:I("flex items-center gap-1.5 rounded-md px-2 py-1 text-sm transition-colors",i?"text-muted-foreground hover:bg-muted hover:text-foreground":"bg-primary/10 font-medium text-primary"),onClick:vs,children:[e.jsx(is,{className:"size-4"}),e.jsx("span",{children:"All Files"})]}),We.map((t,j)=>e.jsxs("span",{className:"flex items-center",children:[e.jsx("span",{className:"mx-1 text-muted-foreground",children:"/"}),e.jsx("button",{className:I("rounded-md px-2 py-1 text-sm transition-colors",j===We.length-1?"bg-primary/10 font-medium text-primary":"text-muted-foreground hover:bg-muted hover:text-foreground"),onClick:()=>Ke(t._id),children:t.name})]},t._id))]}),e.jsx(Vs,{left:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Je,{className:"absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(K,{type:"search",placeholder:"Search files...",value:m,onChange:t=>d(t.target.value),className:"w-64 pl-9"}),m&&e.jsx("button",{className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-0.5 hover:bg-muted",onClick:()=>d(""),"aria-label":"Clear search",children:e.jsx(le,{className:"size-4 text-muted-foreground"})})]}),e.jsxs(Ws,{value:f||"all",onValueChange:t=>k(t==="all"?"":t),children:[e.jsx(Ks,{className:"w-36",children:e.jsx(Os,{placeholder:"All Types"})}),e.jsxs(Qs,{children:[e.jsx(J,{value:"all",children:"All Types"}),e.jsx(J,{value:"image",children:"Images"}),e.jsx(J,{value:"video",children:"Videos"}),e.jsx(J,{value:"audio",children:"Audio"}),e.jsx(J,{value:"document",children:"Documents"}),e.jsx(J,{value:"other",children:"Other"})]})]}),e.jsx(qs,{selectedTermIds:h,onChange:y,placeholder:"Tags"}),_?.page&&_.page.length>0&&e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-sm",children:[e.jsx(Xe,{checked:N,onCheckedChange:t=>{b(t),t||v(new Set)}}),"Selection Mode"]})]}),right:e.jsxs("div",{className:"flex items-center gap-2",children:[N&&c.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:[c.size," selected"]}),N&&e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"secondary",size:"sm",onClick:bs,children:"Select All"}),e.jsx(x,{variant:"secondary",size:"sm",onClick:pe,children:"Clear"})]}),i&&!w&&e.jsxs(x,{variant:"secondary",onClick:js,children:[e.jsx(rs,{className:"size-4"}),"Up"]}),!w&&e.jsxs(e.Fragment,{children:[e.jsxs(x,{variant:"secondary",onClick:()=>M(!0),children:[e.jsx(ot,{className:"size-4"}),"New Folder"]}),e.jsxs(x,{onClick:()=>u(!0),children:[e.jsx($s,{className:"size-4"}),"Upload Files"]})]})]})}),_s?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading media library..."})]}):e.jsxs(e.Fragment,{children:[!w&&P&&P.length>0&&!m&&e.jsxs("section",{children:[e.jsx("h3",{className:"mb-3 text-sm font-medium text-muted-foreground",children:"Folders"}),e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4 md:grid-cols-6",children:P.map(t=>e.jsxs("div",{className:"group relative flex cursor-pointer flex-col items-center gap-2 rounded-lg border bg-card p-4 text-center transition-colors hover:border-primary/50 hover:bg-muted/50",onClick:()=>Ke(t._id),children:[e.jsx("div",{className:"absolute right-2 top-2",children:e.jsx(jt,{folder:{_id:t._id,name:t.name},onEdit:()=>ae({_id:t._id,name:t.name,description:t.description}),onDelete:()=>C({type:"folder",id:t._id,name:t.name})})}),e.jsx(be,{className:"size-10 text-amber-500"}),e.jsx("span",{className:"truncate text-sm font-medium",children:t.name})]},t._id))})]}),w&&P&&P.length>0&&e.jsxs("section",{children:[e.jsxs("h3",{className:"mb-3 text-sm font-medium text-muted-foreground",children:["Deleted Folders (",P.length,")"]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4 md:grid-cols-6",children:P.map(t=>e.jsxs("div",{className:"group relative flex flex-col items-center gap-2 rounded-lg border border-destructive/20 bg-card p-4 text-center opacity-60",children:[e.jsx(be,{className:"size-10 text-amber-500/50"}),e.jsx("span",{className:"truncate text-sm font-medium",children:t.name}),e.jsxs(x,{variant:"secondary",size:"sm",onClick:()=>Ms(t._id),disabled:Ee,children:[e.jsx(ke,{className:"mr-1 size-3"}),"Restore"]})]},t._id))})]}),H.length>0?e.jsxs("section",{children:[!w&&P&&P.length>0&&!m&&e.jsx("h3",{className:"mb-3 text-sm font-medium text-muted-foreground",children:"Files"}),w&&e.jsxs("h3",{className:"mb-3 text-sm font-medium text-muted-foreground",children:["Deleted Files (",H.length,")"]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4 md:grid-cols-6",children:H.map(t=>{const j=t._id,z=c.has(j),W=wt(t.mimeType);return e.jsxs("div",{className:I("group relative flex cursor-pointer flex-col overflow-hidden rounded-lg border bg-card transition-all hover:border-primary/50",z&&"border-primary ring-2 ring-primary/20"),onClick:()=>Ns(j),children:[N&&e.jsx("div",{className:"absolute left-2 top-2 z-10",children:e.jsx(Xe,{checked:z,onCheckedChange:()=>fe(j),onClick:B=>B.stopPropagation(),className:"bg-white/80"})}),!N&&!w&&e.jsx("div",{className:"absolute right-2 top-2 z-10",children:e.jsx(gt,{asset:{_id:t._id,name:t.name,url:t.url},onView:()=>{const B=H.findIndex(As=>As._id===t._id);B!==-1&&G(B)},onEdit:()=>te({_id:t._id,name:t.name,title:t.title,description:t.description,altText:t.altText,tags:t.tags}),onDelete:()=>C({type:"asset",id:t._id,name:t.name})})}),!N&&w&&e.jsxs("div",{className:"absolute right-2 top-2 z-10 flex gap-1 opacity-0 group-hover:opacity-100",children:[e.jsx(x,{variant:"secondary",size:"icon-sm",onClick:B=>{B.stopPropagation(),Fs(t._id)},title:"Restore",children:e.jsx(ke,{className:"size-4"})}),e.jsx(x,{variant:"danger",size:"icon-sm",onClick:B=>{B.stopPropagation(),re(t._id),ie(!0)},title:"Delete Forever",children:e.jsx(O,{className:"size-4"})})]}),e.jsx("div",{className:"aspect-square overflow-hidden bg-muted",children:W==="image"&&t.url?e.jsx("img",{src:t.url,alt:t.title||t.name,className:"h-full w-full object-cover"}):e.jsx("div",{className:"flex size-full items-center justify-center text-muted-foreground",children:kt(W,"size-10")})}),e.jsxs("div",{className:"p-2",children:[e.jsx("p",{className:"truncate text-sm font-medium",title:t.name,children:t.name}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx("span",{className:"capitalize",children:W}),e.jsx("span",{children:"•"}),e.jsx("span",{children:Nt(t.size??0)})]}),e.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:Ct(t._creationTime)})]})]},t._id)})}),!_.isDone&&e.jsxs("p",{className:"mt-4 text-center text-sm text-muted-foreground",children:["Showing ",_.page.length," files. More files available."]})]}):w?e.jsx(ge,{icon:e.jsx(O,{className:"size-8"}),title:"Trash is empty",description:"Deleted files will appear here. You can restore them or permanently delete them."}):!P?.length&&e.jsx(ge,{icon:e.jsx(de,{className:"size-8"}),title:"No media assets yet",description:"Upload images, videos, documents, and other files to use in your content.",action:{label:"Upload Files",onClick:()=>u(!0)}}),m&&H.length===0&&!w&&e.jsx(ge,{icon:e.jsx(Je,{className:"size-8"}),title:"No results found",description:`No files match "${m}". Try a different search term.`,action:{label:"Clear Search",onClick:()=>d(""),variant:"secondary"}})]}),e.jsx(ye,{open:S,onOpenChange:M,children:e.jsxs(Ne,{children:[e.jsx(Ye,{children:e.jsx(Ce,{children:"Create New Folder"})}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(ms,{htmlFor:"folder-name",children:"Folder Name"}),e.jsx(K,{id:"folder-name",value:D,onChange:t=>{F(t.target.value),Q("")},placeholder:"Enter folder name",autoFocus:!0,onKeyDown:t=>{t.key==="Enter"&&!T&&Oe()}}),$&&e.jsx("p",{className:"text-sm text-destructive",children:$})]})}),e.jsxs(Ze,{children:[e.jsx(x,{variant:"secondary",onClick:()=>M(!1),disabled:T,children:"Cancel"}),e.jsx(x,{onClick:Oe,disabled:T||!D.trim(),loading:T,children:"Create Folder"})]})]})}),e.jsx(ye,{open:g,onOpenChange:u,children:e.jsxs(Ne,{className:"max-w-lg",children:[e.jsx(Ye,{children:e.jsx(Ce,{children:"Upload Files"})}),e.jsx("div",{className:"py-4",children:e.jsx(Ls,{currentFolderId:i,generateUploadUrl:s.generateUploadUrl,createAsset:s.createMediaAsset,onUploadComplete:Ts,maxFileSize:50*1024*1024,maxConcurrentUploads:3})}),e.jsx(Ze,{children:e.jsx(x,{variant:"secondary",onClick:()=>u(!1),children:"Close"})})]})}),e.jsx(xt,{asset:q!==null&&H[q]?H[q]:null,assets:H,currentIndex:q??0,open:q!==null,onOpenChange:t=>{t||G(null)},onNavigate:Cs,onEdit:w?void 0:t=>te({_id:t._id,name:t.name,title:t.title,description:t.description,altText:t.altText,tags:t.tags}),onDelete:w?void 0:t=>C({type:"asset",id:t._id,name:t.name})}),e.jsx(ft,{asset:se,open:se!==null,onOpenChange:t=>{t||te(null)}}),e.jsx(pt,{folder:L,open:L!==null,onOpenChange:t=>{t||ae(null)}}),e.jsx(je,{open:n!==null,onOpenChange:t=>{t||C(null)},title:`Delete ${n?.type==="folder"?"Folder":"File"}?`,description:`Are you sure you want to delete "${n?.name}"? ${n?.type==="folder"?"This will also delete all files inside the folder.":"This action can be undone from the trash."}`,confirmLabel:"Delete",onConfirm:ks,variant:"danger",loading:xs}),e.jsx(je,{open:fs,onOpenChange:me,title:"Delete Selected Files?",description:`Are you sure you want to delete ${c.size} ${c.size===1?"file":"files"}? This action can be undone from the trash.`,confirmLabel:"Delete All",onConfirm:ws,variant:"danger",loading:Te}),e.jsx(je,{open:gs,onOpenChange:t=>{ie(t),t||re(null)},title:Z==="bulk"?`Delete ${c.size} ${c.size===1?"File":"Files"} Forever?`:"Delete Forever?",description:Z==="bulk"?`This will permanently delete ${c.size} ${c.size===1?"file":"files"}. This action cannot be undone.`:"This will permanently delete this file. This action cannot be undone.",confirmLabel:"Delete Forever",onConfirm:Ds,variant:"danger",loading:Ie}),e.jsx(yt,{open:hs,onOpenChange:De,assetIds:Array.from(c),currentFolderId:i,onMoved:zs}),N&&!w&&e.jsx(vt,{selectedCount:c.size,onClear:pe,onMove:()=>De(!0),onDelete:()=>me(!0),isDeleting:Te}),N&&w&&e.jsx(bt,{selectedCount:c.size,onClear:pe,onRestore:Ss,onPermanentDelete:()=>{re("bulk"),ie(!0)},isRestoring:Ee,isDeleting:Ie})]})}function qt(){const s=Zs(),{settings:r}=Ps();return e.jsx(zt,{api:R.admin,navigation:s,settings:r})}export{qt as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{W as a,z as p,u as m,b as c,j as e,F as d}from"./main-dZT72bAG.js";import{C as l}from"./ContentEntryEditor-CWBiIx52.js";import{u as y}from"./useBreadcrumbLabel-D00rvqjw.js";import{C as u}from"./CmsEmptyState-Do_erIgn.js";import"./label-B6PPtKR5.js";import"./switch-DiJvolcs.js";import"./badge-BAlGIjop.js";import"./tabs-Cgz6G_Xy.js";import"./textarea-CgggMxUX.js";import"./list-F8O0lZXC.js";import"./select-BuiHcMzS.js";import"./search-BvgYr-c9.js";import"./command-di7XCqcv.js";import"./CmsStatusBadge-Dd9uToHE.js";import"./plus-AABQIF0N.js";import"./link-2-W2fVnVOf.js";import"./scroll-area-CDfk-zrz.js";import"./triangle-alert-lvCbwp0s.js";import"./circle-check-big-CpLxAvEj.js";function L(){const{contentTypeId:o}=a.useParams(),n=p(),t=m(c.admin.getContentType,{id:o});if(y(`/entries/new/${o}`,t?`New ${t.displayName}`:void 0),t===void 0)return e.jsx("div",{className:"space-y-6 p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading content type..."})]})});if(t===null)return e.jsx("div",{className:"space-y-6 p-6",children:e.jsx(u,{icon:e.jsx(d,{className:"size-6"}),title:"Content Type Not Found",description:"The content type you're looking for doesn't exist or has been deleted.",action:{label:"Back to Content Types",onClick:()=>n({to:"/content-types"})}})});const s=i=>{n({to:"/entries/$entryId",params:{entryId:i._id}})},r=()=>{n({to:"/entries/type/$contentTypeId",params:{contentTypeId:o}})};return e.jsx("div",{className:"space-y-6 p-6",children:e.jsx(l,{contentType:t,onSave:s,onCancel:r})})}export{L as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as e}from"./main-dZT72bAG.js";const o=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],t=e("plus",o);export{t as P};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,a2 as T,a3 as se,j as f,a4 as L,a5 as O,a6 as ce,a7 as C,a8 as P,a9 as ae,c as F}from"./main-dZT72bAG.js";import{c as ie}from"./badge-BAlGIjop.js";function de(e,o){return s.useReducer((r,l)=>o[r][l]??r,e)}var U="ScrollArea",[$]=ce(U),[ue,m]=$(U),q=s.forwardRef((e,o)=>{const{__scopeScrollArea:r,type:l="hover",dir:t,scrollHideDelay:n=600,...c}=e,[a,i]=s.useState(null),[h,d]=s.useState(null),[b,u]=s.useState(null),[S,w]=s.useState(null),[A,Y]=s.useState(null),[x,_]=s.useState(0),[M,D]=s.useState(0),[j,y]=s.useState(!1),[N,W]=s.useState(!1),v=T(o,E=>i(E)),p=se(t);return f.jsx(ue,{scope:r,type:l,dir:p,scrollHideDelay:n,scrollArea:a,viewport:h,onViewportChange:d,content:b,onContentChange:u,scrollbarX:S,onScrollbarXChange:w,scrollbarXEnabled:j,onScrollbarXEnabledChange:y,scrollbarY:A,onScrollbarYChange:Y,scrollbarYEnabled:N,onScrollbarYEnabledChange:W,onCornerWidthChange:_,onCornerHeightChange:D,children:f.jsx(L.div,{dir:p,...c,ref:v,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":M+"px",...e.style}})})});q.displayName=U;var G="ScrollAreaViewport",J=s.forwardRef((e,o)=>{const{__scopeScrollArea:r,children:l,nonce:t,...n}=e,c=m(G,r),a=s.useRef(null),i=T(o,a,c.onViewportChange);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t}),f.jsx(L.div,{"data-radix-scroll-area-viewport":"",...n,ref:i,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...e.style},children:f.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:l})})]})});J.displayName=G;var g="ScrollAreaScrollbar",K=s.forwardRef((e,o)=>{const{forceMount:r,...l}=e,t=m(g,e.__scopeScrollArea),{onScrollbarXEnabledChange:n,onScrollbarYEnabledChange:c}=t,a=e.orientation==="horizontal";return s.useEffect(()=>(a?n(!0):c(!0),()=>{a?n(!1):c(!1)}),[a,n,c]),t.type==="hover"?f.jsx(he,{...l,ref:o,forceMount:r}):t.type==="scroll"?f.jsx(fe,{...l,ref:o,forceMount:r}):t.type==="auto"?f.jsx(Q,{...l,ref:o,forceMount:r}):t.type==="always"?f.jsx(V,{...l,ref:o}):null});K.displayName=g;var he=s.forwardRef((e,o)=>{const{forceMount:r,...l}=e,t=m(g,e.__scopeScrollArea),[n,c]=s.useState(!1);return s.useEffect(()=>{const a=t.scrollArea;let i=0;if(a){const h=()=>{window.clearTimeout(i),c(!0)},d=()=>{i=window.setTimeout(()=>c(!1),t.scrollHideDelay)};return a.addEventListener("pointerenter",h),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(i),a.removeEventListener("pointerenter",h),a.removeEventListener("pointerleave",d)}}},[t.scrollArea,t.scrollHideDelay]),f.jsx(O,{present:r||n,children:f.jsx(Q,{"data-state":n?"visible":"hidden",...l,ref:o})})}),fe=s.forwardRef((e,o)=>{const{forceMount:r,...l}=e,t=m(g,e.__scopeScrollArea),n=e.orientation==="horizontal",c=X(()=>i("SCROLL_END"),100),[a,i]=de("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return s.useEffect(()=>{if(a==="idle"){const h=window.setTimeout(()=>i("HIDE"),t.scrollHideDelay);return()=>window.clearTimeout(h)}},[a,t.scrollHideDelay,i]),s.useEffect(()=>{const h=t.viewport,d=n?"scrollLeft":"scrollTop";if(h){let b=h[d];const u=()=>{const S=h[d];b!==S&&(i("SCROLL"),c()),b=S};return h.addEventListener("scroll",u),()=>h.removeEventListener("scroll",u)}},[t.viewport,n,i,c]),f.jsx(O,{present:r||a!=="hidden",children:f.jsx(V,{"data-state":a==="hidden"?"hidden":"visible",...l,ref:o,onPointerEnter:C(e.onPointerEnter,()=>i("POINTER_ENTER")),onPointerLeave:C(e.onPointerLeave,()=>i("POINTER_LEAVE"))})})}),Q=s.forwardRef((e,o)=>{const r=m(g,e.__scopeScrollArea),{forceMount:l,...t}=e,[n,c]=s.useState(!1),a=e.orientation==="horizontal",i=X(()=>{if(r.viewport){const h=r.viewport.offsetWidth<r.viewport.scrollWidth,d=r.viewport.offsetHeight<r.viewport.scrollHeight;c(a?h:d)}},10);return R(r.viewport,i),R(r.content,i),f.jsx(O,{present:l||n,children:f.jsx(V,{"data-state":n?"visible":"hidden",...t,ref:o})})}),V=s.forwardRef((e,o)=>{const{orientation:r="vertical",...l}=e,t=m(g,e.__scopeScrollArea),n=s.useRef(null),c=s.useRef(0),[a,i]=s.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=te(a.viewport,a.content),d={...l,sizes:a,onSizesChange:i,hasThumb:h>0&&h<1,onThumbChange:u=>n.current=u,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:u=>c.current=u};function b(u,S){return we(u,c.current,a,S)}return r==="horizontal"?f.jsx(be,{...d,ref:o,onThumbPositionChange:()=>{if(t.viewport&&n.current){const u=t.viewport.scrollLeft,S=k(u,a,t.dir);n.current.style.transform=`translate3d(${S}px, 0, 0)`}},onWheelScroll:u=>{t.viewport&&(t.viewport.scrollLeft=u)},onDragScroll:u=>{t.viewport&&(t.viewport.scrollLeft=b(u,t.dir))}}):r==="vertical"?f.jsx(Se,{...d,ref:o,onThumbPositionChange:()=>{if(t.viewport&&n.current){const u=t.viewport.scrollTop,S=k(u,a);n.current.style.transform=`translate3d(0, ${S}px, 0)`}},onWheelScroll:u=>{t.viewport&&(t.viewport.scrollTop=u)},onDragScroll:u=>{t.viewport&&(t.viewport.scrollTop=b(u))}}):null}),be=s.forwardRef((e,o)=>{const{sizes:r,onSizesChange:l,...t}=e,n=m(g,e.__scopeScrollArea),[c,a]=s.useState(),i=s.useRef(null),h=T(o,i,n.onScrollbarXChange);return s.useEffect(()=>{i.current&&a(getComputedStyle(i.current))},[i]),f.jsx(ee,{"data-orientation":"horizontal",...t,ref:h,sizes:r,style:{bottom:0,left:n.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:n.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":I(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,b)=>{if(n.viewport){const u=n.viewport.scrollLeft+d.deltaX;e.onWheelScroll(u),le(u,b)&&d.preventDefault()}},onResize:()=>{i.current&&n.viewport&&c&&l({content:n.viewport.scrollWidth,viewport:n.viewport.offsetWidth,scrollbar:{size:i.current.clientWidth,paddingStart:z(c.paddingLeft),paddingEnd:z(c.paddingRight)}})}})}),Se=s.forwardRef((e,o)=>{const{sizes:r,onSizesChange:l,...t}=e,n=m(g,e.__scopeScrollArea),[c,a]=s.useState(),i=s.useRef(null),h=T(o,i,n.onScrollbarYChange);return s.useEffect(()=>{i.current&&a(getComputedStyle(i.current))},[i]),f.jsx(ee,{"data-orientation":"vertical",...t,ref:h,sizes:r,style:{top:0,right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":I(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,b)=>{if(n.viewport){const u=n.viewport.scrollTop+d.deltaY;e.onWheelScroll(u),le(u,b)&&d.preventDefault()}},onResize:()=>{i.current&&n.viewport&&c&&l({content:n.viewport.scrollHeight,viewport:n.viewport.offsetHeight,scrollbar:{size:i.current.clientHeight,paddingStart:z(c.paddingTop),paddingEnd:z(c.paddingBottom)}})}})}),[ve,Z]=$(g),ee=s.forwardRef((e,o)=>{const{__scopeScrollArea:r,sizes:l,hasThumb:t,onThumbChange:n,onThumbPointerUp:c,onThumbPointerDown:a,onThumbPositionChange:i,onDragScroll:h,onWheelScroll:d,onResize:b,...u}=e,S=m(g,r),[w,A]=s.useState(null),Y=T(o,v=>A(v)),x=s.useRef(null),_=s.useRef(""),M=S.viewport,D=l.content-l.viewport,j=P(d),y=P(i),N=X(b,10);function W(v){if(x.current){const p=v.clientX-x.current.left,E=v.clientY-x.current.top;h({x:p,y:E})}}return s.useEffect(()=>{const v=p=>{const E=p.target;w?.contains(E)&&j(p,D)};return document.addEventListener("wheel",v,{passive:!1}),()=>document.removeEventListener("wheel",v,{passive:!1})},[M,w,D,j]),s.useEffect(y,[l,y]),R(w,N),R(S.content,N),f.jsx(ve,{scope:r,scrollbar:w,hasThumb:t,onThumbChange:P(n),onThumbPointerUp:P(c),onThumbPositionChange:y,onThumbPointerDown:P(a),children:f.jsx(L.div,{...u,ref:Y,style:{position:"absolute",...u.style},onPointerDown:C(e.onPointerDown,v=>{v.button===0&&(v.target.setPointerCapture(v.pointerId),x.current=w.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",S.viewport&&(S.viewport.style.scrollBehavior="auto"),W(v))}),onPointerMove:C(e.onPointerMove,W),onPointerUp:C(e.onPointerUp,v=>{const p=v.target;p.hasPointerCapture(v.pointerId)&&p.releasePointerCapture(v.pointerId),document.body.style.webkitUserSelect=_.current,S.viewport&&(S.viewport.style.scrollBehavior=""),x.current=null})})})}),H="ScrollAreaThumb",re=s.forwardRef((e,o)=>{const{forceMount:r,...l}=e,t=Z(H,e.__scopeScrollArea);return f.jsx(O,{present:r||t.hasThumb,children:f.jsx(me,{ref:o,...l})})}),me=s.forwardRef((e,o)=>{const{__scopeScrollArea:r,style:l,...t}=e,n=m(H,r),c=Z(H,r),{onThumbPositionChange:a}=c,i=T(o,b=>c.onThumbChange(b)),h=s.useRef(void 0),d=X(()=>{h.current&&(h.current(),h.current=void 0)},100);return s.useEffect(()=>{const b=n.viewport;if(b){const u=()=>{if(d(),!h.current){const S=ge(b,a);h.current=S,a()}};return a(),b.addEventListener("scroll",u),()=>b.removeEventListener("scroll",u)}},[n.viewport,d,a]),f.jsx(L.div,{"data-state":c.hasThumb?"visible":"hidden",...t,ref:i,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...l},onPointerDownCapture:C(e.onPointerDownCapture,b=>{const S=b.target.getBoundingClientRect(),w=b.clientX-S.left,A=b.clientY-S.top;c.onThumbPointerDown({x:w,y:A})}),onPointerUp:C(e.onPointerUp,c.onThumbPointerUp)})});re.displayName=H;var B="ScrollAreaCorner",oe=s.forwardRef((e,o)=>{const r=m(B,e.__scopeScrollArea),l=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&l?f.jsx(pe,{...e,ref:o}):null});oe.displayName=B;var pe=s.forwardRef((e,o)=>{const{__scopeScrollArea:r,...l}=e,t=m(B,r),[n,c]=s.useState(0),[a,i]=s.useState(0),h=!!(n&&a);return R(t.scrollbarX,()=>{const d=t.scrollbarX?.offsetHeight||0;t.onCornerHeightChange(d),i(d)}),R(t.scrollbarY,()=>{const d=t.scrollbarY?.offsetWidth||0;t.onCornerWidthChange(d),c(d)}),h?f.jsx(L.div,{...l,ref:o,style:{width:n,height:a,position:"absolute",right:t.dir==="ltr"?0:void 0,left:t.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function z(e){return e?parseInt(e,10):0}function te(e,o){const r=e/o;return isNaN(r)?0:r}function I(e){const o=te(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,l=(e.scrollbar.size-r)*o;return Math.max(l,18)}function we(e,o,r,l="ltr"){const t=I(r),n=t/2,c=o||n,a=t-c,i=r.scrollbar.paddingStart+c,h=r.scrollbar.size-r.scrollbar.paddingEnd-a,d=r.content-r.viewport,b=l==="ltr"?[0,d]:[d*-1,0];return ne([i,h],b)(e)}function k(e,o,r="ltr"){const l=I(o),t=o.scrollbar.paddingStart+o.scrollbar.paddingEnd,n=o.scrollbar.size-t,c=o.content-o.viewport,a=n-l,i=r==="ltr"?[0,c]:[c*-1,0],h=ie(e,i);return ne([0,c],[0,a])(h)}function ne(e,o){return r=>{if(e[0]===e[1]||o[0]===o[1])return o[0];const l=(o[1]-o[0])/(e[1]-e[0]);return o[0]+l*(r-e[0])}}function le(e,o){return e>0&&e<o}var ge=(e,o=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},l=0;return(function t(){const n={left:e.scrollLeft,top:e.scrollTop},c=r.left!==n.left,a=r.top!==n.top;(c||a)&&o(),r=n,l=window.requestAnimationFrame(t)})(),()=>window.cancelAnimationFrame(l)};function X(e,o){const r=P(e),l=s.useRef(0);return s.useEffect(()=>()=>window.clearTimeout(l.current),[]),s.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(r,o)},[r,o])}function R(e,o){const r=P(o);ae(()=>{let l=0;if(e){const t=new ResizeObserver(()=>{cancelAnimationFrame(l),l=window.requestAnimationFrame(r)});return t.observe(e),()=>{window.cancelAnimationFrame(l),t.unobserve(e)}}},[e,r])}var xe=q,Pe=J,Ce=oe;function ye({className:e,children:o,...r}){return f.jsxs(xe,{"data-slot":"scroll-area",className:F("relative",e),...r,children:[f.jsx(Pe,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:o}),f.jsx(Ee,{}),f.jsx(Ce,{})]})}function Ee({className:e,orientation:o="vertical",...r}){return f.jsx(K,{"data-slot":"scroll-area-scrollbar",orientation:o,className:F("flex touch-none p-px transition-colors select-none",o==="vertical"&&"h-full w-2.5 border-l border-l-transparent",o==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...r,children:f.jsx(re,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}export{ye as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as nt,r as n,j as a,ah as rt,a4 as _,a3 as st,aa as Te,ap as at,ac as Ie,a2 as L,aq as lt,a7 as E,a9 as $,ai as it,ar as Pe,as as Ne,at as ct,a8 as dt,aj as ut,al as pt,ak as ft,am as mt,an as ht,a6 as gt,au as vt,av as xt,C as Re,c as te}from"./main-dZT72bAG.js";import{u as St,c as Ee,a as wt}from"./badge-BAlGIjop.js";const yt=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ct=nt("chevron-up",yt);function It(t){const o=bt(t),e=n.forwardRef((s,r)=>{const{children:d,...l}=s,i=n.Children.toArray(d),c=i.find(Et);if(c){const p=c.props.children,g=i.map(x=>x===c?n.Children.count(p)>1?n.Children.only(null):n.isValidElement(p)?p.props.children:null:x);return a.jsx(o,{...l,ref:r,children:n.isValidElement(p)?n.cloneElement(p,void 0,g):null})}return a.jsx(o,{...l,ref:r,children:d})});return e.displayName=`${t}.Slot`,e}function bt(t){const o=n.forwardRef((e,s)=>{const{children:r,...d}=e;if(n.isValidElement(r)){const l=Nt(r),i=Pt(d,r.props);return r.type!==n.Fragment&&(i.ref=s?rt(s,l):l),n.cloneElement(r,i)}return n.Children.count(r)>1?n.Children.only(null):null});return o.displayName=`${t}.SlotClone`,o}var Tt=Symbol("radix.slottable");function Et(t){return n.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Tt}function Pt(t,o){const e={...o};for(const s in o){const r=t[s],d=o[s];/^on[A-Z]/.test(s)?r&&d?e[s]=(...i)=>{const c=d(...i);return r(...i),c}:r&&(e[s]=r):s==="style"?e[s]={...r,...d}:s==="className"&&(e[s]=[r,d].filter(Boolean).join(" "))}return{...t,...e}}function Nt(t){let o=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,e=o&&"isReactWarning"in o&&o.isReactWarning;return e?t.ref:(o=Object.getOwnPropertyDescriptor(t,"ref")?.get,e=o&&"isReactWarning"in o&&o.isReactWarning,e?t.props.ref:t.props.ref||t.ref)}var _e=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Rt="VisuallyHidden",_t=n.forwardRef((t,o)=>a.jsx(_.span,{...t,ref:o,style:{..._e,...t.style}}));_t.displayName=Rt;var jt=[" ","Enter","ArrowUp","ArrowDown"],Mt=[" ","Enter"],J="Select",[ce,de,At]=ct(J),[oe]=gt(J,[At,Ne]),ue=Ne(),[Ot,G]=oe(J),[Dt,Lt]=oe(J),je=t=>{const{__scopeSelect:o,children:e,open:s,defaultOpen:r,onOpenChange:d,value:l,defaultValue:i,onValueChange:c,dir:p,name:g,autoComplete:x,disabled:P,required:b,form:C}=t,u=ue(o),[h,S]=n.useState(null),[m,v]=n.useState(null),[F,M]=n.useState(!1),ne=st(p),[N,O]=Te({prop:s,defaultProp:r??!1,onChange:d,caller:J}),[U,q]=Te({prop:l,defaultProp:i,onChange:c,caller:J}),k=n.useRef(null),V=h?C||!!h.closest("form"):!0,[z,B]=n.useState(new Set),H=Array.from(z).map(R=>R.props.value).join(";");return a.jsx(at,{...u,children:a.jsxs(Ot,{required:b,scope:o,trigger:h,onTriggerChange:S,valueNode:m,onValueNodeChange:v,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:Ie(),value:U,onValueChange:q,open:N,onOpenChange:O,dir:ne,triggerPointerDownPosRef:k,disabled:P,children:[a.jsx(ce.Provider,{scope:o,children:a.jsx(Dt,{scope:t.__scopeSelect,onNativeOptionAdd:n.useCallback(R=>{B(D=>new Set(D).add(R))},[]),onNativeOptionRemove:n.useCallback(R=>{B(D=>{const W=new Set(D);return W.delete(R),W})},[]),children:e})}),V?a.jsxs(Qe,{"aria-hidden":!0,required:b,tabIndex:-1,name:g,autoComplete:x,value:U,onChange:R=>q(R.target.value),disabled:P,form:C,children:[U===void 0?a.jsx("option",{value:""}):null,Array.from(z)]},H):null]})})};je.displayName=J;var Me="SelectTrigger",Ae=n.forwardRef((t,o)=>{const{__scopeSelect:e,disabled:s=!1,...r}=t,d=ue(e),l=G(Me,e),i=l.disabled||s,c=L(o,l.onTriggerChange),p=de(e),g=n.useRef("touch"),[x,P,b]=tt(u=>{const h=p().filter(v=>!v.disabled),S=h.find(v=>v.value===l.value),m=ot(h,u,S);m!==void 0&&l.onValueChange(m.value)}),C=u=>{i||(l.onOpenChange(!0),b()),u&&(l.triggerPointerDownPosRef.current={x:Math.round(u.pageX),y:Math.round(u.pageY)})};return a.jsx(lt,{asChild:!0,...d,children:a.jsx(_.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:i,"data-disabled":i?"":void 0,"data-placeholder":et(l.value)?"":void 0,...r,ref:c,onClick:E(r.onClick,u=>{u.currentTarget.focus(),g.current!=="mouse"&&C(u)}),onPointerDown:E(r.onPointerDown,u=>{g.current=u.pointerType;const h=u.target;h.hasPointerCapture(u.pointerId)&&h.releasePointerCapture(u.pointerId),u.button===0&&u.ctrlKey===!1&&u.pointerType==="mouse"&&(C(u),u.preventDefault())}),onKeyDown:E(r.onKeyDown,u=>{const h=x.current!=="";!(u.ctrlKey||u.altKey||u.metaKey)&&u.key.length===1&&P(u.key),!(h&&u.key===" ")&&jt.includes(u.key)&&(C(),u.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=n.forwardRef((t,o)=>{const{__scopeSelect:e,className:s,style:r,children:d,placeholder:l="",...i}=t,c=G(Oe,e),{onValueNodeHasChildrenChange:p}=c,g=d!==void 0,x=L(o,c.onValueNodeChange);return $(()=>{p(g)},[p,g]),a.jsx(_.span,{...i,ref:x,style:{pointerEvents:"none"},children:et(c.value)?a.jsx(a.Fragment,{children:l}):d})});De.displayName=Oe;var kt="SelectIcon",Le=n.forwardRef((t,o)=>{const{__scopeSelect:e,children:s,...r}=t;return a.jsx(_.span,{"aria-hidden":!0,...r,ref:o,children:s||"▼"})});Le.displayName=kt;var Vt="SelectPortal",ke=t=>a.jsx(it,{asChild:!0,...t});ke.displayName=Vt;var Q="SelectContent",Ve=n.forwardRef((t,o)=>{const e=G(Q,t.__scopeSelect),[s,r]=n.useState();if($(()=>{r(new DocumentFragment)},[]),!e.open){const d=s;return d?Pe.createPortal(a.jsx(Be,{scope:t.__scopeSelect,children:a.jsx(ce.Slot,{scope:t.__scopeSelect,children:a.jsx("div",{children:t.children})})}),d):null}return a.jsx(He,{...t,ref:o})});Ve.displayName=Q;var A=10,[Be,Y]=oe(Q),Bt="SelectContentImpl",Ht=It("SelectContent.RemoveScroll"),He=n.forwardRef((t,o)=>{const{__scopeSelect:e,position:s="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:d,onPointerDownOutside:l,side:i,sideOffset:c,align:p,alignOffset:g,arrowPadding:x,collisionBoundary:P,collisionPadding:b,sticky:C,hideWhenDetached:u,avoidCollisions:h,...S}=t,m=G(Q,e),[v,F]=n.useState(null),[M,ne]=n.useState(null),N=L(o,f=>F(f)),[O,U]=n.useState(null),[q,k]=n.useState(null),V=de(e),[z,B]=n.useState(!1),H=n.useRef(!1);n.useEffect(()=>{if(v)return ut(v)},[v]),pt();const R=n.useCallback(f=>{const[I,...j]=V().map(T=>T.ref.current),[w]=j.slice(-1),y=document.activeElement;for(const T of f)if(T===y||(T?.scrollIntoView({block:"nearest"}),T===I&&M&&(M.scrollTop=0),T===w&&M&&(M.scrollTop=M.scrollHeight),T?.focus(),document.activeElement!==y))return},[V,M]),D=n.useCallback(()=>R([O,v]),[R,O,v]);n.useEffect(()=>{z&&D()},[z,D]);const{onOpenChange:W,triggerPointerDownPosRef:K}=m;n.useEffect(()=>{if(v){let f={x:0,y:0};const I=w=>{f={x:Math.abs(Math.round(w.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(w.pageY)-(K.current?.y??0))}},j=w=>{f.x<=10&&f.y<=10?w.preventDefault():v.contains(w.target)||W(!1),document.removeEventListener("pointermove",I),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",I),document.addEventListener("pointerup",j,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",I),document.removeEventListener("pointerup",j,{capture:!0})}}},[v,W,K]),n.useEffect(()=>{const f=()=>W(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[W]);const[pe,ae]=tt(f=>{const I=V().filter(y=>!y.disabled),j=I.find(y=>y.ref.current===document.activeElement),w=ot(I,f,j);w&&setTimeout(()=>w.ref.current.focus())}),fe=n.useCallback((f,I,j)=>{const w=!H.current&&!j;(m.value!==void 0&&m.value===I||w)&&(U(f),w&&(H.current=!0))},[m.value]),me=n.useCallback(()=>v?.focus(),[v]),ee=n.useCallback((f,I,j)=>{const w=!H.current&&!j;(m.value!==void 0&&m.value===I||w)&&k(f)},[m.value]),le=s==="popper"?xe:We,re=le===xe?{side:i,sideOffset:c,align:p,alignOffset:g,arrowPadding:x,collisionBoundary:P,collisionPadding:b,sticky:C,hideWhenDetached:u,avoidCollisions:h}:{};return a.jsx(Be,{scope:e,content:v,viewport:M,onViewportChange:ne,itemRefCallback:fe,selectedItem:O,onItemLeave:me,itemTextRefCallback:ee,focusSelectedItem:D,selectedItemText:q,position:s,isPositioned:z,searchRef:pe,children:a.jsx(ft,{as:Ht,allowPinchZoom:!0,children:a.jsx(mt,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:E(r,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:a.jsx(ht,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:l,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:a.jsx(le,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...S,...re,onPlaced:()=>B(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:E(S.onKeyDown,f=>{const I=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!I&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let w=V().filter(y=>!y.disabled).map(y=>y.ref.current);if(["ArrowUp","End"].includes(f.key)&&(w=w.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const y=f.target,T=w.indexOf(y);w=w.slice(T+1)}setTimeout(()=>R(w)),f.preventDefault()}})})})})})})});He.displayName=Bt;var Wt="SelectItemAlignedPosition",We=n.forwardRef((t,o)=>{const{__scopeSelect:e,onPlaced:s,...r}=t,d=G(Q,e),l=Y(Q,e),[i,c]=n.useState(null),[p,g]=n.useState(null),x=L(o,N=>g(N)),P=de(e),b=n.useRef(!1),C=n.useRef(!0),{viewport:u,selectedItem:h,selectedItemText:S,focusSelectedItem:m}=l,v=n.useCallback(()=>{if(d.trigger&&d.valueNode&&i&&p&&u&&h&&S){const N=d.trigger.getBoundingClientRect(),O=p.getBoundingClientRect(),U=d.valueNode.getBoundingClientRect(),q=S.getBoundingClientRect();if(d.dir!=="rtl"){const y=q.left-O.left,T=U.left-y,Z=N.left-T,X=N.width+Z,he=Math.max(X,O.width),ge=window.innerWidth-A,ve=Ee(T,[A,Math.max(A,ge-he)]);i.style.minWidth=X+"px",i.style.left=ve+"px"}else{const y=O.right-q.right,T=window.innerWidth-U.right-y,Z=window.innerWidth-N.right-T,X=N.width+Z,he=Math.max(X,O.width),ge=window.innerWidth-A,ve=Ee(T,[A,Math.max(A,ge-he)]);i.style.minWidth=X+"px",i.style.right=ve+"px"}const k=P(),V=window.innerHeight-A*2,z=u.scrollHeight,B=window.getComputedStyle(p),H=parseInt(B.borderTopWidth,10),R=parseInt(B.paddingTop,10),D=parseInt(B.borderBottomWidth,10),W=parseInt(B.paddingBottom,10),K=H+R+z+W+D,pe=Math.min(h.offsetHeight*5,K),ae=window.getComputedStyle(u),fe=parseInt(ae.paddingTop,10),me=parseInt(ae.paddingBottom,10),ee=N.top+N.height/2-A,le=V-ee,re=h.offsetHeight/2,f=h.offsetTop+re,I=H+R+f,j=K-I;if(I<=ee){const y=k.length>0&&h===k[k.length-1].ref.current;i.style.bottom="0px";const T=p.clientHeight-u.offsetTop-u.offsetHeight,Z=Math.max(le,re+(y?me:0)+T+D),X=I+Z;i.style.height=X+"px"}else{const y=k.length>0&&h===k[0].ref.current;i.style.top="0px";const Z=Math.max(ee,H+u.offsetTop+(y?fe:0)+re)+j;i.style.height=Z+"px",u.scrollTop=I-ee+u.offsetTop}i.style.margin=`${A}px 0`,i.style.minHeight=pe+"px",i.style.maxHeight=V+"px",s?.(),requestAnimationFrame(()=>b.current=!0)}},[P,d.trigger,d.valueNode,i,p,u,h,S,d.dir,s]);$(()=>v(),[v]);const[F,M]=n.useState();$(()=>{p&&M(window.getComputedStyle(p).zIndex)},[p]);const ne=n.useCallback(N=>{N&&C.current===!0&&(v(),m?.(),C.current=!1)},[v,m]);return a.jsx(Ut,{scope:e,contentWrapper:i,shouldExpandOnScrollRef:b,onScrollButtonChange:ne,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:a.jsx(_.div,{...r,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});We.displayName=Wt;var Ft="SelectPopperPosition",xe=n.forwardRef((t,o)=>{const{__scopeSelect:e,align:s="start",collisionPadding:r=A,...d}=t,l=ue(e);return a.jsx(vt,{...l,...d,ref:o,align:s,collisionPadding:r,style:{boxSizing:"border-box",...d.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});xe.displayName=Ft;var[Ut,be]=oe(Q,{}),Se="SelectViewport",Fe=n.forwardRef((t,o)=>{const{__scopeSelect:e,nonce:s,...r}=t,d=Y(Se,e),l=be(Se,e),i=L(o,d.onViewportChange),c=n.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),a.jsx(ce.Slot,{scope:e,children:a.jsx(_.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:E(r.onScroll,p=>{const g=p.currentTarget,{contentWrapper:x,shouldExpandOnScrollRef:P}=l;if(P?.current&&x){const b=Math.abs(c.current-g.scrollTop);if(b>0){const C=window.innerHeight-A*2,u=parseFloat(x.style.minHeight),h=parseFloat(x.style.height),S=Math.max(u,h);if(S<C){const m=S+b,v=Math.min(C,m),F=m-v;x.style.height=v+"px",x.style.bottom==="0px"&&(g.scrollTop=F>0?F:0,x.style.justifyContent="flex-end")}}}c.current=g.scrollTop})})})]})});Fe.displayName=Se;var Ue="SelectGroup",[zt,Kt]=oe(Ue),$t=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=Ie();return a.jsx(zt,{scope:e,id:r,children:a.jsx(_.div,{role:"group","aria-labelledby":r,...s,ref:o})})});$t.displayName=Ue;var ze="SelectLabel",Gt=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=Kt(ze,e);return a.jsx(_.div,{id:r.id,...s,ref:o})});Gt.displayName=ze;var ie="SelectItem",[Yt,Ke]=oe(ie),$e=n.forwardRef((t,o)=>{const{__scopeSelect:e,value:s,disabled:r=!1,textValue:d,...l}=t,i=G(ie,e),c=Y(ie,e),p=i.value===s,[g,x]=n.useState(d??""),[P,b]=n.useState(!1),C=L(o,m=>c.itemRefCallback?.(m,s,r)),u=Ie(),h=n.useRef("touch"),S=()=>{r||(i.onValueChange(s),i.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(Yt,{scope:e,value:s,disabled:r,textId:u,isSelected:p,onItemTextChange:n.useCallback(m=>{x(v=>v||(m?.textContent??"").trim())},[]),children:a.jsx(ce.ItemSlot,{scope:e,value:s,disabled:r,textValue:g,children:a.jsx(_.div,{role:"option","aria-labelledby":u,"data-highlighted":P?"":void 0,"aria-selected":p&&P,"data-state":p?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...l,ref:C,onFocus:E(l.onFocus,()=>b(!0)),onBlur:E(l.onBlur,()=>b(!1)),onClick:E(l.onClick,()=>{h.current!=="mouse"&&S()}),onPointerUp:E(l.onPointerUp,()=>{h.current==="mouse"&&S()}),onPointerDown:E(l.onPointerDown,m=>{h.current=m.pointerType}),onPointerMove:E(l.onPointerMove,m=>{h.current=m.pointerType,r?c.onItemLeave?.():h.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:E(l.onPointerLeave,m=>{m.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:E(l.onKeyDown,m=>{c.searchRef?.current!==""&&m.key===" "||(Mt.includes(m.key)&&S(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ie;var se="SelectItemText",Ge=n.forwardRef((t,o)=>{const{__scopeSelect:e,className:s,style:r,...d}=t,l=G(se,e),i=Y(se,e),c=Ke(se,e),p=Lt(se,e),[g,x]=n.useState(null),P=L(o,S=>x(S),c.onItemTextChange,S=>i.itemTextRefCallback?.(S,c.value,c.disabled)),b=g?.textContent,C=n.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:b},c.value),[c.disabled,c.value,b]),{onNativeOptionAdd:u,onNativeOptionRemove:h}=p;return $(()=>(u(C),()=>h(C)),[u,h,C]),a.jsxs(a.Fragment,{children:[a.jsx(_.span,{id:c.textId,...d,ref:P}),c.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Pe.createPortal(d.children,l.valueNode):null]})});Ge.displayName=se;var Ye="SelectItemIndicator",qe=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t;return Ke(Ye,e).isSelected?a.jsx(_.span,{"aria-hidden":!0,...s,ref:o}):null});qe.displayName=Ye;var we="SelectScrollUpButton",Ze=n.forwardRef((t,o)=>{const e=Y(we,t.__scopeSelect),s=be(we,t.__scopeSelect),[r,d]=n.useState(!1),l=L(o,s.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let i=function(){const p=c.scrollTop>0;d(p)};const c=e.viewport;return i(),c.addEventListener("scroll",i),()=>c.removeEventListener("scroll",i)}},[e.viewport,e.isPositioned]),r?a.jsx(Je,{...t,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=e;i&&c&&(i.scrollTop=i.scrollTop-c.offsetHeight)}}):null});Ze.displayName=we;var ye="SelectScrollDownButton",Xe=n.forwardRef((t,o)=>{const e=Y(ye,t.__scopeSelect),s=be(ye,t.__scopeSelect),[r,d]=n.useState(!1),l=L(o,s.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let i=function(){const p=c.scrollHeight-c.clientHeight,g=Math.ceil(c.scrollTop)<p;d(g)};const c=e.viewport;return i(),c.addEventListener("scroll",i),()=>c.removeEventListener("scroll",i)}},[e.viewport,e.isPositioned]),r?a.jsx(Je,{...t,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=e;i&&c&&(i.scrollTop=i.scrollTop+c.offsetHeight)}}):null});Xe.displayName=ye;var Je=n.forwardRef((t,o)=>{const{__scopeSelect:e,onAutoScroll:s,...r}=t,d=Y("SelectScrollButton",e),l=n.useRef(null),i=de(e),c=n.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return n.useEffect(()=>()=>c(),[c]),$(()=>{i().find(g=>g.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[i]),a.jsx(_.div,{"aria-hidden":!0,...r,ref:o,style:{flexShrink:0,...r.style},onPointerDown:E(r.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(s,50))}),onPointerMove:E(r.onPointerMove,()=>{d.onItemLeave?.(),l.current===null&&(l.current=window.setInterval(s,50))}),onPointerLeave:E(r.onPointerLeave,()=>{c()})})}),qt="SelectSeparator",Zt=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t;return a.jsx(_.div,{"aria-hidden":!0,...s,ref:o})});Zt.displayName=qt;var Ce="SelectArrow",Xt=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=ue(e),d=G(Ce,e),l=Y(Ce,e);return d.open&&l.position==="popper"?a.jsx(xt,{...r,...s,ref:o}):null});Xt.displayName=Ce;var Jt="SelectBubbleInput",Qe=n.forwardRef(({__scopeSelect:t,value:o,...e},s)=>{const r=n.useRef(null),d=L(s,r),l=St(o);return n.useEffect(()=>{const i=r.current;if(!i)return;const c=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(c,"value").set;if(l!==o&&g){const x=new Event("change",{bubbles:!0});g.call(i,o),i.dispatchEvent(x)}},[l,o]),a.jsx(_.select,{...e,style:{..._e,...e.style},ref:d,defaultValue:o})});Qe.displayName=Jt;function et(t){return t===""||t===void 0}function tt(t){const o=dt(t),e=n.useRef(""),s=n.useRef(0),r=n.useCallback(l=>{const i=e.current+l;o(i),(function c(p){e.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>c(""),1e3))})(i)},[o]),d=n.useCallback(()=>{e.current="",window.clearTimeout(s.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(s.current),[]),[e,r,d]}function ot(t,o,e){const r=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,d=e?t.indexOf(e):-1;let l=Qt(t,Math.max(d,0));r.length===1&&(l=l.filter(p=>p!==e));const c=l.find(p=>p.textValue.toLowerCase().startsWith(r.toLowerCase()));return c!==e?c:void 0}function Qt(t,o){return t.map((e,s)=>t[(o+s)%t.length])}var eo=je,to=Ae,oo=De,no=Le,ro=ke,so=Ve,ao=Fe,lo=$e,io=Ge,co=qe,uo=Ze,po=Xe;function vo({...t}){return a.jsx(eo,{"data-slot":"select",...t})}function xo({...t}){return a.jsx(oo,{"data-slot":"select-value",...t})}function So({className:t,size:o="default",children:e,...s}){return a.jsxs(to,{"data-slot":"select-trigger","data-size":o,className:te("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s,children:[e,a.jsx(no,{asChild:!0,children:a.jsx(Re,{className:"size-4 opacity-50"})})]})}function wo({className:t,children:o,position:e="item-aligned",align:s="center",...r}){return a.jsx(ro,{children:a.jsxs(so,{"data-slot":"select-content",className:te("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",e==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:e,align:s,...r,children:[a.jsx(fo,{}),a.jsx(ao,{className:te("p-1",e==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:o}),a.jsx(mo,{})]})})}function yo({className:t,children:o,...e}){return a.jsxs(lo,{"data-slot":"select-item",className:te("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...e,children:[a.jsx("span",{"data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:a.jsx(co,{children:a.jsx(wt,{className:"size-4"})})}),a.jsx(io,{children:o})]})}function fo({className:t,...o}){return a.jsx(uo,{"data-slot":"select-scroll-up-button",className:te("flex cursor-default items-center justify-center py-1",t),...o,children:a.jsx(Ct,{className:"size-4"})})}function mo({className:t,...o}){return a.jsx(po,{"data-slot":"select-scroll-down-button",className:te("flex cursor-default items-center justify-center py-1",t),...o,children:a.jsx(Re,{className:"size-4"})})}export{Ct as C,vo as S,_t as V,So as a,xo as b,wo as c,yo as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as S,g as B,r as a,u as O,a as D,j as e,R as C,L as E,h as G,c as V,b as $}from"./main-dZT72bAG.js";import{B as N,a as H,X as J,C as L}from"./badge-BAlGIjop.js";import{L as l}from"./label-B6PPtKR5.js";import{S as Q,a as X,b as Z,c as K,d as W}from"./select-BuiHcMzS.js";import{u as Y}from"./usePermissions-D7tQowaF.js";import{C as M}from"./CmsPageHeader-qDwPGi48.js";import{C as u}from"./CmsSurface-DBy5Lumx.js";import{S as v}from"./switch-DiJvolcs.js";import{A as ee,a as se}from"./alert-GxZx0y5c.js";import{u as te}from"./tanstack-adapter-BknsSgra.js";const ae=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ne=S("info",ae);const ie=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],le=S("monitor",ie);const re=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],ce=S("moon",re);const de=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],oe=S("sun",de),b={versioning:!0,scheduling:!0,localization:!1,mediaManagement:!0},f={_id:null,defaultLocale:"en",availableLocales:["en","es","fr","de"],features:b},me=[{value:"en",label:"English (en)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"},{value:"it",label:"Italian (it)"},{value:"pt",label:"Portuguese (pt)"},{value:"zh",label:"Chinese (zh)"},{value:"ja",label:"Japanese (ja)"}],ue=[{value:"light",label:"Light",icon:e.jsx(oe,{className:"size-4"})},{value:"dark",label:"Dark",icon:e.jsx(ce,{className:"size-4"})},{value:"system",label:"System",icon:e.jsx(le,{className:"size-4"})}];function A(){const{theme:s,setTheme:w}=G();return e.jsxs(u,{elevation:"base",className:"p-6",children:[e.jsx("h2",{className:"mb-4 text-lg font-semibold text-foreground",children:"Appearance"}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Theme"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose your preferred color theme for the admin interface."})]}),e.jsx("div",{className:"flex gap-1 rounded-lg border bg-muted/50 p-1",children:ue.map(d=>e.jsxs("button",{type:"button",onClick:()=>w(d.value),className:V("flex items-center gap-2 rounded-md px-3 py-1.5 text-sm font-medium transition-colors",s===d.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[d.icon,d.label]},d.value))})]})})]})}function xe({api:s,navigation:w}){const{canManageSettings:d}=Y(),k=d(),I=B(),o=a.useMemo(()=>typeof s.getSettings=="function",[s]),r=O(o?s.getSettings:"skip",o?{}:"skip"),T=D(s.updateSettings??(()=>{})),z=D(s.resetSettings??(()=>{})),[c,g]=a.useState(null),[x,y]=a.useState(!1),[h,n]=a.useState("idle"),[P,j]=a.useState(null),i=a.useMemo(()=>r?{_id:r._id??null,defaultLocale:r.defaultLocale??f.defaultLocale,availableLocales:r.availableLocales??f.availableLocales,features:{...b,...r.features??{}},updatedBy:r.updatedBy,_creationTime:r._creationTime}:null,[r]);a.useEffect(()=>{i&&!c&&g(i)},[i,c]),a.useEffect(()=>{i&&!x&&g(i)},[i,x]);const F=a.useCallback(t=>{c&&(g({...c,defaultLocale:t}),y(!0),n("idle"))},[c]),R=a.useCallback(async()=>{if(!(!c||!x||!o||!s.updateSettings)){n("saving"),j(null);try{await T({defaultLocale:c.defaultLocale}),n("saved"),y(!1),setTimeout(()=>{n("idle")},3e3)}catch(t){n("error"),j(t instanceof Error?t.message:"Failed to save settings")}}},[c,x,o,s.updateSettings,T]),U=a.useCallback(async()=>{if(!(!o||!s.resetSettings||!window.confirm("Are you sure you want to reset all settings to their defaults? This action cannot be undone."))){n("saving"),j(null);try{const m=await z({});g({...f,_id:m?._id??null,defaultLocale:m?.defaultLocale??f.defaultLocale,availableLocales:m?.availableLocales??f.availableLocales,features:{...b,...m?.features??{}}}),n("saved"),y(!1),setTimeout(()=>{n("idle")},3e3)}catch(m){n("error"),j(m instanceof Error?m.message:"Failed to reset settings")}}},[o,s.resetSettings,z]),q=a.useCallback(()=>{i&&(g(i),y(!1),n("idle"),j(null))},[i]);if(!o)return e.jsx(C,{requiredPermission:{resource:"settings",action:"manage"},children:e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx(M,{title:"Settings",description:"Configure your CMS settings and preferences."}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(A,{}),e.jsxs(ee,{children:[e.jsx(ne,{className:"size-4"}),e.jsxs(se,{children:[e.jsx("strong",{children:"Settings not configured."})," To enable CMS settings, export"," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"getSettings"}),","," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"updateSettings"}),", and"," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"resetSettings"})," from your"," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"convex/admin.ts"})," file."]})]}),e.jsxs(u,{elevation:"base",className:"p-6",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Features"}),e.jsxs(N,{variant:"secondary",className:"gap-1",children:[e.jsx(E,{className:"size-3"}),"Default values"]})]}),e.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:"Showing default feature flags. Configure settings in your admin API to customize."}),e.jsx("div",{className:"space-y-4",children:["versioning","scheduling","localization","mediaManagement"].map(t=>e.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[e.jsx("div",{children:e.jsx(l,{className:"text-sm font-medium capitalize",children:t})}),e.jsx(v,{checked:b[t],disabled:!0})]},t))})]}),e.jsxs(u,{elevation:"base",className:"p-6",children:[e.jsx("h2",{className:"mb-4 text-lg font-semibold text-foreground",children:"API"}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Convex Deployment URL"}),e.jsx("code",{className:"mt-1 block rounded-md bg-muted px-3 py-2 text-sm",children:"https://majestic-beagle-49.convex.cloud"})]})})]})]})]})});if(r===void 0)return e.jsx(C,{requiredPermission:{resource:"settings",action:"manage"},children:e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx(M,{title:"Settings",description:"Configure your CMS settings and preferences."}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading settings..."})]})]})});const _=c??i??f,p=_.features??b;return e.jsx(C,{requiredPermission:{resource:"settings",action:"manage"},children:e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(M,{title:"Settings",description:"Configure your CMS settings and preferences."}),k&&s.updateSettings&&e.jsxs("div",{className:"flex items-center gap-3",children:[h==="saved"&&e.jsxs(N,{variant:"secondary",className:"gap-1 bg-emerald-100 text-emerald-700",children:[e.jsx(H,{className:"size-3"}),"Settings saved successfully"]}),h==="error"&&e.jsxs(N,{variant:"destructive",className:"gap-1",children:[e.jsx(J,{className:"size-3"}),P||"An error occurred"]}),x&&e.jsx(L,{variant:"secondary",onClick:q,disabled:h==="saving",children:"Discard Changes"}),e.jsx(L,{onClick:R,disabled:!x,loading:h==="saving",children:"Save Changes"})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(A,{}),p.localization&&e.jsxs(u,{elevation:"base",className:"p-6",children:[e.jsx("h2",{className:"mb-4 text-lg font-semibold text-foreground",children:"General"}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Default Locale"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"The default language for new content entries."})]}),e.jsxs(Q,{value:_.defaultLocale,onValueChange:F,disabled:!k||h==="saving"||!s.updateSettings,children:[e.jsx(X,{className:"w-48",children:e.jsx(Z,{})}),e.jsx(K,{children:me.map(t=>e.jsx(W,{value:t.value,children:t.label},t.value))})]})]})})]}),e.jsxs(u,{elevation:"base",className:"p-6",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Features"}),e.jsxs(N,{variant:"secondary",className:"gap-1",children:[e.jsx(E,{className:"size-3"}),"Configured in code"]})]}),e.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:"Feature flags are defined in your Convex configuration and cannot be changed from the UI."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Versioning"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Track content history and enable rollback to previous versions"})]}),e.jsx(v,{checked:p.versioning,disabled:!0})]}),e.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Scheduling"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Schedule content to publish at a future date and time"})]}),e.jsx(v,{checked:p.scheduling,disabled:!0})]}),e.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Localization"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Support multiple languages for content entries"})]}),e.jsx(v,{checked:p.localization,disabled:!0})]}),I.navigation.showMedia&&e.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Media Management"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Use the built-in media library for image and file uploads"})]}),e.jsx(v,{checked:p.mediaManagement,disabled:!0})]})]})]}),e.jsxs(u,{elevation:"base",className:"p-6",children:[e.jsx("h2",{className:"mb-4 text-lg font-semibold text-foreground",children:"API"}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Convex Deployment URL"}),e.jsx("code",{className:"mt-1 block rounded-md bg-muted px-3 py-2 text-sm",children:"https://majestic-beagle-49.convex.cloud"})]})})]}),k&&s.resetSettings&&e.jsxs(u,{elevation:"base",className:"border-red-200 p-6 dark:border-red-900",children:[e.jsx("h2",{className:"mb-4 text-lg font-semibold text-red-600",children:"Danger Zone"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Reset to Defaults"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Reset all settings to their default values. This cannot be undone."})]}),e.jsx(L,{variant:"danger",onClick:U,disabled:h==="saving",children:"Reset Settings"})]})]})]})]})})}function ke(){const s=te();return e.jsx(xe,{api:$.admin,navigation:s})}export{ke as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,a2 as C,aa as T,j as o,a4 as y,a7 as I,ab as M,a6 as H,c as g}from"./main-dZT72bAG.js";import{u as z}from"./badge-BAlGIjop.js";var b="Switch",[A]=H(b),[U,q]=A(b),P=s.forwardRef((e,a)=>{const{__scopeSwitch:t,name:n,checked:r,defaultChecked:m,required:d,disabled:c,value:u="on",onCheckedChange:k,form:i,...w}=e,[l,p]=s.useState(null),v=C(a,f=>p(f)),x=s.useRef(!1),S=l?i||!!l.closest("form"):!0,[h,N]=T({prop:r,defaultProp:m??!1,onChange:k,caller:b});return o.jsxs(U,{scope:t,checked:h,disabled:c,children:[o.jsx(y.button,{type:"button",role:"switch","aria-checked":h,"aria-required":d,"data-state":_(h),"data-disabled":c?"":void 0,disabled:c,value:u,...w,ref:v,onClick:I(e.onClick,f=>{N(B=>!B),S&&(x.current=f.isPropagationStopped(),x.current||f.stopPropagation())})}),S&&o.jsx(j,{control:l,bubbles:!x.current,name:n,value:u,checked:h,required:d,disabled:c,form:i,style:{transform:"translateX(-100%)"}})]})});P.displayName=b;var E="SwitchThumb",R=s.forwardRef((e,a)=>{const{__scopeSwitch:t,...n}=e,r=q(E,t);return o.jsx(y.span,{"data-state":_(r.checked),"data-disabled":r.disabled?"":void 0,...n,ref:a})});R.displayName=E;var L="SwitchBubbleInput",j=s.forwardRef(({__scopeSwitch:e,control:a,checked:t,bubbles:n=!0,...r},m)=>{const d=s.useRef(null),c=C(d,m),u=z(t),k=M(a);return s.useEffect(()=>{const i=d.current;if(!i)return;const w=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(w,"checked").set;if(u!==t&&p){const v=new Event("click",{bubbles:n});p.call(i,t),i.dispatchEvent(v)}},[u,t,n]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...r,tabIndex:-1,ref:c,style:{...r.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});j.displayName=L;function _(e){return e?"checked":"unchecked"}var O=P,D=R;function X({className:e,...a}){return o.jsx(O,{"data-slot":"switch",className:g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...a,children:o.jsx(D,{"data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{X as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as k,r as u,a as H,j as t,a0 as ee,c as N,a3 as te,aa as se,a4 as T,ac as re,ad as ae,ae as ne,a7 as z,af as B,a6 as oe,a5 as ie}from"./main-dZT72bAG.js";import{C as j,X as $,a as ce}from"./badge-BAlGIjop.js";const le=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Re=k("chevron-left",le);const de=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],Ue=k("file",de);const ue=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],De=k("music",ue);const pe=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],me=k("refresh-cw",pe);const ge=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],fe=k("upload",ge);const he=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],Ie=k("video",he);function ve(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function xe(r,a=5e3){return r.type.startsWith("image/")?new Promise(s=>{const c=new Image;let l=null;const i=setTimeout(()=>{l&&URL.revokeObjectURL(l),s(void 0)},a);c.onload=()=>{clearTimeout(i),l&&URL.revokeObjectURL(l),s({width:c.naturalWidth,height:c.naturalHeight})},c.onerror=()=>{clearTimeout(i),l&&URL.revokeObjectURL(l),s(void 0)},l=URL.createObjectURL(r),c.src=l}):Promise.resolve(void 0)}function be(r,a,s,c){return new Promise((l,i)=>{const n=new XMLHttpRequest,g=()=>{n.abort(),i(new DOMException("Upload aborted","AbortError"))};s.addEventListener("abort",g),n.upload.onprogress=h=>{if(h.lengthComputable){const v=Math.round(h.loaded/h.total*80);c(10+v)}},n.onload=()=>{if(s.removeEventListener("abort",g),n.status>=200&&n.status<300)try{const h=JSON.parse(n.responseText);l(h.storageId)}catch{i(new Error("Invalid response from upload server"))}else i(new Error(`Upload failed: ${n.statusText||`HTTP ${n.status}`}`))},n.onerror=()=>{s.removeEventListener("abort",g),i(new Error("Network error during upload"))},n.ontimeout=()=>{s.removeEventListener("abort",g),i(new Error("Upload timed out"))},n.open("POST",r),n.setRequestHeader("Content-Type",a.type),n.send(a)})}function Ce(r,a){switch(a.type){case"ADD_FILES":{const s=a.files.map(c=>({id:ve(),file:c,status:"pending",progress:0}));return[...r,...s]}case"UPDATE_FILE":return r.map(s=>s.id===a.id?{...s,...a.updates}:s);case"RETRY_FILE":return r.map(s=>s.id===a.id?{...s,status:"pending",progress:0,error:void 0}:s);case"REMOVE_FILE":return r.filter(s=>s.id!==a.id);case"CLEAR_COMPLETED":return r.filter(s=>s.status==="pending"||s.status==="uploading");case"CLEAR_ALL":return[];case"CANCEL_FILE":return r.map(s=>s.id===a.id&&(s.status==="pending"||s.status==="uploading")?{...s,status:"cancelled",error:"Upload cancelled"}:s);case"CANCEL_ALL":return r.map(s=>s.status==="pending"||s.status==="uploading"?{...s,status:"cancelled",error:"Upload cancelled"}:s);default:return r}}function ye(r){const{maxConcurrent:a=3,metadata:s,onComplete:c,onError:l}=r,[i,n]=u.useReducer(Ce,[]),g=H(r.getUploadUrl),h=H(r.createAsset),v=u.useRef(0),p=u.useRef(new Map),m=u.useRef(!1),x=u.useCallback(async o=>{const f=new AbortController;p.current.set(o.id,f),n({type:"UPDATE_FILE",id:o.id,updates:{status:"uploading",progress:0}});try{const y=await g({});n({type:"UPDATE_FILE",id:o.id,updates:{progress:5}});const e=await be(y,o.file,f.signal,L=>{n({type:"UPDATE_FILE",id:o.id,updates:{progress:L}})});n({type:"UPDATE_FILE",id:o.id,updates:{progress:90}});const C=await xe(o.file),b=await h({storageId:e,name:o.file.name,mimeType:o.file.type,size:o.file.size,...C,...s});n({type:"UPDATE_FILE",id:o.id,updates:{status:"complete",progress:100,result:b}})}catch(y){const e=y instanceof Error?y:new Error(String(y));if(e.name==="AbortError")n({type:"UPDATE_FILE",id:o.id,updates:{status:"cancelled",error:"Upload cancelled"}});else{const C={...o,status:"error",error:e.message};n({type:"UPDATE_FILE",id:o.id,updates:{status:"error",error:e.message}}),l?.(C)}}finally{p.current.delete(o.id),v.current--}},[g,h,s,l]),d=u.useCallback(()=>{if(m.current)return;m.current=!0;const o=i.filter(f=>f.status==="pending");for(;v.current<a&&o.length>0;){const f=o.shift();v.current++,x(f)}m.current=!1,v.current===0&&i.length>0&&i.every(f=>f.status!=="pending"&&f.status!=="uploading")&&c?.(i)},[i,a,x,c]);u.useEffect(()=>{i.some(o=>o.status==="pending")&&v.current<a&&d()},[i,a,d]);const A=u.useCallback(o=>{n({type:"ADD_FILES",files:o})},[]),E=u.useCallback(o=>{const f=p.current.get(o);f&&f.abort(),n({type:"CANCEL_FILE",id:o})},[]),w=u.useCallback(()=>{p.current.forEach(o=>o.abort()),n({type:"CANCEL_ALL"})},[]),R=u.useCallback(o=>{n({type:"RETRY_FILE",id:o})},[]),U=u.useCallback(()=>{n({type:"CLEAR_COMPLETED"})},[]),D=u.useCallback(()=>{p.current.forEach(o=>o.abort()),n({type:"CLEAR_ALL"})},[]),I=i.some(o=>o.status==="uploading"),M=i.length>0?Math.round(i.reduce((o,f)=>o+f.progress,0)/i.length):0;return{files:i,addFiles:A,cancelFile:E,cancelAll:w,retryFile:R,clearCompleted:U,clearAll:D,isUploading:I,overallProgress:M}}function S(r){if(r===0)return"0 B";const a=1024,s=["B","KB","MB","GB"],c=Math.floor(Math.log(r)/Math.log(a));return`${parseFloat((r/Math.pow(a,c)).toFixed(1))} ${s[c]}`}function je(r,a){return a.length===0?!0:a.some(s=>{if(s.endsWith("/*")){const c=s.slice(0,-2);return r.startsWith(c+"/")}return r===s})}function Me({onUploadComplete:r,currentFolderId:a,generateUploadUrl:s,createAsset:c,maxFileSize:l,allowedMimeTypes:i=[],maxConcurrentUploads:n=3,onError:g}){const[h,v]=u.useState(!1),[p,m]=u.useState(new Map),x=u.useRef(null),d=ye({getUploadUrl:s,createAsset:c,maxConcurrent:n,metadata:a?{parentId:a}:void 0,onComplete:e=>{const C=e.map(b=>({filename:b.file.name,storageId:b.result?String(b.result._id||""):"",success:b.status==="complete",error:b.error}));r(C)},onError:e=>{g?.(e.error||"Upload failed",e.file.name)}}),A=u.useCallback(e=>l&&e.size>l?`File exceeds maximum size of ${S(l)}`:i.length>0&&!je(e.type,i)?`File type ${e.type||"unknown"} is not allowed`:null,[l,i]),E=u.useCallback(e=>{const C=Array.from(e),b=new Map,L=[];for(const P of C){const V=A(P);V?b.set(P.name,V):L.push(P)}m(b),L.length>0&&d.addFiles(L)},[A,d]),w=u.useCallback(e=>{e.preventDefault(),e.stopPropagation(),v(!0)},[]),R=u.useCallback(e=>{e.preventDefault(),e.stopPropagation(),v(!1)},[]),U=u.useCallback(e=>{e.preventDefault(),e.stopPropagation()},[]),D=u.useCallback(e=>{e.preventDefault(),e.stopPropagation(),v(!1),e.dataTransfer.files?.length&&E(e.dataTransfer.files)},[E]),I=u.useCallback(e=>{e.target.files?.length&&(E(e.target.files),e.target.value="")},[E]),M=e=>{switch(e){case"complete":return t.jsx(ce,{className:"size-4 text-emerald-500"});case"error":case"cancelled":return t.jsx($,{className:"size-4 text-red-500"});case"uploading":return t.jsx("div",{className:"size-4 animate-spin rounded-full border-2 border-muted border-t-primary"});default:return t.jsx("div",{className:"size-4 rounded-full border-2 border-muted"})}},o=d.files.filter(e=>e.status==="complete").length,f=d.files.filter(e=>e.status==="error"||e.status==="cancelled").length,y=o>0||f>0;return t.jsxs("div",{className:"space-y-4",children:[p.size>0&&t.jsxs("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 p-3",children:[t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(ee,{className:"mt-0.5 size-4 shrink-0 text-destructive"}),t.jsx("div",{className:"flex-1 space-y-1",children:Array.from(p.entries()).map(([e,C])=>t.jsxs("p",{className:"text-sm text-destructive",children:[t.jsxs("span",{className:"font-medium",children:[e,":"]})," ",C]},e))})]}),t.jsx(j,{variant:"ghost",size:"sm",className:"mt-2",onClick:()=>m(new Map),children:"Dismiss"})]}),!d.isUploading&&d.files.length===0&&t.jsxs("div",{className:N("flex cursor-pointer flex-col items-center justify-center gap-3 rounded-lg border-2 border-dashed p-8 text-center transition-colors",h?"border-primary bg-primary/5":"border-muted-foreground/25 hover:border-primary/50 hover:bg-muted/50"),onClick:()=>x.current?.click(),onDragEnter:w,onDragLeave:R,onDragOver:U,onDrop:D,children:[t.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:t.jsx(fe,{className:"size-6 text-muted-foreground"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:h?"Drop files here":"Drag and drop files here"}),t.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"or click to browse"})]}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Supports images, videos, documents, and more",l&&` (max ${S(l)} per file)`]})]}),d.files.length>0&&t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsxs("span",{className:"font-medium",children:[d.files.length," file",d.files.length!==1?"s":""]}),d.isUploading&&t.jsxs("span",{className:"text-muted-foreground",children:[d.overallProgress,"% complete"]}),!d.isUploading&&y&&t.jsxs("div",{className:"flex items-center gap-2",children:[o>0&&t.jsxs("span",{className:"text-emerald-600",children:[o," completed"]}),f>0&&t.jsxs("span",{className:"text-red-500",children:[f," failed"]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[!d.isUploading&&t.jsx(j,{variant:"outline",size:"sm",onClick:()=>x.current?.click(),children:"Add More"}),d.isUploading&&t.jsx(j,{variant:"outline",size:"sm",onClick:d.cancelAll,children:"Cancel All"}),y&&!d.isUploading&&t.jsx(j,{variant:"ghost",size:"sm",onClick:d.clearCompleted,children:"Clear Done"})]})]}),d.isUploading&&t.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:t.jsx("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${d.overallProgress}%`}})}),t.jsx("div",{className:"space-y-2",children:d.files.map(e=>t.jsxs("div",{className:N("flex items-center gap-3 rounded-lg border bg-card p-3",e.status==="error"&&"border-red-200 bg-red-50 dark:border-red-900 dark:bg-red-950/20",e.status==="complete"&&"border-emerald-200 bg-emerald-50 dark:border-emerald-900 dark:bg-emerald-950/20"),children:[t.jsx("div",{className:"shrink-0",children:M(e.status)}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",title:e.file.name,children:e.file.name}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:S(e.file.size)}),e.error&&t.jsx("span",{className:"text-xs text-red-500",children:e.error})]})]}),e.status==="uploading"&&t.jsxs("div",{className:"flex w-20 items-center gap-2",children:[t.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-muted",children:t.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${e.progress}%`}})}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.progress,"%"]})]}),t.jsxs("div",{className:"shrink-0",children:[e.status==="pending"&&!d.isUploading&&t.jsx(j,{variant:"ghost",size:"icon-sm",onClick:()=>d.cancelFile(e.id),title:"Remove",children:t.jsx($,{className:"size-4"})}),(e.status==="uploading"||e.status==="pending")&&d.isUploading&&t.jsx(j,{variant:"ghost",size:"icon-sm",onClick:()=>d.cancelFile(e.id),title:"Cancel",children:t.jsx($,{className:"size-4"})}),(e.status==="error"||e.status==="cancelled")&&!d.isUploading&&t.jsx(j,{variant:"ghost",size:"icon-sm",onClick:()=>d.retryFile(e.id),title:"Retry",children:t.jsx(me,{className:"size-4"})})]})]},e.id))})]}),t.jsx("input",{ref:x,type:"file",multiple:!0,onChange:I,className:"hidden",accept:i.length>0?i.join(","):void 0})]})}var _="Tabs",[Ee]=oe(_,[B]),F=B(),[Ne,O]=Ee(_),G=u.forwardRef((r,a)=>{const{__scopeTabs:s,value:c,onValueChange:l,defaultValue:i,orientation:n="horizontal",dir:g,activationMode:h="automatic",...v}=r,p=te(g),[m,x]=se({prop:c,onChange:l,defaultProp:i??"",caller:_});return t.jsx(Ne,{scope:s,baseId:re(),value:m,onValueChange:x,orientation:n,dir:p,activationMode:h,children:t.jsx(T.div,{dir:p,"data-orientation":n,...v,ref:a})})});G.displayName=_;var W="TabsList",K=u.forwardRef((r,a)=>{const{__scopeTabs:s,loop:c=!0,...l}=r,i=O(W,s),n=F(s);return t.jsx(ae,{asChild:!0,...n,orientation:i.orientation,dir:i.dir,loop:c,children:t.jsx(T.div,{role:"tablist","aria-orientation":i.orientation,...l,ref:a})})});K.displayName=W;var X="TabsTrigger",Q=u.forwardRef((r,a)=>{const{__scopeTabs:s,value:c,disabled:l=!1,...i}=r,n=O(X,s),g=F(s),h=Z(n.baseId,c),v=q(n.baseId,c),p=c===n.value;return t.jsx(ne,{asChild:!0,...g,focusable:!l,active:p,children:t.jsx(T.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":v,"data-state":p?"active":"inactive","data-disabled":l?"":void 0,disabled:l,id:h,...i,ref:a,onMouseDown:z(r.onMouseDown,m=>{!l&&m.button===0&&m.ctrlKey===!1?n.onValueChange(c):m.preventDefault()}),onKeyDown:z(r.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&n.onValueChange(c)}),onFocus:z(r.onFocus,()=>{const m=n.activationMode!=="manual";!p&&!l&&m&&n.onValueChange(c)})})})});Q.displayName=X;var Y="TabsContent",J=u.forwardRef((r,a)=>{const{__scopeTabs:s,value:c,forceMount:l,children:i,...n}=r,g=O(Y,s),h=Z(g.baseId,c),v=q(g.baseId,c),p=c===g.value,m=u.useRef(p);return u.useEffect(()=>{const x=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(x)},[]),t.jsx(ie,{present:l||p,children:({present:x})=>t.jsx(T.div,{"data-state":p?"active":"inactive","data-orientation":g.orientation,role:"tabpanel","aria-labelledby":h,hidden:!x,id:v,tabIndex:0,...n,ref:a,style:{...r.style,animationDuration:m.current?"0s":void 0},children:x&&i})})});J.displayName=Y;function Z(r,a){return`${r}-trigger-${a}`}function q(r,a){return`${r}-content-${a}`}var ke=G,Le=K,Ae=Q,Te=J;function Pe({className:r,...a}){return t.jsx(ke,{"data-slot":"tabs",className:N("flex flex-col gap-2",r),...a})}function ze({className:r,...a}){return t.jsx(Le,{"data-slot":"tabs-list",className:N("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",r),...a})}function $e({className:r,...a}){return t.jsx(Ae,{"data-slot":"tabs-trigger",className:N("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",r),...a})}function Se({className:r,...a}){return t.jsx(Te,{"data-slot":"tabs-content",className:N("flex-1 outline-none",r),...a})}export{Re as C,Ue as F,De as M,me as R,Pe as T,fe as U,Ie as V,ze as a,$e as b,Me as c,Se as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{y as k,z as m,A as v,r as e}from"./main-dZT72bAG.js";function b(t){return k({select:n=>n.location})}function h(){const t=m(),n=b(),s=v({strict:!1}),c=e.useCallback((a,p)=>{let o=a;if(p)for(const[y,g]of Object.entries(p))o=o.replace(`:${y}`,g).replace(`$${y}`,g);t({to:o})},[t]),r=e.useCallback(a=>{t({to:"/entries/$entryId",params:{entryId:a}})},[t]),i=e.useCallback(a=>{t({to:"/entries/type/$contentTypeId",params:{contentTypeId:a}})},[t]),l=e.useCallback(a=>{t({to:"/entries/new/$contentTypeId",params:{contentTypeId:a}})},[t]),u=e.useCallback(()=>{window.history.back()},[]);return e.useMemo(()=>({navigate:c,currentRoute:n.pathname,params:s??{},canGoBack:window.history.length>1,goBack:u,navigateToEntry:r,navigateToContentType:i,navigateToNewEntry:l}),[c,n.pathname,s,u,r,i,l])}export{h as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as K,r as t,a as I,b as F,j as e,u as M,e as W,C as X,f as Y,c as L,T as Q}from"./main-dZT72bAG.js";import{c as R,I as D,a as _,C as Z,b as U}from"./CmsEmptyState-Do_erIgn.js";import{C as y,B as q}from"./badge-BAlGIjop.js";import{L as f}from"./label-B6PPtKR5.js";import{T as V,P as G,a as H}from"./textarea-CgggMxUX.js";import{P}from"./plus-AABQIF0N.js";import{C as ee}from"./CmsPageHeader-qDwPGi48.js";import{C as B}from"./CmsSurface-DBy5Lumx.js";import{S as se}from"./scroll-area-CDfk-zrz.js";import{u as ae}from"./tanstack-adapter-BknsSgra.js";const te=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],re=K("folder-tree",te);function ie({taxonomy:r,onSave:o,onCancel:c}){const x=!!r,[n,b]=t.useState({name:r?.name??"",displayName:r?.displayName??"",description:r?.description??"",isHierarchical:r?.isHierarchical??!1,allowInlineCreation:r?.allowInlineCreation??!0,isActive:r?.isActive??!0,icon:r?.icon??"",sortOrder:r?.sortOrder??0}),[m,l]=t.useState({}),[d,v]=t.useState(!1),[T,u]=t.useState(null),[S,E]=t.useState(!1),w=I(F.admin.createTaxonomy),z=I(F.admin.updateTaxonomy);t.useEffect(()=>{r&&b({name:r.name,displayName:r.displayName,description:r.description??"",isHierarchical:r.isHierarchical,allowInlineCreation:r.allowInlineCreation,isActive:r.isActive,icon:r.icon??"",sortOrder:r.sortOrder??0})},[r]);const h=t.useCallback((s,p)=>{b(C=>({...C,[s]:p})),l(C=>{const{[s]:i,...a}=C;return a})},[]),N=t.useCallback(s=>s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),[]),A=t.useCallback(s=>{h("displayName",s),!x&&!S&&h("name",N(s))},[h,x,S,N]),j=t.useCallback(()=>{const s={};return n.name.trim()?/^[a-z][a-z0-9-]*$/.test(n.name)||(s.name="Slug must start with a letter and contain only lowercase letters, numbers, and hyphens"):s.name="Slug is required",n.displayName.trim()||(s.displayName="Display name is required"),l(s),Object.keys(s).length===0},[n]),k=t.useCallback(async s=>{if(s.preventDefault(),!!j()){v(!0),u(null);try{x&&r?await z({id:r._id,displayName:n.displayName,description:n.description||void 0,allowInlineCreation:n.allowInlineCreation,icon:n.icon||void 0,sortOrder:n.sortOrder,isActive:n.isActive}):await w({name:n.name,displayName:n.displayName,description:n.description||void 0,isHierarchical:n.isHierarchical,allowInlineCreation:n.allowInlineCreation,icon:n.icon||void 0,sortOrder:n.sortOrder}),o()}catch(p){const C=p instanceof Error?p.message:"Failed to save taxonomy";u(C)}finally{v(!1)}}},[j,x,r,n,w,z,o]);return e.jsx(R,{open:!0,onOpenChange:s=>!s&&!d&&c(),title:x?"Edit Taxonomy":"Create Taxonomy",size:"lg",footer:e.jsxs(e.Fragment,{children:[e.jsx(y,{variant:"outline",onClick:c,disabled:d,children:"Cancel"}),e.jsx(y,{variant:"primary",onClick:k,loading:d,children:x?"Save Changes":"Create Taxonomy"})]}),children:e.jsxs("form",{onSubmit:k,className:"space-y-4",children:[T&&e.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800",children:T}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{htmlFor:"displayName",children:["Display Name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(D,{id:"displayName",value:n.displayName,onChange:s=>A(s.target.value),placeholder:"e.g., Categories, Tags",disabled:d,className:m.displayName?"border-destructive":""}),m.displayName&&e.jsx("p",{className:"text-xs text-destructive",children:m.displayName})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{htmlFor:"name",children:["Slug ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(D,{id:"name",value:n.name,onChange:s=>{h("name",s.target.value.toLowerCase()),E(!0)},placeholder:"e.g., categories, tags",disabled:d||x,className:m.name?"border-destructive":""}),m.name&&e.jsx("p",{className:"text-xs text-destructive",children:m.name}),x&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Slug cannot be changed after creation"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"description",children:"Description"}),e.jsx(V,{id:"description",value:n.description,onChange:s=>h("description",s.target.value),placeholder:"Optional description",rows:2,disabled:d})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"icon",children:"Icon"}),e.jsx(D,{id:"icon",value:n.icon,onChange:s=>h("icon",s.target.value),placeholder:"e.g., 🏷️ or folder",disabled:d}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Emoji or icon name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"sortOrder",children:"Sort Order"}),e.jsx(D,{id:"sortOrder",type:"number",value:n.sortOrder,onChange:s=>h("sortOrder",parseInt(s.target.value)||0),disabled:d})]})]}),e.jsxs("div",{className:"space-y-4 pt-2",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_,{id:"isHierarchical",checked:n.isHierarchical,onCheckedChange:s=>h("isHierarchical",s),disabled:d||x}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{htmlFor:"isHierarchical",className:"cursor-pointer font-medium",children:"Hierarchical"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Terms can have parent-child relationships (like categories)"}),x&&e.jsx("p",{className:"text-xs text-amber-600",children:"Hierarchy type cannot be changed after creation"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_,{id:"allowInlineCreation",checked:n.allowInlineCreation,onCheckedChange:s=>h("allowInlineCreation",s),disabled:d}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{htmlFor:"allowInlineCreation",className:"cursor-pointer font-medium",children:"Allow inline creation"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Users can create new terms while editing content"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_,{id:"isActive",checked:n.isActive,onCheckedChange:s=>h("isActive",s),disabled:d}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{htmlFor:"isActive",className:"cursor-pointer font-medium",children:"Active"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Inactive taxonomies are hidden from content editors"})]})]})]})]})})}function ne({taxonomyId:r,isHierarchical:o,allowInlineCreation:c}){const[x,n]=t.useState(new Set),[b,m]=t.useState(null),[l,d]=t.useState(!1),[v,T]=t.useState(),[u,S]=t.useState(null),[E,w]=t.useState(null),z=o?M(F.admin.getTermsHierarchy,{taxonomyId:r}):M(F.admin.listTerms,{taxonomyId:r}),h=I(F.admin.deleteTerm),N=o?z:z?.page,A=N===void 0,j=t.useCallback(i=>{n(a=>{const g=new Set(a);return g.has(i)?g.delete(i):g.add(i),g})},[]),k=t.useCallback(i=>{T(i),m(null),d(!0)},[]),s=t.useCallback(i=>{m(i),d(!0)},[]),p=t.useCallback(async i=>{w(null);try{await h({id:i,cascade:!0}),S(null)}catch(a){const g=a instanceof Error?a.message:"Failed to delete term";w(g)}},[h]),C=(i,a=0)=>{const g=i.children&&i.children.length>0,O=x.has(i._id);return e.jsxs("div",{className:"border-b border-border/50 last:border-0",children:[e.jsxs("div",{className:L("group flex items-center gap-2 py-2 pr-2 transition-colors hover:bg-muted/50",a>0&&"border-l-2 border-muted"),style:{paddingLeft:`${a*24+8}px`},children:[o&&e.jsx("button",{type:"button",onClick:()=>j(i._id),disabled:!g,className:L("flex size-5 items-center justify-center rounded transition-colors",g?"text-muted-foreground hover:bg-muted hover:text-foreground":"invisible"),"aria-expanded":O,children:g&&(O?e.jsx(X,{className:"size-4"}):e.jsx(Y,{className:"size-4"}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[i.color&&e.jsx("span",{className:"size-3 shrink-0 rounded-full",style:{backgroundColor:i.color}}),i.icon&&e.jsx("span",{className:"shrink-0 text-sm",children:i.icon}),e.jsx("span",{className:"truncate font-medium text-foreground",children:i.name}),e.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:["(",i.slug,")"]}),e.jsxs("span",{className:"ml-auto shrink-0 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:[i.usageCount," ",i.usageCount===1?"use":"uses"]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[o&&c&&e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>k(i._id),title:"Add child term",className:"size-7 p-0",children:e.jsx(P,{className:"size-3.5"})}),e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>s(i),title:"Edit term",className:"size-7 p-0",children:e.jsx(G,{className:"size-3.5"})}),e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>S(i._id),title:"Delete term",className:"size-7 p-0 text-destructive hover:text-destructive",children:e.jsx(Q,{className:"size-3.5"})})]})]}),o&&g&&O&&e.jsx("div",{children:i.children.map($=>C($,a+1))})]},i._id)};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Terms"}),e.jsxs(y,{variant:"secondary",size:"sm",onClick:()=>k(),children:[e.jsx(P,{className:"size-3.5"}),"Add Term"]})]}),E&&e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800",children:[E,e.jsx("button",{type:"button",onClick:()=>w(null),className:"text-red-600 hover:text-red-800",children:"×"})]}),e.jsx("div",{className:"rounded-lg border bg-card",children:A?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx("div",{className:"size-6 animate-spin rounded-full border-2 border-muted border-t-primary"})}):!N||N.length===0?e.jsx(Z,{icon:e.jsx(W,{className:"size-8"}),title:"No terms yet",description:"Add your first term to start organizing content.",action:c?{label:"Add your first term",onClick:()=>k(),variant:"secondary"}:void 0}):e.jsx("div",{className:"divide-y divide-border/50",children:N.map(i=>C(i))})}),l&&e.jsx(le,{taxonomyId:r,term:b,parentId:v,isHierarchical:o,onSave:()=>{d(!1),m(null),T(void 0)},onCancel:()=>{d(!1),m(null),T(void 0)}}),e.jsx(U,{open:!!u,onOpenChange:i=>!i&&S(null),title:"Delete Term",description:o?"Are you sure you want to delete this term? All child terms will also be deleted.":"Are you sure you want to delete this term?",confirmLabel:"Delete",variant:"danger",onConfirm:()=>u&&p(u)})]})}function le({taxonomyId:r,term:o,parentId:c,isHierarchical:x,onSave:n,onCancel:b}){const m=!!o,[l,d]=t.useState({name:o?.name??"",slug:o?.slug??"",description:o?.description??"",color:o?.color??"",icon:o?.icon??"",sortOrder:o?.sortOrder??0}),[v,T]=t.useState({}),[u,S]=t.useState(!1),[E,w]=t.useState(null),[z,h]=t.useState(!1),N=I(F.admin.createTerm),A=I(F.admin.updateTerm),j=t.useCallback((a,g)=>{d(O=>({...O,[a]:g})),T(O=>{const{[a]:$,...J}=O;return J})},[]),k=t.useCallback(a=>a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),[]),s=t.useCallback(a=>{j("name",a),!m&&!z&&j("slug",k(a))},[j,m,z,k]),p=t.useCallback(()=>{const a={};return l.name.trim()||(a.name="Name is required"),l.slug.trim()?/^[a-z0-9-]+$/.test(l.slug)||(a.slug="Slug must contain only lowercase letters, numbers, and hyphens"):a.slug="Slug is required",T(a),Object.keys(a).length===0},[l]),C=t.useCallback(async a=>{if(a.preventDefault(),!!p()){S(!0),w(null);try{m&&o?await A({id:o._id,name:l.name,slug:l.slug,description:l.description||void 0,color:l.color||void 0,icon:l.icon||void 0,sortOrder:l.sortOrder}):await N({taxonomyId:r,name:l.name,slug:l.slug,description:l.description||void 0,parentId:c,color:l.color||void 0,icon:l.icon||void 0,sortOrder:l.sortOrder}),n()}catch(g){const O=g instanceof Error?g.message:"Failed to save term";w(O)}finally{S(!1)}}},[p,m,o,l,r,c,N,A,n]),i=m?"Edit Term":c?"Create Child Term":"Create Term";return e.jsx(R,{open:!0,onOpenChange:a=>!a&&!u&&b(),title:i,size:"md",footer:e.jsxs(e.Fragment,{children:[e.jsx(y,{variant:"outline",onClick:b,disabled:u,children:"Cancel"}),e.jsx(y,{variant:"primary",onClick:C,loading:u,children:m?"Save Changes":"Create Term"})]}),children:e.jsxs("form",{onSubmit:C,className:"space-y-4",children:[E&&e.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800",children:E}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{htmlFor:"termName",children:["Name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(D,{id:"termName",value:l.name,onChange:a=>s(a.target.value),placeholder:"e.g., Technology",disabled:u,className:v.name?"border-destructive":""}),v.name&&e.jsx("p",{className:"text-xs text-destructive",children:v.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{htmlFor:"termSlug",children:["Slug ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(D,{id:"termSlug",value:l.slug,onChange:a=>{j("slug",a.target.value.toLowerCase()),h(!0)},placeholder:"e.g., technology",disabled:u,className:v.slug?"border-destructive":""}),v.slug&&e.jsx("p",{className:"text-xs text-destructive",children:v.slug})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"termDescription",children:"Description"}),e.jsx(V,{id:"termDescription",value:l.description,onChange:a=>j("description",a.target.value),placeholder:"Optional description",rows:2,disabled:u})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"termColor",children:"Color"}),e.jsx(D,{id:"termColor",type:"color",value:l.color||"#6b7280",onChange:a=>j("color",a.target.value),disabled:u,className:"h-9 p-1"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"termIcon",children:"Icon"}),e.jsx(D,{id:"termIcon",value:l.icon,onChange:a=>j("icon",a.target.value),placeholder:"e.g., 💻",disabled:u})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"termSortOrder",children:"Sort Order"}),e.jsx(D,{id:"termSortOrder",type:"number",value:l.sortOrder,onChange:a=>j("sortOrder",parseInt(a.target.value)||0),disabled:u})]})]})]})})}function oe({api:r,navigation:o}){const[c,x]=t.useState(null),[n,b]=t.useState(!1),[m,l]=t.useState(null),[d,v]=t.useState(null),[T,u]=t.useState(null),S=M(r.listTaxonomies,{isActive:void 0,includeDeleted:!1}),E=I(r.deleteTaxonomy),w=S?.page??[],z=S===void 0,h=t.useCallback(()=>{l(null),b(!0)},[]),N=t.useCallback(s=>{l(s),b(!0)},[]),A=t.useCallback(async s=>{u(null);try{await E({id:s}),v(null),c?._id===s&&x(null)}catch(p){const C=p instanceof Error?p.message:"Failed to delete taxonomy";u(C)}},[E,c]),j=t.useCallback(()=>{b(!1),l(null)},[]),k=s=>s.isHierarchical?e.jsx(re,{className:"size-5"}):e.jsx(H,{className:"size-5"});return e.jsxs("div",{className:"flex h-[calc(100vh-4rem)] flex-col p-6",children:[e.jsxs("div",{className:"mb-6 flex items-start justify-between",children:[e.jsx(ee,{title:"Taxonomies",description:"Manage tags, categories, and other classification systems"}),e.jsxs(y,{onClick:h,children:[e.jsx(P,{className:"size-4"}),"Create Taxonomy"]})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 gap-6",children:[e.jsx(B,{elevation:"base",className:"w-80 shrink-0 overflow-hidden",children:z?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx("div",{className:"size-6 animate-spin rounded-full border-2 border-muted border-t-primary"}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"Loading taxonomies..."})]}):w.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(H,{className:"mb-3 size-8 text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No taxonomies created yet."}),e.jsx(y,{variant:"secondary",className:"mt-4",onClick:h,children:"Create your first taxonomy"})]}):e.jsx(se,{className:"h-full",children:e.jsx("div",{className:"divide-y",children:w.map(s=>e.jsxs("div",{className:L("group flex cursor-pointer items-center gap-3 p-3 transition-colors hover:bg-muted/50",c?._id===s._id&&"bg-primary/5",!s.isActive&&"opacity-60"),onClick:()=>x(s),children:[e.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:k(s)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:s.displayName}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:s.name})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(q,{variant:"secondary",className:"text-xs font-normal",children:s.isHierarchical?"Hierarchical":"Flat"}),!s.isActive&&e.jsx(q,{variant:"outline",className:"text-xs font-normal",children:"Inactive"})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[e.jsx(y,{variant:"ghost",size:"icon-sm",onClick:p=>{p.stopPropagation(),N(s)},title:"Edit taxonomy",children:e.jsx(G,{className:"size-4"})}),e.jsx(y,{variant:"ghost",size:"icon-sm",onClick:p=>{p.stopPropagation(),v(s._id)},title:"Delete taxonomy",className:"text-destructive hover:bg-destructive/10 hover:text-destructive",children:e.jsx(Q,{className:"size-4"})})]})]},s._id))})})}),e.jsx(B,{elevation:"base",className:"min-w-0 flex-1 overflow-hidden",children:c?e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-start justify-between border-b p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex size-10 items-center justify-center rounded-md bg-muted text-muted-foreground",children:k(c)}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:c.displayName}),c.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:c.description})]})]}),e.jsx(y,{variant:"secondary",onClick:()=>N(c),children:"Edit Taxonomy"})]}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsx(ne,{taxonomyId:c._id,isHierarchical:c.isHierarchical,allowInlineCreation:c.allowInlineCreation})})]}):e.jsx(Z,{icon:e.jsx(H,{className:"size-6"}),title:"Select a taxonomy",description:"Select a taxonomy to view and manage its terms",className:"h-full"})})]}),n&&e.jsx(ie,{taxonomy:m,onSave:j,onCancel:()=>{b(!1),l(null)}}),e.jsx(U,{open:d!==null,onOpenChange:s=>{s||(v(null),u(null))},title:"Delete Taxonomy",description:"Are you sure you want to delete this taxonomy? All associated terms will also be deleted.",confirmLabel:"Delete",onConfirm:()=>d&&A(d),variant:"danger",error:T})]})}function fe(){const r=ae();return e.jsx(oe,{api:F.admin,navigation:r})}export{fe as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as a,j as r,c as i}from"./main-dZT72bAG.js";const o=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],d=a("pencil",o);const n=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],c=a("tag",n);function l({className:e,...t}){return r.jsx("textarea",{"data-slot":"textarea",className:i("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}export{d as P,l as T,c as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as a,u as m,a as E,j as e,T as D,c as Y,b as Z}from"./main-dZT72bAG.js";import{C as ee}from"./CmsPageHeader-qDwPGi48.js";import{C as se}from"./CmsToolbar-D1-Y-7SK.js";import{I as te,C as ae,a as I,b as ne}from"./CmsEmptyState-Do_erIgn.js";import{C as A}from"./CmsSurface-DBy5Lumx.js";import{C as c,X as R,B as re}from"./badge-BAlGIjop.js";import{S as le,a as oe,b as ie,c as ce,d as _}from"./select-BuiHcMzS.js";import{A as Q,a as L}from"./alert-GxZx0y5c.js";import{S as de}from"./search-BvgYr-c9.js";import{T as B}from"./triangle-alert-lvCbwp0s.js";import{R as M}from"./rotate-ccw-BZpZtw0N.js";import{u as me}from"./tanstack-adapter-BknsSgra.js";function xe({api:l,navigation:ue}){const[g,F]=a.useState(""),[j,O]=a.useState(""),[r,i]=a.useState(new Set),[y,x]=a.useState(null),[N,C]=a.useState(!1),[P,u]=a.useState(!1),[b,v]=a.useState(!1),[S,h]=a.useState(null),T=m(l.listTrash,{contentTypeId:g||void 0,search:j||void 0,paginationOpts:{numItems:50,cursor:null}}),U=m(l.getTrashConfig,{}),V=m(l.getTrashStats,{}),H=m(l.listContentTypes,{})?.page??[],w=E(l.bulkRestore),k=E(l.emptyTrash),o=T?.page??[],X=T===void 0,p=U,f=V,$=a.useCallback((s,t)=>{i(n=>{const d=new Set(n);return t?d.add(s):d.delete(s),d})},[]),q=a.useCallback(()=>{r.size===o.length?i(new Set):i(new Set(o.map(s=>s._id)))},[r.size,o]),z=a.useCallback(async s=>{C(!0),x(null);try{await w({ids:s}),i(t=>{const n=new Set(t);return s.forEach(d=>n.delete(d)),n})}catch(t){const n=t instanceof Error?t.message:"Failed to restore";x(n)}finally{C(!1)}},[w]),G=a.useCallback(async()=>{v(!0),h(null);try{await k({}),u(!1),i(new Set)}catch(s){const t=s instanceof Error?s.message:"Failed to empty trash";h(t)}finally{v(!1)}},[k]),J=s=>new Date(s).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),K=s=>{if(!p?.retentionDays)return null;const t=s+p.retentionDays*24*60*60*1e3,n=Math.ceil((t-Date.now())/(1440*60*1e3));return Math.max(0,n)},W=s=>{if(s.title)return s.title;if(s.name)return s.name;if(s.data){const t=s.data.title||s.data.name;if(t&&typeof t=="string")return t}return s.slug||s._id};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(ee,{title:"Trash",description:`Deleted items are kept for ${p?.retentionDays??30} days before permanent deletion`}),o.length>0&&e.jsxs(c,{variant:"danger",onClick:()=>u(!0),children:[e.jsx(D,{className:"size-4"}),"Empty Trash"]})]}),f&&e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs(A,{elevation:"base",className:"p-4",children:[e.jsx("p",{className:"text-2xl font-semibold text-foreground",children:f.totalCount??0}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Items in Trash"})]}),e.jsxs(A,{elevation:"base",className:"p-4",children:[e.jsx("p",{className:"text-2xl font-semibold text-foreground",children:f.expiredCount??0}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Expired"})]})]}),e.jsx(se,{left:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(de,{className:"absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(te,{type:"text",placeholder:"Search deleted items...",value:j,onChange:s=>O(s.target.value),className:"w-64 pl-9"})]}),e.jsxs(le,{value:g||"all",onValueChange:s=>F(s==="all"?"":s),children:[e.jsx(oe,{className:"w-48",children:e.jsx(ie,{placeholder:"All Content Types"})}),e.jsxs(ce,{children:[e.jsx(_,{value:"all",children:"All Content Types"}),H.map(s=>e.jsx(_,{value:s._id,children:s.displayName},s._id))]})]})]})}),y&&e.jsxs(Q,{variant:"destructive",children:[e.jsx(B,{className:"size-4"}),e.jsxs(L,{className:"flex items-center justify-between",children:[y,e.jsx(c,{variant:"ghost",size:"icon-sm",onClick:()=>x(null),children:e.jsx(R,{className:"size-4"})})]})]}),S&&e.jsxs(Q,{variant:"destructive",children:[e.jsx(B,{className:"size-4"}),e.jsxs(L,{className:"flex items-center justify-between",children:[S,e.jsx(c,{variant:"ghost",size:"icon-sm",onClick:()=>h(null),children:e.jsx(R,{className:"size-4"})})]})]}),r.size>0&&e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-primary/20 bg-primary/5 p-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[r.size," ",r.size===1?"item":"items"," ","selected"]}),e.jsxs(c,{variant:"primary",size:"sm",onClick:()=>z(Array.from(r)),loading:N,children:[e.jsx(M,{className:"size-4"}),"Restore Selected"]}),e.jsx(c,{variant:"secondary",size:"sm",onClick:()=>i(new Set),children:"Clear Selection"})]}),X?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading trash..."})]}):o.length===0?e.jsx(ae,{icon:e.jsx(D,{className:"size-6"}),title:"Trash is empty",description:"Deleted items will appear here"}):e.jsx("div",{className:"rounded-lg border bg-card",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"w-10 p-3 text-left",children:e.jsx(I,{checked:r.size===o.length&&o.length>0,onCheckedChange:q})}),e.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Name"}),e.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Type"}),e.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Deleted"}),e.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Expires In"}),e.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Actions"})]})}),e.jsx("tbody",{children:o.map(s=>{const t=K(s.deletedAt);return e.jsxs("tr",{className:Y("border-b last:border-0 transition-colors hover:bg-muted/50",r.has(s._id)&&"bg-primary/5"),children:[e.jsx("td",{className:"p-3",children:e.jsx(I,{checked:r.has(s._id),onCheckedChange:n=>$(s._id,n)})}),e.jsxs("td",{className:"p-3",children:[e.jsx("span",{className:"font-medium text-foreground",children:W(s)}),s.slug&&e.jsx("span",{className:"block text-xs text-muted-foreground",children:s.slug})]}),e.jsx("td",{className:"p-3 text-sm text-muted-foreground",children:s.contentTypeName||"Unknown"}),e.jsxs("td",{className:"p-3",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:J(s.deletedAt)}),s.deletedBy&&e.jsxs("span",{className:"block text-xs text-muted-foreground",children:["by ",s.deletedBy]})]}),e.jsx("td",{className:"p-3",children:t!==null&&e.jsxs(re,{variant:t<=3?"destructive":"secondary",className:"font-normal",children:[t," ",t===1?"day":"days"]})}),e.jsx("td",{className:"p-3",children:e.jsxs(c,{variant:"outline",size:"sm",onClick:()=>z([s._id]),loading:N,children:[e.jsx(M,{className:"size-4"}),"Restore"]})})]},s._id)})})]})}),e.jsx(ne,{open:P,onOpenChange:u,title:"Empty Trash",description:"This will permanently delete all items in the trash. This action cannot be undone.",confirmLabel:b?"Deleting...":"Empty Trash",onConfirm:G,variant:"danger",loading:b})]})}function ke(){const l=me();return e.jsx(xe,{api:Z.admin,navigation:l})}export{ke as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as e}from"./main-dZT72bAG.js";const a=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],o=e("triangle-alert",a);export{o as T};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as c,r as o,Q as i,U as u,V as d}from"./main-dZT72bAG.js";function U(){const{role:n}=c();return o.useMemo(()=>{const r=!!n,t=(e,s,a)=>n?d(n,{resource:e,action:s,scope:a}):!1;return{role:n,hasRole:r,check:t,canAccess:e=>n?u(n,e):!1,canCreate:e=>t(e,"create"),canRead:(e,s)=>t(e,"read",s),canUpdate:(e,s)=>t(e,"update",s),canDelete:(e,s)=>t(e,"delete",s),canPublish:e=>t("contentEntries","publish",e),canUnpublish:e=>t("contentEntries","unpublish",e),canManageSettings:()=>t("settings","manage"),canManageContentTypes:()=>t("contentTypes","create")||t("contentTypes","update")||t("contentTypes","delete"),getPermissions:e=>n?i(n,e):[],isAdmin:n==="admin",isEditor:n==="admin"||n==="editor",isAuthor:n==="admin"||n==="editor"||n==="author"}},[n])}export{U as u};
|