@mintlify/msft-sdk 1.1.18 → 1.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/api-playground/ApiPlayground/ApiPlaygroundContext.js +11 -0
  2. package/dist/api-playground/ApiPlayground/ApiPlaygroundContext.js.map +1 -0
  3. package/dist/api-playground-2/ApiExamples.js +3 -3
  4. package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +3 -3
  5. package/dist/api-playground-2/components/Example/GeneratedResponseExample.js +2 -2
  6. package/dist/api-playground-2/components/Example/RequestExample.js +35 -35
  7. package/dist/api-playground-2/components/Example/RequestExample.js.map +1 -1
  8. package/dist/api-playground-2/constants/index.js +20 -0
  9. package/dist/api-playground-2/constants/index.js.map +1 -0
  10. package/dist/api-playground-2/generators/createBodyData.js +67 -0
  11. package/dist/api-playground-2/generators/createBodyData.js.map +1 -0
  12. package/dist/api-playground-2/generators/createHeaders.js +45 -0
  13. package/dist/api-playground-2/generators/createHeaders.js.map +1 -0
  14. package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +50 -0
  15. package/dist/api-playground-2/generators/generateInteractiveCodeSample.js.map +1 -0
  16. package/dist/api-playground-2/generators/generateRequest.js +65 -0
  17. package/dist/api-playground-2/generators/generateRequest.js.map +1 -0
  18. package/dist/api-playground-2/generators/generateResponseExampleMap.js +36 -0
  19. package/dist/api-playground-2/generators/generateResponseExampleMap.js.map +1 -0
  20. package/dist/api-playground-2/generators/generateSnippet.js +42 -0
  21. package/dist/api-playground-2/generators/generateSnippet.js.map +1 -0
  22. package/dist/api-playground-2/generators/generateSnippetMap.js +68 -0
  23. package/dist/api-playground-2/generators/generateSnippetMap.js.map +1 -0
  24. package/dist/api-playground-2/generators/getFileProperties.js +24 -0
  25. package/dist/api-playground-2/generators/getFileProperties.js.map +1 -0
  26. package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js +22 -0
  27. package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js.map +1 -0
  28. package/dist/api-playground-2/schemaGraph/getAllRequiredProperties.js +10 -0
  29. package/dist/api-playground-2/schemaGraph/getAllRequiredProperties.js.map +1 -0
  30. package/dist/api-playground-2/schemaGraph/processExamples.js +13 -0
  31. package/dist/api-playground-2/schemaGraph/processExamples.js.map +1 -0
  32. package/dist/api-playground-2/schemaGraph/utils.js +76 -0
  33. package/dist/api-playground-2/schemaGraph/utils.js.map +1 -0
  34. package/dist/components/Api/dropdown-menu.js +4 -3
  35. package/dist/components/Api/dropdown-menu.js.map +1 -1
  36. package/dist/components/content-components/CodeGroupSelect/index.js +3 -3
  37. package/dist/constants/initialRequest.js +14 -0
  38. package/dist/constants/initialRequest.js.map +1 -0
  39. package/dist/constants/snippetPresets.js +47 -13
  40. package/dist/constants/snippetPresets.js.map +1 -1
  41. package/dist/contexts/CodeExampleLabelContext.js +14 -0
  42. package/dist/contexts/CodeExampleLabelContext.js.map +1 -0
  43. package/dist/contexts/ConfigContext.js +1 -2
  44. package/dist/contexts/ConfigContext.js.map +1 -1
  45. package/dist/env.js +3 -0
  46. package/dist/env.js.map +1 -0
  47. package/dist/hooks/useSendPlaygroundRequest.js +18 -0
  48. package/dist/hooks/useSendPlaygroundRequest.js.map +1 -0
  49. package/dist/utils/locales/en.js +111 -0
  50. package/dist/utils/locales/en.js.map +1 -0
  51. package/dist/utils/locales/index.js +6 -0
  52. package/dist/utils/locales/index.js.map +1 -0
  53. package/dist/utils/uuid.js +7 -0
  54. package/dist/utils/uuid.js.map +1 -0
  55. package/package.json +6 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateSnippet.js","sources":["../../../src/api-playground-2/generators/generateSnippet.ts"],"sourcesContent":["import { ApiPlaygroundInputs } from '@mintlify/validation';\nimport type { Request } from 'har-format';\nimport { HTTPSnippet } from '@readme/httpsnippet';\nimport { generateUniqueString } from '@/utils/uuid';\n\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\nimport { snippetPresets as defaultSnippetPresets, SnippetPreset } from '@/constants/snippetPresets';\nimport { ExampleCodeSnippet } from '@/types/exampleCodeSnippet';\n\ntype TargetId = 'c' | 'clojure' | 'csharp' | 'go' | 'http' | 'java' | 'javascript' | 'json' | 'kotlin' | 'node' | 'objc' | 'ocaml' | 'php' | 'powershell' | 'python' | 'r' | 'ruby' | 'shell' | 'swift';\n\nexport interface GenerateSnippetParams {\n request: Request;\n pathInputs: ApiPlaygroundInputs['path'];\n apiReferenceData: ApiReferenceDataV2;\n snippetPresets?: SnippetPreset[];\n isMultipleRequest?: boolean;\n}\n\nexport const generateSnippet = async ({\n request,\n pathInputs,\n apiReferenceData,\n snippetPresets = defaultSnippetPresets,\n isMultipleRequest = false,\n}: GenerateSnippetParams): Promise<ExampleCodeSnippet[]> => {\n const uuidToName: Record<string, string> = {};\n\n // https://regex101.com/r/3PPRco/1\n const portRegex = /:{[^{}]+}/g;\n\n // for the port number found in the url that is not populated, replace it with a rare integer\n const safePortUrl = request.url.replace(portRegex, (nameWithColon) => {\n const replacementWithColon = ':62437'; // arbitrary port value which is unlikely to appear in url\n uuidToName[replacementWithColon] = nameWithColon;\n return replacementWithColon;\n });\n\n // https://regex101.com/r/pwKjrJ/1\n const pathParamRegex = /{[^{}]+}/g;\n\n // for each path param found in the url, replace it with the value if the input is populated, otherwise replace it with a uuid\n const safeUrl = safePortUrl.replace(pathParamRegex, (name) => {\n const nameNoBrackets = name.slice(1, name.length - 1);\n const paramValue = pathInputs[nameNoBrackets];\n\n if (name === '{endpoint}') {\n return 'https://{endpoint}';\n }\n\n if (paramValue && (typeof paramValue !== 'string' || paramValue.length > 0)) {\n return `${encodeURIComponent(paramValue.toString())}`;\n }\n\n const uuid = generateUniqueString();\n uuidToName[uuid] = name;\n return uuid;\n });\n\n const httpSnippet = new HTTPSnippet({\n ...request,\n url: safeUrl,\n postData: request.postData || { mimeType: 'application/json' },\n });\n\n return Promise.all(\n snippetPresets.map(async (snippetPreset) => {\n const { filename, snippet, language } = snippetPreset;\n const { target, client } = snippet;\n const response = httpSnippet.convert(target as TargetId, client);\n\n const code = restorePlaceholders(uuidToName, response?.toString() || '');\n\n return {\n filename: isMultipleRequest ? filename : apiReferenceData.operation?.title || filename,\n code,\n language,\n };\n })\n );\n};\n\n/**\n * For each uuid that was substituted into the url, replaces the first (and only) instance of the uuid with the original name.\n *\n * @param uuidNameMap - Mapping of UUIDs to their original names.\n * @param snippet - String where UUIDs need to be replaced with their original names.\n */\nconst restorePlaceholders = (uuidNameMap: Record<string, string>, snippet: string): string => {\n return Object.entries(uuidNameMap).reduce((acc, [uuid, name]) => {\n return acc.replace(uuid, name);\n }, snippet);\n};\n"],"names":["generateSnippet","request","pathInputs","apiReferenceData","snippetPresets","defaultSnippetPresets","isMultipleRequest","uuidToName","portRegex","safePortUrl","nameWithColon","replacementWithColon","pathParamRegex","safeUrl","name","nameNoBrackets","paramValue","uuid","generateUniqueString","httpSnippet","HTTPSnippet","snippetPreset","filename","snippet","language","target","client","response","code","restorePlaceholders","_a","uuidNameMap","acc"],"mappings":";;;AAmBO,MAAMA,IAAkB,OAAO;AAAA,EACpC,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,kBAAAC;AAAA,EAAA,gBACAC,IAAiBC;AAAAA,EACjB,mBAAAC,IAAoB;AACtB,MAA4D;AAC1D,QAAMC,IAAqC,CAAA,GAGrCC,IAAY,cAGZC,IAAcR,EAAQ,IAAI,QAAQO,GAAW,CAACE,MAAkB;AACpE,UAAMC,IAAuB;AAC7B,WAAAJ,EAAWI,CAAoB,IAAID,GAC5BC;AAAA,EACT,CAAC,GAGKC,IAAiB,aAGjBC,IAAUJ,EAAY,QAAQG,GAAgB,CAACE,MAAS;AAC5D,UAAMC,IAAiBD,EAAK,MAAM,GAAGA,EAAK,SAAS,CAAC,GAC9CE,IAAad,EAAWa,CAAc;AAE5C,QAAID,MAAS;AACX,aAAO;AAGT,QAAIE,MAAe,OAAOA,KAAe,YAAYA,EAAW,SAAS;AACvE,aAAO,GAAG,mBAAmBA,EAAW,SAAA,CAAU,CAAC;AAGrD,UAAMC,IAAOC,EAAA;AACb,WAAAX,EAAWU,CAAI,IAAIH,GACZG;AAAA,EACT,CAAC,GAEKE,IAAc,IAAIC,EAAY;AAAA,IAClC,GAAGnB;AAAA,IACH,KAAKY;AAAA,IACL,UAAUZ,EAAQ,YAAY,EAAE,UAAU,mBAAA;AAAA,EAAmB,CAC9D;AAED,SAAO,QAAQ;AAAA,IACbG,EAAe,IAAI,OAAOiB,MAAkB;;AAC1C,YAAM,EAAE,UAAAC,GAAU,SAAAC,GAAS,UAAAC,EAAA,IAAaH,GAClC,EAAE,QAAAI,GAAQ,QAAAC,EAAA,IAAWH,GACrBI,IAAWR,EAAY,QAAQM,GAAoBC,CAAM,GAEzDE,IAAOC,EAAoBtB,IAAYoB,KAAA,gBAAAA,EAAU,eAAc,EAAE;AAEvE,aAAO;AAAA,QACL,UAAUrB,IAAoBgB,MAAWQ,IAAA3B,EAAiB,cAAjB,gBAAA2B,EAA4B,UAASR;AAAA,QAC9E,MAAAM;AAAA,QACA,UAAAJ;AAAA,MAAA;AAAA,IAEJ,CAAC;AAAA,EAAA;AAEL,GAQMK,IAAsB,CAACE,GAAqCR,MACzD,OAAO,QAAQQ,CAAW,EAAE,OAAO,CAACC,GAAK,CAACf,GAAMH,CAAI,MAClDkB,EAAI,QAAQf,GAAMH,CAAI,GAC5BS,CAAO;"}
@@ -0,0 +1,68 @@
1
+ import { requestExampleLanguages as d } from "@mintlify/models";
2
+ import { toShikiLang as k, shikiLangToDisplayLang as m } from "../../constants/snippetPresets.js";
3
+ import { generateInteractiveCodeSample as x } from "./generateInteractiveCodeSample.js";
4
+ const O = async ({
5
+ codeSamples: t,
6
+ apiReferenceData: c,
7
+ baseUrl: i,
8
+ inputs: e,
9
+ apiPlaygroundMode: f,
10
+ requestExampleLanguages: r,
11
+ requiredOnly: g
12
+ }) => {
13
+ const L = i && f !== "none" || i && r, s = r ?? [];
14
+ t = t.map((n) => ({
15
+ ...n,
16
+ lang: k(n.lang)
17
+ })), r === void 0 && (t.forEach((n) => {
18
+ s.includes(n.lang) || s.push(n.lang);
19
+ }), L && d.forEach((n) => {
20
+ s.includes(n) || s.push(n);
21
+ }));
22
+ const h = {};
23
+ for (const n of s) {
24
+ let o = m[n] ?? n;
25
+ const u = t.filter((a) => a.lang === n), l = h[o] ?? {};
26
+ if (u.length === 0) {
27
+ const a = await x({
28
+ baseUrl: i,
29
+ apiReferenceData: c,
30
+ inputs: e,
31
+ apiPlaygroundMode: f,
32
+ lang: n,
33
+ requiredOnly: g
34
+ });
35
+ a && E(
36
+ a,
37
+ n,
38
+ o,
39
+ l,
40
+ !0
41
+ );
42
+ } else
43
+ u.forEach((a) => {
44
+ o = m[n] ?? a.label ?? n, E(
45
+ a,
46
+ n,
47
+ o,
48
+ l,
49
+ !1
50
+ );
51
+ });
52
+ Object.keys(l).length > 0 && (h[o] = l);
53
+ }
54
+ return h;
55
+ }, E = (t, c, i, e, f) => {
56
+ "" in e && (e["Example 1"] = e[""], delete e[""]);
57
+ const r = Object.keys(e).length, g = t.label ?? (r > 0 ? `Example ${r + 1}` : "");
58
+ e[g] = {
59
+ filename: f ? i : g || i,
60
+ // (used in CodeSnippets)
61
+ language: c,
62
+ code: t.source
63
+ };
64
+ };
65
+ export {
66
+ O as generateSnippetMap
67
+ };
68
+ //# sourceMappingURL=generateSnippetMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateSnippetMap.js","sources":["../../../src/api-playground-2/generators/generateSnippetMap.ts"],"sourcesContent":["import {\n ApiPlaygroundDisplayType,\n requestExampleLanguages as defaultRequestExampleLanguages,\n} from '@mintlify/models';\nimport { ApiPlaygroundInputs, CodeSample } from '@mintlify/validation';\n\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\nimport { shikiLangToDisplayLang, toShikiLang } from '@/constants/snippetPresets';\nimport { ExampleCodeSnippet } from '@/types/exampleCodeSnippet';\n\nimport { generateInteractiveCodeSample } from './generateInteractiveCodeSample';\n\n// more or less identical but in all places where we use Endpoint, we use ApiReferenceDataV2 instead\nexport const generateSnippetMap = async ({\n codeSamples,\n apiReferenceData,\n baseUrl,\n inputs,\n apiPlaygroundMode,\n requestExampleLanguages,\n requiredOnly,\n}: {\n codeSamples: CodeSample[];\n apiReferenceData: ApiReferenceDataV2;\n baseUrl?: string;\n inputs: ApiPlaygroundInputs;\n apiPlaygroundMode: ApiPlaygroundDisplayType;\n requestExampleLanguages?: string[];\n requiredOnly?: boolean;\n}): Promise<Record<string, Record<string, ExampleCodeSnippet>>> => {\n const shouldHaveGeneratedExamples =\n (baseUrl && apiPlaygroundMode !== 'none') || (baseUrl && requestExampleLanguages);\n const langOrder = requestExampleLanguages ?? [];\n codeSamples = codeSamples.map((codeSample) => ({\n ...codeSample,\n lang: toShikiLang(codeSample.lang),\n }));\n if (requestExampleLanguages === undefined) {\n codeSamples.forEach((codeSample) => {\n if (langOrder.includes(codeSample.lang)) return;\n langOrder.push(codeSample.lang);\n });\n if (shouldHaveGeneratedExamples) {\n defaultRequestExampleLanguages.forEach((lang) => {\n if (langOrder.includes(lang)) return;\n langOrder.push(lang);\n });\n }\n }\n\n const map: Record<string, Record<string, ExampleCodeSnippet>> = {};\n\n for (const shikiLang of langOrder) {\n let displayLang = shikiLangToDisplayLang[shikiLang] ?? shikiLang;\n\n const codeSamplesInLang = codeSamples.filter((codeSample) => codeSample.lang === shikiLang);\n\n const labelToSnippetMap = map[displayLang] ?? {};\n if (codeSamplesInLang.length === 0) {\n const generatedCodeSample = await generateInteractiveCodeSample({\n baseUrl,\n apiReferenceData,\n inputs,\n apiPlaygroundMode,\n lang: shikiLang,\n requiredOnly,\n });\n if (generatedCodeSample) {\n addCodeSampleToLabelToSnippetMap(\n generatedCodeSample,\n shikiLang,\n displayLang,\n labelToSnippetMap,\n true\n );\n }\n } else {\n codeSamplesInLang.forEach((codeSample) => {\n displayLang = shikiLangToDisplayLang[shikiLang] ?? codeSample.label ?? shikiLang;\n addCodeSampleToLabelToSnippetMap(\n codeSample,\n shikiLang,\n displayLang,\n labelToSnippetMap,\n false\n );\n });\n }\n if (Object.keys(labelToSnippetMap).length > 0) {\n map[displayLang] = labelToSnippetMap;\n }\n }\n\n return map;\n};\n\nconst addCodeSampleToLabelToSnippetMap = (\n codeSample: CodeSample,\n shikiLang: string,\n displayLang: string,\n labelToSnippetMap: Record<string, ExampleCodeSnippet>,\n isGenerated: boolean\n) => {\n // if we have entered an empty label, retroactively update it to 'Example 1'\n if ('' in labelToSnippetMap) {\n labelToSnippetMap['Example 1'] = labelToSnippetMap[''];\n delete labelToSnippetMap[''];\n }\n\n const numExistingLabels = Object.keys(labelToSnippetMap).length;\n const label =\n codeSample.label ?? (numExistingLabels > 0 ? `Example ${numExistingLabels + 1}` : '');\n\n labelToSnippetMap[label] = {\n filename: isGenerated ? displayLang : label || displayLang, // (used in CodeSnippets)\n language: shikiLang,\n code: codeSample.source,\n };\n};\n"],"names":["generateSnippetMap","codeSamples","apiReferenceData","baseUrl","inputs","apiPlaygroundMode","requestExampleLanguages","requiredOnly","shouldHaveGeneratedExamples","langOrder","codeSample","toShikiLang","defaultRequestExampleLanguages","lang","map","shikiLang","displayLang","shikiLangToDisplayLang","codeSamplesInLang","labelToSnippetMap","generatedCodeSample","generateInteractiveCodeSample","addCodeSampleToLabelToSnippetMap","isGenerated","numExistingLabels","label"],"mappings":";;;AAaO,MAAMA,IAAqB,OAAO;AAAA,EACvC,aAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,mBAAAC;AAAA,EAAA,yBACAC;AAAAA,EACA,cAAAC;AACF,MAQmE;AACjE,QAAMC,IACHL,KAAWE,MAAsB,UAAYF,KAAWG,GACrDG,IAAYH,KAA2B,CAAA;AAC7C,EAAAL,IAAcA,EAAY,IAAI,CAACS,OAAgB;AAAA,IAC7C,GAAGA;AAAA,IACH,MAAMC,EAAYD,EAAW,IAAI;AAAA,EAAA,EAC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,CAAiB,EAAE,QACnDM,IACJf,EAAW,UAAUc,IAAoB,IAAI,WAAWA,IAAoB,CAAC,KAAK;AAEpF,EAAAL,EAAkBM,CAAK,IAAI;AAAA,IACzB,UAAUF,IAAcP,IAAcS,KAAST;AAAA;AAAA,IAC/C,UAAUD;AAAA,IACV,MAAML,EAAW;AAAA,EAAA;AAErB;"}
@@ -0,0 +1,24 @@
1
+ import { isSchemaObject as d } from "../schemaGraph/utils.js";
2
+ const f = (i, o = "", t = []) => {
3
+ if ("format" in i && (i.format === "binary" || i.format === "base64") && o && !t.includes(o) && t.push(o), "items" in i && i.items) {
4
+ const r = o ? `${o}.items` : "items";
5
+ d(i.items) && f(i.items, r, t);
6
+ }
7
+ if ("properties" in i && i.properties && Object.entries(i.properties).forEach(([r, n]) => {
8
+ const e = o ? `${o}.${r}` : r;
9
+ f(n, e, t);
10
+ }), "additionalProperties" in i && d(i.additionalProperties)) {
11
+ const r = o ? `${o}.additionalProperties` : "additionalProperties";
12
+ f(i.additionalProperties, r, t);
13
+ }
14
+ return "oneOf" in i && Array.isArray(i.oneOf) && i.oneOf.forEach((r, n) => {
15
+ if (d(r)) {
16
+ const e = o ? `${o}.${n}` : `${n}`;
17
+ f(r, e, t);
18
+ }
19
+ }), t;
20
+ };
21
+ export {
22
+ f as getFileProperties
23
+ };
24
+ //# sourceMappingURL=getFileProperties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFileProperties.js","sources":["../../../src/api-playground-2/generators/getFileProperties.ts"],"sourcesContent":["import { SchemaObject } from '@mintlify/validation';\n\nimport { isSchemaObject } from '@/api-playground-2/schemaGraph/utils';\n\nexport const getFileProperties = (\n schema: SchemaObject,\n path: string = '',\n result: string[] = []\n): string[] => {\n if ('format' in schema && (schema.format === 'binary' || schema.format === 'base64')) {\n if (path && !result.includes(path)) {\n result.push(path);\n }\n }\n\n if ('items' in schema && schema.items) {\n const itemPath = path ? `${path}.items` : 'items';\n if (isSchemaObject(schema.items)) {\n getFileProperties(schema.items, itemPath, result);\n }\n }\n\n if ('properties' in schema && schema.properties) {\n Object.entries(schema.properties).forEach(([propName, propSchema]) => {\n const propPath = path ? `${path}.${propName}` : propName;\n getFileProperties(propSchema, propPath, result);\n });\n }\n\n if ('additionalProperties' in schema && isSchemaObject(schema.additionalProperties)) {\n const additionalPropsPath = path ? `${path}.additionalProperties` : 'additionalProperties';\n getFileProperties(schema.additionalProperties, additionalPropsPath, result);\n }\n\n if ('oneOf' in schema && Array.isArray(schema.oneOf)) {\n schema.oneOf.forEach((subSchema, index) => {\n if (isSchemaObject(subSchema)) {\n const oneOfPath = path ? `${path}.${index}` : `${index}`;\n getFileProperties(subSchema, oneOfPath, result);\n }\n });\n }\n\n return result;\n};\n"],"names":["getFileProperties","schema","path","result","itemPath","isSchemaObject","propName","propSchema","propPath","additionalPropsPath","subSchema","index","oneOfPath"],"mappings":";AAIO,MAAMA,IAAoB,CAC/BC,GACAC,IAAe,IACfC,IAAmB,CAAA,MACN;AAOb,MANI,YAAYF,MAAWA,EAAO,WAAW,YAAYA,EAAO,WAAW,aACrEC,KAAQ,CAACC,EAAO,SAASD,CAAI,KAC/BC,EAAO,KAAKD,CAAI,GAIhB,WAAWD,KAAUA,EAAO,OAAO;AACrC,UAAMG,IAAWF,IAAO,GAAGA,CAAI,WAAW;AAC1C,IAAIG,EAAeJ,EAAO,KAAK,KAC7BD,EAAkBC,EAAO,OAAOG,GAAUD,CAAM;AAAA,EAEpD;AASA,MAPI,gBAAgBF,KAAUA,EAAO,cACnC,OAAO,QAAQA,EAAO,UAAU,EAAE,QAAQ,CAAC,CAACK,GAAUC,CAAU,MAAM;AACpE,UAAMC,IAAWN,IAAO,GAAGA,CAAI,IAAII,CAAQ,KAAKA;AAChD,IAAAN,EAAkBO,GAAYC,GAAUL,CAAM;AAAA,EAChD,CAAC,GAGC,0BAA0BF,KAAUI,EAAeJ,EAAO,oBAAoB,GAAG;AACnF,UAAMQ,IAAsBP,IAAO,GAAGA,CAAI,0BAA0B;AACpE,IAAAF,EAAkBC,EAAO,sBAAsBQ,GAAqBN,CAAM;AAAA,EAC5E;AAEA,SAAI,WAAWF,KAAU,MAAM,QAAQA,EAAO,KAAK,KACjDA,EAAO,MAAM,QAAQ,CAACS,GAAWC,MAAU;AACzC,QAAIN,EAAeK,CAAS,GAAG;AAC7B,YAAME,IAAYV,IAAO,GAAGA,CAAI,IAAIS,CAAK,KAAK,GAAGA,CAAK;AACtD,MAAAX,EAAkBU,GAAWE,GAAWT,CAAM;AAAA,IAChD;AAAA,EACF,CAAC,GAGIA;AACT;"}
@@ -0,0 +1,22 @@
1
+ import { create as s } from "zustand";
2
+ import { unflattenInputs as r } from "../schemaGraph/utils.js";
3
+ const a = s((n, u) => ({
4
+ inputs: {},
5
+ initialize: (t) => n({
6
+ inputs: { ...t }
7
+ }),
8
+ setInput: (t, p) => n((i) => ({
9
+ inputs: { ...i.inputs, [t]: p }
10
+ })),
11
+ setInputs: (t) => n((p) => ({
12
+ inputs: { ...p.inputs, ...t }
13
+ })),
14
+ getInput: (t) => u().inputs[t],
15
+ getApiPlaygroundInputs: () => r(u().inputs),
16
+ clear: () => n({ inputs: {} }),
17
+ reset: () => n({ inputs: {} })
18
+ }));
19
+ export {
20
+ a as usePlaygroundInputsStore
21
+ };
22
+ //# sourceMappingURL=usePlaygroundInputsStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePlaygroundInputsStore.js","sources":["../../../src/api-playground-2/hooks/usePlaygroundInputsStore.ts"],"sourcesContent":["import { ApiPlaygroundInputs } from '@mintlify/validation';\nimport { create } from 'zustand';\n\nimport { unflattenInputs } from '../schemaGraph/utils';\n\nexport type PlaygroundInputValue = unknown;\n\ninterface PlaygroundInputsState {\n inputs: Record<string, PlaygroundInputValue>;\n initialize: (initialValues: Record<string, PlaygroundInputValue>) => void;\n setInput: (name: string, value: PlaygroundInputValue) => void;\n setInputs: (inputs: Record<string, PlaygroundInputValue>) => void;\n getInput: (name: string) => PlaygroundInputValue;\n getApiPlaygroundInputs: () => ApiPlaygroundInputs;\n clear: () => void;\n reset: () => void;\n}\n\nexport const usePlaygroundInputsStore = create<PlaygroundInputsState>((set, get) => ({\n inputs: {},\n initialize: (initialValues) =>\n set({\n inputs: { ...initialValues },\n }),\n setInput: (name, value) =>\n set((state) => ({\n inputs: { ...state.inputs, [name]: value },\n })),\n setInputs: (inputs) =>\n set((state) => ({\n inputs: { ...state.inputs, ...inputs },\n })),\n getInput: (name) => get().inputs[name],\n getApiPlaygroundInputs: () => unflattenInputs(get().inputs),\n clear: () => set({ inputs: {} }),\n reset: () => set({ inputs: {} }),\n}));\n"],"names":["usePlaygroundInputsStore","create","set","get","initialValues","name","value","state","inputs","unflattenInputs"],"mappings":";;AAkBO,MAAMA,IAA2BC,EAA8B,CAACC,GAAKC,OAAS;AAAA,EACnF,QAAQ,CAAA;AAAA,EACR,YAAY,CAACC,MACXF,EAAI;AAAA,IACF,QAAQ,EAAE,GAAGE,EAAA;AAAA,EAAc,CAC5B;AAAA,EACH,UAAU,CAACC,GAAMC,MACfJ,EAAI,CAACK,OAAW;AAAA,IACd,QAAQ,EAAE,GAAGA,EAAM,QAAQ,CAACF,CAAI,GAAGC,EAAA;AAAA,EAAM,EACzC;AAAA,EACJ,WAAW,CAACE,MACVN,EAAI,CAACK,OAAW;AAAA,IACd,QAAQ,EAAE,GAAGA,EAAM,QAAQ,GAAGC,EAAA;AAAA,EAAO,EACrC;AAAA,EACJ,UAAU,CAACH,MAASF,EAAA,EAAM,OAAOE,CAAI;AAAA,EACrC,wBAAwB,MAAMI,EAAgBN,EAAA,EAAM,MAAM;AAAA,EAC1D,OAAO,MAAMD,EAAI,EAAE,QAAQ,CAAA,GAAI;AAAA,EAC/B,OAAO,MAAMA,EAAI,EAAE,QAAQ,CAAA,GAAI;AACjC,EAAE;"}
@@ -0,0 +1,10 @@
1
+ import { isSchemaObject as f } from "./utils.js";
2
+ const o = (i, r = /* @__PURE__ */ new Set()) => ("required" in i && Array.isArray(i.required) && i.required.forEach((t) => r.add(t)), "items" in i && i.items && f(i.items) && o(i.items, r), "properties" in i && i.properties && Object.values(i.properties).forEach((t) => {
3
+ o(t, r);
4
+ }), "additionalProperties" in i && f(i.additionalProperties) && o(i.additionalProperties, r), "oneOf" in i && Array.isArray(i.oneOf) && i.oneOf.forEach((t) => {
5
+ f(t) && o(t, r);
6
+ }), [...r]);
7
+ export {
8
+ o as getAllRequiredProperties
9
+ };
10
+ //# sourceMappingURL=getAllRequiredProperties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAllRequiredProperties.js","sources":["../../../src/api-playground-2/schemaGraph/getAllRequiredProperties.ts"],"sourcesContent":["import { SchemaObject } from '@mintlify/validation';\n\nimport { isSchemaObject } from './utils';\n\nexport const getAllRequiredProperties = (\n schema: SchemaObject,\n collected: Set<string> = new Set()\n): string[] => {\n if ('required' in schema && Array.isArray(schema.required)) {\n schema.required.forEach((prop) => collected.add(prop));\n }\n\n if ('items' in schema && schema.items) {\n if (isSchemaObject(schema.items)) {\n getAllRequiredProperties(schema.items, collected);\n }\n }\n\n if ('properties' in schema && schema.properties) {\n Object.values(schema.properties).forEach((propSchema) => {\n getAllRequiredProperties(propSchema, collected);\n });\n }\n\n if ('additionalProperties' in schema && isSchemaObject(schema.additionalProperties)) {\n getAllRequiredProperties(schema.additionalProperties, collected);\n }\n\n if ('oneOf' in schema && Array.isArray(schema.oneOf)) {\n schema.oneOf.forEach((subSchema) => {\n if (isSchemaObject(subSchema)) {\n getAllRequiredProperties(subSchema, collected);\n }\n });\n }\n\n return [...collected];\n};\n"],"names":["getAllRequiredProperties","schema","collected","prop","isSchemaObject","propSchema","subSchema"],"mappings":";AAIO,MAAMA,IAA2B,CACtCC,GACAC,IAAyB,oBAAI,WAEzB,cAAcD,KAAU,MAAM,QAAQA,EAAO,QAAQ,KACvDA,EAAO,SAAS,QAAQ,CAACE,MAASD,EAAU,IAAIC,CAAI,CAAC,GAGnD,WAAWF,KAAUA,EAAO,SAC1BG,EAAeH,EAAO,KAAK,KAC7BD,EAAyBC,EAAO,OAAOC,CAAS,GAIhD,gBAAgBD,KAAUA,EAAO,cACnC,OAAO,OAAOA,EAAO,UAAU,EAAE,QAAQ,CAACI,MAAe;AACvD,EAAAL,EAAyBK,GAAYH,CAAS;AAChD,CAAC,GAGC,0BAA0BD,KAAUG,EAAeH,EAAO,oBAAoB,KAChFD,EAAyBC,EAAO,sBAAsBC,CAAS,GAG7D,WAAWD,KAAU,MAAM,QAAQA,EAAO,KAAK,KACjDA,EAAO,MAAM,QAAQ,CAACK,MAAc;AAClC,EAAIF,EAAeE,CAAS,KAC1BN,EAAyBM,GAAWJ,CAAS;AAEjD,CAAC,GAGI,CAAC,GAAGA,CAAS;"}
@@ -0,0 +1,13 @@
1
+ import "html-react-parser";
2
+ const i = (t) => {
3
+ const a = Object.keys(t)[0];
4
+ if (a) {
5
+ const e = t[a], s = Object.values((e == null ? void 0 : e.examples) ?? {})[0];
6
+ if (s && "value" in s)
7
+ return s.value;
8
+ }
9
+ };
10
+ export {
11
+ i as getFirstExampleValue
12
+ };
13
+ //# sourceMappingURL=processExamples.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processExamples.js","sources":["../../../src/api-playground-2/schemaGraph/processExamples.ts"],"sourcesContent":["import { MdxCodeExampleData } from '@mintlify/common';\nimport { ExampleObject, ExampleOrRefObject, MediaObject, SchemaObject } from '@mintlify/validation';\nimport parse from 'html-react-parser';\n\nimport type {\n ApiReferenceDataV2,\n CodeExample,\n SchemaGeneratedExample,\n} from '@/api-playground-2/types';\n\nimport { isSchemaObject } from './utils';\n\n// duplicated from shiki/index.ts\nexport function getLanguageFromClassName(className: string | undefined, fallback?: string): string {\n const match = /language-(\\w+)/.exec(className ?? '');\n return match ? match[1] ?? 'text' : fallback ?? 'text';\n}\n\nexport const mdxCodeExampleToExamples = (mdxCodeExampleData: MdxCodeExampleData): CodeExample[] => {\n const examples: CodeExample[] = [];\n const dropdown = mdxCodeExampleData.attributes?.some(\n (attr) => attr.name === 'dropdown' && attr.value !== 'false'\n );\n mdxCodeExampleData.children?.map((child) => {\n const jsx = parse(child.html ?? '');\n const lang =\n typeof jsx === 'object' && !Array.isArray(jsx) && jsx.type === 'pre'\n ? jsx.props.language ?? getLanguageFromClassName(jsx.props.className, child.filename)\n : undefined;\n examples.push({\n dropdown,\n language: lang,\n code: jsx,\n filename: child.filename,\n });\n });\n return examples;\n};\n\n// same logic as in OpenApiToEndpointConverter convertExamples\nexport const generateExamplesFromSchema = (\n content: Record<string, MediaObject>\n): Record<string, MediaObject> => {\n Object.entries(content).forEach(([contentType, mediaObject]) => {\n const examples: Record<string, SchemaGeneratedExample> = {};\n if (mediaObject.examples) {\n Object.entries(mediaObject.examples).forEach(\n ([exampleName, example]: [string, ExampleOrRefObject]) => {\n if (!('$ref' in example)) {\n examples[exampleName] = {\n title: exampleName,\n description: example.description,\n value: example.value,\n };\n }\n }\n );\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (mediaObject.example) {\n examples['Example'] = {\n title: 'Example',\n value: mediaObject.example,\n };\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n } else if (isSchemaObject(mediaObject.schema)) {\n examples['Example'] = generateExampleFromSchema(mediaObject.schema);\n if (content[contentType]) {\n content[contentType].examples = examples;\n }\n }\n });\n return content;\n};\n\nexport const generateExampleFromSchema = (schema: SchemaObject): SchemaGeneratedExample => {\n const example: SchemaGeneratedExample = {\n title: 'Example',\n value: undefined,\n };\n if (schema.example !== undefined) {\n example.value = schema.example;\n return example;\n }\n if (schema.default !== undefined) {\n example.value = schema.default;\n return example;\n }\n\n if (schema.enum) {\n example.value = schema.enum[0];\n return example;\n }\n\n // Handle oneOf - generate example from first option\n if (schema.oneOf && Array.isArray(schema.oneOf) && schema.oneOf.length > 0) {\n const firstOption = schema.oneOf[0];\n if (isSchemaObject(firstOption)) {\n return generateExampleFromSchema(firstOption);\n }\n }\n\n switch (schema.type) {\n case 'string':\n example.value = generateStringExample(schema);\n return example;\n case 'boolean':\n example.value = true;\n return example;\n case 'number':\n case 'integer':\n example.value = generateNumericExample(schema);\n return example;\n case 'object':\n example.value = Object.fromEntries(\n Object.entries(schema.properties ?? {}).map(([propName, subschema]) => [\n propName,\n \n generateExampleFromSchema(subschema as SchemaObject).value,\n ])\n );\n return example;\n case 'array':\n \n example.value = [generateExampleFromSchema(schema.items as SchemaObject).value];\n return example;\n default:\n example.value = '<unknown>';\n return example;\n }\n};\n\nconst generateNumericExample = (schema: SchemaObject): number => {\n // if schema type is integer, make sure example is integer\n const format: (n: number) => number = schema.type === 'integer' ? Math.floor : (n) => n;\n\n if (schema.minimum !== undefined && schema.maximum !== undefined) {\n return format((schema.minimum + schema.maximum) / 2);\n } else if (schema.minimum !== undefined) {\n return format(schema.minimum + 1);\n } else if (schema.maximum !== undefined) {\n return 123 < schema.maximum ? 123 : format(schema.maximum - 1);\n } else {\n return 123;\n }\n};\n\nconst generateStringExample = (schema: SchemaObject): string => {\n switch (schema.format?.toLowerCase()) {\n case 'byte':\n case 'base64':\n return 'aSDinaTvuI8gbWludGxpZnk=';\n case 'date':\n return '2023-12-25';\n case 'date-time':\n return '2023-11-07T05:31:56Z';\n case 'email':\n return 'jsmith@example.com';\n case 'uuid':\n return '3c90c3cc-0d44-4b50-8888-8dd25736052a';\n case 'ipv4':\n return '127.0.0.1';\n case 'ipv6':\n return '2606:4700:3108::ac42:2835';\n default:\n return '<string>';\n }\n};\n\nexport const getFirstExampleValue = (\n content: Record<string, MediaObject>\n): ExampleObject | undefined => {\n const firstContentType = Object.keys(content)[0];\n if (firstContentType) {\n const contentTypeObject = content[firstContentType];\n const examples = Object.values(contentTypeObject?.examples ?? {});\n const firstExample = examples[0];\n if (firstExample && 'value' in firstExample) {\n return firstExample.value;\n }\n }\n return undefined;\n};\n\nexport const getFirstWebhookExample = (apiReferenceData: ApiReferenceDataV2): CodeExample[] => {\n const requestExamples: CodeExample[] = [];\n if (apiReferenceData.dependencies?.requestBody?.content) {\n const firstExample = getFirstExampleValue(apiReferenceData.dependencies.requestBody.content);\n if (firstExample) {\n requestExamples.push({\n language: 'json',\n filename: 'Example Request Body',\n code: JSON.stringify(firstExample.value, null, 2),\n });\n }\n }\n return requestExamples;\n};\n"],"names":["getFirstExampleValue","content","firstContentType","contentTypeObject","firstExample"],"mappings":";AA4KO,MAAMA,IAAuB,CAClCC,MAC8B;AAC9B,QAAMC,IAAmB,OAAO,KAAKD,CAAO,EAAE,CAAC;AAC/C,MAAIC,GAAkB;AACpB,UAAMC,IAAoBF,EAAQC,CAAgB,GAE5CE,IADW,OAAO,QAAOD,KAAA,gBAAAA,EAAmB,aAAY,CAAA,CAAE,EAClC,CAAC;AAC/B,QAAIC,KAAgB,WAAWA;AAC7B,aAAOA,EAAa;AAAA,EAExB;AAEF;"}
@@ -0,0 +1,76 @@
1
+ import "@mintlify/validation";
2
+ import { apiPlaygroundInputKeys as y } from "../constants/index.js";
3
+ const p = (e) => typeof e == "object" && e !== null && !Array.isArray(e), h = (e) => p(e) ? "type" in e || "properties" in e || "oneOf" in e || "anyOf" in e || "allOf" in e || "items" in e || "additionalProperties" in e || "enum" in e || "const" in e || "format" in e || "pattern" in e || "minimum" in e || "maximum" in e || "minLength" in e || "maxLength" in e || "minItems" in e || "maxItems" in e || "minProperties" in e || "maxProperties" in e || "required" in e || "nullable" in e || "description" in e : !1, O = (e) => {
4
+ var o;
5
+ const t = {};
6
+ return Object.entries(((o = e.operation) == null ? void 0 : o.responses) ?? {}).forEach(([i, s]) => {
7
+ var n, c;
8
+ const r = (c = (n = e.dependencies) == null ? void 0 : n.responses) == null ? void 0 : c[s];
9
+ r && r.content && (t[i] = r.content);
10
+ }), t;
11
+ }, g = (e) => {
12
+ const t = {
13
+ server: {},
14
+ header: {},
15
+ path: {},
16
+ query: {},
17
+ cookie: {},
18
+ body: void 0
19
+ };
20
+ return Object.entries(e).forEach(([o, i]) => {
21
+ if (i == null)
22
+ return;
23
+ const s = o.split(new RegExp("(?<!\\\\)\\.")).map((m) => m.replace(/\\\./g, "."));
24
+ if (s.length < 2) {
25
+ o === "body" && (t.body = i);
26
+ return;
27
+ }
28
+ const [r, ...n] = s, c = Object.values(y);
29
+ !r || !c.includes(r) || (r !== y.body ? d(
30
+ t[r],
31
+ [...n],
32
+ i
33
+ ) : [...n].length === 0 ? t.body = i : ((t.body === void 0 || typeof t.body != "object") && (t.body = {}), d(t.body, n, i)));
34
+ }), f(t);
35
+ }, a = (e) => {
36
+ if (!p(e))
37
+ return !1;
38
+ const t = Object.keys(e);
39
+ return t.length === 0 ? !1 : t.every((o) => /^\d+$/.test(o));
40
+ }, f = (e) => {
41
+ if (e == null)
42
+ return e;
43
+ if (Array.isArray(e))
44
+ return e.map(f);
45
+ if (p(e)) {
46
+ if (a(e))
47
+ return Object.keys(e).sort((s, r) => Number(s) - Number(r)).map((s) => e[s]).map(f);
48
+ const t = {};
49
+ for (const [o, i] of Object.entries(e))
50
+ t[o] = f(i);
51
+ return t;
52
+ }
53
+ return e;
54
+ }, d = (e, t, o) => {
55
+ const i = [];
56
+ for (let r = 0; r < t.length; r++) {
57
+ const n = t[r];
58
+ if (n === "oneOf") {
59
+ r++;
60
+ continue;
61
+ }
62
+ n === "additionalProperties" || n === "items" || n && i.push(n);
63
+ }
64
+ let s = e;
65
+ for (let r = 0; r < i.length; r++) {
66
+ const n = i[r];
67
+ r === i.length - 1 ? n && (s[n] = o) : (n && (!s[n] || typeof s[n] != "object") && (s[n] = {}), n && (s = s[n]));
68
+ }
69
+ };
70
+ export {
71
+ p as isPlainRecord,
72
+ h as isSchemaObject,
73
+ O as mapResponseExamples,
74
+ g as unflattenInputs
75
+ };
76
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../src/api-playground-2/schemaGraph/utils.ts"],"sourcesContent":["import { openApiToSchemaGraph } from '@mintlify/validation';\nimport type {\n ApiPlaygroundInputs,\n ArraySchemaObject,\n MediaObject,\n ParameterObject,\n GraphNode,\n SchemaObject,\n DataSchema,\n} from '@mintlify/validation';\nimport type { OpenAPIV3_1 } from 'openapi-types';\n\nimport {\n CIRCULAR_REF_KEY,\n combinationKeys,\n initialApiPlaygroundInputs,\n MAX_SCHEMA_COMBINATION_SIZE,\n stringFileFormats,\n apiPlaygroundInputKeys,\n} from '@/api-playground-2/constants';\nimport type {\n ApiReferenceDataV2,\n CircularRefObject,\n DifferentiatedType,\n ResolvedSchemaObject,\n ReducedSchema,\n} from '@/api-playground-2/types';\n\nimport { PlaygroundInputValue } from '../hooks/usePlaygroundInputsStore';\nimport { cn } from '@/utils/cn';\n\nexport { cn };\n\nexport function isCircularRef(value: unknown): value is CircularRefObject {\n return (\n typeof value === 'object' &&\n value !== null &&\n CIRCULAR_REF_KEY in value &&\n typeof value[CIRCULAR_REF_KEY] === 'string'\n );\n}\n\nexport const isResolvedSchemaObject = (obj: unknown): obj is ResolvedSchemaObject => {\n return isSchemaObject(obj) && ('isCircular' in obj || 'isRequired' in obj);\n};\n\nexport const createEmptyReducedSchema = (): ReducedSchema => ({ oneOf: [] });\nexport const createUnknownReducedSchema = (): ReducedSchema => ({ oneOf: [{}] });\n\nexport const isPlainRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nexport const isReducedSchema = (schema: unknown): schema is ReducedSchema =>\n isSchemaObject(schema) && Array.isArray(schema.oneOf);\n\n/**\n * Given an OpenAPI 3.1 schema, this function will attempt to determine the schema type\n * based on the properties present in the schema. This is useful for assigning types to\n * schemas that are missing a type.\n *\n * For example, if a schema has no type but has `schema.properties`, we can infer the\n * intended type is `object`.\n *\n * Used in the Conversion step.\n *\n * @param schema\n * @returns if exactly one type can be inferred, the string corresponding to that type; otherwise `undefined`\n */\nexport const inferType = (\n schema: Omit<SchemaObject, 'type'>\n): OpenAPIV3_1.ArraySchemaObjectType | OpenAPIV3_1.NonArraySchemaObjectType | undefined => {\n let type: OpenAPIV3_1.ArraySchemaObjectType | OpenAPIV3_1.NonArraySchemaObjectType | undefined;\n if (\n schema.format !== undefined ||\n schema.pattern !== undefined ||\n schema.minLength !== undefined ||\n schema.maxLength !== undefined ||\n schema.enum?.every((option) => typeof option === 'string')\n ) {\n type = 'string';\n }\n if (\n schema.multipleOf !== undefined ||\n schema.minimum !== undefined ||\n schema.maximum !== undefined ||\n schema.exclusiveMinimum !== undefined ||\n schema.exclusiveMaximum !== undefined ||\n schema.enum?.every((option) => typeof option === 'number')\n ) {\n if (type !== undefined) {\n return undefined;\n }\n type = 'number';\n }\n if (\n ('items' in schema && schema.items !== undefined) ||\n schema.minItems !== undefined ||\n schema.maxItems !== undefined ||\n schema.uniqueItems !== undefined\n ) {\n if (type !== undefined) {\n return undefined;\n }\n type = 'array';\n }\n if (\n schema.additionalProperties !== undefined ||\n schema.properties !== undefined ||\n schema.minProperties !== undefined ||\n schema.maxProperties !== undefined\n ) {\n if (type !== undefined) {\n return undefined;\n }\n type = 'object';\n }\n\n return type;\n};\n\nexport const isSchemaObject = (obj: unknown): obj is SchemaObject => {\n if (!isPlainRecord(obj)) {\n return false;\n }\n\n return (\n 'type' in obj ||\n 'properties' in obj ||\n 'oneOf' in obj ||\n 'anyOf' in obj ||\n 'allOf' in obj ||\n 'items' in obj ||\n 'additionalProperties' in obj ||\n 'enum' in obj ||\n 'const' in obj ||\n 'format' in obj ||\n 'pattern' in obj ||\n 'minimum' in obj ||\n 'maximum' in obj ||\n 'minLength' in obj ||\n 'maxLength' in obj ||\n 'minItems' in obj ||\n 'maxItems' in obj ||\n 'minProperties' in obj ||\n 'maxProperties' in obj ||\n 'required' in obj ||\n 'nullable' in obj ||\n 'description' in obj\n );\n};\n\nexport const isArrayObject = (obj: unknown): obj is ArraySchemaObject => {\n return isSchemaObject(obj) && obj.type === 'array';\n};\n\nexport function hasCombinationKey(obj: Record<string, unknown>): boolean {\n return combinationKeys.some((key) => key in obj);\n}\n\nexport function shouldTruncateForSize(schema: OpenAPIV3_1.SchemaObject): boolean {\n const oneOfSize = Array.isArray(schema.oneOf) ? schema.oneOf.length : 1;\n const anyOfSize = Array.isArray(schema.anyOf) ? schema.anyOf.length : 1;\n const allOfSize = Array.isArray(schema.allOf) ? schema.allOf.length : 1;\n\n const combinations: number[] = [oneOfSize, anyOfSize, allOfSize];\n\n // go three levels deep to estimate if combinations may explode\n combinationKeys.forEach((key) => {\n if (schema[key as keyof OpenAPIV3_1.SchemaObject]) {\n const subSchema = schema[key as keyof OpenAPIV3_1.SchemaObject];\n combinations.push(Object.keys(subSchema).length);\n combinationKeys.forEach((subSchemaKey) => {\n if (subSchema[subSchemaKey as keyof OpenAPIV3_1.SchemaObject]) {\n const subSubSchema = subSchema[subSchemaKey as keyof OpenAPIV3_1.SchemaObject];\n combinations.push(Object.keys(subSubSchema).length);\n combinationKeys.forEach((subSubSchemaKey) => {\n if (subSubSchema[subSubSchemaKey as keyof OpenAPIV3_1.SchemaObject]) {\n const subSubSubSchema =\n subSubSchema[subSubSchemaKey as keyof OpenAPIV3_1.SchemaObject];\n combinations.push(Object.keys(subSubSubSchema).length);\n }\n });\n }\n });\n }\n });\n\n const totalCombinations = combinations.reduce((acc, curr) => acc * curr, 1);\n\n return totalCombinations > MAX_SCHEMA_COMBINATION_SIZE;\n}\n\n// similar to RecursiveParamField/renderTruncatedNextProperties\nexport function createTruncatedNextProperties(\n schema: OpenAPIV3_1.SchemaObject\n): OpenAPIV3_1.SchemaObject {\n const truncatedSchema = { ...schema };\n\n // Remove all composition properties to prevent further recursion\n delete truncatedSchema.oneOf;\n delete truncatedSchema.anyOf;\n delete truncatedSchema.allOf;\n\n if (truncatedSchema.type === 'array') {\n truncatedSchema.items = {};\n } else if (truncatedSchema.type === 'object') {\n truncatedSchema.properties = {};\n if (\n truncatedSchema.additionalProperties &&\n typeof truncatedSchema.additionalProperties === 'object'\n ) {\n truncatedSchema.additionalProperties = {};\n }\n }\n\n return truncatedSchema;\n}\n\nexport function createTruncatedReducedSchema(schema: OpenAPIV3_1.SchemaObject): ReducedSchema {\n const truncatedSchema = createTruncatedNextProperties(schema);\n // For reduction, we need to wrap in oneOf\n return { oneOf: [truncatedSchema] };\n}\n\nexport function collectCombinationSizes(\n value: unknown,\n remainingDepth: number,\n combinations: number[]\n): void {\n if (remainingDepth === 0 || value === undefined || value === null) {\n return;\n }\n\n if (Array.isArray(value)) {\n combinations.push(value.length);\n if (remainingDepth > 1) {\n value.forEach((item) => collectCombinationSizes(item, remainingDepth - 1, combinations));\n }\n return;\n }\n\n if (isPlainRecord(value)) {\n combinations.push(Object.keys(value).length);\n if (remainingDepth > 1) {\n Object.values(value).forEach((item) =>\n collectCombinationSizes(item, remainingDepth - 1, combinations)\n );\n }\n }\n}\n\nexport const addKeyIfDefined = <D, K extends keyof D>(\n key: K,\n value: D[K] | undefined,\n destination: D\n) => {\n if (value !== undefined) {\n destination[key] = value;\n }\n};\n\nexport const copyKeyIfDefined = <D, K extends keyof D>(\n key: K,\n source: Pick<D, K>,\n destination: D\n) => {\n if (source[key] !== undefined) {\n destination[key] = source[key];\n }\n};\n\nexport const takeLast = <T extends keyof OpenAPIV3_1.SchemaObject>(\n schema1: OpenAPIV3_1.SchemaObject,\n schema2: OpenAPIV3_1.SchemaObject,\n key: T\n): OpenAPIV3_1.SchemaObject[T] => {\n return schema2[key] ?? schema1[key];\n};\n\nexport const combine = <T extends keyof OpenAPIV3_1.SchemaObject>(\n schema1: OpenAPIV3_1.SchemaObject,\n schema2: OpenAPIV3_1.SchemaObject,\n key: T,\n transform: (\n a: NonNullable<OpenAPIV3_1.SchemaObject[T]>,\n b: NonNullable<OpenAPIV3_1.SchemaObject[T]>\n ) => OpenAPIV3_1.SchemaObject[T]\n): OpenAPIV3_1.SchemaObject[T] => {\n return schema1[key] !== undefined && schema2[key] !== undefined\n ? transform(schema1[key], schema2[key])\n : schema1[key] ?? schema2[key];\n};\n\nexport const copyExampleIfDefined = (\n source: Pick<OpenAPIV3_1.SchemaObject, 'example' | 'examples'>,\n destination: Pick<DataSchema, 'example'>\n) => {\n const example = source.example !== undefined ? source.example : source.examples?.[0];\n if (example !== undefined) {\n destination.example = example;\n }\n};\n\n// Testing utility for quick and dirty schema graph conversion\nexport const convertSchemaToGraph = (\n schema: OpenAPIV3_1.SchemaObject,\n skipClone: boolean = false\n) => {\n let spec: OpenAPIV3_1.Document;\n if ('openapi' in schema) {\n spec = schema as OpenAPIV3_1.Document;\n } else {\n spec = {\n openapi: '3.1.0',\n info: { title: 'Test', version: '1.0.0' },\n paths: {},\n components: {\n schemas: {\n TestSchema: schema,\n },\n },\n };\n }\n if (!skipClone) {\n const clonedSpec = JSON.parse(JSON.stringify(spec));\n return openApiToSchemaGraph({\n spec: clonedSpec,\n filename: 'test.json',\n originalFileLocation: 'test.json',\n });\n }\n return openApiToSchemaGraph({\n spec,\n filename: 'test.json',\n originalFileLocation: 'test.json',\n });\n};\n\nexport const flattenSingleOneOf = <T extends GraphNode & { oneOf?: SchemaObject[] }>(\n node: T\n): T => {\n if (node.oneOf && node.oneOf.length === 1) {\n return node.oneOf[0] as T;\n }\n return node;\n};\n\nexport const flattenSchemaOneOfs = (schema: SchemaObject): SchemaObject => {\n let result = { ...schema } as SchemaObject;\n\n // recursively flatten into each combinator\n if (result.properties && typeof result.properties === 'object') {\n const flattened: Record<string, SchemaObject> = {};\n for (const [key, value] of Object.entries(result.properties)) {\n if (isSchemaObject(value)) {\n flattened[key] = flattenSchemaOneOfs(value);\n } else {\n flattened[key] = value as SchemaObject;\n }\n }\n result.properties = flattened;\n }\n\n if ('items' in result && result.items && typeof result.items === 'object') {\n if (isSchemaObject(result.items)) {\n result.items = flattenSchemaOneOfs(result.items);\n }\n }\n\n if (\n result.additionalProperties &&\n typeof result.additionalProperties === 'object' &&\n isSchemaObject(result.additionalProperties)\n ) {\n result.additionalProperties = flattenSchemaOneOfs(result.additionalProperties);\n }\n if (result.oneOf && Array.isArray(result.oneOf) && result.oneOf.length > 1) {\n const oneOfArray = result.oneOf;\n const mappedOneOf = (oneOfArray as unknown[]).map((item: unknown) => {\n if (isSchemaObject(item)) {\n return flattenSchemaOneOfs(item);\n }\n return item as SchemaObject;\n });\n result.oneOf = mappedOneOf as SchemaObject[];\n }\n\n if (\n 'oneOf' in result &&\n result.oneOf &&\n Array.isArray(result.oneOf) &&\n result.oneOf.length === 1\n ) {\n const singleItem = result.oneOf[0];\n if (isSchemaObject(singleItem)) {\n result = { ...result, ...singleItem } as SchemaObject;\n delete (result as { oneOf?: unknown[] }).oneOf;\n return flattenSchemaOneOfs(result);\n }\n }\n\n return result;\n};\n\nexport const calculateMaxDepth = (obj: unknown, currentDepth = 0): number => {\n if (obj === null || typeof obj !== 'object') {\n return currentDepth;\n }\n\n if (Array.isArray(obj)) {\n if (obj.length === 0) return currentDepth;\n return Math.max(...obj.map((item) => calculateMaxDepth(item, currentDepth)));\n }\n\n const depths = Object.entries(obj).map(([key, value]) => {\n if (key === 'type' || key === 'title') {\n return currentDepth;\n }\n return calculateMaxDepth(value, currentDepth + 1);\n });\n\n return depths.length > 0 ? Math.max(...depths) : currentDepth;\n};\n\n// converts standard schema types to differentiated types that were used in v1 and oneOf type\nexport const getDifferentiatedType = (schema: ResolvedSchemaObject): DifferentiatedType => {\n if (schema.oneOf) {\n return 'oneOf';\n }\n if (schema.enum) {\n switch (schema.type) {\n case 'string':\n return 'enum<string>';\n case 'number':\n return 'enum<number>';\n case 'integer':\n return 'enum<integer>';\n default:\n return schema.type;\n }\n }\n if (schema.format && stringFileFormats.includes(schema.format)) {\n return 'file';\n }\n return schema.type;\n};\n\nexport const isEnum = (schema: SchemaObject): boolean => {\n return 'enum' in schema && schema.enum !== undefined;\n};\n\nexport const getSchemaPlaceholder = (schema: SchemaObject): string | undefined => {\n return 'placeholder' in schema && typeof schema.placeholder === 'string'\n ? schema.placeholder\n : undefined;\n};\n\nexport const isStringSchema = (schema: SchemaObject): boolean => {\n return schema.type === 'string';\n};\n\nexport const isNumberSchema = (schema: SchemaObject): boolean => {\n return schema.type === 'number' || schema.type === 'integer';\n};\n\nexport const mapResponseExamples = (apiReferenceData: ApiReferenceDataV2) => {\n const responseCodeMediaObjectMap: Record<string, MediaObject> = {};\n Object.entries(apiReferenceData.operation?.responses ?? {}).forEach(([responseCode, UUID]) => {\n const response = apiReferenceData.dependencies?.responses?.[UUID];\n if (response && response.content) {\n responseCodeMediaObjectMap[responseCode] = response.content;\n }\n });\n return responseCodeMediaObjectMap;\n};\n\nexport const generatePrefillRequestData = (\n apiReferenceData: ApiReferenceDataV2\n): ApiPlaygroundInputs[] => {\n const requestBodyContent = apiReferenceData.dependencies?.requestBody?.content;\n if (requestBodyContent === undefined) {\n return [initialApiPlaygroundInputs];\n }\n const requestBodyContentTypes = Object.keys(requestBodyContent);\n const contentType = requestBodyContentTypes[0];\n if (!contentType) {\n return [initialApiPlaygroundInputs];\n }\n const requestBodyContentExamples = Object.values(requestBodyContent[contentType]?.examples ?? {});\n const examples: ApiPlaygroundInputs[] = [];\n for (const example of requestBodyContentExamples) {\n if ('value' in example) {\n examples.push({\n ...initialApiPlaygroundInputs,\n body: example.value,\n });\n }\n }\n\n return examples;\n};\n\nexport const getParametersPerSection = (\n apiReferenceData: ApiReferenceDataV2\n): {\n header: ParameterObject[];\n path: ParameterObject[];\n query: ParameterObject[];\n cookie: ParameterObject[];\n} => {\n const parameters = apiReferenceData.dependencies?.parameters;\n if (parameters) {\n const parameterObjects = Object.values(parameters);\n const headerParameters = parameterObjects.filter(\n (parameter) => !('in' in parameter) || parameter.in === 'header'\n );\n const cookieParameters = parameterObjects.filter((parameter) => parameter.in === 'cookie');\n const pathParameters = parameterObjects.filter((parameter) => parameter.in === 'path');\n const queryParameters = parameterObjects.filter((parameter) => parameter.in === 'query');\n return {\n header: headerParameters,\n path: pathParameters,\n query: queryParameters,\n cookie: cookieParameters,\n };\n }\n return { header: [], path: [], query: [], cookie: [] };\n};\n\nexport const getSchemaDefault = (schema: object | undefined): unknown | undefined => {\n let defaultValue = undefined;\n if (!schema) {\n return undefined;\n }\n if (typeof schema === 'object' && 'default' in schema) {\n defaultValue = schema.default;\n }\n if (typeof schema === 'object' && 'x-default' in schema) {\n defaultValue = schema['x-default'];\n }\n return defaultValue;\n};\n\nexport const getUniqueInputKey = (\n inputKeyPrefix: string,\n schema: ResolvedSchemaObject,\n arrayIndex?: number,\n key?: string\n) => {\n if (!schema.uniqueKey) {\n return inputKeyPrefix;\n } else {\n const arrayIndexOrKey = arrayIndex || key;\n return `${inputKeyPrefix ? inputKeyPrefix + '.' : ''}${schema.uniqueKey}${arrayIndexOrKey ? '.' + arrayIndexOrKey : ''}`;\n }\n};\n\nexport const convertAnySchemaToOneOfs = (): SchemaObject => {\n return {\n oneOf: [\n {\n type: 'string',\n },\n {\n type: 'number',\n },\n {\n type: 'boolean',\n },\n {\n type: 'object',\n properties: {},\n },\n {\n type: 'array',\n items: {\n oneOf: [\n { type: 'string' },\n { type: 'number' },\n { type: 'boolean' },\n { type: 'object', properties: {} },\n { type: 'array', items: {} },\n { type: 'null' },\n ],\n },\n },\n {\n type: 'null',\n },\n ],\n };\n};\n\nexport const getRequestBodyContentType = (\n apiReferenceData: ApiReferenceDataV2,\n contentTypeIndex: number\n): string | undefined => {\n const requestBodyContent = apiReferenceData.dependencies?.requestBody?.content;\n if (requestBodyContent === undefined) {\n return undefined;\n }\n const requestBodyContentTypes = Object.keys(requestBodyContent);\n return requestBodyContentTypes[contentTypeIndex];\n};\n\nexport const escapeDots = (key: string): string => {\n return key.replace(/\\./g, '\\\\.');\n};\n\nexport const mapParamInToPlaygroundInputKey = (parameterIn: string): string => {\n switch (parameterIn) {\n case 'header':\n return apiPlaygroundInputKeys.header;\n case 'path':\n return apiPlaygroundInputKeys.path;\n case 'query':\n return apiPlaygroundInputKeys.query;\n case 'cookie':\n return apiPlaygroundInputKeys.cookie;\n default:\n return apiPlaygroundInputKeys.header;\n }\n};\n\n// CLANKED AS HELL. TODO: Refactor.\nexport const unflattenInputs = (\n inputs: Record<string, PlaygroundInputValue>\n): ApiPlaygroundInputs => {\n const result: ApiPlaygroundInputs = {\n server: {},\n header: {},\n path: {},\n query: {},\n cookie: {},\n body: undefined,\n };\n\n Object.entries(inputs).forEach(([key, value]) => {\n // skip undefined/null values\n if (value === undefined || value === null) {\n return;\n }\n // split on . but not on \\. (escaped dots), then unescape the parts\n const parts = key.split(/(?<!\\\\)\\./).map((part) => part.replace(/\\\\\\./g, '.'));\n if (parts.length < 2) {\n if (key === 'body') {\n result.body = value;\n }\n return;\n }\n\n const [section, ...keyPath] = parts;\n\n const validKeys = Object.values(apiPlaygroundInputKeys);\n if (!section || !validKeys.includes(section)) {\n return;\n }\n\n if (section !== apiPlaygroundInputKeys.body) {\n setNestedValue(\n result[section as keyof ApiPlaygroundInputs] as Record<string, unknown>,\n [...keyPath],\n value\n );\n } else {\n if ([...keyPath].length === 0) {\n result.body = value;\n } else {\n // Initialize body as object if it's undefined\n if (result.body === undefined || typeof result.body !== 'object') {\n result.body = {};\n }\n setNestedValue(result.body as Record<string, unknown>, keyPath, value);\n }\n }\n });\n\n // Convert array-like objects (objects with only numeric keys) to actual arrays\n return convertArrayLikeToArray(result) as ApiPlaygroundInputs;\n};\n\n// Check if an object should be converted to an array (all keys are numeric strings)\nconst isArrayLike = (obj: unknown): obj is Record<string, unknown> => {\n if (!isPlainRecord(obj)) {\n return false;\n }\n const keys = Object.keys(obj);\n if (keys.length === 0) {\n return false;\n }\n // Check if all keys are numeric strings\n return keys.every((k) => /^\\d+$/.test(k));\n};\n\n// Recursively convert array-like objects to arrays\nconst convertArrayLikeToArray = (value: unknown): unknown => {\n if (value === null || value === undefined) {\n return value;\n }\n\n if (Array.isArray(value)) {\n return value.map(convertArrayLikeToArray);\n }\n\n if (isPlainRecord(value)) {\n if (isArrayLike(value)) {\n // Convert object with numeric keys to array\n // Sort keys numerically and map to values\n const keys = Object.keys(value).sort((a, b) => Number(a) - Number(b));\n const arr = keys.map((k) => value[k]);\n // Recursively convert nested values\n return arr.map(convertArrayLikeToArray);\n }\n\n // Recursively process regular objects\n const result: Record<string, unknown> = {};\n for (const [key, val] of Object.entries(value)) {\n result[key] = convertArrayLikeToArray(val);\n }\n return result;\n }\n\n return value;\n};\n\n// recursively set a value in a nested object\nconst setNestedValue = (obj: Record<string, unknown>, keyPath: string[], value: unknown) => {\n // First pass: filter out keys we want to skip\n const filteredKeys: string[] = [];\n for (let i = 0; i < keyPath.length; i++) {\n const key = keyPath[i];\n if (key === 'oneOf') {\n // Skip this key and the next one (the oneOf index)\n i++;\n continue;\n }\n if (key === 'additionalProperties' || key === 'items') {\n // Skip these keys\n continue;\n }\n if (key) {\n filteredKeys.push(key);\n }\n }\n\n // Second pass: navigate through/create nested structure and set value\n let current = obj;\n for (let i = 0; i < filteredKeys.length; i++) {\n const key = filteredKeys[i];\n if (i === filteredKeys.length - 1) {\n // Last key - set the value\n if (key) {\n current[key] = value;\n }\n } else {\n // Not the last key - ensure nested object exists\n if (key && (!current[key] || typeof current[key] !== 'object')) {\n current[key] = {};\n }\n if (key) {\n current = current[key] as Record<string, unknown>;\n }\n }\n }\n};\n// CLANK ENDS HERE\n\nexport const filterSchemasWithConsts = (\n schemas: ResolvedSchemaObject[]\n): ResolvedSchemaObject[] => {\n const filteredSchemas = schemas.filter((schema) => {\n if ('enum' in schema && schema.enum && 'const' in schema) {\n return schema.enum.includes(schema.const);\n }\n return true;\n });\n return filteredSchemas;\n};\n\nexport const getBodyDefaultsFromSchema = (schema: SchemaObject): Record<string, unknown> => {\n const bodyDefaults: Record<string, unknown> = {};\n\n if ('uniqueKey' in schema && schema.uniqueKey !== undefined) {\n const defaultValue = getSchemaDefault(schema);\n if (defaultValue !== undefined) {\n const inputKey = `${apiPlaygroundInputKeys.body}.${schema.uniqueKey}`;\n bodyDefaults[inputKey] = defaultValue;\n }\n }\n\n if ('oneOf' in schema && Array.isArray(schema.oneOf)) {\n schema.oneOf.forEach((subSchema) => {\n if (isSchemaObject(subSchema)) {\n const subDefaults = getBodyDefaultsFromSchema(subSchema);\n Object.assign(bodyDefaults, subDefaults);\n }\n });\n }\n\n if (schema.type === 'object' && schema.properties) {\n Object.values(schema.properties).forEach((propSchema) => {\n if (isSchemaObject(propSchema)) {\n const propDefaults = getBodyDefaultsFromSchema(propSchema);\n Object.assign(bodyDefaults, propDefaults);\n }\n });\n }\n\n if (\n schema.additionalProperties &&\n typeof schema.additionalProperties === 'object' &&\n isSchemaObject(schema.additionalProperties)\n ) {\n const addPropsDefaults = getBodyDefaultsFromSchema(schema.additionalProperties);\n Object.assign(bodyDefaults, addPropsDefaults);\n }\n\n if (schema.type === 'array' && 'items' in schema && isSchemaObject(schema.items)) {\n const itemsDefaults = getBodyDefaultsFromSchema(schema.items);\n Object.assign(bodyDefaults, itemsDefaults);\n }\n\n return bodyDefaults;\n};"],"names":["isPlainRecord","value","isSchemaObject","obj","mapResponseExamples","apiReferenceData","responseCodeMediaObjectMap","_a","responseCode","UUID","response","_b","unflattenInputs","inputs","result","key","parts","part","section","keyPath","validKeys","apiPlaygroundInputKeys","setNestedValue","convertArrayLikeToArray","isArrayLike","keys","k","a","b","val","filteredKeys","i","current"],"mappings":";;AAiDO,MAAMA,IAAgB,CAACC,MAC5B,OAAOA,KAAU,YAAYA,MAAU,QAAQ,CAAC,MAAM,QAAQA,CAAK,GAsExDC,IAAiB,CAACC,MACxBH,EAAcG,CAAG,IAKpB,UAAUA,KACV,gBAAgBA,KAChB,WAAWA,KACX,WAAWA,KACX,WAAWA,KACX,WAAWA,KACX,0BAA0BA,KAC1B,UAAUA,KACV,WAAWA,KACX,YAAYA,KACZ,aAAaA,KACb,aAAaA,KACb,aAAaA,KACb,eAAeA,KACf,eAAeA,KACf,cAAcA,KACd,cAAcA,KACd,mBAAmBA,KACnB,mBAAmBA,KACnB,cAAcA,KACd,cAAcA,KACd,iBAAiBA,IAzBV,IAuVEC,IAAsB,CAACC,MAAyC;;AAC3E,QAAMC,IAA0D,CAAA;AAChE,gBAAO,UAAQC,IAAAF,EAAiB,cAAjB,gBAAAE,EAA4B,cAAa,EAAE,EAAE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,OAAOiB,EAAQjB,CAAG,KAAM,cACnDiB,EAAQjB,CAAG,IAAI,CAAA,IAEbA,MACFiB,IAAUA,EAAQjB,CAAG;AAAA,EAG3B;AACF;"}
@@ -1,11 +1,12 @@
1
1
  import { jsx as m, jsxs as r } from "react/jsx-runtime";
2
- import { cn as d } from "@/api-playground-2/schemaGraph/utils";
2
+ import "@mintlify/validation";
3
+ import { cn as d } from "../../utils/cn.js";
3
4
  import * as t from "@radix-ui/react-dropdown-menu";
4
5
  import { ChevronRightFilled as l, CheckmarkCircleRegular as c, CircleRegular as p } from "@fluentui/react-icons";
5
6
  import * as o from "react";
6
7
  const f = o.forwardRef((n, e) => /* @__PURE__ */ m(t.Root, { modal: !1, ...n }));
7
8
  f.displayName = t.Root.displayName;
8
- const C = t.Trigger, u = o.forwardRef(({ className: n, inset: e, children: i, ...a }, s) => /* @__PURE__ */ r(
9
+ const I = t.Trigger, u = o.forwardRef(({ className: n, inset: e, children: i, ...a }, s) => /* @__PURE__ */ r(
9
10
  t.SubTrigger,
10
11
  {
11
12
  ref: s,
@@ -122,6 +123,6 @@ export {
122
123
  x as DropdownMenuSeparator,
123
124
  b as DropdownMenuSubContent,
124
125
  u as DropdownMenuSubTrigger,
125
- C as DropdownMenuTrigger
126
+ I as DropdownMenuTrigger
126
127
  };
127
128
  //# sourceMappingURL=dropdown-menu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-menu.js","sources":["../../../src/components/Api/dropdown-menu.tsx"],"sourcesContent":["import { cn } from '@/api-playground-2/schemaGraph/utils';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { CheckmarkCircleRegular, ChevronRightFilled, CircleRegular } from '@fluentui/react-icons';\nimport * as React from 'react';\n\nconst DropdownMenu = React.forwardRef<\n typeof DropdownMenuPrimitive.Root,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Root>\n>((props, _ref) => <DropdownMenuPrimitive.Root modal={false} {...props} />);\nDropdownMenu.displayName = DropdownMenuPrimitive.Root.displayName;\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'mint:flex mint:cursor-default mint:select-none mint:items-center mint:rounded-md mint:px-2 mint:py-1.5 mint:text-sm mint:outline-none mint:focus:bg-accent mint:data-[state=open]:bg-accent',\n inset && 'mint:pl-8',\n className\n )}\n {...props}\n >\n {children}\n <ChevronRightFilled className=\"mint:size-4 mint:ml-auto\" />\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'mint:z-50 mint:min-w-[8rem] mint:overflow-hidden mint:rounded-xl mint:border mint:bg-popover mint:p-1 mint:shadow-md mint:data-[state=open]:animate-in mint:data-[state=closed]:animate-out mint:data-[state=closed]:fade-out-0 mint:data-[state=open]:fade-in-0 mint:data-[state=closed]:zoom-out-95 mint:data-[state=open]:zoom-in-95 mint:data-[side=bottom]:slide-in-from-top-2 mint:data-[side=left]:slide-in-from-right-2 mint:data-[side=right]:slide-in-from-left-2 mint:data-[side=top]:slide-in-from-bottom-2',\n className\n )}\n {...props}\n />\n));\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 8, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'mint:bg-white mint:dark:bg-zinc-950 mint:z-50 mint:min-w-[8rem] mint:overflow-hidden mint:rounded-xl mint:border mint:p-3 mint:text-secondary mint:data-[state=open]:animate-in mint:data-[state=closed]:animate-out mint:data-[state=closed]:fade-out-0 mint:data-[state=open]:fade-in-0 mint:data-[state=closed]:zoom-out-95 mint:data-[state=open]:zoom-in-95 mint:data-[side=bottom]:slide-in-from-top-2 mint:data-[side=left]:slide-in-from-right-2 mint:data-[side=right]:slide-in-from-left-2 mint:data-[side=top]:slide-in-from-bottom-2 mint:shadow-xl mint:shadow-zinc-400/10 mint:dark:border-white/10 mint:dark:shadow-none',\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\ntype DropdownMenuItemProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n isSelected?: boolean;\n};\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n DropdownMenuItemProps\n>(({ className, inset, isSelected, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'mint:relative mint:flex mint:cursor-pointer mint:select-none mint:items-center mint:rounded-lg mint:px-2 mint:py-1.5 mint:text-sm mint:outline-none mint:focus:bg-accent mint:focus:text-accent-foreground mint:data-[disabled]:pointer-events-none mint:data-[disabled]:opacity-50 mint:hover:bg-zinc-950/5 mint:dark:hover:bg-white/5',\n inset && 'mint:pl-8',\n isSelected && 'mint:bg-zinc-950/5 mint:dark:bg-white/5 mint:font-medium',\n className\n )}\n {...props}\n />\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n 'mint:relative mint:flex mint:cursor-default mint:select-none mint:items-center mint:rounded-sm mint:py-1.5 mint:pl-8 mint:pr-2 mint:text-sm mint:outline-none mint:transition-colors mint:focus:bg-accent mint:focus:text-accent-foreground mint:data-[disabled]:pointer-events-none mint:data-[disabled]:opacity-50',\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"mint:absolute mint:left-2 mint:flex mint:size-3.5 mint:items-center mint:justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckmarkCircleRegular className=\"mint:size-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'mint:relative mint:flex mint:cursor-default mint:select-none mint:items-center mint:rounded-md mint:py-1.5 mint:pl-8 mint:pr-2 mint:text-sm mint:outline-none mint:transition-colors mint:focus:bg-accent mint:focus:text-accent-foreground mint:data-[disabled]:pointer-events-none mint:data-[disabled]:opacity-50',\n className\n )}\n {...props}\n >\n <span className=\"mint:absolute mint:left-2 mint:flex mint:size-3.5 mint:items-center mint:justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CircleRegular className=\"mint:size-2 mint:fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn('mint:px-2 mint:py-1.5 mint:text-sm mint:font-semibold', inset && 'mint:pl-8', className)}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn('mint:-mx-1 mint:my-1 mint:h-px mint:bg-zinc-950/10 mint:dark:bg-white/10', className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span className={cn('mint:ml-auto mint:text-xs mint:tracking-widest mint:opacity-60', className)} {...props} />\n );\n};\nDropdownMenuShortcut.displayName = 'DropdownMenuShortcut';\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n};\n"],"names":["DropdownMenu","React","props","_ref","jsx","DropdownMenuPrimitive","DropdownMenuTrigger","DropdownMenuSubTrigger","className","inset","children","ref","jsxs","cn","ChevronRightFilled","DropdownMenuSubContent","DropdownMenuContent","sideOffset","DropdownMenuItem","isSelected","DropdownMenuCheckboxItem","checked","CheckmarkCircleRegular","DropdownMenuRadioItem","CircleRegular","DropdownMenuLabel","DropdownMenuSeparator"],"mappings":";;;;;AAKA,MAAMA,IAAeC,EAAM,WAGzB,CAACC,GAAOC,MAAS,gBAAAC,EAACC,EAAsB,MAAtB,EAA2B,OAAO,IAAQ,GAAGH,GAAO,CAAE;AAC1EF,EAAa,cAAcK,EAAsB,KAAK;AAEtD,MAAMC,IAAsBD,EAAsB,SAU5CE,IAAyBN,EAAM,WAKnC,CAAC,EAAE,WAAAO,GAAW,OAAAC,GAAO,UAAAC,GAAU,GAAGR,KAASS,MAC3C,gBAAAC;AAAA,EAACP,EAAsB;AAAA,EAAtB;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ,KAAS;AAAA,MACTD;AAAA,IAAA;AAAA,IAED,GAAGN;AAAA,IAEH,UAAA;AAAA,MAAAQ;AAAA,MACD,gBAAAN,EAACU,GAAA,EAAmB,WAAU,2BAAA,CAA2B;AAAA,IAAA;AAAA,EAAA;AAC3D,CACD;AACDP,EAAuB,cAAcF,EAAsB,WAAW;AAEtE,MAAMU,IAAyBd,EAAM,WAGnC,CAAC,EAAE,WAAAO,GAAW,GAAGN,EAAA,GAASS,MAC1B,gBAAAP;AAAA,EAACC,EAAsB;AAAA,EAAtB;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAL;AAAA,IAAA;AAAA,IAED,GAAGN;AAAA,EAAA;AACN,CACD;AACDa,EAAuB,cAAcV,EAAsB,WAAW;AAEtE,MAAMW,IAAsBf,EAAM,WAGhC,CAAC,EAAE,WAAAO,GAAW,YAAAS,IAAa,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AAC;AAAA,EAACP,EAAsB;AAAA,EAAtB;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAL;AAAA,IAAA;AAAA,IAED,GAAGN;AAAA,IAEJ,UAAA;AAAA,MAAA,gBAAAE,EAAC,QAAA,EAAK,WAAU,2FACd,UAAA,gBAAAA,EAACC,EAAsB,eAAtB,EACC,UAAA,gBAAAD,EAACoB,GAAA,EAAc,WAAU,gCAAA,CAAgC,EAAA,CAC3D,GACF;AAAA,MACCd;AAAA,IAAA;AAAA,EAAA;AACH,CACD;AACDa,EAAsB,cAAclB,EAAsB,UAAU;AAEpE,MAAMoB,IAAoBxB,EAAM,WAK9B,CAAC,EAAE,WAAAO,GAAW,OAAAC,GAAO,GAAGP,KAASS,MACjC,gBAAAP;AAAA,EAACC,EAAsB;AAAA,EAAtB;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE,EAAG,yDAAyDJ,KAAS,aAAaD,CAAS;AAAA,IACrG,GAAGN;AAAA,EAAA;AACN,CACD;AACDuB,EAAkB,cAAcpB,EAAsB,MAAM;AAE5D,MAAMqB,IAAwBzB,EAAM,WAGlC,CAAC,EAAE,WAAAO,GAAW,GAAGN,EAAA,GAASS,MAC1B,gBAAAP;AAAA,EAACC,EAAsB;AAAA,EAAtB;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE,EAAG,4EAA4EL,CAAS;AAAA,IAClG,GAAGN;AAAA,EAAA;AACN,CACD;AACDwB,EAAsB,cAAcrB,EAAsB,UAAU;"}
1
+ {"version":3,"file":"dropdown-menu.js","sources":["../../../src/components/Api/dropdown-menu.tsx"],"sourcesContent":["import { cn } from '@/api-playground-2/schemaGraph/utils';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { CheckmarkCircleRegular, ChevronRightFilled, CircleRegular } from '@fluentui/react-icons';\nimport * as React from 'react';\n\nconst DropdownMenu = React.forwardRef<\n typeof DropdownMenuPrimitive.Root,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Root>\n>((props, _ref) => <DropdownMenuPrimitive.Root modal={false} {...props} />);\nDropdownMenu.displayName = DropdownMenuPrimitive.Root.displayName;\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'mint:flex mint:cursor-default mint:select-none mint:items-center mint:rounded-md mint:px-2 mint:py-1.5 mint:text-sm mint:outline-none mint:focus:bg-accent mint:data-[state=open]:bg-accent',\n inset && 'mint:pl-8',\n className\n )}\n {...props}\n >\n {children}\n <ChevronRightFilled className=\"mint:size-4 mint:ml-auto\" />\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'mint:z-50 mint:min-w-[8rem] mint:overflow-hidden mint:rounded-xl mint:border mint:bg-popover mint:p-1 mint:shadow-md mint:data-[state=open]:animate-in mint:data-[state=closed]:animate-out mint:data-[state=closed]:fade-out-0 mint:data-[state=open]:fade-in-0 mint:data-[state=closed]:zoom-out-95 mint:data-[state=open]:zoom-in-95 mint:data-[side=bottom]:slide-in-from-top-2 mint:data-[side=left]:slide-in-from-right-2 mint:data-[side=right]:slide-in-from-left-2 mint:data-[side=top]:slide-in-from-bottom-2',\n className\n )}\n {...props}\n />\n));\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 8, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'mint:bg-white mint:dark:bg-zinc-950 mint:z-50 mint:min-w-[8rem] mint:overflow-hidden mint:rounded-xl mint:border mint:p-3 mint:text-secondary mint:data-[state=open]:animate-in mint:data-[state=closed]:animate-out mint:data-[state=closed]:fade-out-0 mint:data-[state=open]:fade-in-0 mint:data-[state=closed]:zoom-out-95 mint:data-[state=open]:zoom-in-95 mint:data-[side=bottom]:slide-in-from-top-2 mint:data-[side=left]:slide-in-from-right-2 mint:data-[side=right]:slide-in-from-left-2 mint:data-[side=top]:slide-in-from-bottom-2 mint:shadow-xl mint:shadow-zinc-400/10 mint:dark:border-white/10 mint:dark:shadow-none',\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\ntype DropdownMenuItemProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n isSelected?: boolean;\n};\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n DropdownMenuItemProps\n>(({ className, inset, isSelected, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'mint:relative mint:flex mint:cursor-pointer mint:select-none mint:items-center mint:rounded-lg mint:px-2 mint:py-1.5 mint:text-sm mint:outline-none mint:focus:bg-accent mint:focus:text-accent-foreground mint:data-[disabled]:pointer-events-none mint:data-[disabled]:opacity-50 mint:hover:bg-zinc-950/5 mint:dark:hover:bg-white/5',\n inset && 'mint:pl-8',\n isSelected && 'mint:bg-zinc-950/5 mint:dark:bg-white/5 mint:font-medium',\n className\n )}\n {...props}\n />\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n 'mint:relative mint:flex mint:cursor-default mint:select-none mint:items-center mint:rounded-sm mint:py-1.5 mint:pl-8 mint:pr-2 mint:text-sm mint:outline-none mint:transition-colors mint:focus:bg-accent mint:focus:text-accent-foreground mint:data-[disabled]:pointer-events-none mint:data-[disabled]:opacity-50',\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"mint:absolute mint:left-2 mint:flex mint:size-3.5 mint:items-center mint:justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckmarkCircleRegular className=\"mint:size-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'mint:relative mint:flex mint:cursor-default mint:select-none mint:items-center mint:rounded-md mint:py-1.5 mint:pl-8 mint:pr-2 mint:text-sm mint:outline-none mint:transition-colors mint:focus:bg-accent mint:focus:text-accent-foreground mint:data-[disabled]:pointer-events-none mint:data-[disabled]:opacity-50',\n className\n )}\n {...props}\n >\n <span className=\"mint:absolute mint:left-2 mint:flex mint:size-3.5 mint:items-center mint:justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CircleRegular className=\"mint:size-2 mint:fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn('mint:px-2 mint:py-1.5 mint:text-sm mint:font-semibold', inset && 'mint:pl-8', className)}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn('mint:-mx-1 mint:my-1 mint:h-px mint:bg-zinc-950/10 mint:dark:bg-white/10', className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span className={cn('mint:ml-auto mint:text-xs mint:tracking-widest mint:opacity-60', className)} {...props} />\n );\n};\nDropdownMenuShortcut.displayName = 'DropdownMenuShortcut';\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n};\n"],"names":["DropdownMenu","React","props","_ref","jsx","DropdownMenuPrimitive","DropdownMenuTrigger","DropdownMenuSubTrigger","className","inset","children","ref","jsxs","cn","ChevronRightFilled","DropdownMenuSubContent","DropdownMenuContent","sideOffset","DropdownMenuItem","isSelected","DropdownMenuCheckboxItem","checked","CheckmarkCircleRegular","DropdownMenuRadioItem","CircleRegular","DropdownMenuLabel","DropdownMenuSeparator"],"mappings":";;;;;;AAKA,MAAMA,IAAeC,EAAM,WAGzB,CAACC,GAAOC,MAAS,gBAAAC,EAACC,EAAsB,MAAtB,EAA2B,OAAO,IAAQ,GAAGH,GAAO,CAAE;AAC1EF,EAAa,cAAcK,EAAsB,KAAK;AAEtD,MAAMC,IAAsBD,EAAsB,SAU5CE,IAAyBN,EAAM,WAKnC,CAAC,EAAE,WAAAO,GAAW,OAAAC,GAAO,UAAAC,GAAU,GAAGR,KAASS,MAC3C,gBAAAC;AAAA,EAACP,EAAsB;AAAA,EAAtB;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ,KAAS;AAAA,MACTD;AAAA,IAAA;AAAA,IAED,GAAGN;AAAA,IAEH,UAAA;AAAA,MAAAQ;AAAA,MACD,gBAAAN,EAACU,GAAA,EAAmB,WAAU,2BAAA,CAA2B;AAAA,IAAA;AAAA,EAAA;AAC3D,CACD;AACDP,EAAuB,cAAcF,EAAsB,WAAW;AAEtE,MAAMU,IAAyBd,EAAM,WAGnC,CAAC,EAAE,WAAAO,GAAW,GAAGN,EAAA,GAASS,MAC1B,gBAAAP;AAAA,EAACC,EAAsB;AAAA,EAAtB;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAL;AAAA,IAAA;AAAA,IAED,GAAGN;AAAA,EAAA;AACN,CACD;AACDa,EAAuB,cAAcV,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kB,IAAwBtB,EAAM,WAGlC,CAAC,EAAE,WAAAO,GAAW,UAAAE,GAAU,GAAGR,KAASS,MACpC,gBAAAC;AAAA,EAACP,EAAsB;AAAA,EAAtB;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAL;AAAA,IAAA;AAAA,IAED,GAAGN;AAAA,IAEJ,UAAA;AAAA,MAAA,gBAAAE,EAAC,QAAA,EAAK,WAAU,2FACd,UAAA,gBAAAA,EAACC,EAAsB,eAAtB,EACC,UAAA,gBAAAD,EAACoB,GAAA,EAAc,WAAU,gCAAA,CAAgC,EAAA,CAC3D,GACF;AAAA,MACCd;AAAA,IAAA;AAAA,EAAA;AACH,CACD;AACDa,EAAsB,cAAclB,EAAsB,UAAU;AAEpE,MAAMoB,IAAoBxB,EAAM,WAK9B,CAAC,EAAE,WAAAO,GAAW,OAAAC,GAAO,GAAGP,KAASS,MACjC,gBAAAP;AAAA,EAACC,EAAsB;AAAA,EAAtB;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE,EAAG,yDAAyDJ,KAAS,aAAaD,CAAS;AAAA,IACrG,GAAGN;AAAA,EAAA;AACN,CACD;AACDuB,EAAkB,cAAcpB,EAAsB,MAAM;AAE5D,MAAMqB,IAAwBzB,EAAM,WAGlC,CAAC,EAAE,WAAAO,GAAW,GAAGN,EAAA,GAASS,MAC1B,gBAAAP;AAAA,EAACC,EAAsB;AAAA,EAAtB;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE,EAAG,4EAA4EL,CAAS;AAAA,IAClG,GAAGN;AAAA,EAAA;AACN,CACD;AACDwB,EAAsB,cAAcrB,EAAsB,UAAU;"}
@@ -1,8 +1,8 @@
1
1
  import { jsxs as a, jsx as o } from "react/jsx-runtime";
2
2
  import { useContext as y, useState as f, useEffect as C } from "react";
3
- import { ApiPlaygroundContext as k } from "@/api-playground/ApiPlayground/ApiPlaygroundContext";
4
- import { useCodeExampleLabel as j } from "@/contexts/CodeExampleLabelContext";
5
- import { useSelectedLocale as G } from "@/utils/locales";
3
+ import { ApiPlaygroundContext as k } from "../../../api-playground/ApiPlayground/ApiPlaygroundContext.js";
4
+ import { useCodeExampleLabel as j } from "../../../contexts/CodeExampleLabelContext.js";
5
+ import { useSelectedLocale as G } from "../../../utils/locales/index.js";
6
6
  import { CodeSnippet as L } from "../code-snippet.js";
7
7
  import { CodeGroupCopyButton as N } from "./CodeGroupCopyButton.js";
8
8
  import { CodeSelectDropdown as g } from "./CodeSelectDropdown.js";
@@ -0,0 +1,14 @@
1
+ const e = {
2
+ headers: [],
3
+ method: "GET",
4
+ url: "",
5
+ httpVersion: "HTTP/1.1",
6
+ queryString: [],
7
+ headersSize: -1,
8
+ cookies: [],
9
+ bodySize: -1
10
+ };
11
+ export {
12
+ e as initialRequest
13
+ };
14
+ //# sourceMappingURL=initialRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initialRequest.js","sources":["../../src/constants/initialRequest.ts"],"sourcesContent":["export const initialRequest = {\n headers: [],\n method: 'GET' as const,\n url: '',\n httpVersion: 'HTTP/1.1',\n queryString: [],\n headersSize: -1,\n cookies: [],\n bodySize: -1,\n};\n"],"names":["initialRequest"],"mappings":"AAAO,MAAMA,IAAiB;AAAA,EAC5B,SAAS,CAAA;AAAA,EACT,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,aAAa;AAAA,EACb,aAAa,CAAA;AAAA,EACb,aAAa;AAAA,EACb,SAAS,CAAA;AAAA,EACT,UAAU;AACZ;"}
@@ -1,37 +1,56 @@
1
- const e = {
1
+ const c = {
2
+ curl: "bash",
3
+ golang: "go",
4
+ js: "javascript",
5
+ sh: "bash",
6
+ ts: "typescript",
7
+ rb: "ruby"
8
+ }, g = {
9
+ bash: "cURL",
10
+ c: "C",
11
+ "c#": "C#",
12
+ "c++": "C++",
13
+ go: "Go",
14
+ java: "Java",
15
+ javascript: "JavaScript",
16
+ php: "PHP",
17
+ python: "Python",
18
+ typescript: "TypeScript",
19
+ ruby: "Ruby"
20
+ }, e = {
2
21
  filename: "cURL",
3
22
  snippet: {
4
23
  target: "shell"
5
24
  },
6
25
  language: "bash"
7
- }, t = {
26
+ }, a = {
8
27
  filename: "Python",
9
28
  snippet: {
10
29
  target: "python",
11
30
  client: "requests"
12
31
  },
13
32
  language: "python"
14
- }, a = {
33
+ }, p = {
15
34
  filename: "JavaScript",
16
35
  snippet: {
17
36
  target: "javascript",
18
37
  client: "fetch"
19
38
  },
20
39
  language: "javascript"
21
- }, p = {
40
+ }, n = {
22
41
  filename: "PHP",
23
42
  snippet: {
24
43
  target: "php",
25
44
  client: "curl"
26
45
  },
27
46
  language: "php"
28
- }, n = {
47
+ }, s = {
29
48
  filename: "Go",
30
49
  snippet: {
31
50
  target: "go"
32
51
  },
33
52
  language: "go"
34
- }, s = {
53
+ }, r = {
35
54
  filename: "Java",
36
55
  snippet: {
37
56
  target: "java"
@@ -43,16 +62,31 @@ const e = {
43
62
  target: "ruby"
44
63
  },
45
64
  language: "ruby"
46
- }, r = {
65
+ }, l = [
66
+ e,
67
+ a,
68
+ p,
69
+ n,
70
+ s,
71
+ r,
72
+ i
73
+ ], h = {
47
74
  bash: e,
48
- python: t,
49
- javascript: a,
50
- php: p,
51
- go: n,
52
- java: s,
75
+ python: a,
76
+ javascript: p,
77
+ php: n,
78
+ go: s,
79
+ java: r,
53
80
  ruby: i
81
+ }, u = (o) => {
82
+ const t = o.toLowerCase();
83
+ return c[t] ?? t;
54
84
  };
55
85
  export {
56
- r as langToPresetMap
86
+ h as langToPresetMap,
87
+ g as shikiLangToDisplayLang,
88
+ l as snippetPresets,
89
+ u as toShikiLang,
90
+ c as userLangToShikiLang
57
91
  };
58
92
  //# sourceMappingURL=snippetPresets.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"snippetPresets.js","sources":["../../src/constants/snippetPresets.ts"],"sourcesContent":["export type ExampleCodeSnippet = {\n filename: string;\n code: string;\n language: string;\n};\n\nexport type SnippetPreset = Pick<\n ExampleCodeSnippet,\n \"filename\" | \"language\"\n> & {\n snippet: {\n target: string;\n client?: string;\n };\n};\n\nexport type ShikiSnippetLangs =\n | 'bash'\n | 'c'\n | 'c#'\n | 'c++'\n | 'go'\n | 'java'\n | 'javascript'\n | 'php'\n | 'python'\n | 'typescript'\n | 'ruby';\n\n// map from some common language aliases to the form used by Shiki\nexport const userLangToShikiLang: Record<string, ShikiSnippetLangs> = {\n curl: 'bash',\n golang: 'go',\n js: 'javascript',\n sh: 'bash',\n ts: 'typescript',\n rb: 'ruby',\n};\n\n// map from standardized Shiki language names to a more human-readable label\nexport const shikiLangToDisplayLang: Record<string, string> = {\n bash: 'cURL',\n c: 'C',\n 'c#': 'C#',\n 'c++': 'C++',\n go: 'Go',\n java: 'Java',\n javascript: 'JavaScript',\n php: 'PHP',\n python: 'Python',\n typescript: 'TypeScript',\n ruby: 'Ruby',\n} satisfies Record<ShikiSnippetLangs, string>;\n\nconst curlSnippetPreset: SnippetPreset = {\n filename: 'cURL',\n snippet: {\n target: 'shell',\n },\n language: 'bash',\n};\n\nconst pythonSnippetPreset: SnippetPreset = {\n filename: 'Python',\n snippet: {\n target: 'python',\n client: 'requests',\n },\n language: 'python',\n};\n\nconst javascriptSnippetPreset: SnippetPreset = {\n filename: 'JavaScript',\n snippet: {\n target: 'javascript',\n client: 'fetch',\n },\n language: 'javascript',\n};\n\nconst phpSnippetPreset: SnippetPreset = {\n filename: 'PHP',\n snippet: {\n target: 'php',\n client: 'curl',\n },\n language: 'php',\n};\n\nconst goSnippetPreset: SnippetPreset = {\n filename: 'Go',\n snippet: {\n target: 'go',\n },\n language: 'go',\n};\n\nconst javaSnippetPreset: SnippetPreset = {\n filename: 'Java',\n snippet: {\n target: 'java',\n },\n language: 'java',\n};\n\nconst rubySnippetPreset: SnippetPreset = {\n filename: 'Ruby',\n snippet: {\n target: 'ruby',\n },\n language: 'ruby',\n};\n\nexport const snippetPresets: SnippetPreset[] = [\n curlSnippetPreset,\n pythonSnippetPreset,\n javascriptSnippetPreset,\n phpSnippetPreset,\n goSnippetPreset,\n javaSnippetPreset,\n rubySnippetPreset,\n];\n\nexport const langToPresetMap: Record<string, SnippetPreset> = {\n bash: curlSnippetPreset,\n python: pythonSnippetPreset,\n javascript: javascriptSnippetPreset,\n php: phpSnippetPreset,\n go: goSnippetPreset,\n java: javaSnippetPreset,\n ruby: rubySnippetPreset,\n} satisfies { [k in ShikiSnippetLangs]?: SnippetPreset };\n\nexport const toShikiLang = (lang: string) => {\n const lowerLang = lang.toLowerCase();\n return userLangToShikiLang[lowerLang] ?? lowerLang;\n};\n"],"names":["curlSnippetPreset","pythonSnippetPreset","javascriptSnippetPreset","phpSnippetPreset","goSnippetPreset","javaSnippetPreset","rubySnippetPreset","langToPresetMap"],"mappings":"AAsDA,MAAMA,IAAmC;AAAA,EACvC,UAAU;AAAA,EACV,SAAS;AAAA,IACP,QAAQ;AAAA,EAAA;AAAA,EAEV,UAAU;AACZ,GAEMC,IAAqC;AAAA,EACzC,UAAU;AAAA,EACV,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,EAAA;AAAA,EAEV,UAAU;AACZ,GAEMC,IAAyC;AAAA,EAC7C,UAAU;AAAA,EACV,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,EAAA;AAAA,EAEV,UAAU;AACZ,GAEMC,IAAkC;AAAA,EACtC,UAAU;AAAA,EACV,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,EAAA;AAAA,EAEV,UAAU;AACZ,GAEMC,IAAiC;AAAA,EACrC,UAAU;AAAA,EACV,SAAS;AAAA,IACP,QAAQ;AAAA,EAAA;AAAA,EAEV,UAAU;AACZ,GAEMC,IAAmC;AAAA,EACvC,UAAU;AAAA,EACV,SAAS;AAAA,IACP,QAAQ;AAAA,EAAA;AAAA,EAEV,UAAU;AACZ,GAEMC,IAAmC;AAAA,EACvC,UAAU;AAAA,EACV,SAAS;AAAA,IACP,QAAQ;AAAA,EAAA;AAAA,EAEV,UAAU;AACZ,GAYaC,IAAiD;AAAA,EAC5D,MAAMP;AAAA,EACN,QAAQC;AAAA,EACR,YAAYC;AAAA,EACZ,KAAKC;AAAA,EACL,IAAIC;AAAA,EACJ,MAAMC;AAAA,EACN,MAAMC;AACR;"}
1
+ {"version":3,"file":"snippetPresets.js","sources":["../../src/constants/snippetPresets.ts"],"sourcesContent":["export type ExampleCodeSnippet = {\n filename: string;\n code: string;\n language: string;\n};\n\nexport type SnippetPreset = Pick<\n ExampleCodeSnippet,\n \"filename\" | \"language\"\n> & {\n snippet: {\n target: string;\n client?: string;\n };\n};\n\nexport type ShikiSnippetLangs =\n | 'bash'\n | 'c'\n | 'c#'\n | 'c++'\n | 'go'\n | 'java'\n | 'javascript'\n | 'php'\n | 'python'\n | 'typescript'\n | 'ruby';\n\n// map from some common language aliases to the form used by Shiki\nexport const userLangToShikiLang: Record<string, ShikiSnippetLangs> = {\n curl: 'bash',\n golang: 'go',\n js: 'javascript',\n sh: 'bash',\n ts: 'typescript',\n rb: 'ruby',\n};\n\n// map from standardized Shiki language names to a more human-readable label\nexport const shikiLangToDisplayLang: Record<string, string> = {\n bash: 'cURL',\n c: 'C',\n 'c#': 'C#',\n 'c++': 'C++',\n go: 'Go',\n java: 'Java',\n javascript: 'JavaScript',\n php: 'PHP',\n python: 'Python',\n typescript: 'TypeScript',\n ruby: 'Ruby',\n} satisfies Record<ShikiSnippetLangs, string>;\n\nconst curlSnippetPreset: SnippetPreset = {\n filename: 'cURL',\n snippet: {\n target: 'shell',\n },\n language: 'bash',\n};\n\nconst pythonSnippetPreset: SnippetPreset = {\n filename: 'Python',\n snippet: {\n target: 'python',\n client: 'requests',\n },\n language: 'python',\n};\n\nconst javascriptSnippetPreset: SnippetPreset = {\n filename: 'JavaScript',\n snippet: {\n target: 'javascript',\n client: 'fetch',\n },\n language: 'javascript',\n};\n\nconst phpSnippetPreset: SnippetPreset = {\n filename: 'PHP',\n snippet: {\n target: 'php',\n client: 'curl',\n },\n language: 'php',\n};\n\nconst goSnippetPreset: SnippetPreset = {\n filename: 'Go',\n snippet: {\n target: 'go',\n },\n language: 'go',\n};\n\nconst javaSnippetPreset: SnippetPreset = {\n filename: 'Java',\n snippet: {\n target: 'java',\n },\n language: 'java',\n};\n\nconst rubySnippetPreset: SnippetPreset = {\n filename: 'Ruby',\n snippet: {\n target: 'ruby',\n },\n language: 'ruby',\n};\n\nexport const snippetPresets: SnippetPreset[] = [\n curlSnippetPreset,\n pythonSnippetPreset,\n javascriptSnippetPreset,\n phpSnippetPreset,\n goSnippetPreset,\n javaSnippetPreset,\n rubySnippetPreset,\n];\n\nexport const langToPresetMap: Record<string, SnippetPreset> = {\n bash: curlSnippetPreset,\n python: pythonSnippetPreset,\n javascript: javascriptSnippetPreset,\n php: phpSnippetPreset,\n go: goSnippetPreset,\n java: javaSnippetPreset,\n ruby: rubySnippetPreset,\n} satisfies { [k in ShikiSnippetLangs]?: SnippetPreset };\n\nexport const toShikiLang = (lang: string) => {\n const lowerLang = lang.toLowerCase();\n return userLangToShikiLang[lowerLang] ?? lowerLang;\n};\n"],"names":["userLangToShikiLang","shikiLangToDisplayLang","curlSnippetPreset","pythonSnippetPreset","javascriptSnippetPreset","phpSnippetPreset","goSnippetPreset","javaSnippetPreset","rubySnippetPreset","snippetPresets","langToPresetMap","toShikiLang","lang","lowerLang"],"mappings":"AA8BO,MAAMA,IAAyD;AAAA,EACpE,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAGaC,IAAiD;AAAA,EAC5D,MAAM;AAAA,EACN,GAAG;AAAA,EACH,MAAM;AAAA,EACN,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,MAAM;AACR,GAEMC,IAAmC;AAAA,EACvC,UAAU;AAAA,EACV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