zudoku 0.64.0 → 0.64.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/config.d.ts +15 -46
- package/dist/config/validators/InputNavigationSchema.d.ts +53 -53
- package/dist/config/validators/ProtectedRoutesSchema.d.ts +1 -1
- package/dist/config/validators/validate.d.ts +105 -1
- package/dist/config/validators/validate.js +30 -0
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/flat-config.d.ts +16 -0
- package/dist/lib/auth/issuer.js +3 -0
- package/dist/lib/auth/issuer.js.map +1 -1
- package/dist/lib/authentication/authentication.d.ts +1 -1
- package/dist/lib/authentication/providers/firebase.d.ts +4 -0
- package/dist/lib/authentication/providers/firebase.js +215 -0
- package/dist/lib/authentication/providers/firebase.js.map +1 -0
- package/dist/lib/authentication/providers/supabase.js +1 -6
- package/dist/lib/authentication/providers/supabase.js.map +1 -1
- package/dist/lib/authentication/ui/ZudokuAuthUi.d.ts +24 -0
- package/dist/lib/authentication/ui/ZudokuAuthUi.js +124 -0
- package/dist/lib/authentication/ui/ZudokuAuthUi.js.map +1 -0
- package/dist/lib/authentication/ui/icons/Apple.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/Apple.js +4 -0
- package/dist/lib/authentication/ui/icons/Apple.js.map +1 -0
- package/dist/lib/authentication/ui/icons/Facebook.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/Facebook.js +4 -0
- package/dist/lib/authentication/ui/icons/Facebook.js.map +1 -0
- package/dist/lib/authentication/ui/icons/Github.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/Github.js +4 -0
- package/dist/lib/authentication/ui/icons/Github.js.map +1 -0
- package/dist/lib/authentication/ui/icons/Google.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/Google.js +4 -0
- package/dist/lib/authentication/ui/icons/Google.js.map +1 -0
- package/dist/lib/authentication/ui/icons/Microsoft.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/Microsoft.js +4 -0
- package/dist/lib/authentication/ui/icons/Microsoft.js.map +1 -0
- package/dist/lib/authentication/ui/icons/X.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/X.js +4 -0
- package/dist/lib/authentication/ui/icons/X.js.map +1 -0
- package/dist/lib/components/Heading.d.ts +1 -1
- package/dist/lib/core/RouteGuard.js +6 -6
- package/dist/lib/core/RouteGuard.js.map +1 -1
- package/dist/lib/oas/parser/index.js +7 -3
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/api-keys/ProtectedRoute.js +4 -1
- package/dist/lib/plugins/api-keys/ProtectedRoute.js.map +1 -1
- package/dist/lib/plugins/openapi/CollapsibleCode.d.ts +1 -0
- package/dist/lib/plugins/openapi/CollapsibleCode.js +2 -1
- package/dist/lib/plugins/openapi/CollapsibleCode.js.map +1 -1
- package/dist/lib/plugins/openapi/GeneratedExampleSidecarBox.d.ts +5 -0
- package/dist/lib/plugins/openapi/GeneratedExampleSidecarBox.js +10 -0
- package/dist/lib/plugins/openapi/GeneratedExampleSidecarBox.js.map +1 -0
- package/dist/lib/plugins/openapi/OperationList.js +4 -1
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.d.ts +2 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +2 -2
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.d.ts +9 -2
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +2 -2
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.d.ts +3 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +14 -2
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.d.ts +2 -1
- package/dist/lib/plugins/openapi/Sidecar.js +33 -30
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/SidecarExamples.d.ts +9 -2
- package/dist/lib/plugins/openapi/SidecarExamples.js +15 -33
- package/dist/lib/plugins/openapi/SidecarExamples.js.map +1 -1
- package/dist/lib/plugins/openapi/components/NonHighlightedCode.d.ts +4 -0
- package/dist/lib/plugins/openapi/components/NonHighlightedCode.js +5 -0
- package/dist/lib/plugins/openapi/components/NonHighlightedCode.js.map +1 -0
- package/dist/lib/plugins/openapi/components/ResponseContent.js +1 -1
- package/dist/lib/plugins/openapi/components/ResponseContent.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/InlineInput.d.ts +1 -1
- package/dist/lib/plugins/openapi/playground/ParamsGrid.d.ts +2 -2
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +1 -2
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js +0 -4
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/union-helpers.js +0 -1
- package/dist/lib/plugins/openapi/schema/union-helpers.js.map +1 -1
- package/dist/lib/plugins/openapi/util/generateSchemaExample.js +9 -11
- package/dist/lib/plugins/openapi/util/generateSchemaExample.js.map +1 -1
- package/dist/lib/ui/CodeBlock.d.ts +0 -1
- package/dist/lib/ui/CodeBlock.js.map +1 -1
- package/dist/lib/ui/Command.d.ts +3 -3
- package/dist/lib/ui/EmbeddedCodeBlock.d.ts +0 -1
- package/dist/lib/ui/EmbeddedCodeBlock.js +1 -1
- package/dist/lib/ui/EmbeddedCodeBlock.js.map +1 -1
- package/dist/lib/ui/Separator.d.ts +4 -0
- package/dist/lib/ui/Separator.js +8 -0
- package/dist/lib/ui/Separator.js.map +1 -0
- package/dist/lib/ui/Tooltip.d.ts +7 -7
- package/dist/lib/ui/Tooltip.js +16 -10
- package/dist/lib/ui/Tooltip.js.map +1 -1
- package/dist/lib/util/createVariantComponent.d.ts +5 -2
- package/dist/lib/util/createVariantComponent.js +5 -2
- package/dist/lib/util/createVariantComponent.js.map +1 -1
- package/dist/lib/util/flattenAllOf.d.ts +4 -0
- package/dist/lib/util/flattenAllOf.js +65 -0
- package/dist/lib/util/flattenAllOf.js.map +1 -0
- package/dist/lib/util/flattenAllOf.test.d.ts +1 -0
- package/dist/lib/util/flattenAllOf.test.js +532 -0
- package/dist/lib/util/flattenAllOf.test.js.map +1 -0
- package/dist/vite/api/SchemaManager.js +6 -18
- package/dist/vite/api/SchemaManager.js.map +1 -1
- package/dist/vite/plugin-theme.js +10 -1
- package/dist/vite/plugin-theme.js.map +1 -1
- package/lib/{ErrorAlert-DE3Sf66a.js → ErrorAlert--3alJ_-b.js} +1340 -1311
- package/lib/{ErrorAlert-DE3Sf66a.js.map → ErrorAlert--3alJ_-b.js.map} +1 -1
- package/lib/{MdxPage-DZfeC0QY.js → MdxPage-Bpa9tL63.js} +5 -5
- package/lib/{MdxPage-DZfeC0QY.js.map → MdxPage-Bpa9tL63.js.map} +1 -1
- package/lib/{OAuthErrorPage-BycMozgn.js → OAuthErrorPage-B79J86Fo.js} +4 -4
- package/lib/{OAuthErrorPage-BycMozgn.js.map → OAuthErrorPage-B79J86Fo.js.map} +1 -1
- package/lib/{OasProvider-Bf5zBDBY.js → OasProvider-jr0oDSFy.js} +2 -2
- package/lib/{OasProvider-Bf5zBDBY.js.map → OasProvider-jr0oDSFy.js.map} +1 -1
- package/lib/OperationList-DLEAg4qw.js +5465 -0
- package/lib/OperationList-DLEAg4qw.js.map +1 -0
- package/lib/{Pagination-CJszmeSA.js → Pagination-H2HW9-Er.js} +2 -2
- package/lib/{Pagination-CJszmeSA.js.map → Pagination-H2HW9-Er.js.map} +1 -1
- package/lib/RouteGuard-CjzxosTf.js +77 -0
- package/lib/RouteGuard-CjzxosTf.js.map +1 -0
- package/lib/{RouterError-VDLnrFqF.js → RouterError-DZS2d6Sc.js} +2 -2
- package/lib/{RouterError-VDLnrFqF.js.map → RouterError-DZS2d6Sc.js.map} +1 -1
- package/lib/{SchemaList-xZSf3IMh.js → SchemaList-CSDSazqV.js} +6 -6
- package/lib/{SchemaList-xZSf3IMh.js.map → SchemaList-CSDSazqV.js.map} +1 -1
- package/lib/SchemaView-DJiBd0_5.js +397 -0
- package/lib/SchemaView-DJiBd0_5.js.map +1 -0
- package/lib/{SignUp-6SGx9Yyq.js → SignUp-Fycafbyg.js} +2 -2
- package/lib/{SignUp-6SGx9Yyq.js.map → SignUp-Fycafbyg.js.map} +1 -1
- package/lib/{SyntaxHighlight-zvlnSnHB.js → SyntaxHighlight-C19vH0V_.js} +525 -509
- package/lib/SyntaxHighlight-C19vH0V_.js.map +1 -0
- package/lib/{Toc-Da9yp7lo.js → Toc-ChkOg2UU.js} +2 -2
- package/lib/{Toc-Da9yp7lo.js.map → Toc-ChkOg2UU.js.map} +1 -1
- package/lib/{circular-DvuimBGQ.js → circular-DGfd8SGc.js} +2 -2
- package/lib/{circular-DvuimBGQ.js.map → circular-DGfd8SGc.js.map} +1 -1
- package/lib/{createServer-D9UvCoDf.js → createServer-DGD8hEzT.js} +4662 -4238
- package/lib/createServer-DGD8hEzT.js.map +1 -0
- package/lib/{errors-CuGgh3hf.js → errors-BTpjwHS6.js} +2 -2
- package/lib/{errors-CuGgh3hf.js.map → errors-BTpjwHS6.js.map} +1 -1
- package/lib/{index-rYHsvtTo.js → index-Bvas0H4x.js} +2 -2
- package/lib/{index-rYHsvtTo.js.map → index-Bvas0H4x.js.map} +1 -1
- package/lib/{index-Cr9_YzOZ.js → index-DP1xZgfJ.js} +9 -9
- package/lib/index-DP1xZgfJ.js.map +1 -0
- package/lib/{index-B1rmok4X.js → index-FNRZUtwo.js} +2 -2
- package/lib/{index-B1rmok4X.js.map → index-FNRZUtwo.js.map} +1 -1
- package/lib/ui/CodeBlock.js.map +1 -1
- package/lib/ui/EmbeddedCodeBlock.js +9 -9
- package/lib/ui/EmbeddedCodeBlock.js.map +1 -1
- package/lib/ui/Separator.js +27 -0
- package/lib/ui/Separator.js.map +1 -0
- package/lib/ui/SyntaxHighlight.js +1 -1
- package/lib/ui/Tooltip.js +55 -28
- package/lib/ui/Tooltip.js.map +1 -1
- package/lib/zudoku.__internal.js +4 -4
- package/lib/zudoku.auth-azureb2c.js +3 -3
- package/lib/zudoku.auth-clerk.js +1 -1
- package/lib/zudoku.auth-openid.js +3 -3
- package/lib/zudoku.auth-supabase.js +30 -33
- package/lib/zudoku.auth-supabase.js.map +1 -1
- package/lib/zudoku.components.js +2 -2
- package/lib/zudoku.plugin-api-catalog.js +3 -3
- package/lib/zudoku.plugin-api-keys.js +3 -3
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +1 -1
- package/package.json +16 -11
- package/src/app/main.css +1 -1
- package/src/lib/auth/issuer.ts +3 -0
- package/src/lib/authentication/authentication.ts +1 -1
- package/src/lib/authentication/providers/firebase.tsx +284 -0
- package/src/lib/authentication/providers/supabase.tsx +2 -7
- package/src/lib/authentication/ui/ZudokuAuthUi.tsx +335 -0
- package/src/lib/authentication/ui/icons/Apple.tsx +10 -0
- package/src/lib/authentication/ui/icons/Facebook.tsx +15 -0
- package/src/lib/authentication/ui/icons/Github.tsx +16 -0
- package/src/lib/authentication/ui/icons/Google.tsx +16 -0
- package/src/lib/authentication/ui/icons/Microsoft.tsx +12 -0
- package/src/lib/authentication/ui/icons/X.tsx +10 -0
- package/src/lib/core/RouteGuard.tsx +8 -8
- package/src/lib/oas/parser/index.ts +8 -3
- package/src/lib/plugins/api-keys/ProtectedRoute.tsx +11 -7
- package/src/lib/plugins/openapi/CollapsibleCode.tsx +5 -3
- package/src/lib/plugins/openapi/GeneratedExampleSidecarBox.tsx +52 -0
- package/src/lib/plugins/openapi/OperationList.tsx +5 -0
- package/src/lib/plugins/openapi/OperationListItem.tsx +3 -0
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +20 -2
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +26 -1
- package/src/lib/plugins/openapi/Sidecar.tsx +84 -63
- package/src/lib/plugins/openapi/SidecarExamples.tsx +38 -48
- package/src/lib/plugins/openapi/components/NonHighlightedCode.tsx +22 -0
- package/src/lib/plugins/openapi/components/ResponseContent.tsx +1 -1
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +1 -4
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +0 -5
- package/src/lib/plugins/openapi/schema/union-helpers.ts +0 -1
- package/src/lib/plugins/openapi/util/generateSchemaExample.ts +11 -11
- package/src/lib/ui/CodeBlock.tsx +0 -1
- package/src/lib/ui/EmbeddedCodeBlock.tsx +1 -2
- package/src/lib/ui/Separator.tsx +25 -0
- package/src/lib/ui/Tooltip.tsx +54 -32
- package/src/lib/util/createVariantComponent.tsx +31 -5
- package/src/lib/util/flattenAllOf.test.ts +637 -0
- package/src/lib/util/flattenAllOf.ts +101 -0
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupConnector.d.ts +0 -5
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupConnector.js +0 -7
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupConnector.js.map +0 -1
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupItem.d.ts +0 -4
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupItem.js +0 -10
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupItem.js.map +0 -1
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupView.d.ts +0 -5
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupView.js +0 -16
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupView.js.map +0 -1
- package/lib/OperationList-Cmiw1xm2.js +0 -5446
- package/lib/OperationList-Cmiw1xm2.js.map +0 -1
- package/lib/RouteGuard-DhU3LRr1.js +0 -81
- package/lib/RouteGuard-DhU3LRr1.js.map +0 -1
- package/lib/SchemaView-tHXTm5oM.js +0 -458
- package/lib/SchemaView-tHXTm5oM.js.map +0 -1
- package/lib/SyntaxHighlight-zvlnSnHB.js.map +0 -1
- package/lib/createServer-D9UvCoDf.js.map +0 -1
- package/lib/index-Cr9_YzOZ.js.map +0 -1
- package/src/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupConnector.tsx +0 -36
- package/src/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupItem.tsx +0 -25
- package/src/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupView.tsx +0 -42
|
@@ -2,7 +2,7 @@ import { j as t } from "./jsx-runtime-BzflLqGi.js";
|
|
|
2
2
|
import { ArrowLeftIcon as n, ArrowRightIcon as l } from "lucide-react";
|
|
3
3
|
import { L as r } from "./chunk-PVWAREVJ-BMhpCH5D.js";
|
|
4
4
|
import { c } from "./cn-dYga0KKN.js";
|
|
5
|
-
import { B as o } from "./index-
|
|
5
|
+
import { B as o } from "./index-FNRZUtwo.js";
|
|
6
6
|
const j = ({
|
|
7
7
|
prev: s,
|
|
8
8
|
next: e,
|
|
@@ -34,4 +34,4 @@ const j = ({
|
|
|
34
34
|
export {
|
|
35
35
|
j as P
|
|
36
36
|
};
|
|
37
|
-
//# sourceMappingURL=Pagination-
|
|
37
|
+
//# sourceMappingURL=Pagination-H2HW9-Er.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination-
|
|
1
|
+
{"version":3,"file":"Pagination-H2HW9-Er.js","sources":["../src/lib/components/Pagination.tsx"],"sourcesContent":["import { ArrowLeftIcon, ArrowRightIcon } from \"lucide-react\";\nimport { Link } from \"react-router\";\nimport { cn } from \"../util/cn.js\";\nimport { Button } from \"./index.js\";\n\nexport const Pagination = ({\n prev,\n next,\n className,\n}: {\n prev: { to: string; label: string } | undefined;\n next: { to: string; label: string } | undefined;\n className?: string;\n}) => {\n const linkClass =\n \"group transition-all p-5 space-x-1 rtl:space-x-reverse transition-all hover:text-foreground\";\n\n return (\n <div\n className={cn(\n \"flex -mx-4 text-muted-foreground font-semibold\",\n prev ? \"justify-between\" : \"justify-end\",\n className,\n )}\n data-pagefind-ignore=\"all\"\n >\n {prev && (\n <Button variant=\"ghost\" asChild>\n <Link to={prev.to} relative=\"path\" className={linkClass}>\n <ArrowLeftIcon size={14} strokeWidth={2.5} />\n <span className=\"text-lg truncate\">{prev.label}</span>\n </Link>\n </Button>\n )}\n {next && (\n <Button variant=\"ghost\" asChild>\n <Link to={next.to} relative=\"path\" className={linkClass}>\n <span className=\"text-lg truncate\">{next.label}</span>\n <ArrowRightIcon size={14} strokeWidth={2.5} />\n </Link>\n </Button>\n )}\n </div>\n );\n};\n"],"names":["Pagination","prev","next","className","linkClass","jsxs","cn","jsx","Button","Link","ArrowLeftIcon","ArrowRightIcon"],"mappings":";;;;;AAKO,MAAMA,IAAa,CAAC;AAAA,EACzB,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,WAAAC;AACF,MAIM;AACJ,QAAMC,IACJ;AAEF,SACEC,gBAAAA,EAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAL,IAAO,oBAAoB;AAAA,QAC3BE;AAAA,MAAA;AAAA,MAEF,wBAAqB;AAAA,MAEpB,UAAA;AAAA,QAAAF,KACCM,gBAAAA,EAAAA,IAACC,GAAA,EAAO,SAAQ,SAAQ,SAAO,IAC7B,UAAAH,gBAAAA,EAAAA,KAACI,GAAA,EAAK,IAAIR,EAAK,IAAI,UAAS,QAAO,WAAWG,GAC5C,UAAA;AAAA,UAAAG,gBAAAA,EAAAA,IAACG,GAAA,EAAc,MAAM,IAAI,aAAa,KAAK;AAAA,UAC3CH,gBAAAA,EAAAA,IAAC,QAAA,EAAK,WAAU,oBAAoB,YAAK,MAAA,CAAM;AAAA,QAAA,EAAA,CACjD,EAAA,CACF;AAAA,QAEDL,KACCK,gBAAAA,EAAAA,IAACC,GAAA,EAAO,SAAQ,SAAQ,SAAO,IAC7B,UAAAH,gBAAAA,EAAAA,KAACI,GAAA,EAAK,IAAIP,EAAK,IAAI,UAAS,QAAO,WAAWE,GAC5C,UAAA;AAAA,UAAAG,gBAAAA,EAAAA,IAAC,QAAA,EAAK,WAAU,oBAAoB,UAAAL,EAAK,OAAM;AAAA,UAC/CK,gBAAAA,EAAAA,IAACI,GAAA,EAAe,MAAM,IAAI,aAAa,IAAA,CAAK;AAAA,QAAA,EAAA,CAC9C,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { j as t } from "./jsx-runtime-BzflLqGi.js";
|
|
2
|
+
import { H as m } from "./index.esm-BnYHxCYC.js";
|
|
3
|
+
import { createContext as p, use as f } from "react";
|
|
4
|
+
import { u as g, d as x, m as j, O as v } from "./chunk-PVWAREVJ-BMhpCH5D.js";
|
|
5
|
+
import { B as s } from "./Button-DmS4u8Lj.js";
|
|
6
|
+
import { D as C, a as R, b as D, c as w, d as T, e as b } from "./Dialog-BQciPiHN.js";
|
|
7
|
+
import { u as k } from "./hook-CMeoxziF.js";
|
|
8
|
+
import { a as E } from "./ZudokuContext-BUZ5hkWB.js";
|
|
9
|
+
import { Z as P } from "./invariant-Bm-FVUQE.js";
|
|
10
|
+
import { u as y } from "./useLatest-hmRS46UF.js";
|
|
11
|
+
const O = p(!1), A = "protected", G = () => {
|
|
12
|
+
const n = k(), e = E(), o = g(), a = x(), r = y(a.pathname), c = f(O), { protectedRoutes: d } = e.options, u = !c && d ? Object.entries(d).find(
|
|
13
|
+
([i]) => j({ path: i, end: !0 }, a.pathname)
|
|
14
|
+
)?.[1] : void 0, l = u !== void 0, h = l && !u({ auth: n, context: e });
|
|
15
|
+
if (l && !n.isAuthEnabled)
|
|
16
|
+
throw new P("Authentication is not enabled", {
|
|
17
|
+
title: "Authentication is not enabled",
|
|
18
|
+
developerHint: "To use protectedRoutes you need authentication to be enabled"
|
|
19
|
+
});
|
|
20
|
+
return h && n.isPending && typeof window < "u" ? null : h ? /* @__PURE__ */ t.jsx(
|
|
21
|
+
C,
|
|
22
|
+
{
|
|
23
|
+
open: !0,
|
|
24
|
+
onOpenChange: (i) => {
|
|
25
|
+
i || o(-1);
|
|
26
|
+
},
|
|
27
|
+
children: /* @__PURE__ */ t.jsxs(R, { children: [
|
|
28
|
+
/* @__PURE__ */ t.jsx(D, { children: /* @__PURE__ */ t.jsx(w, { children: "Login to continue" }) }),
|
|
29
|
+
/* @__PURE__ */ t.jsx(T, { children: "Please wait while we log you in." }),
|
|
30
|
+
/* @__PURE__ */ t.jsxs(b, { children: [
|
|
31
|
+
/* @__PURE__ */ t.jsx(s, { variant: "outline", onClick: () => void o(-1), children: "Cancel" }),
|
|
32
|
+
/* @__PURE__ */ t.jsx("div", { className: "w-full" }),
|
|
33
|
+
/* @__PURE__ */ t.jsx(
|
|
34
|
+
s,
|
|
35
|
+
{
|
|
36
|
+
variant: "secondary",
|
|
37
|
+
onClick: () => void e.authentication?.signUp(
|
|
38
|
+
{ navigate: o },
|
|
39
|
+
{ redirectTo: r.current }
|
|
40
|
+
),
|
|
41
|
+
children: "Register"
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ t.jsxs(
|
|
45
|
+
s,
|
|
46
|
+
{
|
|
47
|
+
onClick: () => void e.authentication?.signIn(
|
|
48
|
+
{ navigate: o },
|
|
49
|
+
{ redirectTo: r.current }
|
|
50
|
+
),
|
|
51
|
+
children: [
|
|
52
|
+
"Login",
|
|
53
|
+
" "
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] })
|
|
58
|
+
] })
|
|
59
|
+
}
|
|
60
|
+
) : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
61
|
+
c && /* @__PURE__ */ t.jsx(m, { children: /* @__PURE__ */ t.jsx(
|
|
62
|
+
"meta",
|
|
63
|
+
{
|
|
64
|
+
name: "pagefind",
|
|
65
|
+
"data-pagefind-filter": `section:${A}`,
|
|
66
|
+
content: "true"
|
|
67
|
+
}
|
|
68
|
+
) }),
|
|
69
|
+
/* @__PURE__ */ t.jsx(v, {})
|
|
70
|
+
] });
|
|
71
|
+
};
|
|
72
|
+
export {
|
|
73
|
+
O as B,
|
|
74
|
+
G as R,
|
|
75
|
+
A as S
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=RouteGuard-CjzxosTf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouteGuard-CjzxosTf.js","sources":["../src/lib/components/context/BypassProtectedRoutesContext.ts","../src/lib/core/RouteGuard.tsx"],"sourcesContent":["import { createContext } from \"react\";\n\nexport const BypassProtectedRoutesContext = createContext(false);\n","import { Helmet } from \"@zudoku/react-helmet-async\";\nimport { use } from \"react\";\nimport { matchPath, Outlet, useLocation, useNavigate } from \"react-router\";\nimport { Button } from \"zudoku/ui/Button.js\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from \"zudoku/ui/Dialog.js\";\nimport { useAuth } from \"../authentication/hook.js\";\nimport { BypassProtectedRoutesContext } from \"../components/context/BypassProtectedRoutesContext.js\";\nimport { useZudoku } from \"../components/context/ZudokuContext.js\";\nimport { ZudokuError } from \"../util/invariant.js\";\nimport { useLatest } from \"../util/useLatest.js\";\n\nexport const SEARCH_PROTECTED_SECTION = \"protected\";\n\nexport const RouteGuard = () => {\n const auth = useAuth();\n const zudoku = useZudoku();\n const navigate = useNavigate();\n const location = useLocation();\n const latestPath = useLatest(location.pathname);\n const shouldBypass = use(BypassProtectedRoutesContext);\n const { protectedRoutes } = zudoku.options;\n\n const authCheckFn =\n !shouldBypass && protectedRoutes\n ? Object.entries(protectedRoutes).find(([path]) =>\n matchPath({ path, end: true }, location.pathname),\n )?.[1]\n : undefined;\n\n const isProtectedRoute = authCheckFn !== undefined;\n const needsToSignIn =\n isProtectedRoute && !authCheckFn({ auth, context: zudoku });\n\n if (isProtectedRoute && !auth.isAuthEnabled) {\n throw new ZudokuError(\"Authentication is not enabled\", {\n title: \"Authentication is not enabled\",\n developerHint:\n \"To use protectedRoutes you need authentication to be enabled\",\n });\n }\n\n if (needsToSignIn && auth.isPending && typeof window !== \"undefined\") {\n return null;\n }\n\n if (needsToSignIn) {\n return (\n <Dialog\n open={true}\n onOpenChange={(open) => {\n if (!open) {\n void navigate(-1);\n }\n }}\n >\n <DialogContent>\n <DialogHeader>\n <DialogTitle>Login to continue</DialogTitle>\n </DialogHeader>\n <DialogDescription>\n Please wait while we log you in.\n </DialogDescription>\n <DialogFooter>\n <Button variant=\"outline\" onClick={() => void navigate(-1)}>\n Cancel\n </Button>\n <div className=\"w-full\"></div>\n <Button\n variant=\"secondary\"\n onClick={() =>\n void zudoku.authentication?.signUp(\n { navigate },\n { redirectTo: latestPath.current },\n )\n }\n >\n Register\n </Button>\n <Button\n onClick={() =>\n void zudoku.authentication?.signIn(\n { navigate },\n { redirectTo: latestPath.current },\n )\n }\n >\n Login{\" \"}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n }\n\n return (\n <>\n {shouldBypass && (\n <Helmet>\n <meta\n name=\"pagefind\"\n data-pagefind-filter={`section:${SEARCH_PROTECTED_SECTION}`}\n content=\"true\"\n />\n </Helmet>\n )}\n <Outlet />\n </>\n );\n};\n"],"names":["BypassProtectedRoutesContext","createContext","SEARCH_PROTECTED_SECTION","RouteGuard","auth","useAuth","zudoku","useZudoku","navigate","useNavigate","location","useLocation","latestPath","useLatest","shouldBypass","use","protectedRoutes","authCheckFn","path","matchPath","isProtectedRoute","needsToSignIn","ZudokuError","jsx","Dialog","open","DialogContent","DialogHeader","DialogTitle","DialogDescription","DialogFooter","Button","jsxs","Fragment","Helmet","Outlet"],"mappings":";;;;;;;;;;AAEO,MAAMA,IAA+BC,EAAc,EAAK,GCgBlDC,IAA2B,aAE3BC,IAAa,MAAM;AAC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AA,YAAA;AAAA,cACC,SAAQ;AAAA,cACR,SAAS,MACP,KAAKzB,EAAO,gBAAgB;AAAA,gBAC1B,EAAE,UAAAE,EAAA;AAAA,gBACF,EAAE,YAAYI,EAAW,QAAA;AAAA,cAAQ;AAAA,cAGtC,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGDoB,gBAAAA,EAAAA;AAAAA,YAACD;AAAA,YAAA;AAAA,cACC,SAAS,MACP,KAAKzB,EAAO,gBAAgB;AAAA,gBAC1B,EAAE,UAAAE,EAAA;AAAA,gBACF,EAAE,YAAYI,EAAW,QAAA;AAAA,cAAQ;AAAA,cAGtC,UAAA;AAAA,gBAAA;AAAA,gBACO;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACR,EAAA,CACF;AAAA,MAAA,EAAA,CACF;AAAA,IAAA;AAAA,EAAA,IAMJoB,gBAAAA,EAAAA,KAAAC,YAAA,EACG,UAAA;AAAA,IAAAnB,2BACEoB,GAAA,EACC,UAAAX,gBAAAA,EAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,wBAAsB,WAAWrB,CAAwB;AAAA,QACzD,SAAQ;AAAA,MAAA;AAAA,IAAA,GAEZ;AAAA,0BAEDiC,GAAA,CAAA,CAAO;AAAA,EAAA,GACV;AAEJ;"}
|
|
@@ -2,7 +2,7 @@ import { j as e } from "./jsx-runtime-BzflLqGi.js";
|
|
|
2
2
|
import { b as o, L as s, c as t, i as a } from "./chunk-PVWAREVJ-BMhpCH5D.js";
|
|
3
3
|
import { UnlinkIcon as n } from "lucide-react";
|
|
4
4
|
import { C as i } from "./CategoryHeading-DhmodDcq.js";
|
|
5
|
-
import { T as c, H as d, D as m, E as l } from "./ErrorAlert-
|
|
5
|
+
import { T as c, H as d, D as m, E as l } from "./ErrorAlert--3alJ_-b.js";
|
|
6
6
|
const p = () => {
|
|
7
7
|
const r = o();
|
|
8
8
|
return /* @__PURE__ */ e.jsxs(c, { className: "h-full pt-(--padding-content-top)", children: [
|
|
@@ -38,4 +38,4 @@ export {
|
|
|
38
38
|
p as N,
|
|
39
39
|
j as R
|
|
40
40
|
};
|
|
41
|
-
//# sourceMappingURL=RouterError-
|
|
41
|
+
//# sourceMappingURL=RouterError-DZS2d6Sc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouterError-
|
|
1
|
+
{"version":3,"file":"RouterError-DZS2d6Sc.js","sources":["../src/lib/components/NotFoundPage.tsx","../src/lib/errors/RouterError.tsx"],"sourcesContent":["import { UnlinkIcon } from \"lucide-react\";\nimport { Link, useParams } from \"react-router\";\nimport { CategoryHeading } from \"./CategoryHeading.js\";\nimport { DeveloperHint } from \"./DeveloperHint.js\";\nimport { Heading } from \"./Heading.js\";\nimport { Typography } from \"./Typography.js\";\n\nexport const NotFoundPage = () => {\n const params = useParams();\n\n return (\n <Typography className=\"h-full pt-(--padding-content-top)\">\n <CategoryHeading>404</CategoryHeading>\n <Heading level={1} className=\"flex gap-3.5 items-center\">\n Page not found\n <UnlinkIcon size={24} />\n </Heading>\n <DeveloperHint>\n Start by adding a file at{\" \"}\n <code>\n {\"{DOCUMENT_ROOT}\"}/{params[\"*\"]}.mdx\n </code>{\" \"}\n and add some content to make this error go away. By default{\" \"}\n <code>DOCUMENT_ROOT</code> is the `pages` directory.\n </DeveloperHint>\n <p>\n It seems that the page you are looking for does not exist or may have\n been moved. Please check the URL for any typos or use the navigation\n menu to find the correct page.\n </p>\n <Link to=\"/\">Go back home</Link>\n </Typography>\n );\n};\n","import { isRouteErrorResponse, useRouteError } from \"react-router\";\nimport { NotFoundPage } from \"../components/NotFoundPage.js\";\nimport { ErrorAlert } from \"./ErrorAlert.js\";\n\nexport function RouterError() {\n const error = useRouteError();\n\n if (isRouteErrorResponse(error) && error.status === 404) {\n return <NotFoundPage />;\n }\n\n return <ErrorAlert error={error} />;\n}\n"],"names":["NotFoundPage","params","useParams","jsxs","Typography","jsx","CategoryHeading","Heading","UnlinkIcon","DeveloperHint","Link","RouterError","error","useRouteError","isRouteErrorResponse","ErrorAlert"],"mappings":";;;;;AAOO,MAAMA,IAAe,MAAM;AAChC,QAAMC,IAASC,EAAA;AAEf,SACEC,gBAAAA,EAAAA,KAACC,GAAA,EAAW,WAAU,qCACpB,UAAA;AAAA,IAAAC,gBAAAA,EAAAA,IAACC,KAAgB,UAAA,MAAA,CAAG;AAAA,IACpBH,gBAAAA,EAAAA,KAACI,GAAA,EAAQ,OAAO,GAAG,WAAU,6BAA4B,UAAA;AAAA,MAAA;AAAA,MAEvDF,gBAAAA,EAAAA,IAACG,GAAA,EAAW,MAAM,GAAA,CAAI;AAAA,IAAA,GACxB;AAAA,2BACCC,GAAA,EAAc,UAAA;AAAA,MAAA;AAAA,MACa;AAAA,6BACzB,QAAA,EACE,UAAA;AAAA,QAAA;AAAA,QAAkB;AAAA,QAAER,EAAO,GAAG;AAAA,QAAE;AAAA,MAAA,GACnC;AAAA,MAAQ;AAAA,MAAI;AAAA,MACgD;AAAA,MAC5DI,gBAAAA,EAAAA,IAAC,UAAK,UAAA,gBAAA,CAAa;AAAA,MAAO;AAAA,IAAA,GAC5B;AAAA,IACAA,gBAAAA,EAAAA,IAAC,OAAE,UAAA,4KAAA,CAIH;AAAA,IACAA,gBAAAA,EAAAA,IAACK,GAAA,EAAK,IAAG,KAAI,UAAA,eAAA,CAAY;AAAA,EAAA,GAC3B;AAEJ;AC7BO,SAASC,IAAc;AAC5B,QAAMC,IAAQC,EAAA;AAEd,SAAIC,EAAqBF,CAAK,KAAKA,EAAM,WAAW,4BAC1CZ,GAAA,EAAa,IAGhBK,gBAAAA,MAACU,KAAW,OAAAH,GAAc;AACnC;"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-BzflLqGi.js";
|
|
2
|
-
import { s as r } from "./index-
|
|
2
|
+
import { s as r } from "./index-Bvas0H4x.js";
|
|
3
3
|
import { b as j } from "./ZudokuContext-BUZ5hkWB.js";
|
|
4
4
|
import { H as c } from "./index.esm-BnYHxCYC.js";
|
|
5
5
|
import { ChevronsUpDownIcon as N, ChevronsDownUpIcon as y, ChevronRightIcon as b } from "lucide-react";
|
|
6
6
|
import { B as v } from "./Button-DmS4u8Lj.js";
|
|
7
|
-
import { u as C, a as w, C as m, b as l, c as d, g as S } from "./index-
|
|
7
|
+
import { u as C, a as w, C as m, b as l, c as d, g as S } from "./index-DP1xZgfJ.js";
|
|
8
8
|
import { C as A } from "./CategoryHeading-DhmodDcq.js";
|
|
9
|
-
import { H as p, M as H } from "./ErrorAlert-
|
|
10
|
-
import { T as I } from "./Toc-
|
|
11
|
-
import { S as z } from "./SchemaView-
|
|
9
|
+
import { H as p, M as H } from "./ErrorAlert--3alJ_-b.js";
|
|
10
|
+
import { T as I } from "./Toc-ChkOg2UU.js";
|
|
11
|
+
import { S as z } from "./SchemaView-DJiBd0_5.js";
|
|
12
12
|
const T = S(
|
|
13
13
|
/* GraphQL */
|
|
14
14
|
`
|
|
@@ -147,4 +147,4 @@ function G() {
|
|
|
147
147
|
export {
|
|
148
148
|
G as SchemaList
|
|
149
149
|
};
|
|
150
|
-
//# sourceMappingURL=SchemaList-
|
|
150
|
+
//# sourceMappingURL=SchemaList-CSDSazqV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaList-
|
|
1
|
+
{"version":3,"file":"SchemaList-CSDSazqV.js","sources":["../src/lib/plugins/openapi/SchemaList.tsx"],"sourcesContent":["import slugify from \"@sindresorhus/slugify\";\nimport { useSuspenseQuery } from \"@tanstack/react-query\";\nimport { Helmet } from \"@zudoku/react-helmet-async\";\nimport {\n ChevronRightIcon,\n ChevronsDownUpIcon,\n ChevronsUpDownIcon,\n} from \"lucide-react\";\nimport { Button } from \"zudoku/ui/Button.js\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"zudoku/ui/Collapsible.js\";\nimport { CategoryHeading } from \"../../components/CategoryHeading.js\";\nimport { Heading } from \"../../components/Heading.js\";\nimport { Markdown } from \"../../components/Markdown.js\";\nimport { Toc } from \"../../components/navigation/Toc.js\";\nimport { useCreateQuery } from \"./client/useCreateQuery.js\";\nimport { useOasConfig } from \"./context.js\";\nimport { graphql } from \"./graphql/gql.js\";\nimport { SchemaView } from \"./schema/SchemaView.js\";\n\nconst GET_SCHEMAS = graphql(/* GraphQL */ `\n query GetSchemas($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n title\n description\n summary\n components {\n schemas {\n name\n schema\n extensions\n }\n }\n }\n }\n`);\n\nexport function SchemaList() {\n const { input, type, versions, version, options } = useOasConfig();\n const schemasQuery = useCreateQuery(GET_SCHEMAS, {\n input,\n type,\n });\n const { data } = useSuspenseQuery(schemasQuery);\n\n const schemas = data.schema.components?.schemas ?? [];\n const hasMultipleVersions = Object.entries(versions).length > 1;\n const showVersions =\n options?.showVersionSelect === \"always\" ||\n (hasMultipleVersions && options?.showVersionSelect !== \"hide\");\n\n if (!schemas.length) {\n return (\n <div>\n <Helmet>\n <title>Schemas {showVersions ? version : \"\"}</title>\n <meta name=\"description\" content=\"List of schemas used by the API.\" />\n </Helmet>\n No schemas found\n </div>\n );\n }\n\n return (\n <div\n className=\"grid grid-cols-(--sidecar-grid-cols) gap-8 justify-between\"\n data-pagefind-filter=\"section:openapi\"\n data-pagefind-meta=\"section:openapi\"\n >\n <Helmet>\n <title>Schemas {showVersions ? version : \"\"}</title>\n <meta name=\"description\" content=\"List of schemas used by the API.\" />\n </Helmet>\n <div className=\"pt-(--padding-content-top) pb-(--padding-content-bottom)\">\n <Collapsible className=\"w-full\">\n <div className=\"flex flex-col gap-y-4 sm:flex-row justify-around items-start sm:items-end\">\n <div className=\"flex-1\">\n <CategoryHeading>{data.schema.title}</CategoryHeading>\n <Heading\n level={1}\n id=\"schemas\"\n registerNavigationAnchor\n className=\"mb-0\"\n >\n Schemas\n {showVersions && (\n <span className=\"text-xl text-muted-foreground ms-1.5\">\n ({version})\n </span>\n )}\n </Heading>\n </div>\n {data.schema.description && (\n <CollapsibleTrigger className=\"flex items-center gap-1 text-sm font-medium text-muted-foreground group\">\n <span>API information</span>\n <ChevronsUpDownIcon\n className=\"group-data-[state=open]:hidden translate-y-px\"\n size={14}\n />\n <ChevronsDownUpIcon\n className=\"group-data-[state=closed]:hidden translate-y-px\"\n size={13}\n />\n </CollapsibleTrigger>\n )}\n </div>\n {data.schema.description && (\n <CollapsibleContent className=\"CollapsibleContent\">\n <div className=\"mt-4 max-w-full border rounded-sm bg-muted/25\">\n <Markdown\n className=\"max-w-full prose-img:max-w-prose border-border p-3 lg:p-5\"\n content={data.schema.description}\n />\n </div>\n </CollapsibleContent>\n )}\n </Collapsible>\n <hr className=\"my-8\" />\n <div className=\"flex flex-col gap-y-5\">\n {schemas.map((schema) => (\n <Collapsible key={schema.name} className=\"group\" defaultOpen>\n <Heading\n registerNavigationAnchor\n level={2}\n className=\"flex items-center gap-1 justify-between w-fit\"\n id={slugify(schema.name)}\n >\n {schema.name}{\" \"}\n <CollapsibleTrigger asChild>\n <Button variant=\"ghost\" size=\"icon\" className=\"size-6\">\n <ChevronRightIcon\n size={16}\n className=\"group-data-[state=open]:rotate-90 transition cursor-pointer\"\n />\n </Button>\n </CollapsibleTrigger>\n </Heading>\n <CollapsibleContent className=\"mt-4 CollapsibleContent\">\n <SchemaView schema={schema.schema} />\n </CollapsibleContent>\n </Collapsible>\n ))}\n </div>\n </div>\n <Toc\n entries={schemas.map((schema) => ({\n id: slugify(schema.name),\n value: schema.name,\n depth: 1,\n }))}\n />\n </div>\n );\n}\n"],"names":["GET_SCHEMAS","graphql","SchemaList","input","type","versions","version","options","useOasConfig","schemasQuery","useCreateQuery","data","useSuspenseQuery","schemas","hasMultipleVersions","showVersions","jsxs","Helmet","jsx","Collapsible","CategoryHeading","Heading","CollapsibleTrigger","ChevronsUpDownIcon","ChevronsDownUpIcon","CollapsibleContent","Markdown","schema","slugify","Button","ChevronRightIcon","SchemaView","Toc"],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MAAA,GAAG;AAAA,MAC5CY,gBAAAA,EAAAA,IAAC,QAAA,EAAK,MAAK,eAAc,SAAQ,mCAAA,CAAmC;AAAA,IAAA,GACtE;AAAA,IAAS;AAAA,EAAA,GAEX;AA8FN;"}
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { j as t } from "./jsx-runtime-BzflLqGi.js";
|
|
2
|
+
import { ChevronUpIcon as q, ChevronDownIcon as E, ChevronsLeftRightIcon as R, MinusIcon as z, PlusIcon as B, RefreshCcwDotIcon as L, InfoIcon as M } from "lucide-react";
|
|
3
|
+
import { S as x, I as C, M as P } from "./ErrorAlert--3alJ_-b.js";
|
|
4
|
+
import { Card as u } from "./ui/Card.js";
|
|
5
|
+
import { useState as m, isValidElement as D } from "react";
|
|
6
|
+
import { B as T } from "./Button-DmS4u8Lj.js";
|
|
7
|
+
import { c as h } from "./cn-dYga0KKN.js";
|
|
8
|
+
import * as j from "@radix-ui/react-collapsible";
|
|
9
|
+
import { Button as F } from "./ui/Button.js";
|
|
10
|
+
import { Badge as J } from "./ui/Badge.js";
|
|
11
|
+
import { C as U } from "./circular-DGfd8SGc.js";
|
|
12
|
+
const _ = (e, r) => e.reduce(
|
|
13
|
+
(s, i) => {
|
|
14
|
+
const o = r(i);
|
|
15
|
+
return s[o] || (s[o] = []), s[o].push(i), s;
|
|
16
|
+
},
|
|
17
|
+
{}
|
|
18
|
+
), $ = ({
|
|
19
|
+
schema: e,
|
|
20
|
+
hideDescription: r = !1
|
|
21
|
+
}) => /* @__PURE__ */ t.jsx("div", { className: "flex flex-col gap-1 text-xs", children: /* @__PURE__ */ t.jsxs("div", { children: [
|
|
22
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: "Const value: " }),
|
|
23
|
+
/* @__PURE__ */ t.jsx(x, { className: "border rounded px-1 font-mono", children: e.const }),
|
|
24
|
+
!r && e.description && /* @__PURE__ */ t.jsx("div", { className: "text-muted-foreground", children: e.description })
|
|
25
|
+
] }) }), y = ({
|
|
26
|
+
values: e,
|
|
27
|
+
className: r,
|
|
28
|
+
maxVisibleValues: s = 8
|
|
29
|
+
}) => {
|
|
30
|
+
const [i, o] = m(!1);
|
|
31
|
+
if (!e.length) return null;
|
|
32
|
+
const n = e.length > s, l = n && !i ? e.slice(0, s) : e;
|
|
33
|
+
return /* @__PURE__ */ t.jsxs("div", { className: h("flex flex-wrap gap-1.5 text-xs", r), children: [
|
|
34
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: "Enum values: " }),
|
|
35
|
+
l.map((a) => /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(x, { className: "border rounded-sm px-1 font-mono", children: a }) }, a)),
|
|
36
|
+
n && /* @__PURE__ */ t.jsx(
|
|
37
|
+
T,
|
|
38
|
+
{
|
|
39
|
+
variant: "ghost",
|
|
40
|
+
size: "sm",
|
|
41
|
+
className: "h-fit px-0",
|
|
42
|
+
onClick: () => o(!i),
|
|
43
|
+
children: i ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
44
|
+
/* @__PURE__ */ t.jsx(q, { size: 12 }),
|
|
45
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: "show less" })
|
|
46
|
+
] }) : /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
47
|
+
/* @__PURE__ */ t.jsx(E, { size: 12 }),
|
|
48
|
+
/* @__PURE__ */ t.jsxs("span", { className: "text-muted-foreground", children: [
|
|
49
|
+
"show ",
|
|
50
|
+
e.length - s,
|
|
51
|
+
" more"
|
|
52
|
+
] })
|
|
53
|
+
] })
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
] });
|
|
57
|
+
}, G = ({ pattern: e }) => {
|
|
58
|
+
const [r, s] = m(!1), i = e.length > 20, o = i ? `${e.slice(0, 20)}…` : e;
|
|
59
|
+
return /* @__PURE__ */ t.jsxs(
|
|
60
|
+
C,
|
|
61
|
+
{
|
|
62
|
+
className: h("text-xs", i && "cursor-pointer"),
|
|
63
|
+
onClick: () => s(!r),
|
|
64
|
+
selectOnClick: !1,
|
|
65
|
+
children: [
|
|
66
|
+
r ? e : o,
|
|
67
|
+
i && /* @__PURE__ */ t.jsx("button", { type: "button", className: "p-1 translate-y-[2px]", children: !r && /* @__PURE__ */ t.jsx(R, { size: 12 }) })
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}, K = (e) => e ? [
|
|
72
|
+
e.type === "array" && e.items.type ? Array.isArray(e.items.type) ? `(${e.items.type.join(" | ")})[]` : `${e.items.type}[]` : Array.isArray(e.type) ? e.type.join(" | ") : e.type,
|
|
73
|
+
e.enum && "enum",
|
|
74
|
+
e.const && "const",
|
|
75
|
+
e.format,
|
|
76
|
+
e.minimum !== void 0 && `min: ${e.minimum}`,
|
|
77
|
+
e.maximum !== void 0 && `max: ${e.maximum}`,
|
|
78
|
+
e.minLength !== void 0 && `minLength: ${e.minLength}`,
|
|
79
|
+
e.maxLength !== void 0 && `maxLength: ${e.maxLength}`,
|
|
80
|
+
e.minItems !== void 0 && `minItems: ${e.minItems}`,
|
|
81
|
+
e.maxItems !== void 0 && `maxItems: ${e.maxItems}`,
|
|
82
|
+
e.minProperties !== void 0 && `minProps: ${e.minProperties}`,
|
|
83
|
+
e.maxProperties !== void 0 && `maxProps: ${e.maxProperties}`,
|
|
84
|
+
e.uniqueItems && "unique",
|
|
85
|
+
e.readOnly && "readOnly",
|
|
86
|
+
e.writeOnly && "writeOnly",
|
|
87
|
+
e.deprecated && "deprecated",
|
|
88
|
+
e.pattern && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
89
|
+
"pattern: ",
|
|
90
|
+
/* @__PURE__ */ t.jsx(G, { pattern: e.pattern })
|
|
91
|
+
] })
|
|
92
|
+
] : [], g = ({
|
|
93
|
+
schema: e,
|
|
94
|
+
extraItems: r = [],
|
|
95
|
+
className: s
|
|
96
|
+
}) => {
|
|
97
|
+
const i = [...K(e), ...r].flatMap(
|
|
98
|
+
(o) => typeof o == "string" || D(o) ? o : []
|
|
99
|
+
);
|
|
100
|
+
return /* @__PURE__ */ t.jsx("span", { className: s, children: i.map((o, n) => (
|
|
101
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: index should be stable
|
|
102
|
+
/* @__PURE__ */ t.jsxs("span", { className: "text-muted-foreground", children: [
|
|
103
|
+
o,
|
|
104
|
+
n < i.length - 1 && /* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground/50", children: " · " })
|
|
105
|
+
] }, n)
|
|
106
|
+
)) });
|
|
107
|
+
}, N = ({
|
|
108
|
+
schema: e
|
|
109
|
+
}) => {
|
|
110
|
+
const r = e.examples?.at(0), s = e.default;
|
|
111
|
+
return r === void 0 && s === void 0 ? null : /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col gap-1 text-xs", children: [
|
|
112
|
+
r !== void 0 && /* @__PURE__ */ t.jsxs("div", { children: [
|
|
113
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: "Example: " }),
|
|
114
|
+
/* @__PURE__ */ t.jsx(x, { className: "border rounded-sm px-1 font-mono", children: typeof r == "object" || typeof r == "boolean" ? JSON.stringify(r) : r })
|
|
115
|
+
] }),
|
|
116
|
+
s !== void 0 && /* @__PURE__ */ t.jsxs("div", { children: [
|
|
117
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-muted-foreground", children: "Default: " }),
|
|
118
|
+
/* @__PURE__ */ t.jsx(x, { className: "border rounded-sm px-1 font-mono", children: typeof s == "object" || typeof s == "boolean" ? JSON.stringify(s) : s })
|
|
119
|
+
] })
|
|
120
|
+
] });
|
|
121
|
+
}, w = (e) => typeof e == "string" && ["string", "number", "boolean", "integer", "null"].includes(e) || Array.isArray(e) && e.every(w), b = (e) => e.type === "array" || // schema.type might be an array of types, so we need to check if "array" is one of them
|
|
122
|
+
Array.isArray(e.type) && e.type.includes("array"), O = (e) => e && (e.type === "object" && Object.keys(e.properties ?? {}).length > 0 || e.type === "array" && typeof e.items == "object" && (!e.items.type || e.items.type === "object")), S = (e) => typeof e == "string" && e.startsWith(U), I = (e) => b(e) && "items" in e && S(e.items), W = (e) => typeof e == "string" ? e.split(":")[1] : void 0, A = ({ circularProp: e }) => /* @__PURE__ */ t.jsxs(
|
|
123
|
+
C,
|
|
124
|
+
{
|
|
125
|
+
className: "inline-flex items-center gap-1.5 italic text-xs translate-y-0.5",
|
|
126
|
+
selectOnClick: !1,
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ t.jsx(L, { size: 13 }),
|
|
129
|
+
/* @__PURE__ */ t.jsx("span", { children: e ? `${e} (circular)` : "circular" })
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
), Q = ({
|
|
133
|
+
name: e,
|
|
134
|
+
schema: r,
|
|
135
|
+
group: s,
|
|
136
|
+
defaultOpen: i = !1,
|
|
137
|
+
showCollapseButton: o = !0
|
|
138
|
+
}) => {
|
|
139
|
+
const [n, l] = m(i);
|
|
140
|
+
if (S(r))
|
|
141
|
+
return /* @__PURE__ */ t.jsx("li", { className: "p-4 bg-border/20 hover:bg-border/30", children: /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col gap-2.5 justify-between text-sm", children: [
|
|
142
|
+
/* @__PURE__ */ t.jsxs("div", { className: "space-x-2 rtl:space-x-reverse", children: [
|
|
143
|
+
/* @__PURE__ */ t.jsx("code", { children: e }),
|
|
144
|
+
/* @__PURE__ */ t.jsx(
|
|
145
|
+
g,
|
|
146
|
+
{
|
|
147
|
+
schema: r,
|
|
148
|
+
extraItems: [/* @__PURE__ */ t.jsx(A, {}, "circular-ref")]
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
] }),
|
|
152
|
+
/* @__PURE__ */ t.jsx(N, { schema: r })
|
|
153
|
+
] }) });
|
|
154
|
+
const a = !!((r.allOf || r.anyOf || r.oneOf || O(r) || b(r) && "items" in r && O(r.items) || r.additionalProperties) && !I(r));
|
|
155
|
+
return /* @__PURE__ */ t.jsx("li", { className: "p-4 bg-border/20 hover:bg-border/30", children: /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col gap-2.5 justify-between text-sm", children: [
|
|
156
|
+
/* @__PURE__ */ t.jsxs("div", { className: "space-x-2 rtl:space-x-reverse", children: [
|
|
157
|
+
/* @__PURE__ */ t.jsx(x, { asChild: !0, children: /* @__PURE__ */ t.jsx("code", { children: e }) }),
|
|
158
|
+
/* @__PURE__ */ t.jsx(
|
|
159
|
+
g,
|
|
160
|
+
{
|
|
161
|
+
schema: r,
|
|
162
|
+
extraItems: [
|
|
163
|
+
s !== "optional" && /* @__PURE__ */ t.jsx("span", { className: "text-primary", children: "required" }),
|
|
164
|
+
I(r) && /* @__PURE__ */ t.jsx(
|
|
165
|
+
A,
|
|
166
|
+
{
|
|
167
|
+
circularProp: W(r.items)
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
] }),
|
|
174
|
+
r.description && /* @__PURE__ */ t.jsx(
|
|
175
|
+
P,
|
|
176
|
+
{
|
|
177
|
+
className: "text-sm leading-normal",
|
|
178
|
+
content: r.description
|
|
179
|
+
}
|
|
180
|
+
),
|
|
181
|
+
r.type === "array" && "items" in r && r.items.enum && /* @__PURE__ */ t.jsx(y, { values: r.items.enum }),
|
|
182
|
+
r.const && /* @__PURE__ */ t.jsx($, { schema: r, hideDescription: !0 }),
|
|
183
|
+
r.enum && /* @__PURE__ */ t.jsx(y, { values: r.enum }),
|
|
184
|
+
/* @__PURE__ */ t.jsx(N, { schema: r }),
|
|
185
|
+
a && /* @__PURE__ */ t.jsxs(
|
|
186
|
+
j.Root,
|
|
187
|
+
{
|
|
188
|
+
defaultOpen: i,
|
|
189
|
+
open: n,
|
|
190
|
+
onOpenChange: () => l(!n),
|
|
191
|
+
children: [
|
|
192
|
+
o && /* @__PURE__ */ t.jsx(j.Trigger, { asChild: !0, children: /* @__PURE__ */ t.jsxs(F, { variant: "expand", size: "sm", children: [
|
|
193
|
+
n ? /* @__PURE__ */ t.jsx(z, { size: 12 }) : /* @__PURE__ */ t.jsx(B, { size: 12 }),
|
|
194
|
+
n ? "Hide properties" : "Show properties"
|
|
195
|
+
] }) }),
|
|
196
|
+
/* @__PURE__ */ t.jsx(j.Content, { children: /* @__PURE__ */ t.jsx("div", { className: "mt-2", children: r.anyOf || r.oneOf || r.type === "object" ? /* @__PURE__ */ t.jsx(p, { schema: r }) : b(r) && "items" in r ? /* @__PURE__ */ t.jsx(p, { schema: r.items }) : null }) })
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
] }) });
|
|
201
|
+
}, V = (e) => {
|
|
202
|
+
const r = e.oneOf ?? e.anyOf ?? [];
|
|
203
|
+
return e.properties && Object.keys(e.properties).length > 0 ? r.map((s) => !s.properties && !s.type && !s.oneOf && !s.anyOf ? {
|
|
204
|
+
...s,
|
|
205
|
+
type: "object",
|
|
206
|
+
properties: e.properties,
|
|
207
|
+
required: s.required ?? e.required
|
|
208
|
+
} : s) : r;
|
|
209
|
+
}, X = (e) => {
|
|
210
|
+
if (Array.isArray(e.oneOf)) return "exactly-one";
|
|
211
|
+
const r = e.discriminator?.propertyName;
|
|
212
|
+
if (!r) return "at-least-one";
|
|
213
|
+
const s = V(e), i = /* @__PURE__ */ new Set();
|
|
214
|
+
for (const o of s) {
|
|
215
|
+
const n = o.properties?.[r], l = n?.const ?? (Array.isArray(n?.enum) && n.enum.length === 1 ? String(n.enum[0]) : void 0);
|
|
216
|
+
if (l == null || i.has(String(l))) return "at-least-one";
|
|
217
|
+
i.add(String(l));
|
|
218
|
+
}
|
|
219
|
+
return "exactly-one";
|
|
220
|
+
}, v = (e, r) => r.title?.trim() || `Variant ${e + 1}`, Y = (e, r) => {
|
|
221
|
+
const s = [];
|
|
222
|
+
e.type && s.push(
|
|
223
|
+
`type = ${Array.isArray(e.type) ? e.type.join("|") : e.type}`
|
|
224
|
+
);
|
|
225
|
+
const i = r?.discriminator?.propertyName;
|
|
226
|
+
if (i) {
|
|
227
|
+
const n = e.properties?.[i], l = n?.const ?? (Array.isArray(n?.enum) && n.enum.length === 1 ? n.enum[0] : void 0);
|
|
228
|
+
l !== void 0 && s.push(`${i}=${JSON.stringify(l)}`);
|
|
229
|
+
}
|
|
230
|
+
const o = (e.required ?? []).filter((n) => n !== i);
|
|
231
|
+
if (o.length) {
|
|
232
|
+
const n = o.slice(0, 3).join(", "), l = o.length > 3 ? ` +${o.length - 3} more` : "";
|
|
233
|
+
s.push(`requires: ${n}${l}`);
|
|
234
|
+
}
|
|
235
|
+
return s;
|
|
236
|
+
}, Z = ({
|
|
237
|
+
variants: e,
|
|
238
|
+
schema: r,
|
|
239
|
+
selectedVariant: s,
|
|
240
|
+
onSelectVariant: i
|
|
241
|
+
}) => {
|
|
242
|
+
const o = e.map((n, l) => ({
|
|
243
|
+
label: v(l, n),
|
|
244
|
+
guards: Y(n, r)
|
|
245
|
+
}));
|
|
246
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col gap-2 text-sm", children: [
|
|
247
|
+
/* @__PURE__ */ t.jsx("h4", { className: "font-medium", children: "Decision Table" }),
|
|
248
|
+
/* @__PURE__ */ t.jsx("div", { className: "border rounded-md overflow-hidden", children: /* @__PURE__ */ t.jsxs("table", { className: "w-full", children: [
|
|
249
|
+
/* @__PURE__ */ t.jsx("thead", { children: /* @__PURE__ */ t.jsxs("tr", { className: "border-b bg-muted/50", children: [
|
|
250
|
+
/* @__PURE__ */ t.jsx("th", { className: "text-left p-2 font-medium", children: "Variant" }),
|
|
251
|
+
/* @__PURE__ */ t.jsx("th", { className: "text-left p-2 font-medium", children: "Matching Criteria" })
|
|
252
|
+
] }) }),
|
|
253
|
+
/* @__PURE__ */ t.jsx("tbody", { className: "divide-y", children: o.map((n) => /* @__PURE__ */ t.jsxs("tr", { className: "hover:bg-muted/30", children: [
|
|
254
|
+
/* @__PURE__ */ t.jsx("td", { className: "p-2 font-medium", children: /* @__PURE__ */ t.jsx(
|
|
255
|
+
"button",
|
|
256
|
+
{
|
|
257
|
+
type: "button",
|
|
258
|
+
className: h(
|
|
259
|
+
"hover:underline",
|
|
260
|
+
s === n.label && "text-primary"
|
|
261
|
+
),
|
|
262
|
+
onClick: () => i(n.label),
|
|
263
|
+
children: n.label
|
|
264
|
+
}
|
|
265
|
+
) }),
|
|
266
|
+
/* @__PURE__ */ t.jsx("td", { className: "p-2 text-muted-foreground text-xs", children: n.guards.length > 0 ? n.guards.join(" · ") : "No specific criteria" })
|
|
267
|
+
] }, n.label)) })
|
|
268
|
+
] }) })
|
|
269
|
+
] });
|
|
270
|
+
}, H = ({ variant: e }) => /* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
|
|
271
|
+
e.description && /* @__PURE__ */ t.jsx("p", { className: "text-sm text-muted-foreground", children: e.description }),
|
|
272
|
+
/* @__PURE__ */ t.jsx(p, { schema: e })
|
|
273
|
+
] }), ee = ({
|
|
274
|
+
schema: e,
|
|
275
|
+
cardHeader: r
|
|
276
|
+
}) => {
|
|
277
|
+
const s = Array.isArray(e.oneOf) ? "oneOf" : Array.isArray(e.anyOf) ? "anyOf" : void 0, i = s ? V(e) : [], [o, n] = m(
|
|
278
|
+
() => i[0] ? v(0, i[0]) : ""
|
|
279
|
+
);
|
|
280
|
+
if (!s) return null;
|
|
281
|
+
const a = X(e) === "exactly-one" ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
282
|
+
"Exactly one variant ",
|
|
283
|
+
/* @__PURE__ */ t.jsx("b", { children: "must match" }),
|
|
284
|
+
"."
|
|
285
|
+
] }) : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
286
|
+
"At least one variant ",
|
|
287
|
+
/* @__PURE__ */ t.jsx("b", { children: "must match" }),
|
|
288
|
+
". Multiple variants",
|
|
289
|
+
" ",
|
|
290
|
+
/* @__PURE__ */ t.jsx("i", { children: "may match" }),
|
|
291
|
+
" simultaneously."
|
|
292
|
+
] }), d = i.findIndex(
|
|
293
|
+
(f, k) => v(k, f) === o
|
|
294
|
+
), c = d >= 0 ? i[d] : null;
|
|
295
|
+
return /* @__PURE__ */ t.jsxs(u, { className: "overflow-hidden text-sm", children: [
|
|
296
|
+
r,
|
|
297
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex flex-col gap-4 p-4", children: [
|
|
298
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
299
|
+
/* @__PURE__ */ t.jsx(J, { variant: "outline", children: s }),
|
|
300
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex-1 p-2", children: /* @__PURE__ */ t.jsx("span", { className: "text-sm", children: a }) })
|
|
301
|
+
] }),
|
|
302
|
+
/* @__PURE__ */ t.jsx(
|
|
303
|
+
Z,
|
|
304
|
+
{
|
|
305
|
+
variants: i,
|
|
306
|
+
schema: e,
|
|
307
|
+
selectedVariant: o,
|
|
308
|
+
onSelectVariant: n
|
|
309
|
+
}
|
|
310
|
+
),
|
|
311
|
+
/* @__PURE__ */ t.jsxs("strong", { children: [
|
|
312
|
+
"Properties for ",
|
|
313
|
+
o,
|
|
314
|
+
":"
|
|
315
|
+
] }),
|
|
316
|
+
c && /* @__PURE__ */ t.jsx(H, { variant: c })
|
|
317
|
+
] })
|
|
318
|
+
] });
|
|
319
|
+
}, te = (e) => e && /* @__PURE__ */ t.jsx(
|
|
320
|
+
P,
|
|
321
|
+
{
|
|
322
|
+
className: "text-sm leading-normal line-clamp-4",
|
|
323
|
+
content: e
|
|
324
|
+
}
|
|
325
|
+
), re = (e, r) => /* @__PURE__ */ t.jsxs(u, { className: "overflow-hidden", children: [
|
|
326
|
+
r,
|
|
327
|
+
/* @__PURE__ */ t.jsxs("div", { className: "p-4 space-y-2", children: [
|
|
328
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-sm text-muted-foreground", children: /* @__PURE__ */ t.jsx(g, { schema: e }) }),
|
|
329
|
+
e.enum && /* @__PURE__ */ t.jsx(y, { values: e.enum }),
|
|
330
|
+
te(e.description),
|
|
331
|
+
/* @__PURE__ */ t.jsx(N, { schema: e })
|
|
332
|
+
] })
|
|
333
|
+
] }), p = ({
|
|
334
|
+
schema: e,
|
|
335
|
+
defaultOpen: r = !1,
|
|
336
|
+
cardHeader: s,
|
|
337
|
+
embedded: i
|
|
338
|
+
}) => {
|
|
339
|
+
if (!e || Object.keys(e).length === 0)
|
|
340
|
+
return /* @__PURE__ */ t.jsxs(u, { className: "overflow-hidden", children: [
|
|
341
|
+
s,
|
|
342
|
+
/* @__PURE__ */ t.jsx("div", { className: "text-sm text-muted-foreground italic p-4", children: "No data returned" })
|
|
343
|
+
] });
|
|
344
|
+
if (e.const)
|
|
345
|
+
return /* @__PURE__ */ t.jsx($, { schema: e });
|
|
346
|
+
if (Array.isArray(e.oneOf) || Array.isArray(e.anyOf))
|
|
347
|
+
return /* @__PURE__ */ t.jsx(ee, { schema: e, cardHeader: s });
|
|
348
|
+
if (w(e.type))
|
|
349
|
+
return re(e, s);
|
|
350
|
+
if (e.type === "array" && typeof e.items == "object")
|
|
351
|
+
return /* @__PURE__ */ t.jsx(p, { schema: e.items, cardHeader: s });
|
|
352
|
+
if (e.type === "object") {
|
|
353
|
+
const o = _(
|
|
354
|
+
Object.entries(e.properties ?? {}),
|
|
355
|
+
([d, c]) => c.deprecated ? "deprecated" : e.required?.includes(d) ? "required" : "optional"
|
|
356
|
+
), n = ["required", "optional", "deprecated"], l = typeof e.additionalProperties == "object" ? /* @__PURE__ */ t.jsx(p, { schema: e.additionalProperties, embedded: !0 }) : e.additionalProperties === !0 ? /* @__PURE__ */ t.jsxs("div", { className: "text-sm p-4 bg-border/20 hover:bg-border/30 flex items-center gap-1", children: [
|
|
357
|
+
/* @__PURE__ */ t.jsx("span", { children: "Additional properties are allowed" }),
|
|
358
|
+
/* @__PURE__ */ t.jsx(
|
|
359
|
+
"a",
|
|
360
|
+
{
|
|
361
|
+
className: "p-0.5 -m-0.5",
|
|
362
|
+
href: "https://swagger.io/docs/specification/v3_0/data-models/dictionaries/",
|
|
363
|
+
rel: "noopener noreferrer",
|
|
364
|
+
target: "_blank",
|
|
365
|
+
children: /* @__PURE__ */ t.jsx(M, { size: 14 })
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
] }) : null, a = i ? "div" : u;
|
|
369
|
+
return /* @__PURE__ */ t.jsxs(a, { className: "divide-y overflow-hidden", children: [
|
|
370
|
+
s,
|
|
371
|
+
n.map(
|
|
372
|
+
(d) => o[d] && /* @__PURE__ */ t.jsx("ul", { className: "divide-y", children: o[d].map(([c, f]) => /* @__PURE__ */ t.jsx(
|
|
373
|
+
Q,
|
|
374
|
+
{
|
|
375
|
+
name: c,
|
|
376
|
+
schema: f,
|
|
377
|
+
group: d,
|
|
378
|
+
defaultOpen: r
|
|
379
|
+
},
|
|
380
|
+
c
|
|
381
|
+
)) }, d)
|
|
382
|
+
),
|
|
383
|
+
l
|
|
384
|
+
] });
|
|
385
|
+
}
|
|
386
|
+
return null;
|
|
387
|
+
};
|
|
388
|
+
export {
|
|
389
|
+
y as E,
|
|
390
|
+
g as P,
|
|
391
|
+
p as S,
|
|
392
|
+
N as a,
|
|
393
|
+
S as b,
|
|
394
|
+
_ as g,
|
|
395
|
+
b as i
|
|
396
|
+
};
|
|
397
|
+
//# sourceMappingURL=SchemaView-DJiBd0_5.js.map
|