@redocly/api-docs 0.1.0-next.2 → 0.1.0-next.4

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 (42) hide show
  1. package/lib/.tsbuildinfo +1 -1
  2. package/lib/adapters/openapi/items/operation/content.d.ts +9 -0
  3. package/lib/adapters/openapi/items/operation/content.js +1 -1
  4. package/lib/adapters/utils/markdoc.js +1 -1
  5. package/lib/components/ItemContent/hooks.js +1 -1
  6. package/lib/components/ItemContent/sections/BodySection.js +3 -3
  7. package/lib/components/ItemContent/sections/CallbacksSection.js +19 -19
  8. package/lib/components/ItemContent/sections/ParametersSection.js +2 -2
  9. package/lib/components/ItemContent/sections/ResponsesSection.js +8 -8
  10. package/lib/components/MessageLinksItem.js +1 -1
  11. package/lib/components/Schema/hooks/useSchemaFieldDeepLink.js +1 -1
  12. package/lib/components/Schema/styled.d.ts +1 -1
  13. package/lib/components/Schema/styled.js +3 -4
  14. package/lib/components/SideMenu/useMenuItems.js +1 -1
  15. package/lib/components/common/DeepLinkAnchor.js +1 -1
  16. package/lib/components/graphql/GraphQLGroupTypeList.js +1 -1
  17. package/lib/components/graphql/GraphQLReturnTypeDetails.js +1 -1
  18. package/lib/components/markdoc/Heading.d.ts +1 -1
  19. package/lib/components/markdoc/Heading.js +3 -3
  20. package/lib/components/markdoc/defaultMarkdocConfig.js +1 -1
  21. package/lib/components/panels/ExampleItem/CallbackPayloadItem.js +2 -2
  22. package/lib/components/panels/ReferencesPanelItem.js +1 -1
  23. package/lib/components/panels/asyncapi/MessageReferencesItem/MessageReferencesItem.js +1 -1
  24. package/lib/hoc/withRouter.js +1 -1
  25. package/lib/hooks/useApiDocsScroll.js +1 -1
  26. package/lib/hooks/useDeepLinkSection.d.ts +11 -4
  27. package/lib/hooks/useDeepLinkSection.js +1 -1
  28. package/lib/hooks/useHashLinkRedirect.js +1 -1
  29. package/lib/hooks/useIsExpanded.js +1 -1
  30. package/lib/hooks/useRouterHashBridge.js +1 -1
  31. package/lib/hooks/useScrollSpyUrlSync.js +1 -1
  32. package/lib/hooks/useVisitedChannelsTracker.js +1 -1
  33. package/lib/jotai/app.d.ts +0 -3
  34. package/lib/jotai/app.js +1 -1
  35. package/lib/jotai/itemStore.d.ts +1 -0
  36. package/lib/jotai/itemStore.js +1 -1
  37. package/lib/pages/EntryPage.js +1 -1
  38. package/lib/pages/GroupPage.js +1 -1
  39. package/lib/pages/NotFoundPage.js +1 -1
  40. package/lib/utils/deep-link.d.ts +22 -0
  41. package/lib/utils/deep-link.js +1 -1
  42. package/package.json +9 -9
@@ -1,3 +1,12 @@
1
1
  import type { ApiItemContent } from '../../../../types/content.js';
2
2
  import type { OperationInfo } from '../../../../types/openapi.js';
3
+ /**
4
+ * Callback ids in the legacy openapi-docs shape, `<name>/<verb>`, so links shared from it
5
+ * still resolve. One entry is emitted per url expression, so that pair can repeat within an
6
+ * operation — later duplicates take a `~<n>` suffix, which legacy lacked and collided on.
7
+ *
8
+ * The separator is deliberately not `/`: an id must never be a path-segment prefix of a
9
+ * sibling's, or hash matching would treat `<name>/<verb>` as also naming `<name>/<verb>~1`.
10
+ */
11
+ export declare function createCallbackIdFactory(): (name: string, httpVerb: string) => string;
3
12
  export declare function buildItemContent(operationInfo: OperationInfo, pageSlug: string): ApiItemContent;
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as ee}from"@redocly/config";import{contentType as je,itemVariant as Ne,nodeTypes as u,panelKind as le,schemaKind as H}from"../../../../types/common.js";import{readRbacScope as T,rbacProp as O,registerExample as te,registerSchema as K,resolveContent as pe,resolveRef as D}from"../../../helpers.js";import{applyIgnoreNamedSchemasDeep as Te}from"../../utils/applyIgnoreNamedSchemasDeep.js";import{isStatusCode as Pe}from"../../../../utils/status-code.js";import{parseMarkdown as F}from"../../../utils/parseMarkdown.js";import{extractDescriptionSegments as $e,resolveMarkdocHeadingIds as me}from"../../../utils/markdoc.js";import{getExtensionsForDisplay as ue}from"../../../../utils/extract-extensions.js";import{openApiContext as _}from"../../buildContext.js";import{buildCodeSampleSource as De}from"../../build-code-sample-source.js";import{mergeInMockServer as Be,pickOperationServers as He}from"../../utils/merge-mock-server.js";import{normalizePath as Ke,toRelativePath as Ee}from"../../../../utils/url.js";import{encodeJsonPointerSegment as B}from"../../../../utils/refPointer.js";import{hasOpenApiExampleValue as ge,resolveOpenApiExampleValue as ye}from"../../resolve-openapi-example-value.js";const se="request",ke="responses";function it(e,n){const{options:i,storeCtx:c,basePath:s}=_.get(),t=e.summary||e.operationId||e.pathName||"Unknown Operation",r=[],{feedback:y}=i,d=e.isWebhook||!1,p=[{nodeType:u.HEADER,level:2,label:t,badges:e["x-badges"],isWebhook:d,deprecated:e.deprecated,showPageActions:!0}],o=ue(e,i.showExtensions);Object.keys(o).length>0&&p.push({nodeType:u.EXTENSIONS,extensions:o}),r.push({nodeType:u.CONTAINER,children:p,panels:[]});const m=i.ignoreNamedSchemas,f=e["x-codeSamples"]?.map(({lang:a,label:x,source:h})=>({lang:a,label:x,source:h})),S=He(e.servers,c?.document?.servers),E=Be(S.filter(a=>typeof a?.url=="string"),i.mockServer).map(a=>{const x=T(a);return{url:a.url??"",name:a.name,description:typeof a.description=="string"?a.description:void 0,...a.isMockServer&&{isMockServer:!0},variables:a.variables&&Object.keys(a.variables).length>0?Object.fromEntries(Object.entries(a.variables).map(([h,M])=>[h,{default:M.default}])):void 0,...O(x)}}),b=Oe(e,m),R=Ee(n,s);let l=[];e.description&&(me(e.description,R,se),l=$e(e.description,i));const A=l.some(a=>a.kind==="schemaDefinition"),g=b.find(a=>a.nodeType===u.ITEM&&a.variant==="body"),v=Fe(e,m,d,R||void 0),j=g?.schemaId,q=g?.mediaTypes,N=g?.mediaTypeSchemas,$=T(g),C=[{children:[{kind:le.CODE_SAMPLE,source:v,definitionSamples:f?.length?f:void 0,isWebhook:d,hideReplay:e["x-hideReplay"]===!0,servers:E?.length?E:void 0,schemaId:j,exampleIds:g?.exampleIds,mediaTypes:q,mediaTypeSchemas:N,examples:g?.exampleIds?.map(()=>({}))??[]}],...O($)}];if(b.length>0||l.length>0)if(A){r.push({nodeType:u.CONTAINER,children:[{nodeType:u.HEADER,level:4,label:"Request",labelTranslationKey:"request",deepLinkSuffix:se}],panels:[]});for(const a of l)a.kind==="schemaDefinition"?r.push(a.node):r.push({nodeType:u.CONTAINER,children:[a.node],panels:[]});r.push({nodeType:u.CONTAINER,children:[...b],panels:C})}else r.push({nodeType:u.CONTAINER,children:[{nodeType:u.HEADER,level:4,label:"Request",labelTranslationKey:"request",deepLinkSuffix:se},...l.map(a=>a.node),...b],panels:C});else r.push({nodeType:u.CONTAINER,children:[{nodeType:u.HEADER,level:4,label:"Request",labelTranslationKey:"request",deepLinkSuffix:se},{nodeType:u.EMPTY_MESSAGE,label:"No request data",labelTranslationKey:"noRequestData"}],panels:C});if(e.responses){const a=Re(e,i,R,m);if(a){const x=a.responses?.some(k=>k.schemaId||(k.exampleIds?.length??0)>0),h=a?.responses?.map(k=>{const re=k[ee];return{code:k.code,schemaId:k.schemaId,exampleIds:k.exampleIds,mediaTypes:k.mediaTypes,mediaTypeContent:k.mediaTypeContent,...O(re)}}),M=[];x&&M.push({children:[{kind:le.RESPONSE,headerTitle:"Response",responseCodes:h,examples:[]}]});const U=T(e.responses);r.push({nodeType:u.CONTAINER,children:[{nodeType:u.HEADER,level:4,label:"Responses",labelTranslationKey:"responses",deepLinkSuffix:"responses"},a],panels:M.length>0?M:[],...O(U)})}}if(Array.isArray(e.callbacks)&&e.callbacks.length>0){r.push({nodeType:u.CONTAINER,children:[{nodeType:u.HEADER,level:4,label:"Callbacks",labelTranslationKey:"callbacks",deepLinkSuffix:"callbacks"}],panels:[]});let a=0;for(const x of e.callbacks)if(x.operations)for(const h of x.operations){const M=h.httpVerb??"post",U=`${x.name}/${M}/${a}`,k={pointer:e.pointer+"/callbacks/"+x.name+"/"+M,pathName:h.pathName??x.url??"",httpVerb:M,summary:h.summary,deprecated:h.deprecated,isWebhook:!1,isAdditionalOperation:!1,tags:[],parameters:h.parameters,requestBody:h.requestBody,responses:h.responses,servers:h.servers,security:h.security},re=Oe(k,m),he=Re(k,i,`${R}/callbacks/${U}`,m),oe=[...re];he&&oe.push(he);const ie=h.externalDocs,fe=ue(h,i.showExtensions),Ae={httpVerb:M,pathName:k.pathName,summary:k.summary,operationId:typeof h.operationId=="string"?h.operationId:void 0,description:h.description?F(h.description,i):void 0,deprecated:k.deprecated,callbackName:x.name,callbackId:U,externalDocs:ie?{url:ie.url,description:ie.description}:void 0,extensions:Object.keys(fe).length>0?fe:void 0,contentChildren:oe.length>0?oe:void 0},be=[];if(h.requestBody&&"content"in h.requestBody){const ce=c?.document??{},qe=D(ce,h.requestBody,m)??h.requestBody,ae=pe(ce,qe,m);if(ae){const xe=Object.keys(ae);let X=!1;const de={};for(const[W,P]of Object.entries(ae)){let Q;if(P.schema){const V=P.schema;Q=K(c.schemaStore,c.hashIndex,{kind:H.JSON_SCHEMA,data:V})}const G=`${k.pointer}/requestBody/content/${B(W)}`.replace(/^\//,""),L=[];if(P.example!==void 0){const V=te(c.exampleStore,{value:P.example,id:`${G}/example`});L.push(V),X=!0}if(P.examples)for(const[V,Ie]of Object.entries(P.examples)){const Z=D(ce,Ie,m);if(Z&&ge(Z)){const Me=te(c.exampleStore,{value:ye(Z),summary:Z.summary??V,id:`${G}/examples/${B(V)}`});L.push(Me),X=!0}}de[W]={schemaId:Q,exampleIds:L.length>0?L:void 0},Q&&(X=!0)}const Se=h["x-codeSamples"];if(X||(Se?.length??0)>0){const W=h.servers?.filter(P=>P.url).map(({url:P,name:Q,description:G,variables:L})=>({url:P,name:Q,description:G,variables:L}));be.push({children:[{kind:le.CALLBACK_PAYLOAD,callbackName:U,path:k.pathName,httpVerb:M,servers:W?.length?W:void 0,definitionSamples:Se,mediaTypes:xe.length>0?xe:void 0,mediaTypeSchemas:Object.keys(de).length>0?de:void 0,examples:[]}]})}}}const ve=T(x);r.push({nodeType:u.CONTAINER,children:[{nodeType:u.ITEM,variant:"callback",callback:Ae,pointer:e.pointer+"/callbacks"}],panels:be,...O(ve)}),a++}}y?.hide!==!0&&r.push({nodeType:u.CONTAINER,children:[{nodeType:u.FEEDBACK,pageSlug:Ke(Ee(n,s))}],panels:[]});const w=b.some(a=>{const x=a;return x.variant==="body"&&((x.exampleIds?.length??0)>0||!!x.schemaId)})||(f?.length??0)>0;return{contentType:je.ITEM,itemVariant:Ne.HTTP_ITEM,seo:e["x-seo"],meta:{sourceId:e.operationId,name:t,deprecated:e.deprecated,isWebhook:e.isWebhook||!1,pointer:e.pointer,hasSamples:w},children:r}}function _e(e,n,i){const c=D(n,e,i)??e,{$ref:s,...t}=e,r=typeof s=="string"?{...c,...t}:c;return Te(r,i)}function Y(e,n,i){if(!e||typeof e!="object")return;const c=e,s=D(n,c,i)??c;return Te(s,i)}function we(e,n,i){if(!e||typeof e!="object")return;const c=T(e),s={},t=[];for(const[r,y]of Object.entries(e)){if(r===ee)continue;const d=D(n,y,i)??y,p=d.content,o=p?p[Object.keys(p)[0]]:void 0,m=d.schema??o?.schema??o?.itemSchema,f=Y(m,n,i);if(!f)continue;const S=Ce(d.examples,n,i),E=T(y)??T(d)??c;s[r]={...f,...d.description!==void 0&&{description:d.description},...d.example!==void 0&&{example:d.example},...S&&{examples:S},...O(E)},d.required&&t.push(r)}if(Object.keys(s).length!==0)return{type:"object",properties:s,...t.length>0?{required:t}:{}}}function Le(e){if(typeof e=="string"||e&&typeof e=="object"&&"$$mdtype"in e||Array.isArray(e)&&e.length>0&&e.every(n=>!!n&&typeof n=="object"&&"$$mdtype"in n))return e}function z(e,n){const{storeCtx:i,options:c}=_.get(),s=i.document;return e.map(t=>{const r=t.schema;let y={};if(r&&typeof r=="object")y=r;else if(t.content&&typeof t.content=="object"){const S=t.content,E=Object.keys(S)[0],b=E?S[E]?.schema:void 0;b&&typeof b=="object"&&(y=b)}const d=K(i.schemaStore,i.hashIndex,{kind:H.JSON_SCHEMA,data:y}),p=t["x-badges"],o=y["x-badges"],m=Array.isArray(p)?p:Array.isArray(o)?o:void 0,f=ue(t,c.showExtensions);return{name:String(t.name??""),in:typeof t.in=="string"?t.in:void 0,schemaId:d,description:Le(t.description),required:t.required===!0?!0:void 0,deprecated:t.deprecated===!0?!0:void 0,example:t.example,examples:Ce(t.examples,s,n),...m?.length?{badges:m}:{},...Object.keys(f).length?{extensions:f}:{},...O(T(t))}})}function Ce(e,n,i){if(!e||typeof e!="object")return;const c={};for(const[s,t]of Object.entries(e)){if(!t||typeof t!="object")continue;const r=D(n,t,i)??t;if(!ge(r))continue;const y=ye(r);c[s]={...typeof r.summary=="string"&&{summary:r.summary},...typeof r.description=="string"&&{description:r.description},...y!==void 0&&{value:typeof y=="string"?y:JSON.stringify(y)}}}return Object.keys(c).length>0?c:void 0}function Oe(e,n){const{storeCtx:i,options:c}=_.get(),s=[],t=i.document,r=Ve(e);if(r&&s.push(r),e.parameters&&Array.isArray(e.parameters)){const d=e.parameters.map(l=>_e(l,t,n)),p=d.filter(l=>l.in==="header"),o=d.filter(l=>l.in==="query"),m=d.filter(l=>l.in==="path"),f=d.filter(l=>l.in==="cookie"),S=d.filter(l=>l.in==="querystring"),E=S.filter(l=>!l.content||typeof l.content!="object"),b=S.filter(l=>l.content&&typeof l.content=="object"),R=S.length>0;m.length>0&&s.push({nodeType:u.ITEM,variant:"path",label:"Path",labelTranslationKey:"path",parameters:z(m,n),pointer:e.pointer+"/parameters"}),o.length>0&&!R&&s.push({nodeType:u.ITEM,variant:"query",label:"Query",labelTranslationKey:"query",parameters:z(o,n),pointer:e.pointer+"/parameters"}),E.length>0&&s.push({nodeType:u.ITEM,variant:"querystring",label:"Query String",labelTranslationKey:"querystring",parameters:z(E,n),pointer:e.pointer+"/parameters"});for(const l of b){const A=l.content,g=Object.keys(A),v={};for(const $ of g){const C=A[$];if(!C)continue;let I;const J=C.itemSchema,w=C.schema??J,a=Y(w,t,n);a&&(I=K(i.schemaStore,i.hashIndex,{kind:H.JSON_SCHEMA,data:a}));const x=ne(C,n);v[$]={schemaId:I,exampleIds:x,...O(T(w))}}const j=g[0],q=j?v[j]:void 0,N=F(l.description,c);s.push({nodeType:u.ITEM,variant:"querystring-body",label:String(l.name??""),required:l.required===!0?!0:void 0,mediaTypes:g.length>0?g:void 0,mediaTypeSchemas:Object.keys(v).length>0?v:void 0,schemaId:q?.schemaId,exampleIds:q?.exampleIds,pointer:e.pointer+"/parameters",...N!==void 0?{description:N}:{},...O(T(l))})}f.length>0&&s.push({nodeType:u.ITEM,variant:"cookies",label:"Cookies",labelTranslationKey:"cookie",parameters:z(f,n),pointer:e.pointer+"/parameters"}),p.length>0&&s.push({nodeType:u.ITEM,variant:"headers",label:"Headers",labelTranslationKey:"header",parameters:z(p,n),pointer:e.pointer+"/parameters"})}if(e.requestBody){const y=D(t,e.requestBody,n)??e.requestBody,d=pe(t,y,n),p=d?Object.keys(d):void 0;let o,m,f;if(d&&p){f={};for(const l of p){const A=d[l];if(!A)continue;let g;const v=A.itemSchema,j=A.schema??v,q=Y(j,t,n);q&&(g=K(i.schemaStore,i.hashIndex,{kind:H.JSON_SCHEMA,data:q}));const N=ne(A,n,`${e.pointer}/requestBody/content/${B(l)}`);f[l]={schemaId:g,exampleIds:N,...O(T(j))}}const b=p[0],R=b?f[b]:void 0;o=R?.schemaId,m=R?.exampleIds}const S=F(y.description,c),E=T(e.requestBody)??T(y);s.push({nodeType:u.ITEM,variant:"body",label:"Request Body",labelTranslationKey:"body",required:y.required,mediaTypes:p,mediaTypeSchemas:f,schemaId:o,exampleIds:m,pointer:e.pointer+"/requestBody",...S!==void 0?{description:S}:{},...O(E)})}return s}function Re(e,n,i,c){if(!e.responses)return;const{storeCtx:s}=_.get(),t=s?.document??{},r=e.responses,d=Object.entries(r).filter(([p])=>Pe(p)).map(([p,o])=>{const m=D(t,o,c)??o;let f=T(o)??T(m);const S=pe(t,m,c),E=S?Object.keys(S):[],b=E[0],R=b&&S?S[b]:void 0;let l,A,g,v;if(S&&E.length>0){v={};for(const C of E){const I=S[C];if(!I)continue;let J;const w=I.itemSchema,a=I.schema??w,x=Y(a,t,c);x&&(J=K(s.schemaStore,s.hashIndex,{kind:H.JSON_SCHEMA,data:x}));const h=ne(I,c,`${e.pointer}/responses/${B(p)}/content/${B(C)}`);v[C]={schemaId:J,exampleIds:h,...O(T(a))}}const $=b?v[b]:void 0;l=$?.schemaId,A=$?.exampleIds}else if(R){const $=R.itemSchema,C=R.schema??$,I=Y(C,t,c);I&&(f=f??T(C),l=K(s.schemaStore,s.hashIndex,{kind:H.JSON_SCHEMA,data:I})),A=ne(R,c,b?`${e.pointer}/responses/${B(p)}/content/${B(b)}`:void 0)}const j=we(m.headers,t,c);j&&(g=K(s.schemaStore,s.hashIndex,{kind:H.JSON_SCHEMA,data:j}));let q;m.description&&(q=F(m.description,n),me(q??[],i,`${ke}/${p}`));const N=m["x-summary"]?F(m["x-summary"],n):void 0;return N&&me(N,i,`${ke}/${p}/summary`),{code:p,summary:N,description:q,mediaType:b,mediaTypes:E.length>0?E:void 0,mediaTypeContent:v,schemaId:l,exampleIds:A,headers:m.headers,headerSchemaId:g,...O(f)}});return{nodeType:u.ITEM,variant:"responses",responses:d,pointer:e.pointer+"/responses"}}function ne(e,n,i){const{storeCtx:c}=_.get(),s=[],t=c.document,r=i?.replace(/^\//,"");if(e.example!==void 0){const y=te(c.exampleStore,{value:e.example,...r&&{id:`${r}/example`}});s.push(y)}if(e.examples&&typeof e.examples=="object"){const y=T(e.examples);for(const[d,p]of Object.entries(e.examples)){if(d===ee||!p||typeof p!="object")continue;const o=D(t,p,n)??p,m=T(p)??T(o)??y,f=te(c.exampleStore,{value:ye(o),key:d,summary:typeof o.summary=="string"?o.summary:d,description:typeof o.description=="string"?o.description:void 0,externalValue:typeof o.externalValue=="string"?o.externalValue:void 0,...O(m),...r&&{id:`${r}/examples/${B(d)}`}});s.push(f)}}return s.length>0?s:void 0}function Ve(e){const{storeCtx:n,options:i}=_.get();if(!e.security||!Array.isArray(e.security)||e.security.length===0)return;const c=e.security.map(s=>{const t=Object.entries(s);if(t.length===0)return null;const r=n?.document?.components?.securitySchemes,y=t.map(([d,p])=>{const o=n?.securitySchemeStore[d],m=T(r?.[d])??o?.[ee];return{name:d,scopes:Array.isArray(p)?p:void 0,type:o?.type,scheme:o?.scheme,bearerFormat:o?.bearerFormat,in:o?.in,paramName:o?.paramName,description:o?.description?F(o.description,i):o?.description,openIdConnectUrl:o?.openIdConnectUrl,oauth2MetadataUrl:o?.oauth2MetadataUrl,deprecated:o?.deprecated,flows:o?.flows,...O(m)}}).filter(d=>d.name);return y.length>0?{schemes:y}:null}).filter(s=>s!==null);if(c.length!==0)return{nodeType:u.SECURITY,requirements:c}}function Fe(e,n,i,c){const{storeCtx:s,options:t}=_.get();if(!s)throw new Error("OpenAPI store context is not initialized");return De(e,s,t,n,i,c)}export{it as buildItemContent};
1
+ import{REDOCLY_TEAMS_RBAC as ee}from"@redocly/config";import{contentType as Ne,itemVariant as $e,nodeTypes as u,panelKind as me,schemaKind as H}from"../../../../types/common.js";import{readRbacScope as T,rbacProp as R,registerExample as te,registerSchema as _,resolveContent as ue,resolveRef as D}from"../../../helpers.js";import{applyIgnoreNamedSchemasDeep as Ee}from"../../utils/applyIgnoreNamedSchemasDeep.js";import{isStatusCode as Pe}from"../../../../utils/status-code.js";import{parseMarkdown as V}from"../../../utils/parseMarkdown.js";import{extractDescriptionSegments as De,resolveMarkdocHeadingIds as se}from"../../../utils/markdoc.js";import{getExtensionsForDisplay as ye}from"../../../../utils/extract-extensions.js";import{openApiContext as K}from"../../buildContext.js";import{buildCodeSampleSource as Be}from"../../build-code-sample-source.js";import{mergeInMockServer as He,pickOperationServers as _e}from"../../utils/merge-mock-server.js";import{normalizePath as Ke,toRelativePath as ge}from"../../../../utils/url.js";import{encodeJsonPointerSegment as B}from"../../../../utils/refPointer.js";import{hasOpenApiExampleValue as ke,resolveOpenApiExampleValue as he}from"../../resolve-openapi-example-value.js";const ne="request",Ce="responses",we="callbacks";function Le(){const e=new Map;return(r,o)=>{const n=`${r}/${o}`,t=e.get(n)??0;return e.set(n,t+1),t===0?n:`${n}~${t}`}}function dt(e,r){const{options:o,storeCtx:n,basePath:t}=K.get(),s=e.summary||e.operationId||e.pathName||"Unknown Operation",c=[],{feedback:y}=o,a=e.isWebhook||!1,p=[{nodeType:u.HEADER,level:2,label:s,badges:e["x-badges"],isWebhook:a,deprecated:e.deprecated,showPageActions:!0}],i=ye(e,o.showExtensions);Object.keys(i).length>0&&p.push({nodeType:u.EXTENSIONS,extensions:i}),c.push({nodeType:u.CONTAINER,children:p,panels:[]});const m=o.ignoreNamedSchemas,f=e["x-codeSamples"]?.map(({lang:d,label:x,source:h})=>({lang:d,label:x,source:h})),S=_e(e.servers,n?.document?.servers),E=He(S.filter(d=>typeof d?.url=="string"),o.mockServer).map(d=>{const x=T(d);return{url:d.url??"",name:d.name,description:typeof d.description=="string"?d.description:void 0,...d.isMockServer&&{isMockServer:!0},variables:d.variables&&Object.keys(d.variables).length>0?Object.fromEntries(Object.entries(d.variables).map(([h,M])=>[h,{default:M.default}])):void 0,...R(x)}}),b=Re(e,m),C=ge(r,t);let l=[];e.description&&(se(e.description,C,ne),l=De(e.description,o));const A=l.some(d=>d.kind==="schemaDefinition"),g=b.find(d=>d.nodeType===u.ITEM&&d.variant==="body"),v=We(e,m,a,C||void 0),j=g?.schemaId,I=g?.mediaTypes,N=g?.mediaTypeSchemas,P=T(g),O=[{children:[{kind:me.CODE_SAMPLE,source:v,definitionSamples:f?.length?f:void 0,isWebhook:a,hideReplay:e["x-hideReplay"]===!0,servers:E?.length?E:void 0,schemaId:j,exampleIds:g?.exampleIds,mediaTypes:I,mediaTypeSchemas:N,examples:g?.exampleIds?.map(()=>({}))??[]}],...R(P)}];if(b.length>0||l.length>0)if(A){c.push({nodeType:u.CONTAINER,children:[{nodeType:u.HEADER,level:4,label:"Request",labelTranslationKey:"request",deepLinkSuffix:ne}],panels:[]});for(const d of l)d.kind==="schemaDefinition"?c.push(d.node):c.push({nodeType:u.CONTAINER,children:[d.node],panels:[]});c.push({nodeType:u.CONTAINER,children:[...b],panels:O})}else c.push({nodeType:u.CONTAINER,children:[{nodeType:u.HEADER,level:4,label:"Request",labelTranslationKey:"request",deepLinkSuffix:ne},...l.map(d=>d.node),...b],panels:O});else c.push({nodeType:u.CONTAINER,children:[{nodeType:u.HEADER,level:4,label:"Request",labelTranslationKey:"request",deepLinkSuffix:ne},{nodeType:u.EMPTY_MESSAGE,label:"No request data",labelTranslationKey:"noRequestData"}],panels:O});if(e.responses){const d=Ae(e,o,C,m);if(d){const x=d.responses?.some(k=>k.schemaId||(k.exampleIds?.length??0)>0),h=d?.responses?.map(k=>{const oe=k[ee];return{code:k.code,schemaId:k.schemaId,exampleIds:k.exampleIds,mediaTypes:k.mediaTypes,mediaTypeContent:k.mediaTypeContent,...R(oe)}}),M=[];x&&M.push({children:[{kind:me.RESPONSE,headerTitle:"Response",responseCodes:h,examples:[]}]});const L=T(e.responses);c.push({nodeType:u.CONTAINER,children:[{nodeType:u.HEADER,level:4,label:"Responses",labelTranslationKey:"responses",deepLinkSuffix:"responses"},d],panels:M.length>0?M:[],...R(L)})}}if(Array.isArray(e.callbacks)&&e.callbacks.length>0){c.push({nodeType:u.CONTAINER,children:[{nodeType:u.HEADER,level:4,label:"Callbacks",labelTranslationKey:"callbacks",deepLinkSuffix:"callbacks"}],panels:[]});const d=Le();for(const x of e.callbacks)if(x.operations)for(const h of x.operations){const M=h.httpVerb??"post",L=d(x.name,M),k={pointer:e.pointer+"/callbacks/"+x.name+"/"+M,pathName:h.pathName??x.url??"",httpVerb:M,summary:h.summary,deprecated:h.deprecated,isWebhook:!1,isAdditionalOperation:!1,tags:[],parameters:h.parameters,requestBody:h.requestBody,responses:h.responses,servers:h.servers,security:h.security},oe=Re(k,m),fe=Ae(k,o,`${C}/callbacks/${L}`,m),ce=[...oe];fe&&ce.push(fe);const ie=h.externalDocs,be=ye(h,o.showExtensions);let ae;h.description&&(ae=V(h.description,o),se(ae??[],C,`${we}/${L}`));const ve={httpVerb:M,pathName:k.pathName,summary:k.summary,operationId:typeof h.operationId=="string"?h.operationId:void 0,description:ae,deprecated:k.deprecated,callbackName:x.name,callbackId:L,externalDocs:ie?{url:ie.url,description:ie.description}:void 0,extensions:Object.keys(be).length>0?be:void 0,contentChildren:ce.length>0?ce:void 0},xe=[];if(h.requestBody&&"content"in h.requestBody){const de=n?.document??{},qe=D(de,h.requestBody,m)??h.requestBody,le=ue(de,qe,m);if(le){const Se=Object.keys(le);let z=!1;const pe={};for(const[W,$]of Object.entries(le)){let Q;if($.schema){const U=$.schema;Q=_(n.schemaStore,n.hashIndex,{kind:H.JSON_SCHEMA,data:U})}const G=`${k.pointer}/requestBody/content/${B(W)}`.replace(/^\//,""),F=[];if($.example!==void 0){const U=te(n.exampleStore,{value:$.example,id:`${G}/example`});F.push(U),z=!0}if($.examples)for(const[U,Me]of Object.entries($.examples)){const Z=D(de,Me,m);if(Z&&ke(Z)){const je=te(n.exampleStore,{value:he(Z),summary:Z.summary??U,id:`${G}/examples/${B(U)}`});F.push(je),z=!0}}pe[W]={schemaId:Q,exampleIds:F.length>0?F:void 0},Q&&(z=!0)}const Te=h["x-codeSamples"];if(z||(Te?.length??0)>0){const W=h.servers?.filter($=>$.url).map(({url:$,name:Q,description:G,variables:F})=>({url:$,name:Q,description:G,variables:F}));xe.push({children:[{kind:me.CALLBACK_PAYLOAD,callbackName:L,path:k.pathName,httpVerb:M,servers:W?.length?W:void 0,definitionSamples:Te,mediaTypes:Se.length>0?Se:void 0,mediaTypeSchemas:Object.keys(pe).length>0?pe:void 0,examples:[]}]})}}}const Ie=T(x);c.push({nodeType:u.CONTAINER,children:[{nodeType:u.ITEM,variant:"callback",callback:ve,pointer:e.pointer+"/callbacks"}],panels:xe,...R(Ie)})}}y?.hide!==!0&&c.push({nodeType:u.CONTAINER,children:[{nodeType:u.FEEDBACK,pageSlug:Ke(ge(r,t))}],panels:[]});const w=b.some(d=>{const x=d;return x.variant==="body"&&((x.exampleIds?.length??0)>0||!!x.schemaId)})||(f?.length??0)>0;return{contentType:Ne.ITEM,itemVariant:$e.HTTP_ITEM,seo:e["x-seo"],meta:{sourceId:e.operationId,name:s,deprecated:e.deprecated,isWebhook:e.isWebhook||!1,pointer:e.pointer,hasSamples:w},children:c}}function Fe(e,r,o){const n=D(r,e,o)??e,{$ref:t,...s}=e,c=typeof t=="string"?{...n,...s}:n;return Ee(c,o)}function X(e,r,o){if(!e||typeof e!="object")return;const n=e,t=D(r,n,o)??n;return Ee(t,o)}function Ue(e,r,o){if(!e||typeof e!="object")return;const n=T(e),t={},s=[];for(const[c,y]of Object.entries(e)){if(c===ee)continue;const a=D(r,y,o)??y,p=a.content,i=p?p[Object.keys(p)[0]]:void 0,m=a.schema??i?.schema??i?.itemSchema,f=X(m,r,o);if(!f)continue;const S=Oe(a.examples,r,o),E=T(y)??T(a)??n;t[c]={...f,...a.description!==void 0&&{description:a.description},...a.example!==void 0&&{example:a.example},...S&&{examples:S},...R(E)},a.required&&s.push(c)}if(Object.keys(t).length!==0)return{type:"object",properties:t,...s.length>0?{required:s}:{}}}function Ve(e){if(typeof e=="string"||e&&typeof e=="object"&&"$$mdtype"in e||Array.isArray(e)&&e.length>0&&e.every(r=>!!r&&typeof r=="object"&&"$$mdtype"in r))return e}function Y(e,r){const{storeCtx:o,options:n}=K.get(),t=o.document;return e.map(s=>{const c=s.schema;let y={};if(c&&typeof c=="object")y=c;else if(s.content&&typeof s.content=="object"){const S=s.content,E=Object.keys(S)[0],b=E?S[E]?.schema:void 0;b&&typeof b=="object"&&(y=b)}const a=_(o.schemaStore,o.hashIndex,{kind:H.JSON_SCHEMA,data:y}),p=s["x-badges"],i=y["x-badges"],m=Array.isArray(p)?p:Array.isArray(i)?i:void 0,f=ye(s,n.showExtensions);return{name:String(s.name??""),in:typeof s.in=="string"?s.in:void 0,schemaId:a,description:Ve(s.description),required:s.required===!0?!0:void 0,deprecated:s.deprecated===!0?!0:void 0,example:s.example,examples:Oe(s.examples,t,r),...m?.length?{badges:m}:{},...Object.keys(f).length?{extensions:f}:{},...R(T(s))}})}function Oe(e,r,o){if(!e||typeof e!="object")return;const n={};for(const[t,s]of Object.entries(e)){if(!s||typeof s!="object")continue;const c=D(r,s,o)??s;if(!ke(c))continue;const y=he(c);n[t]={...typeof c.summary=="string"&&{summary:c.summary},...typeof c.description=="string"&&{description:c.description},...y!==void 0&&{value:typeof y=="string"?y:JSON.stringify(y)}}}return Object.keys(n).length>0?n:void 0}function Re(e,r){const{storeCtx:o,options:n}=K.get(),t=[],s=o.document,c=Je(e);if(c&&t.push(c),e.parameters&&Array.isArray(e.parameters)){const a=e.parameters.map(l=>Fe(l,s,r)),p=a.filter(l=>l.in==="header"),i=a.filter(l=>l.in==="query"),m=a.filter(l=>l.in==="path"),f=a.filter(l=>l.in==="cookie"),S=a.filter(l=>l.in==="querystring"),E=S.filter(l=>!l.content||typeof l.content!="object"),b=S.filter(l=>l.content&&typeof l.content=="object"),C=S.length>0;m.length>0&&t.push({nodeType:u.ITEM,variant:"path",label:"Path",labelTranslationKey:"path",parameters:Y(m,r),pointer:e.pointer+"/parameters"}),i.length>0&&!C&&t.push({nodeType:u.ITEM,variant:"query",label:"Query",labelTranslationKey:"query",parameters:Y(i,r),pointer:e.pointer+"/parameters"}),E.length>0&&t.push({nodeType:u.ITEM,variant:"querystring",label:"Query String",labelTranslationKey:"querystring",parameters:Y(E,r),pointer:e.pointer+"/parameters"});for(const l of b){const A=l.content,g=Object.keys(A),v={};for(const P of g){const O=A[P];if(!O)continue;let q;const J=O.itemSchema,w=O.schema??J,d=X(w,s,r);d&&(q=_(o.schemaStore,o.hashIndex,{kind:H.JSON_SCHEMA,data:d}));const x=re(O,r);v[P]={schemaId:q,exampleIds:x,...R(T(w))}}const j=g[0],I=j?v[j]:void 0,N=V(l.description,n);t.push({nodeType:u.ITEM,variant:"querystring-body",label:String(l.name??""),required:l.required===!0?!0:void 0,mediaTypes:g.length>0?g:void 0,mediaTypeSchemas:Object.keys(v).length>0?v:void 0,schemaId:I?.schemaId,exampleIds:I?.exampleIds,pointer:e.pointer+"/parameters",...N!==void 0?{description:N}:{},...R(T(l))})}f.length>0&&t.push({nodeType:u.ITEM,variant:"cookies",label:"Cookies",labelTranslationKey:"cookie",parameters:Y(f,r),pointer:e.pointer+"/parameters"}),p.length>0&&t.push({nodeType:u.ITEM,variant:"headers",label:"Headers",labelTranslationKey:"header",parameters:Y(p,r),pointer:e.pointer+"/parameters"})}if(e.requestBody){const y=D(s,e.requestBody,r)??e.requestBody,a=ue(s,y,r),p=a?Object.keys(a):void 0;let i,m,f;if(a&&p){f={};for(const l of p){const A=a[l];if(!A)continue;let g;const v=A.itemSchema,j=A.schema??v,I=X(j,s,r);I&&(g=_(o.schemaStore,o.hashIndex,{kind:H.JSON_SCHEMA,data:I}));const N=re(A,r,`${e.pointer}/requestBody/content/${B(l)}`);f[l]={schemaId:g,exampleIds:N,...R(T(j))}}const b=p[0],C=b?f[b]:void 0;i=C?.schemaId,m=C?.exampleIds}const S=V(y.description,n),E=T(e.requestBody)??T(y);t.push({nodeType:u.ITEM,variant:"body",label:"Request Body",labelTranslationKey:"body",required:y.required,mediaTypes:p,mediaTypeSchemas:f,schemaId:i,exampleIds:m,pointer:e.pointer+"/requestBody",...S!==void 0?{description:S}:{},...R(E)})}return t}function Ae(e,r,o,n){if(!e.responses)return;const{storeCtx:t}=K.get(),s=t?.document??{},c=e.responses,a=Object.entries(c).filter(([p])=>Pe(p)).map(([p,i])=>{const m=D(s,i,n)??i;let f=T(i)??T(m);const S=ue(s,m,n),E=S?Object.keys(S):[],b=E[0],C=b&&S?S[b]:void 0;let l,A,g,v;if(S&&E.length>0){v={};for(const O of E){const q=S[O];if(!q)continue;let J;const w=q.itemSchema,d=q.schema??w,x=X(d,s,n);x&&(J=_(t.schemaStore,t.hashIndex,{kind:H.JSON_SCHEMA,data:x}));const h=re(q,n,`${e.pointer}/responses/${B(p)}/content/${B(O)}`);v[O]={schemaId:J,exampleIds:h,...R(T(d))}}const P=b?v[b]:void 0;l=P?.schemaId,A=P?.exampleIds}else if(C){const P=C.itemSchema,O=C.schema??P,q=X(O,s,n);q&&(f=f??T(O),l=_(t.schemaStore,t.hashIndex,{kind:H.JSON_SCHEMA,data:q})),A=re(C,n,b?`${e.pointer}/responses/${B(p)}/content/${B(b)}`:void 0)}const j=Ue(m.headers,s,n);j&&(g=_(t.schemaStore,t.hashIndex,{kind:H.JSON_SCHEMA,data:j}));let I;m.description&&(I=V(m.description,r),se(I??[],o,`${Ce}/${p}`));const N=m["x-summary"]?V(m["x-summary"],r):void 0;return N&&se(N,o,`${Ce}/${p}/summary`),{code:p,summary:N,description:I,mediaType:b,mediaTypes:E.length>0?E:void 0,mediaTypeContent:v,schemaId:l,exampleIds:A,headers:m.headers,headerSchemaId:g,...R(f)}});return{nodeType:u.ITEM,variant:"responses",responses:a,pointer:e.pointer+"/responses"}}function re(e,r,o){const{storeCtx:n}=K.get(),t=[],s=n.document,c=o?.replace(/^\//,"");if(e.example!==void 0){const y=te(n.exampleStore,{value:e.example,...c&&{id:`${c}/example`}});t.push(y)}if(e.examples&&typeof e.examples=="object"){const y=T(e.examples);for(const[a,p]of Object.entries(e.examples)){if(a===ee||!p||typeof p!="object")continue;const i=D(s,p,r)??p,m=T(p)??T(i)??y,f=te(n.exampleStore,{value:he(i),key:a,summary:typeof i.summary=="string"?i.summary:a,description:typeof i.description=="string"?i.description:void 0,externalValue:typeof i.externalValue=="string"?i.externalValue:void 0,...R(m),...c&&{id:`${c}/examples/${B(a)}`}});t.push(f)}}return t.length>0?t:void 0}function Je(e){const{storeCtx:r,options:o}=K.get();if(!e.security||!Array.isArray(e.security)||e.security.length===0)return;const n=e.security.map(t=>{const s=Object.entries(t);if(s.length===0)return null;const c=r?.document?.components?.securitySchemes,y=s.map(([a,p])=>{const i=r?.securitySchemeStore[a],m=T(c?.[a])??i?.[ee];return{name:a,scopes:Array.isArray(p)?p:void 0,type:i?.type,scheme:i?.scheme,bearerFormat:i?.bearerFormat,in:i?.in,paramName:i?.paramName,description:i?.description?V(i.description,o):i?.description,openIdConnectUrl:i?.openIdConnectUrl,oauth2MetadataUrl:i?.oauth2MetadataUrl,deprecated:i?.deprecated,flows:i?.flows,...R(m)}}).filter(a=>a.name);return y.length>0?{schemes:y}:null}).filter(t=>t!==null);if(n.length!==0)return{nodeType:u.SECURITY,requirements:n}}function We(e,r,o,n){const{storeCtx:t,options:s}=K.get();if(!t)throw new Error("OpenAPI store context is not initialized");return Be(e,t,s,r,o,n)}export{dt as buildItemContent,Le as createCallbackIdFactory};
@@ -1 +1 @@
1
- import{contentType as D,itemVariant as R,nodeTypes as l}from"../../types/common.js";import{safeSlugify as x}from"../../utils/string.js";import{parseMarkdown as p}from"./parseMarkdown.js";import{isPlainText as C}from"./isPlainText.js";import{joinWithSeparator as a}from"../../utils/url.js";import{buildDeepLinkUrl as v}from"../../utils/deep-link.js";import{getDOMPurify as N}from"./dompurify.js";function O(t){return t.type==="tag"&&t.tag==="schemaDefinition"}const E=/^[ \t]{0,3}#{1,6}[ \t]/m;function k(t){const n=t.search(E);return n===-1?t:t.slice(0,n)}function X(t,n){if(typeof t=="string"){const i=k(t).trim();if(C(i))return i}const e=p(t,n);if(!e)return;if(typeof e=="string")return e;if(Array.isArray(e)){const i=e.findIndex(o=>o.type==="heading");return i===-1?e:e.slice(0,i)}if(!e.children||!Array.isArray(e.children))return;const r=e.children.findIndex(i=>i.type==="heading");return r===-1?[e]:(e.children=e.children.slice(0,r),[e])}function Y(t,n,{sliceAtFirstHeading:e=!1}={}){if(typeof t=="string"&&e){const u=k(t).trim();if(C(u))return[{kind:"markdoc",node:{nodeType:l.MARKDOC,content:u}}]}const r=p(t,n);if(!r)return[];if(typeof r=="string")return[{kind:"markdoc",node:{nodeType:l.MARKDOC,content:r}}];let i=Array.isArray(r)?r:r.children??[];if(e){const u=i.findIndex(d=>d.type==="heading");u!==-1&&(i=i.slice(0,u))}const o=[];let c=[];const f=()=>{c.length>0&&(o.push({kind:"markdoc",node:{nodeType:l.MARKDOC,content:c}}),c=[])};for(const u of i)O(u)?(f(),o.push({kind:"schemaDefinition",node:{nodeType:l.MARKDOC,content:[u]}})):c.push(u);return f(),o}function L(t,n,e){const r=t.toLowerCase(),i=r.startsWith("section/")?r.slice(8):r,o=n.toLowerCase();let c=i!==o?i:"";return e&&(c=a(e,c)),c}function $(t,n,e){if(typeof t=="string")return;const r=o=>{if(typeof o.attributes?.content=="string")return o.attributes.content;for(const c of o.children??[]){const f=r(c);if(f)return f}},i=o=>{if(o.type==="heading"&&o.attributes?.level){const c=o.attributes.id?o.attributes.id.toLowerCase():x(r(o)||"").toLowerCase(),f=L(c,n,e);o.attributes.id=a(n,f).toLowerCase(),o.attributes.deepLinkHash=v("",n,f)}for(const c of o.children??[])i(c)};if(Array.isArray(t))for(const o of t)i(o);else i(t)}function _(t,n,e,r){const i=p(t,n);if(!i)return[];if(typeof i=="string")return[];const o=[];let c;const f=(s,m,w=o,h,A)=>{s=K(s);const I=A!==void 0;let y;h.attributes.id?y=h.attributes.id:I||r?y=x(s):y=`section/${x(s)}`;const T=a(I?A:e,y).toLowerCase();h.attributes.id=T;const b={id:T,name:s,level:m,items:[],ast:[h]};return w.push(b),b},u=s=>{if(typeof s?.attributes?.content=="string")return s.attributes.content;if(s?.children)return u(s.children[0])},d=s=>{const m=u(s)||"";s.type==="heading"&&s.attributes?.level===1?c=f(m,s.attributes.level,void 0,s):s.attributes?.level?f(m,s.attributes.level,c?.items,s,c?.id):c?.items?.length?c.items[c.items.length-1]?.ast?.push(s):o.length&&o[o.length-1]?.ast?.push(s)};if(Array.isArray(i))for(const s of i)d(s);else if(i.children)for(const s of i.children)d(s);return o}function H({heading:t,basePath:n}){const e=t.items.length>0,r=a(n,t.id).toLowerCase(),i=e?t.items.map(o=>H({heading:o,basePath:n})):[];return{type:e?"group":"link",label:t.name,link:r,routeSlug:r,items:e?i:void 0,content:W(t)}}function J(t,n,e){const r=[],i=[];for(const o of _(t,e,"")){const{item:c,children:f}=M(o,n);r.push(c),i.push(...f)}return{sectionItems:r,sectionChildren:i}}function M(t,n){const e=a(n,t.id),r=t.items.length>0,i=t.ast?.length?[z(t.ast,a(n,t.id))]:[],o=[];for(const f of t.items){const{item:u,children:d}=M(f,n);o.push(u);const s=a(n,f.id);i.push({nodeType:l.OVERVIEW_SECTION_WRAPPER,children:d,sectionId:s})}return{item:{type:r?"group":"link",label:t.name,link:e,routeSlug:e,items:r?o:void 0,content:null},children:i}}function Q(t){return typeof t=="string"?t.trim():Array.isArray(t)?t.map(n=>g(n)).filter(Boolean).join(" ").trim():g(t).trim()}function S(t,n=50){if(typeof t=="string"){const o=t.split(/\n[ \t]*\n/)[0].replace(/\s+/g," ").trim();return o?o.substring(0,n):void 0}const r=(Array.isArray(t)?t:t.children??[t])[0];if(!r)return;const i=g(r);return i?i.substring(0,n):void 0}function Z(t,n){if(!t)return;const e=p(t,n);if(!e)return;const r=S(e);return r?r.length===50?r+"\u2026":r:void 0}function tt(t,n){if(!t)return;const e=p(t,n);if(e)return S(e,Number.POSITIVE_INFINITY)}function g(t){const n=[];function e(r){typeof r.attributes?.content=="string"&&n.push(r.attributes.content);for(const i of r.children??[])e(i)}return e(t),n.join("")}function et(t){return typeof t=="string"?t.trim():(Array.isArray(t)?t:[t]).map(e=>g(e)).join("").trim()}function K(t){return t.replace(/&#(\d+);/g,(n,e)=>String.fromCharCode(parseInt(e,10))).replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function nt(t,n){const{unstable_hooks:e,sanitize:r}=n??{};return e?.sanitize?e.sanitize(t):r?N().sanitize(t):t}function W(t){const n=[];return t.ast&&t.ast.length>0&&n.push({nodeType:l.MARKDOC,content:t.ast}),{contentType:D.ITEM,itemVariant:R.MARKDOWN,meta:{name:t.name},children:[{nodeType:l.CONTAINER,children:n,panels:[]}]}}function z(t,n){return{nodeType:l.OVERVIEW_SECTION_WRAPPER,children:[{nodeType:l.MARKDOC,content:t}],sectionId:n}}export{H as buildMarkdownSectionItem,et as collectMarkdownPlainText,J as collectMarkdownSections,X as extractContentUntilFirstHeading,Y as extractDescriptionSegments,S as extractFirstParagraphText,Q as extractFullText,_ as extractMarkdownSections,tt as extractSeoDescriptionText,Z as extractSummaryText,L as resolveMarkdocHeadingDeepSuffix,$ as resolveMarkdocHeadingIds,nt as sanitizeMarkdownSource,K as unescapeHTMLChars};
1
+ import{contentType as D,itemVariant as R,nodeTypes as l}from"../../types/common.js";import{safeSlugify as x}from"../../utils/string.js";import{parseMarkdown as p}from"./parseMarkdown.js";import{isPlainText as k}from"./isPlainText.js";import{joinWithSeparator as a}from"../../utils/url.js";import{buildDeepLinkUrl as v}from"../../utils/deep-link.js";import{getDOMPurify as N}from"./dompurify.js";function O(t){return t.type==="tag"&&t.tag==="schemaDefinition"}const E=/^[ \t]{0,3}#{1,6}[ \t]/m;function b(t){const r=t.search(E);return r===-1?t:t.slice(0,r)}function X(t,r){if(typeof t=="string"){const n=b(t).trim();if(k(n))return n}const e=p(t,r);if(!e)return;if(typeof e=="string")return e;if(Array.isArray(e)){const n=e.findIndex(o=>o.type==="heading");return n===-1?e:e.slice(0,n)}if(!e.children||!Array.isArray(e.children))return;const i=e.children.findIndex(n=>n.type==="heading");return i===-1?[e]:(e.children=e.children.slice(0,i),[e])}function Y(t,r,{sliceAtFirstHeading:e=!1}={}){if(typeof t=="string"&&e){const f=b(t).trim();if(k(f))return[{kind:"markdoc",node:{nodeType:l.MARKDOC,content:f}}]}const i=p(t,r);if(!i)return[];if(typeof i=="string")return[{kind:"markdoc",node:{nodeType:l.MARKDOC,content:i}}];let n=Array.isArray(i)?i:i.children??[];if(e){const f=n.findIndex(d=>d.type==="heading");f!==-1&&(n=n.slice(0,f))}const o=[];let c=[];const u=()=>{c.length>0&&(o.push({kind:"markdoc",node:{nodeType:l.MARKDOC,content:c}}),c=[])};for(const f of n)O(f)?(u(),o.push({kind:"schemaDefinition",node:{nodeType:l.MARKDOC,content:[f]}})):c.push(f);return u(),o}function L(t,r,e){const i=t.toLowerCase(),n=i.startsWith("section/")?i.slice(8):i,o=r.toLowerCase();let c=n!==o?n:"";return e&&(c=a(e,c)),c}function $(t,r,e){if(typeof t=="string")return;const i=n=>{if(n.type==="heading"&&n.attributes?.level){const o=n.attributes.id?n.attributes.id.toLowerCase():x(m(n).trim()).toLowerCase();if(o){const c=L(o,r,e);n.attributes.id=a(r,c).toLowerCase(),n.attributes.deepLinkHash=v("",r,c)}}for(const o of n.children??[])i(o)};if(Array.isArray(t))for(const n of t)i(n);else i(t)}function _(t,r,e,i){const n=p(t,r);if(!n)return[];if(typeof n=="string")return[];const o=[];let c;const u=(s,h,w=o,y,A)=>{s=K(s);const I=A!==void 0;let g;y.attributes.id?g=y.attributes.id:I||i?g=x(s):g=`section/${x(s)}`;const T=a(I?A:e,g).toLowerCase();y.attributes.id=T;const C={id:T,name:s,level:h,items:[],ast:[y]};return w.push(C),C},f=s=>{if(typeof s?.attributes?.content=="string")return s.attributes.content;if(s?.children)return f(s.children[0])},d=s=>{const h=f(s)||"";s.type==="heading"&&s.attributes?.level===1?c=u(h,s.attributes.level,void 0,s):s.attributes?.level?u(h,s.attributes.level,c?.items,s,c?.id):c?.items?.length?c.items[c.items.length-1]?.ast?.push(s):o.length&&o[o.length-1]?.ast?.push(s)};if(Array.isArray(n))for(const s of n)d(s);else if(n.children)for(const s of n.children)d(s);return o}function H({heading:t,basePath:r}){const e=t.items.length>0,i=a(r,t.id).toLowerCase(),n=e?t.items.map(o=>H({heading:o,basePath:r})):[];return{type:e?"group":"link",label:t.name,link:i,routeSlug:i,items:e?n:void 0,content:W(t)}}function J(t,r,e){const i=[],n=[];for(const o of _(t,e,"")){const{item:c,children:u}=M(o,r);i.push(c),n.push(...u)}return{sectionItems:i,sectionChildren:n}}function M(t,r){const e=a(r,t.id),i=t.items.length>0,n=t.ast?.length?[z(t.ast,a(r,t.id))]:[],o=[];for(const u of t.items){const{item:f,children:d}=M(u,r);o.push(f);const s=a(r,u.id);n.push({nodeType:l.OVERVIEW_SECTION_WRAPPER,children:d,sectionId:s})}return{item:{type:i?"group":"link",label:t.name,link:e,routeSlug:e,items:i?o:void 0,content:null},children:n}}function Q(t){return typeof t=="string"?t.trim():Array.isArray(t)?t.map(r=>m(r)).filter(Boolean).join(" ").trim():m(t).trim()}function S(t,r=50){if(typeof t=="string"){const o=t.split(/\n[ \t]*\n/)[0].replace(/\s+/g," ").trim();return o?o.substring(0,r):void 0}const i=(Array.isArray(t)?t:t.children??[t])[0];if(!i)return;const n=m(i);return n?n.substring(0,r):void 0}function Z(t,r){if(!t)return;const e=p(t,r);if(!e)return;const i=S(e);return i?i.length===50?i+"\u2026":i:void 0}function tt(t,r){if(!t)return;const e=p(t,r);if(e)return S(e,Number.POSITIVE_INFINITY)}function m(t){const r=[];function e(i){typeof i.attributes?.content=="string"&&r.push(i.attributes.content);for(const n of i.children??[])e(n)}return e(t),r.join("")}function et(t){return typeof t=="string"?t.trim():(Array.isArray(t)?t:[t]).map(e=>m(e)).join("").trim()}function K(t){return t.replace(/&#(\d+);/g,(r,e)=>String.fromCharCode(parseInt(e,10))).replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function nt(t,r){const{unstable_hooks:e,sanitize:i}=r??{};return e?.sanitize?e.sanitize(t):i?N().sanitize(t):t}function W(t){const r=[];return t.ast&&t.ast.length>0&&r.push({nodeType:l.MARKDOC,content:t.ast}),{contentType:D.ITEM,itemVariant:R.MARKDOWN,meta:{name:t.name},children:[{nodeType:l.CONTAINER,children:r,panels:[]}]}}function z(t,r){return{nodeType:l.OVERVIEW_SECTION_WRAPPER,children:[{nodeType:l.MARKDOC,content:t}],sectionId:r}}export{H as buildMarkdownSectionItem,et as collectMarkdownPlainText,J as collectMarkdownSections,X as extractContentUntilFirstHeading,Y as extractDescriptionSegments,S as extractFirstParagraphText,Q as extractFullText,_ as extractMarkdownSections,tt as extractSeoDescriptionText,Z as extractSummaryText,L as resolveMarkdocHeadingDeepSuffix,$ as resolveMarkdocHeadingIds,nt as sanitizeMarkdownSource,K as unescapeHTMLChars};
@@ -1 +1 @@
1
- import{useContext as d,useMemo as c}from"react";import{useAtomValue as a}from"jotai";import{exampleStoreAtom as h,generatedExampleAtom as x,buildExampleAtomKey as g}from"../../jotai/examples.js";import{convertSampleToString as S}from"../../services/code-samples/index.js";import{isSequentialMediaType as A}from"../../utils/media-type.js";import{schemaStoreAtom as E}from"../../jotai/schema.js";import{buildOpenApiSectionSuffix as L,extractDeepLinkParamFromHash as v,hashToElementId as C}from"../../utils/deep-link.js";import{ItemIdContext as H}from"../../hooks/useDeepLinkSection.js";import{useUrlHash as D}from"../../hooks/useUrlHash.js";import{routingBasePathAtom as F}from"../../jotai/store.js";import{useDeepLinkUrl as P}from"../../hooks/useDeepLinkSection.js";import{toRelativePath as w}from"../../utils/url.js";function y(e){const t=a(h);return!e||e.length===0?[]:e.map(r=>t[r]).filter(Boolean)}function V(e,t,r,o){const n=y(t),m=d(H)??"",i=o?.toLowerCase(),l=e?g(e,r,o,m):"",s=a(x(l)),u=a(E);if(n.length>0){if(i&&A(i)){const f=e?u[e]?.data:void 0;return n.map(p=>typeof p.value=="string"?p.value:S(p.value,i,f))}return n.map(f=>f.value)}return s!==void 0?[s]:[]}function W(e,t){const r=c(()=>e?L("response",t,e):"",[e,t]);return P(r)}function $(e,t,r){const o=D(),n=a(F);return c(()=>{if(!e)return;const m=C(o),i=w(e,n).toLowerCase();if(!(m===i||m.startsWith(`${i}/`)))return;const s=v(o,r);if(s)return t?.find(u=>u.toLowerCase()===s)},[o,e,t,r,n])}export{y as useExampleEntries,$ as useKeyFromHash,V as useResolvedExamples,W as useResponseSectionDeepLink};
1
+ import{useContext as d,useMemo as l}from"react";import{useAtomValue as p}from"jotai";import{exampleStoreAtom as h,generatedExampleAtom as x,buildExampleAtomKey as S}from"../../jotai/examples.js";import{convertSampleToString as g}from"../../services/code-samples/index.js";import{isSequentialMediaType as A}from"../../utils/media-type.js";import{schemaStoreAtom as C}from"../../jotai/schema.js";import{buildOpenApiSectionSuffix as E,extractDeepLinkParamFromHash as L,hashIsForItem as b,hashIsInsideCallback as k,hashIsOutsideCallbacks as v,hashToElementId as I}from"../../utils/deep-link.js";import{ItemIdContext as D,useCallbackScope as P}from"../../hooks/useDeepLinkSection.js";import{useUrlHash as w}from"../../hooks/useUrlHash.js";import{routingBasePathAtom as y}from"../../jotai/store.js";import{useDeepLinkUrl as B}from"../../hooks/useDeepLinkSection.js";import{toRelativePath as F}from"../../utils/url.js";function H(e){const t=p(h);return!e||e.length===0?[]:e.map(o=>t[o]).filter(Boolean)}function N(e,t,o,n){const i=H(t),a=d(D)??"",r=n?.toLowerCase(),s=e?S(e,o,n,a):"",f=p(x(s)),u=p(C);if(i.length>0){if(r&&A(r)){const m=e?u[e]?.data:void 0;return i.map(c=>typeof c.value=="string"?c.value:g(c.value,r,m))}return i.map(m=>m.value)}return f!==void 0?[f]:[]}function Q(e,t){const o=l(()=>e?E("response",t,e):"",[e,t]);return B(o)}function W(e,t,o){const n=w(),i=p(y),a=P();return l(()=>{if(!e)return;const r=I(n),s=F(e,i).toLowerCase();if(!b(r,s)||!(a?k(r,s,a):v(r,s)))return;const u=L(n,o);if(u)return t?.find(m=>m.toLowerCase()===u)},[n,e,t,o,i,a])}export{H as useExampleEntries,W as useKeyFromHash,N as useResolvedExamples,Q as useResponseSectionDeepLink};
@@ -1,7 +1,7 @@
1
- import{jsx as t,jsxs as h}from"react/jsx-runtime";import{useMemo as c,memo as v}from"react";import{styled as p}from"styled-components";import{useAtom as x,useAtomValue as T}from"jotai";import{Markdown as S}from"../../common/Markdown.js";import{schemaEntryAtom as g}from"../../../jotai/schema.js";import{activeMediaTypeAtom as b}from"../../../jotai/app.js";import{SchemaView as k}from"../../Schema/SchemaView.js";import{buildOpenApiSectionSuffix as M,getDeepLinkId as q}from"../../../utils/deep-link.js";import{DeepLinkSectionContext as A,useDeepLinkUrl as B}from"../../../hooks/useDeepLinkSection.js";import{BodyMimeTypeField as D}from"./BodyMimeTypeField.js";function j({node:e}){const i=e.mediaTypeSchemas?Object.keys(e.mediaTypeSchemas):e.mediaTypes,[r,d]=x(b),o=r&&i?.includes(r)?r:i?.[0],s=e.mediaTypeSchemas?.[o??""]?.schemaId??e.schemaId,y=T(g(s??"")),l=i&&i.length>0,n=i&&i.length>1,a=e.variant==="body"||e.variant==="querystring-body",u=c(()=>M("request","body"),[]),m=B(u),f=c(()=>({t:"request",ct:n?o:void 0}),[n,o]);return h(I,{id:q(m),children:[l&&i&&t(D,{mediaTypes:i,value:o,onChange:d,deepLink:m,required:e.required}),e.description?t(L,{children:t(S,{source:e.description})}):null,y&&t(A.Provider,{value:f,children:t(k,{schemaId:s,expandByDefault:!0,level:1,skipReadOnly:a,skipWriteOnly:!a})})]})}const I=p.div`
1
+ import{jsx as t,jsxs as v}from"react/jsx-runtime";import{useMemo as p,memo as x}from"react";import{styled as d}from"styled-components";import{useAtom as T,useAtomValue as S}from"jotai";import{Markdown as b}from"../../common/Markdown.js";import{schemaEntryAtom as k}from"../../../jotai/schema.js";import{activeMediaTypeAtom as g}from"../../../jotai/app.js";import{SchemaView as M}from"../../Schema/SchemaView.js";import{buildOpenApiSectionSuffix as q,getDeepLinkId as A}from"../../../utils/deep-link.js";import{DeepLinkSectionContext as B,useCallbackScope as D,useDeepLinkUrl as j}from"../../../hooks/useDeepLinkSection.js";import{BodyMimeTypeField as I}from"./BodyMimeTypeField.js";function L({node:e}){const i=e.mediaTypeSchemas?Object.keys(e.mediaTypeSchemas):e.mediaTypes,[r,l]=T(g),o=r&&i?.includes(r)?r:i?.[0],s=e.mediaTypeSchemas?.[o??""]?.schemaId??e.schemaId,y=S(k(s??"")),u=i&&i.length>0,a=i&&i.length>1,n=e.variant==="body"||e.variant==="querystring-body",f=p(()=>q("request","body"),[]),c=j(f),m=D(),h=p(()=>({t:"request",cb:m,ct:a?o:void 0}),[m,a,o]);return v(C,{id:A(c),children:[u&&i&&t(I,{mediaTypes:i,value:o,onChange:l,deepLink:c,required:e.required}),e.description?t(E,{children:t(b,{source:e.description})}):null,y&&t(B.Provider,{value:h,children:t(M,{schemaId:s,expandByDefault:!0,level:1,skipReadOnly:n,skipWriteOnly:!n})})]})}const C=d.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
- `,L=p.div`
4
+ `,E=d.div`
5
5
  font-size: var(--font-size-base);
6
6
  line-height: var(--line-height-base);
7
7
  color: var(--text-color-description);
@@ -10,4 +10,4 @@ import{jsx as t,jsxs as h}from"react/jsx-runtime";import{useMemo as c,memo as v}
10
10
  margin-top: var(--spacing-xxs);
11
11
  margin-bottom: 0;
12
12
  }
13
- `,G=v(j);export{G as BodySection};
13
+ `,J=x(L);export{J as BodySection};
@@ -1,35 +1,35 @@
1
- import{Fragment as D,jsx as e,jsxs as n}from"react/jsx-runtime";import{useCallback as O,useRef as W}from"react";import{styled as t}from"styled-components";import{useAtom as M}from"jotai";import{Panel as B}from"@redocly/theme/components/Panel/Panel";import{PanelHeader as V}from"@redocly/theme/components/Panel/PanelHeader";import{PanelHeaderTitle as F}from"@redocly/theme/components/Panel/PanelHeaderTitle";import{TextBadge as J,StyledBadge as K}from"../../common/Badge.js";import{DeepLinkAnchor as y,deepLinkHoverReveal as z,DEEP_LINK_ANCHOR_ATTR as U}from"../../common/DeepLinkAnchor.js";import{ItemContentRenderer as I}from"../ItemContentRenderer.js";import{nodeTypes as S}from"../../../types/common.js";import{selectedCallbackAtom as G}from"../../../jotai/app.js";import{useDeepLinkUrl as T}from"../../../hooks/useDeepLinkSection.js";import{useSpecTranslate as Q}from"../../../hooks/useTranslate.js";import{buildOpenApiSectionSuffix as w,getDeepLinkId as C}from"../../../utils/deep-link.js";import{Markdown as X}from"../../common/Markdown.js";import{collectMarkdownPlainText as Y}from"../../../adapters/utils/markdoc.js";function Z(o){return{delete:"del",options:"opts"}[o]||o}function ee({operation:o,callbackId:a,isExpanded:m,onToggle:l}){const{httpVerb:s,pathName:c,summary:h,operationId:j,description:d,deprecated:R,contentChildren:p,externalDocs:b,extensions:g}=o,f=h||j||d&&Y(d).substring(0,50)||c||"<no summary>",H=w("callbacks",a),v=T(H),P=W(null),_=w("callbacks",`${a}/callback-request`),x=T(_),q=w("callbacks",`${a}/callback-response`),u=T(q),k=Q(),$=k("callbackRequest","Callback Request"),L=k("callbackResponse","Callback Response"),A=k("badges.deprecated","deprecated");return e(oe,{header:({expanded:r,toggle:i})=>n(ae,{ref:P,expanded:r,toggle:N=>{i?.(N),l(a)},id:C(v),children:[v&&e(y,{to:v,label:`link to ${f}`}),n(re,{children:[e(ne,{type:"button","aria-expanded":r,"aria-label":f,children:e(ie,{$expanded:r,"aria-hidden":"true"})}),n(te,{children:[e(le,{$deprecated:R,children:f}),e(se,{color:s,children:Z(s)}),R?e(K,{$deprecated:!0,children:A}):null]})]})]}),expanded:m,className:"panel-response-callback",children:n(ce,{children:[d&&e(pe,{children:e(X,{source:d})}),b&&e(be,{href:b.url,target:"_blank",rel:"noopener noreferrer",children:b.description||b.url}),g&&Object.keys(g).length>0&&e(me,{children:Object.entries(g).map(([r,i])=>n(he,{children:[n("strong",{children:[r,":"]})," ",typeof i=="string"?i:JSON.stringify(i)]},r))}),p&&p.length>0&&n(D,{children:[n(E,{id:C(x),children:[x&&e(y,{to:x,label:`link to ${$}`}),$]}),p.filter(r=>r.nodeType===S.ITEM&&r.variant!=="responses").map((r,i)=>e(I,{node:r},i)),p.filter(r=>r.nodeType===S.ITEM&&r.variant==="responses").map((r,i)=>n("div",{children:[n(E,{id:C(u),children:[u&&e(y,{to:u,label:`link to ${L}`}),L]}),e(I,{node:r})]},`resp-${i}`))]}),e(de,{})]})})}function Ee({node:o}){const a=o.callback,[m,l]=M(G),s=O(c=>{l(h=>h===c?null:c)},[l]);return a?e("div",{children:e(ee,{operation:a,callbackId:a.callbackId,isExpanded:m===a.callbackId,onToggle:s},a.callbackId)}):e(D,{})}const re=t.div`
1
+ import{Fragment as O,jsx as e,jsxs as n}from"react/jsx-runtime";import{useCallback as H,useContext as P,useEffect as j,useRef as B}from"react";import{styled as r}from"styled-components";import{useAtomValue as W,useSetAtom as q}from"jotai";import{Panel as K}from"@redocly/theme/components/Panel/Panel";import{PanelHeader as M}from"@redocly/theme/components/Panel/PanelHeader";import{PanelHeaderTitle as V}from"@redocly/theme/components/Panel/PanelHeaderTitle";import{TextBadge as F,StyledBadge as U}from"../../common/Badge.js";import{DeepLinkAnchor as T,deepLinkHoverReveal as $,DEEP_LINK_ANCHOR_ATTR as J}from"../../common/DeepLinkAnchor.js";import{ItemContentRenderer as A}from"../ItemContentRenderer.js";import{nodeTypes as D}from"../../../types/common.js";import{itemStoreAtom as Q,itemStoreFieldAtom as G}from"../../../jotai/itemStore.js";import{CallbackScopeContext as X,ItemIdContext as Y,useDeepLinkUrl as S,useHashItemId as Z}from"../../../hooks/useDeepLinkSection.js";import{useSpecTranslate as ee}from"../../../hooks/useTranslate.js";import{useUrlHash as te}from"../../../hooks/useUrlHash.js";import{buildOpenApiSectionSuffix as re,CALLBACKS_SECTION as oe,CALLBACK_REQUEST_SECTION as ae,CALLBACK_RESPONSE_SECTION as ne,getDeepLinkId as L,hashTargetsCallback as ie}from"../../../utils/deep-link.js";import{Markdown as le}from"../../common/Markdown.js";import{collectMarkdownPlainText as se}from"../../../adapters/utils/markdoc.js";function ce(o){return{delete:"del",options:"opts"}[o]||o}function de(o){return o.target instanceof Element&&o.target.closest("a")!==null}function pe({operation:o,callbackId:a,isExpanded:p,onToggle:h}){const{httpVerb:s,pathName:g,summary:f,operationId:m,description:l,deprecated:b,contentChildren:c,externalDocs:d,extensions:u}=o,v=f||m||l&&se(l).substring(0,50)||g||"<no summary>",x=re(oe,a),k=S(x),z=B(null),C=S(`${x}/${ae}`),y=S(`${x}/${ne}`),I=ee(),E=I("callbackRequest","Callback Request"),w=I("callbackResponse","Callback Response"),N=I("badges.deprecated","deprecated");return e(he,{header:({expanded:t,toggle:i})=>n(ge,{ref:z,expanded:t,toggle:R=>{de(R)||(i?.(R),h(a))},id:L(k),children:[k&&e(T,{to:k,label:`link to ${v}`}),n(me,{children:[e(fe,{type:"button","aria-expanded":t,"aria-label":v,children:e(ue,{$expanded:t,"aria-hidden":"true"})}),n(be,{children:[e(ve,{$deprecated:b,children:v}),e(xe,{color:s,children:ce(s)}),b?e(U,{$deprecated:!0,children:N}):null]})]})]}),expanded:p,className:"panel-response-callback",children:n(ke,{children:[l&&e(ye,{children:e(le,{source:l})}),d&&e(Ie,{href:d.url,target:"_blank",rel:"noopener noreferrer",children:d.description||d.url}),u&&Object.keys(u).length>0&&e(Te,{children:Object.entries(u).map(([t,i])=>n(Se,{children:[n("strong",{children:[t,":"]})," ",typeof i=="string"?i:JSON.stringify(i)]},t))}),c&&c.length>0&&n(X.Provider,{value:a,children:[n(_,{id:L(C),children:[C&&e(T,{to:C,label:`link to ${E}`}),E]}),c.filter(t=>t.nodeType===D.ITEM&&t.variant!=="responses").map((t,i)=>e(A,{node:t},i)),c.filter(t=>t.nodeType===D.ITEM&&t.variant==="responses").map((t,i)=>n("div",{children:[n(_,{id:L(y),children:[y&&e(T,{to:y,label:`link to ${w}`}),w]}),e(A,{node:t})]},`resp-${i}`))]}),e(Ce,{})]})})}function Me({node:o}){const a=o.callback,p=P(Y)??"",h=W(G({itemId:p,key:"selectedCallback"})),s=q(Q(p)),g=te(),f=Z(),m=a?.callbackId,l=ie(g,f,m)?m:void 0;j(()=>{l&&s({selectedCallback:l})},[l,s]);const b=H(c=>{s(d=>({selectedCallback:d.selectedCallback===c?"":c}))},[s]);return a?e("div",{children:e(pe,{operation:a,callbackId:a.callbackId,isExpanded:h===a.callbackId,onToggle:b},a.callbackId)}):e(O,{})}const me=r.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  gap: var(--spacing-xs);
5
5
  max-width: calc(100% - 9px - var(--spacing-unit));
6
6
  justify-content: flex-start;
7
- `,te=t.div`
7
+ `,be=r.div`
8
8
  flex: 1;
9
9
  min-width: 0;
10
10
  line-height: var(--line-height-base);
11
- `,oe=t(B)`
11
+ `,he=r(K)`
12
12
  border-bottom: 1px solid var(--border-color-primary);
13
13
  border-radius: 0;
14
14
  &:not(:last-child) {
15
15
  margin-bottom: 0;
16
16
  }
17
- `,ae=t(V)`
17
+ `,ge=r(M)`
18
18
  padding: var(--spacing-sm) 0 var(--spacing-sm) calc(var(--spacing-unit) / 2);
19
19
  margin: 0;
20
20
  border-radius: 0;
21
21
  line-height: var(--line-height-base);
22
22
  position: relative;
23
23
 
24
- & > [${U}] {
24
+ & > [${J}] {
25
25
  position: absolute;
26
26
  top: 0;
27
27
  bottom: 0;
28
28
  left: 0;
29
29
  }
30
30
 
31
- ${z}
32
- `,ne=t.button`
31
+ ${$}
32
+ `,fe=r.button`
33
33
  background: none;
34
34
  border: none;
35
35
  cursor: pointer;
@@ -41,7 +41,7 @@ import{Fragment as D,jsx as e,jsxs as n}from"react/jsx-runtime";import{useCallba
41
41
  font-size: var(--font-size-base);
42
42
  font-family: var(--font-family-base);
43
43
  line-height: var(--line-height-base);
44
- `,ie=t.span`
44
+ `,ue=r.span`
45
45
  position: relative;
46
46
  display: inline-block;
47
47
  flex: none;
@@ -72,30 +72,30 @@ import{Fragment as D,jsx as e,jsxs as n}from"react/jsx-runtime";import{useCallba
72
72
  height: var(--spacing-xs);
73
73
  opacity: ${({$expanded:o})=>o?0:1};
74
74
  }
75
- `,le=t(F)`
75
+ `,ve=r(V)`
76
76
  text-decoration: ${({$deprecated:o})=>o?"line-through":"none"};
77
77
  display: inline;
78
78
  margin: 0 4px 0 0;
79
79
  color: var(--panel-response-callback-heading-text-color);
80
80
  font-weight: var(--font-weight-medium);
81
81
  word-break: break-all;
82
- `,se=t(J)`
82
+ `,xe=r(F)`
83
83
  white-space: nowrap;
84
84
  vertical-align: middle;
85
- `,ce=t.div`
85
+ `,ke=r.div`
86
86
  position: relative;
87
87
  .property:last-child {
88
88
  border-bottom: none;
89
89
  padding-bottom: 0;
90
90
  }
91
- `,de=t.div`
91
+ `,Ce=r.div`
92
92
  position: absolute;
93
93
  height: calc(100% + 15px);
94
94
  border-left: 1px solid var(--border-color-primary);
95
95
  top: -15px;
96
96
  left: -13px;
97
97
  z-index: 0;
98
- `,pe=t.div`
98
+ `,ye=r.div`
99
99
  font-size: var(--font-size-base);
100
100
  line-height: var(--line-height-base);
101
101
  color: var(--text-color-primary);
@@ -107,17 +107,17 @@ import{Fragment as D,jsx as e,jsxs as n}from"react/jsx-runtime";import{useCallba
107
107
  p:last-of-type {
108
108
  margin-bottom: 0;
109
109
  }
110
- `,be=t.a`
110
+ `,Ie=r.a`
111
111
  display: inline-block;
112
112
  font-size: var(--font-size-sm);
113
113
  color: var(--link-text-color);
114
114
  margin-bottom: var(--spacing-sm);
115
- `,me=t.div`
115
+ `,Te=r.div`
116
116
  font-size: var(--font-size-sm);
117
117
  margin-bottom: var(--spacing-sm);
118
- `,he=t.div`
118
+ `,Se=r.div`
119
119
  padding: var(--spacing-xxs) 0;
120
- `,E=t.h4`
120
+ `,_=r.h4`
121
121
  position: relative;
122
122
  font-size: var(--h4-font-size);
123
123
  font-weight: var(--h4-font-weight);
@@ -127,5 +127,5 @@ import{Fragment as D,jsx as e,jsxs as n}from"react/jsx-runtime";import{useCallba
127
127
  display: flex;
128
128
  align-items: center;
129
129
  margin: var(--spacing-sm) 0 var(--spacing-xs) 0;
130
- ${z}
131
- `;export{Ee as CallbacksSection};
130
+ ${$}
131
+ `;export{Me as CallbacksSection};
@@ -1,4 +1,4 @@
1
- import{Fragment as a,jsx as r}from"react/jsx-runtime";import{useMemo as c}from"react";import{styled as l}from"styled-components";import{useAtomValue as d}from"jotai";import{SchemaView as p}from"../../Schema/SchemaView.js";import{schemaEntryAtom as u}from"../../../jotai/schema.js";import{DeepLinkSectionContext as f}from"../../../hooks/useDeepLinkSection.js";import{serializeParameterValue as x}from"../../../utils/serialize-parameter.js";import{tryDecodeURIComponent as h}from"../../../utils/string.js";function V({node:e}){const t=e.parameters,n=e.variant,i=c(()=>({t:"request",in:n}),[n]);return!t||t.length===0?r(a,{}):r(f.Provider,{value:i,children:r(P,{children:t.map((o,s)=>r(y,{param:o},`${o.name}-${s}`))})})}function g(e){if(e.in)return t=>h(x(e,t))}function y({param:e}){const n=d(u(e.schemaId))?.data,i={...e.deprecated!==void 0?{deprecated:e.deprecated}:{},...e.description!=null?{description:e.description}:{}},o={...e.example!=null?{example:e.example}:{},...e.examples?{examples:e.examples}:{}},s={allOf:[i,n,o],...e.badges?.length?{"x-badges":e.badges}:{},...e.extensions},m={type:"object",required:e.required?[e.name]:[],properties:{[e.name]:s}};return r(p,{schema:m,level:1,exampleSerializer:g(e)})}const P=l.div`
1
+ import{Fragment as a,jsx as r}from"react/jsx-runtime";import{useMemo as m}from"react";import{styled as l}from"styled-components";import{useAtomValue as d}from"jotai";import{SchemaView as p}from"../../Schema/SchemaView.js";import{schemaEntryAtom as u}from"../../../jotai/schema.js";import{DeepLinkSectionContext as f,useCallbackScope as x}from"../../../hooks/useDeepLinkSection.js";import{serializeParameterValue as h}from"../../../utils/serialize-parameter.js";import{tryDecodeURIComponent as g}from"../../../utils/string.js";function L({node:e}){const t=e.parameters,o=e.variant,n=x(),s=m(()=>({t:"request",in:o,cb:n}),[o,n]);return!t||t.length===0?r(a,{}):r(f.Provider,{value:s,children:r(b,{children:t.map((i,c)=>r(S,{param:i},`${i.name}-${c}`))})})}function y(e){if(e.in)return t=>g(h(e,t))}function S({param:e}){const o=d(u(e.schemaId))?.data,n={...e.deprecated!==void 0?{deprecated:e.deprecated}:{},...e.description!=null?{description:e.description}:{}},s={...e.example!=null?{example:e.example}:{},...e.examples?{examples:e.examples}:{}},i={allOf:[n,o,s],...e.badges?.length?{"x-badges":e.badges}:{},...e.extensions},c={type:"object",required:e.required?[e.name]:[],properties:{[e.name]:i}};return r(p,{schema:c,level:1,exampleSerializer:y(e)})}const b=l.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
- `;export{V as ParametersSection,g as getParameterExampleSerializer};
4
+ `;export{L as ParametersSection,y as getParameterExampleSerializer};
@@ -1,28 +1,28 @@
1
- import{Fragment as w,jsx as e,jsxs as a}from"react/jsx-runtime";import{useContext as z,useEffect as W,useMemo as C}from"react";import{styled as s}from"styled-components";import{useAtom as _,useAtomValue as O,useSetAtom as V}from"jotai";import{SchemaView as f}from"../../Schema/SchemaView.js";import{Markdown as D}from"../../common/Markdown.js";import{DeepLinkAnchor as $,deepLinkHoverReveal as E}from"../../common/DeepLinkAnchor.js";import{getDeepLinkId as S}from"../../../utils/deep-link.js";import{BodyMimeTypeField as K}from"./BodyMimeTypeField.js";import{activeMediaTypeAtom as P}from"../../../jotai/app.js";import{itemStoreAtom as U,itemStoreFieldAtom as q}from"../../../jotai/itemStore.js";import{DeepLinkSectionContext as G,ItemIdContext as J}from"../../../hooks/useDeepLinkSection.js";import{useSpecTranslate as N}from"../../../hooks/useTranslate.js";import{isRecord as Q}from"../../../adapters/helpers.js";import{useKeyFromHash as X,useResponseSectionDeepLink as b}from"../hooks.js";function ge({node:R}){const o=R.responses,u=N(),d=z(J),A=O(q({itemId:d??"",key:"activeResponseCode"})),v=V(U(d??"")),M=C(()=>o?.map(h=>h.code),[o]),n=X(d??void 0,M,"c"),i=A||n||o?.[0]?.code||"";W(()=>{n&&v({activeResponseCode:n})},[n,v]);const y=b(i,"body"),c=b(i,"headers"),{mediaTypes:B,mediaType:g,mediaTypeContent:p,schemaId:F,summary:x,description:k,headers:I,headerSchemaId:m}=o?.find(h=>h.code===i)??o?.[0]??{},t=p?Object.keys(p):B??(g?[g]:[]),[l,H]=_(P),r=l&&t.includes(l)?l:t[0],T=p?.[r]?.schemaId??F,j=C(()=>({t:"response",c:i,ct:t.length>1?r:void 0}),[i,t.length,r]);return!o||o.length===0?e(w,{}):e(Y,{children:a(Z,{children:[x&&e(L,{children:e(D,{source:x})}),k&&e(L,{children:e(D,{source:k})}),a(G.Provider,{value:j,children:[(m||Q(I))&&a(te,{children:[a(ee,{id:S(c),children:[c&&e($,{to:c,label:`link to ${u("header","Headers")}`}),e(oe,{children:u("header","Headers")})]}),m?e(f,{schemaId:m,expandByDefault:!0,level:1}):e(f,{schema:I,expandByDefault:!0,level:1})]}),t.length>0&&e(K,{headingId:S(y),mediaTypes:t,value:r,onChange:H,deepLink:y}),T&&e(f,{schemaId:T,expandByDefault:!0,level:1,skipWriteOnly:!0})]})]})})}const Y=s.div`
1
+ import{Fragment as z,jsx as e,jsxs as a}from"react/jsx-runtime";import{useContext as W,useEffect as _,useMemo as C}from"react";import{styled as s}from"styled-components";import{useAtom as O,useAtomValue as V,useSetAtom as $}from"jotai";import{SchemaView as f}from"../../Schema/SchemaView.js";import{Markdown as T}from"../../common/Markdown.js";import{DeepLinkAnchor as E,deepLinkHoverReveal as K}from"../../common/DeepLinkAnchor.js";import{getDeepLinkId as D}from"../../../utils/deep-link.js";import{BodyMimeTypeField as P}from"./BodyMimeTypeField.js";import{activeMediaTypeAtom as U}from"../../../jotai/app.js";import{itemStoreAtom as q,itemStoreFieldAtom as G}from"../../../jotai/itemStore.js";import{DeepLinkSectionContext as J,ItemIdContext as N,useCallbackScope as Q}from"../../../hooks/useDeepLinkSection.js";import{useSpecTranslate as X}from"../../../hooks/useTranslate.js";import{isRecord as Y}from"../../../adapters/helpers.js";import{useKeyFromHash as Z,useResponseSectionDeepLink as L}from"../hooks.js";function ke({node:A}){const o=A.responses,u=X(),c=W(N),M=V(G({itemId:c??"",key:"activeResponseCode"})),v=$(q(c??"")),B=C(()=>o?.map(h=>h.code),[o]),i=Z(c??void 0,B,"c"),n=M||i||o?.[0]?.code||"";_(()=>{i&&v({activeResponseCode:i})},[i,v]);const y=L(n,"body"),d=L(n,"headers"),{mediaTypes:F,mediaType:g,mediaTypeContent:p,schemaId:H,summary:x,description:k,headers:I,headerSchemaId:m}=o?.find(h=>h.code===n)??o?.[0]??{},t=p?Object.keys(p):F??(g?[g]:[]),[l,j]=O(U),r=l&&t.includes(l)?l:t[0],S=p?.[r]?.schemaId??H,b=Q(),w=C(()=>({t:"response",c:n,cb:b,ct:t.length>1?r:void 0}),[n,b,t.length,r]);return!o||o.length===0?e(z,{}):e(ee,{children:a(oe,{children:[x&&e(R,{children:e(T,{source:x})}),k&&e(R,{children:e(T,{source:k})}),a(J.Provider,{value:w,children:[(m||Y(I))&&a(ne,{children:[a(te,{id:D(d),children:[d&&e(E,{to:d,label:`link to ${u("header","Headers")}`}),e(se,{children:u("header","Headers")})]}),m?e(f,{schemaId:m,expandByDefault:!0,level:1}):e(f,{schema:I,expandByDefault:!0,level:1})]}),t.length>0&&e(P,{headingId:D(y),mediaTypes:t,value:r,onChange:j,deepLink:y}),S&&e(f,{schemaId:S,expandByDefault:!0,level:1,skipWriteOnly:!0})]})]})})}const ee=s.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: var(--spacing-xs);
5
- `,Z=s.div`
5
+ `,oe=s.div`
6
6
  display: flex;
7
7
  flex-direction: column;
8
- `,L=s.div`
8
+ `,R=s.div`
9
9
  font-size: var(--font-size-base);
10
10
  line-height: var(--line-height-base);
11
11
  color: var(--text-color-description);
12
- `,ee=s.span`
12
+ `,te=s.span`
13
13
  position: relative;
14
14
  display: flex;
15
15
  align-items: center;
16
16
  margin-top: var(--spacing-md);
17
17
  padding: var(--spacing-xxs) 0;
18
- ${E}
19
- `,oe=s.span`
18
+ ${K}
19
+ `,se=s.span`
20
20
  font-weight: var(--font-weight-semibold);
21
21
  font-size: 18px;
22
22
  line-height: var(--line-height-lg);
23
23
  color: var(--text-color-primary);
24
- `,te=s.div`
24
+ `,ne=s.div`
25
25
  &:not(:last-child) {
26
26
  margin-bottom: var(--spacing-lg);
27
27
  }
28
- `;export{ge as ResponsesSection};
28
+ `;export{ke as ResponsesSection};
@@ -1,4 +1,4 @@
1
- import{jsx as r,jsxs as o}from"react/jsx-runtime";import{memo as c}from"react";import{styled as i}from"styled-components";import{useAtomValue as p}from"jotai";import{Link as g}from"react-router-dom";import{Tag as d}from"@redocly/theme/components/Tag/Tag";import{ArrowUpRightIcon as f}from"@redocly/theme/icons/ArrowUpRightIcon/ArrowUpRightIcon";import{routingBasePathAtom as h}from"../jotai/store.js";import{buildAsyncApiSuffix as u,buildDeepLinkUrl as x}from"../utils/deep-link.js";import{stripLeadingSlash as k}from"../utils/url.js";import{useNavigationUrlNormalizer as v}from"../hooks/useNormalizeUrl.js";import{useTelemetry as L}from"../hooks/useTelemetry.js";function b({node:n}){const s=p(h),t=v(),a=L(),l=e=>{a.sendMessageClickedMessage([{id:"messageLink",object:"link",uri:"urn:redocly:redoc:ui:link:messageLink",message:e}])},m=e=>t(x(s,k(n.channelLink),u({section:"messages",messageKey:e})));return n.messages.length?o(y,{"data-component-name":"Operation/MessageLinks",children:[r(M,{children:"Messages"}),r(w,{children:n.messages.map(e=>r(T,{to:m(e.name),onClick:()=>l(e.name),children:o(j,{borderless:!0,textTransform:"none",children:[e.label,r(f,{size:"12px"})]})},e.name))})]}):null}const O=c(b),y=i.div`
1
+ import{jsx as r,jsxs as o}from"react/jsx-runtime";import{memo as c}from"react";import{styled as i}from"styled-components";import{useAtomValue as p}from"jotai";import{Link as g}from"react-router";import{Tag as d}from"@redocly/theme/components/Tag/Tag";import{ArrowUpRightIcon as f}from"@redocly/theme/icons/ArrowUpRightIcon/ArrowUpRightIcon";import{routingBasePathAtom as h}from"../jotai/store.js";import{buildAsyncApiSuffix as u,buildDeepLinkUrl as x}from"../utils/deep-link.js";import{stripLeadingSlash as k}from"../utils/url.js";import{useNavigationUrlNormalizer as v}from"../hooks/useNormalizeUrl.js";import{useTelemetry as L}from"../hooks/useTelemetry.js";function b({node:n}){const s=p(h),t=v(),a=L(),l=e=>{a.sendMessageClickedMessage([{id:"messageLink",object:"link",uri:"urn:redocly:redoc:ui:link:messageLink",message:e}])},m=e=>t(x(s,k(n.channelLink),u({section:"messages",messageKey:e})));return n.messages.length?o(y,{"data-component-name":"Operation/MessageLinks",children:[r(M,{children:"Messages"}),r(w,{children:n.messages.map(e=>r(T,{to:m(e.name),onClick:()=>l(e.name),children:o(j,{borderless:!0,textTransform:"none",children:[e.label,r(f,{size:"12px"})]})},e.name))})]}):null}const O=c(b),y=i.div`
2
2
  margin-top: var(--spacing-sm);
3
3
  `,M=i.div`
4
4
  font-size: var(--font-size-base);
@@ -1 +1 @@
1
- import{useContext as i,useMemo as o}from"react";import{useAtomValue as c}from"jotai";import{buildAsyncApiSuffix as f,buildOpenApiFieldSuffix as r}from"../../../utils/deep-link.js";import{DeepLinkSectionContext as u,ItemIdContext as m,useDeepLinkUrl as s}from"../../../hooks/useDeepLinkSection.js";import{expandableSectionAtom as a}from"../../../jotai/itemStore.js";function p(e,n){if(!e)return"";if(e.pathOnly)return n?r({path:n}):"";if(e.asyncSection){let t=f({section:e.asyncSection,messageKey:e.messageKey,subsection:e.t});return n&&(t+=`&path=${n}`),t}return r({t:e.t,in:e.in,c:e.c,cb:e.cb,ct:e.ct,path:n})}function A(e){const n=i(u),t=o(()=>p(n,e),[n,e]);return s(t)}function S(){const e=i(u);return o(()=>p(e,""),[e])}function K(){const e=i(m)??"",n=S();return c(a(e,n))}export{p as buildSchemaFieldSuffix,A as useSchemaFieldDeepLink,S as useSectionBaselineKey,K as useSectionExpandBaseline};
1
+ import{useContext as t,useMemo as o}from"react";import{useAtomValue as c}from"jotai";import{buildAsyncApiSuffix as f,buildOpenApiFieldSuffix as r}from"../../../utils/deep-link.js";import{DeepLinkSectionContext as u,ItemIdContext as m,useFieldDeepLinkUrl as s}from"../../../hooks/useDeepLinkSection.js";import{expandableSectionAtom as a}from"../../../jotai/itemStore.js";function p(e,n){if(!e)return"";if(e.pathOnly)return n?r({path:n}):"";if(e.asyncSection){let i=f({section:e.asyncSection,messageKey:e.messageKey,subsection:e.t});return n&&(i+=`&path=${n}`),i}return r({t:e.t,in:e.in,c:e.c,cb:e.cb,ct:e.ct,path:n})}function A(e){const n=t(u),i=o(()=>p(n,e),[n,e]);return s(i)}function S(){const e=t(u);return o(()=>p(e,""),[e])}function F(){const e=t(m)??"",n=S();return c(a(e,n))}export{p as buildSchemaFieldSuffix,A as useSchemaFieldDeepLink,S as useSectionBaselineKey,F as useSectionExpandBaseline};
@@ -13,7 +13,7 @@ export declare const PropertyName: import("styled-components/dist/types.js").ISt
13
13
  $deprecated?: boolean;
14
14
  }, never>>> & string;
15
15
  export declare const SchemaTypeLabel: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>>> & string;
16
- export declare const SchemaTitle: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react-router-dom").LinkProps & import("react").RefAttributes<HTMLAnchorElement>, never> & Partial<Pick<import("react-router-dom").LinkProps & import("react").RefAttributes<HTMLAnchorElement>, never>>> & string & Omit<import("react").ForwardRefExoticComponent<import("react-router-dom").LinkProps & import("react").RefAttributes<HTMLAnchorElement>>, keyof import("react").Component<any, {}, any>>;
16
+ export declare const SchemaTitle: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react-router").LinkProps & import("react").RefAttributes<HTMLAnchorElement>, never> & Partial<Pick<import("react-router").LinkProps & import("react").RefAttributes<HTMLAnchorElement>, never>>> & string & Omit<import("react").ForwardRefExoticComponent<import("react-router").LinkProps & import("react").RefAttributes<HTMLAnchorElement>>, keyof import("react").Component<any, {}, any>>;
17
17
  export declare const RequiredLabel: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
18
18
  export declare const DeprecatedBadge: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>, "as" | "forwardedAs"> & {
19
19
  as?: import("styled-components").WebTarget | undefined;
@@ -1,4 +1,4 @@
1
- import{styled as r}from"styled-components";import{Link as i}from"react-router-dom";import{JsonViewer as n}from"@redocly/theme/components/JsonViewer/JsonViewer";import{linkCss as s}from"@redocly/theme/components/Markdown/styles/links";import{LEVEL_COLORS as a}from"./utils.js";const b=r.div`
1
+ import{styled as r}from"styled-components";import{Link as i}from"react-router";import{JsonViewer as n}from"@redocly/theme/components/JsonViewer/JsonViewer";import{linkCss as s}from"@redocly/theme/components/Markdown/styles/links";import{LEVEL_COLORS as a}from"./utils.js";const b=r.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
 
@@ -13,12 +13,11 @@ import{styled as r}from"styled-components";import{Link as i}from"react-router-do
13
13
  }
14
14
  `,h=r.div`
15
15
  width: 100%;
16
- padding: ${({$isFirst:e})=>`var(--schema-${e?"fist-":""}property-details-spacing)`}
17
- 0
16
+ padding: ${({$isFirst:e})=>`var(--schema-${e?"fist-":""}property-details-spacing)`} 0
18
17
  var(--schema-property-details-spacing);
19
18
  border-bottom: 1px solid var(--border-color-primary);
20
19
 
21
- &:has([data-schema-nested-open="true"]) {
20
+ &:has([data-schema-nested-open='true']) {
22
21
  border-bottom: none;
23
22
  padding-bottom: 0;
24
23
  }
@@ -1 +1 @@
1
- import{useMemo as m,useRef as a}from"react";import{useAtomValue as s}from"jotai";import{useLocation as u}from"react-router-dom";import{activeScrollSectionAtom as i}from"../../jotai/app.js";import{useSpecTranslate as p}from"../../hooks/useTranslate.js";import{buildMenuItems as f}from"./buildMenuItems.js";function I({items:e}){const{pathname:o}=u(),t=s(i),r=p(),n=a(new WeakMap);return m(()=>{const c=decodeURIComponent(t??o);return f(e,c,r,n.current)},[e,o,t,r])}export{I as useMenuItems};
1
+ import{useMemo as m,useRef as a}from"react";import{useAtomValue as s}from"jotai";import{useLocation as u}from"react-router";import{activeScrollSectionAtom as i}from"../../jotai/app.js";import{useSpecTranslate as p}from"../../hooks/useTranslate.js";import{buildMenuItems as f}from"./buildMenuItems.js";function I({items:e}){const{pathname:o}=u(),t=s(i),r=p(),n=a(new WeakMap);return m(()=>{const c=decodeURIComponent(t??o);return f(e,c,r,n.current)},[e,o,t,r])}export{I as useMenuItems};
@@ -1,4 +1,4 @@
1
- import{jsx as o}from"react/jsx-runtime";import{memo as f,useCallback as v}from"react";import{styled as t,css as a}from"styled-components";import{Link as g}from"react-router-dom";import{useUrlHash as k}from"../../hooks/useUrlHash.js";import{useAtomValue as u}from"jotai";import{LinkIcon as b}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{ClipboardService as x}from"@redocly/theme/core/openapi";import{globalOptionsAtom as y}from"../../jotai/store.js";import{hashToElementId as l}from"../../utils/deep-link.js";function A({to:i,label:s,variant:c="heading"}){const{onDeepLinkClick:e}=u(y),p=k({trackSilentReplaces:!0}),r=i.split("#")[1],m=!!r&&l(p)===l(r),d=v(h=>{x.copyCustom(`${window.location.origin}${i}`),e&&(h.preventDefault(),e(i))},[e,i]);return o(C,{className:"deep-link-anchor","data-deep-link-anchor":!0,children:o(L,{$variant:c,to:i,"aria-label":s??`link to ${i}`,"aria-current":m?"location":void 0,onClick:d,children:o(b,{color:"--heading-anchor-color"})})})}const j=f(A),n="data-deep-link-anchor",w=`
1
+ import{jsx as o}from"react/jsx-runtime";import{memo as f,useCallback as v}from"react";import{styled as t,css as a}from"styled-components";import{Link as g}from"react-router";import{useUrlHash as k}from"../../hooks/useUrlHash.js";import{useAtomValue as u}from"jotai";import{LinkIcon as b}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{ClipboardService as x}from"@redocly/theme/core/openapi";import{globalOptionsAtom as y}from"../../jotai/store.js";import{hashToElementId as l}from"../../utils/deep-link.js";function A({to:i,label:s,variant:c="heading"}){const{onDeepLinkClick:e}=u(y),p=k({trackSilentReplaces:!0}),r=i.split("#")[1],m=!!r&&l(p)===l(r),d=v(h=>{x.copyCustom(`${window.location.origin}${i}`),e&&(h.preventDefault(),e(i))},[e,i]);return o(C,{className:"deep-link-anchor","data-deep-link-anchor":!0,children:o(L,{$variant:c,to:i,"aria-label":s??`link to ${i}`,"aria-current":m?"location":void 0,onClick:d,children:o(b,{color:"--heading-anchor-color"})})})}const j=f(A),n="data-deep-link-anchor",w=`
2
2
  & [${n}] svg {
3
3
  visibility: hidden;
4
4
  }
@@ -1,4 +1,4 @@
1
- import{Fragment as a,jsx as r,jsxs as c}from"react/jsx-runtime";import{memo as l}from"react";import{styled as u}from"styled-components";import{useAtomValue as n}from"jotai";import{Link as d}from"react-router-dom";import{graphqlTypeLookupAtom as f,graphqlTypeSlugMapAtom as h}from"../../jotai/graphql.js";import{SchemaItemWrapper as g,PanelAnnotation as y}from"./styled.js";import{renderDescription as x}from"./renderDescription.js";import{useNavigationUrlNormalizer as L}from"../../hooks/useNormalizeUrl.js";function v({typeNames:i}){const p=n(f),m=n(h),s=L();return r(a,{children:i.map(o=>{const t=p(o),e=m[o];return c(g,{children:[r(k,{to:e?s(e):"#",children:o}),t?.description&&r(y,{children:x(t.description)})]},o)})})}const D=l(v),k=u(d)`
1
+ import{Fragment as a,jsx as r,jsxs as c}from"react/jsx-runtime";import{memo as l}from"react";import{styled as u}from"styled-components";import{useAtomValue as n}from"jotai";import{Link as d}from"react-router";import{graphqlTypeLookupAtom as f,graphqlTypeSlugMapAtom as h}from"../../jotai/graphql.js";import{SchemaItemWrapper as g,PanelAnnotation as y}from"./styled.js";import{renderDescription as x}from"./renderDescription.js";import{useNavigationUrlNormalizer as L}from"../../hooks/useNormalizeUrl.js";function v({typeNames:i}){const p=n(f),m=n(h),s=L();return r(a,{children:i.map(o=>{const t=p(o),e=m[o];return c(g,{children:[r(k,{to:e?s(e):"#",children:o}),t?.description&&r(y,{children:x(t.description)})]},o)})})}const D=l(v),k=u(d)`
2
2
  color: var(--link-color-primary, var(--text-color-secondary));
3
3
  text-decoration: none;
4
4
  cursor: pointer;
@@ -1,4 +1,4 @@
1
- import{Fragment as i,jsx as e,jsxs as n}from"react/jsx-runtime";import{memo as f}from"react";import{useAtomValue as x}from"jotai";import{styled as t}from"styled-components";import{Link as v}from"react-router-dom";import{graphqlTypeSlugMapAtom as y}from"../../jotai/graphql.js";import{NonNullLabel as L,MessageBadge as l}from"./styled.js";import{useNavigationUrlNormalizer as b}from"../../hooks/useNormalizeUrl.js";import{useSpecTranslate as w}from"../../hooks/useTranslate.js";function s({typeRef:r}){return r.isList?n(i,{children:["[",r.name,r.isNonNull?"!":"","]",r.isListNonNull?"!":""]}):n(i,{children:[r.name,r.isNonNull?"!":""]})}function $({typeRef:r,inline:m=!1,size:c="base",deprecated:d=!1,required:p=!1,className:u}){const h=x(y),N=b(),o=w(),g=r.isListNonNull||r.isNonNull,a=h[r.name];return n(T,{className:u,"data-testid":"return-type",$inline:m,$size:c,children:[a?e(k,{to:N(a),children:e(s,{typeRef:r})}):e(s,{typeRef:r}),g&&n(i,{children:[e(z,{children:","}),e(L,{children:o("nonNull","non-null")})]}),d&&e(l,{"data-testid":"deprecated",type:"warning",children:o("badges.deprecated","deprecated")}),p&&e(l,{"data-testid":"required-arg",type:"error",children:o("required","required")})]})}const G=f($),T=t.div`
1
+ import{Fragment as i,jsx as e,jsxs as n}from"react/jsx-runtime";import{memo as f}from"react";import{useAtomValue as x}from"jotai";import{styled as t}from"styled-components";import{Link as v}from"react-router";import{graphqlTypeSlugMapAtom as y}from"../../jotai/graphql.js";import{NonNullLabel as L,MessageBadge as l}from"./styled.js";import{useNavigationUrlNormalizer as b}from"../../hooks/useNormalizeUrl.js";import{useSpecTranslate as w}from"../../hooks/useTranslate.js";function s({typeRef:r}){return r.isList?n(i,{children:["[",r.name,r.isNonNull?"!":"","]",r.isListNonNull?"!":""]}):n(i,{children:[r.name,r.isNonNull?"!":""]})}function $({typeRef:r,inline:m=!1,size:c="base",deprecated:d=!1,required:p=!1,className:u}){const h=x(y),N=b(),o=w(),g=r.isListNonNull||r.isNonNull,a=h[r.name];return n(T,{className:u,"data-testid":"return-type",$inline:m,$size:c,children:[a?e(k,{to:N(a),children:e(s,{typeRef:r})}):e(s,{typeRef:r}),g&&n(i,{children:[e(z,{children:","}),e(L,{children:o("nonNull","non-null")})]}),d&&e(l,{"data-testid":"deprecated",type:"warning",children:o("badges.deprecated","deprecated")}),p&&e(l,{"data-testid":"required-arg",type:"error",children:o("required","required")})]})}const G=f($),T=t.div`
2
2
  display: ${({$inline:r})=>r?"inline-block":"block"};
3
3
  min-width: 0;
4
4
  font-size: ${({$size:r})=>`var(--font-size-${r})`};
@@ -1,7 +1,7 @@
1
1
  import type { JSX, PropsWithChildren } from 'react';
2
2
  declare function HeadingComponent({ level, id, children, deepLinkHash, 'data-source': dataSource, 'data-hash': dataHash, className, }: PropsWithChildren<{
3
3
  level: number;
4
- id: string;
4
+ id?: string;
5
5
  deepLinkHash?: string;
6
6
  'data-source'?: string;
7
7
  'data-hash'?: string;
@@ -1,6 +1,6 @@
1
- import{jsx as e,jsxs as p}from"react/jsx-runtime";import{createElement as c,memo as d}from"react";import{styled as f}from"styled-components";import{useAtomValue as h}from"jotai";import{concatClassNames as g}from"@redocly/theme/core/utils";import{HEADING_ANCHOR_CLASS as u,MARKDOWN_CLASS_NAME as A}from"@redocly/theme/core/constants";import{DeepLinkAnchor as C,deepLinkHoverReveal as H}from"../common/DeepLinkAnchor.js";import{joinWithSeparator as N}from"../../utils/url.js";import{routingBasePathAtom as x}from"../../jotai/store.js";import{useNavigationUrlNormalizer as L}from"../../hooks/useNormalizeUrl.js";function _({level:a,id:o,children:r,deepLinkHash:t,"data-source":n,"data-hash":i,className:m}){const s=h(x),l=L()(N(s,t??o.toLowerCase()));return c(`h${a}`,{id:o.toLowerCase(),className:g(u,A,m),"data-component-name":"Markdoc/Heading/Heading","data-source":n,"data-hash":i},p(j,{children:[e(C,{to:l,label:`link to ${o}`}),e("span",{children:r})]}))}const j=f.div`
1
+ import{jsx as a,jsxs as l}from"react/jsx-runtime";import{createElement as c,memo as f}from"react";import{styled as h}from"styled-components";import{useAtomValue as g}from"jotai";import{concatClassNames as u}from"@redocly/theme/core/utils";import{HEADING_ANCHOR_CLASS as A,MARKDOWN_CLASS_NAME as H}from"@redocly/theme/core/constants";import{DeepLinkAnchor as N,deepLinkHoverReveal as C}from"../common/DeepLinkAnchor.js";import{joinWithSeparator as x}from"../../utils/url.js";import{routingBasePathAtom as _}from"../../jotai/store.js";import{useNavigationUrlNormalizer as j}from"../../hooks/useNormalizeUrl.js";function v({level:t,id:e,children:r,deepLinkHash:n,"data-source":i,"data-hash":m,className:s}){const p=g(_),d=j(),o=e?.toLowerCase();return c(`h${t}`,{id:o,className:u(A,H,s),"data-component-name":"Markdoc/Heading/Heading","data-source":i,"data-hash":m},l(L,{children:[o&&a(N,{to:d(x(p,n??o)),label:`link to ${e}`}),a("span",{children:r})]}))}const L=h.div`
2
2
  position: relative;
3
3
  display: flex;
4
4
  align-items: center;
5
- ${H}
6
- `,w=d(_);export{w as Heading};
5
+ ${C}
6
+ `,B=f(v);export{B as Heading};
@@ -1 +1 @@
1
- import r from"@markdoc/markdoc";import{html as u}from"@redocly/theme/markdoc/tags/html";import{MARKDOWN_CLASS_NAME as f}from"@redocly/theme/core/constants";import{safeSlugify as p}from"../../utils/string.js";import{mcpTagSchemas as g}from"./tags/mcp-tag-schemas.js";import{schemaDefinitionTag as l}from"./tags/schema-definition-tag.js";function i(e){if(typeof e[0]=="string")return`section/${p(e[0])}`;if(e.length>0)return i(e[0])}const y={html:u.schema,schemaDefinition:l,...g};function s(e){return e.map(t=>typeof t=="string"?t:r.Tag.isTag(t)?s(t.children):"").join("")}function o(e){return e.map(t=>r.Tag.isTag(t)?t.name==="th"?new r.Tag("th",{...t.attributes,"data-label":s(t.children)},t.children):new r.Tag(t.name,t.attributes,o(t.children)):t)}const N={table:{transform(e,t){const n=e.transformAttributes(t),a=e.transformChildren(t);return new r.Tag("div",{className:"md-table-wrapper"},[new r.Tag("table",{...n,className:f},o(a))])}},heading:{children:["inline"],attributes:{id:{type:String},level:{type:Number,required:!0,default:1},deepLinkHash:{type:String}},transform(e,t){const n=e.transformAttributes(t),a=e.transformChildren(t),m=typeof n.id=="string"?n.id:i(a);return new r.Tag("Heading",{...n,id:m,level:e.attributes.level===1?2:e.attributes.level},a)}}};export{N as apiDocsMarkdocNodes,y as apiDocsMarkdocTags,i as getMarkdownHeaderId};
1
+ import r from"@markdoc/markdoc";import{html as m}from"@redocly/theme/markdoc/tags/html";import{MARKDOWN_CLASS_NAME as u}from"@redocly/theme/core/constants";import{safeSlugify as f}from"../../utils/string.js";import{mcpTagSchemas as p}from"./tags/mcp-tag-schemas.js";import{schemaDefinitionTag as c}from"./tags/schema-definition-tag.js";function l(e){const t=i(e).trim();return t?`section/${f(t)}`:void 0}const y={html:m.schema,schemaDefinition:c,...p};function i(e){return e.map(t=>typeof t=="string"?t:r.Tag.isTag(t)?i(t.children):"").join("")}function s(e){return e.map(t=>r.Tag.isTag(t)?t.name==="th"?new r.Tag("th",{...t.attributes,"data-label":i(t.children)},t.children):new r.Tag(t.name,t.attributes,s(t.children)):t)}const N={table:{transform(e,t){const n=e.transformAttributes(t),a=e.transformChildren(t);return new r.Tag("div",{className:"md-table-wrapper"},[new r.Tag("table",{...n,className:u},s(a))])}},heading:{children:["inline"],attributes:{id:{type:String},level:{type:Number,required:!0,default:1},deepLinkHash:{type:String}},transform(e,t){const n=e.transformAttributes(t),a=e.transformChildren(t),o=typeof n.id=="string"?n.id:l(a);return new r.Tag("Heading",{...n,id:o,level:e.attributes.level===1?2:e.attributes.level},a)}}};export{N as apiDocsMarkdocNodes,y as apiDocsMarkdocTags,l as getMarkdownHeaderId};
@@ -1,5 +1,5 @@
1
- import{Fragment as A,jsx as e,jsxs as y}from"react/jsx-runtime";import{useState as u,useEffect as N,useMemo as g,useCallback as L}from"react";import{styled as _}from"styled-components";import{useAtomValue as B}from"jotai";import{CodeBlockPanel as K,StyledCodeBlock as V}from"../styled.js";import{useResolvedExamples as F,useExampleEntries as H}from"../../ItemContent/hooks.js";import{useBodySamplingSchemaId as Y,useMediaTypeContent as $}from"./hooks.js";import{ExampleSelector as O,MediaTypeSelector as R,PayloadDisplay as U}from"./selectors.js";import{StyledPanelHeader as W}from"./styled.js";import{ServerDropdown as q}from"./ServerDropdown.js";import{LanguageDropdown as z}from"../LanguageItem/LanguageDropdown.js";import{selectedCallbackAtom as G}from"../../../jotai/app.js";import{getSyntaxHighlightLang as J}from"../../../utils/languages.js";import{useSpecTranslate as Q}from"../../../hooks/useTranslate.js";import{useCopyCodeTelemetry as X}from"../../../hooks/useCopyCodeTelemetry.js";const p="payload",Z=_.div`
1
+ import{Fragment as N,jsx as e,jsxs as y}from"react/jsx-runtime";import{useState as u,useContext as L,useEffect as _,useMemo as g,useCallback as B}from"react";import{styled as F}from"styled-components";import{useAtomValue as K}from"jotai";import{CodeBlockPanel as V,StyledCodeBlock as H}from"../styled.js";import{useResolvedExamples as Y,useExampleEntries as $}from"../../ItemContent/hooks.js";import{useBodySamplingSchemaId as O,useMediaTypeContent as R}from"./hooks.js";import{ExampleSelector as U,MediaTypeSelector as W,PayloadDisplay as q}from"./selectors.js";import{StyledPanelHeader as z}from"./styled.js";import{ServerDropdown as G}from"./ServerDropdown.js";import{LanguageDropdown as J}from"../LanguageItem/LanguageDropdown.js";import{itemStoreFieldAtom as Q}from"../../../jotai/itemStore.js";import{ItemIdContext as X}from"../../../hooks/useDeepLinkSection.js";import{getSyntaxHighlightLang as Z}from"../../../utils/languages.js";import{useSpecTranslate as ee}from"../../../hooks/useTranslate.js";import{useCopyCodeTelemetry as ae}from"../../../hooks/useCopyCodeTelemetry.js";const m="payload",te=F.div`
2
2
  min-width: 0;
3
3
  overflow: hidden;
4
4
  flex: 1 1 auto;
5
- `;function ue({node:a}){const x=Q(),h=B(G),m=a.callbackName,o=a.definitionSamples,S=m!=null&&h===m,{mediaTypes:b,activeMediaType:l,effectiveSchemaId:v,effectiveExampleIds:s,onMediaTypeChange:C}=$(a),k=Y(v,l),d=F(k,s,"response",l),E=H(s),[i,f]=u(0),[n,T]=u(p);N(()=>f(0),[s,l]);const I=d[i]??d[0],D=E[i]?.description,P=g(()=>{const t=[{key:p,lang:"json",title:"Payload"}];if(o)for(const c of o){const w=`x-${c.lang}`;t.push({key:w,lang:c.lang,title:c.label||c.lang})}return t},[o]),r=g(()=>{if(!(n===p||!o))return o.find(t=>`x-${t.lang}`===n)},[n,o]),M=X("response"),j=L(t=>T(t),[]);return S?e(K,{className:"panel-callback-samples",header:()=>y(W,{isExpandable:!1,children:[e(Z,{children:e(q,{servers:a.servers??[],method:(a.httpVerb??"post").toUpperCase(),path:a.path??"Callback"})}),e(z,{activeTab:n,samples:P,onChange:j})]}),isExpandable:!1,children:r?e(V,{lang:J(r.lang),source:r.source,header:{className:"code-block-header",controls:{copy:{onClick:M(r.lang)}}}}):y(A,{children:[e(R,{mediaTypes:b,value:l,onChange:C,label:x("contentType","Payload media type")}),e(O,{exampleIds:s,selectedIdx:i,onSelect:f}),e(U,{payload:I,emptyMessage:"// No callback payload",mediaType:l,description:D})]})}):null}export{ue as CallbackPayloadItem};
5
+ `;function Se({node:a}){const x=ee(),h=L(X)??"",S=K(Q({itemId:h,key:"selectedCallback"})),p=a.callbackName,t=a.definitionSamples,C=p!=null&&S===p,{mediaTypes:b,activeMediaType:l,effectiveSchemaId:v,effectiveExampleIds:s,onMediaTypeChange:k}=R(a),E=O(v,l),d=Y(E,s,"response",l),I=$(s),[i,f]=u(0),[n,T]=u(m);_(()=>f(0),[s,l]);const D=d[i]??d[0],P=I[i]?.description,M=g(()=>{const o=[{key:m,lang:"json",title:"Payload"}];if(t)for(const c of t){const A=`x-${c.lang}`;o.push({key:A,lang:c.lang,title:c.label||c.lang})}return o},[t]),r=g(()=>{if(!(n===m||!t))return t.find(o=>`x-${o.lang}`===n)},[n,t]),j=ae("response"),w=B(o=>T(o),[]);return C?e(V,{className:"panel-callback-samples",header:()=>y(z,{isExpandable:!1,children:[e(te,{children:e(G,{servers:a.servers??[],method:(a.httpVerb??"post").toUpperCase(),path:a.path??"Callback"})}),e(J,{activeTab:n,samples:M,onChange:w})]}),isExpandable:!1,children:r?e(H,{lang:Z(r.lang),source:r.source,header:{className:"code-block-header",controls:{copy:{onClick:j(r.lang)}}}}):y(N,{children:[e(W,{mediaTypes:b,value:l,onChange:k,label:x("contentType","Payload media type")}),e(U,{exampleIds:s,selectedIdx:i,onSelect:f}),e(q,{payload:D,emptyMessage:"// No callback payload",mediaType:l,description:P})]})}):null}export{Se as CallbackPayloadItem};
@@ -1,4 +1,4 @@
1
- import{jsx as n,jsxs as c}from"react/jsx-runtime";import{memo as I,useCallback as u,useMemo as h}from"react";import{useAtomValue as y}from"jotai";import{styled as m}from"styled-components";import{Link as v}from"react-router-dom";import{useSpecTranslate as M}from"../../hooks/useTranslate.js";import{useTelemetry as q}from"../../hooks/useTelemetry.js";import{resolveText as L}from"../../utils/resolveText.js";import{graphqlReferenceMapAtom as j,graphqlTypeSlugMapAtom as w}from"../../jotai/graphql.js";import{PanelWrapper as N,PanelHeading as P,PanelBody as $,PanelListItem as C,ListIcon as S}from"./shared-panel-styles.js";import{useNavigationUrlNormalizer as b}from"../../hooks/useNormalizeUrl.js";function Q({node:i}){const e=i.children[0],p=M(),t=y(j),o=y(w),l=b(),s=q(),x=u(r=>{s.sendReferencedInClickedMessage([{id:"graphqlDocsReferencedInLink",object:"link",uri:"urn:redocly:redoc:ui:link:graphqlDocsReferencedInLink",referencedIn:r}])},[s]),d=h(()=>e?.graphqlTypeName?t[e.graphqlTypeName]??[]:e?.references??[],[e,t]),R=h(()=>d.flatMap(r=>{const a=o[r.name];if(!a)return[];const f=l(a),k=r.field?l(`${a}#${r.name}-${r.field}`):void 0;return[{reference:r,typeTo:f,fieldTo:k}]}),[d,o,l]);if(d.length===0)return null;const T=L(p,i.titleTranslationKey,i.title);return c(N,{className:"panel-api-docs",children:[n(P,{children:T}),n($,{children:R.map(({reference:r,typeTo:a,fieldTo:f})=>n(z,{reference:r,typeTo:a,fieldTo:f,onReferencedInClick:x},`${r.name}.${r.field??""}`))})]})}const z=I(function({reference:e,typeTo:p,fieldTo:t,onReferencedInClick:o}){const l=u(()=>o(e.name),[o,e.name]),s=u(()=>o(e.field??""),[o,e.field]);return c(A,{children:[n(S,{clipId:"clip_ref"}),c(_,{children:[n(g,{to:p,onClick:l,children:e.name}),e.field&&t&&c(D,{children:[".",n("wbr",{}),n(g,{to:t,onClick:s,children:e.field})]})]})]})}),A=m(C)`
1
+ import{jsx as n,jsxs as c}from"react/jsx-runtime";import{memo as I,useCallback as u,useMemo as h}from"react";import{useAtomValue as y}from"jotai";import{styled as m}from"styled-components";import{Link as v}from"react-router";import{useSpecTranslate as M}from"../../hooks/useTranslate.js";import{useTelemetry as q}from"../../hooks/useTelemetry.js";import{resolveText as L}from"../../utils/resolveText.js";import{graphqlReferenceMapAtom as j,graphqlTypeSlugMapAtom as w}from"../../jotai/graphql.js";import{PanelWrapper as N,PanelHeading as P,PanelBody as $,PanelListItem as C,ListIcon as S}from"./shared-panel-styles.js";import{useNavigationUrlNormalizer as b}from"../../hooks/useNormalizeUrl.js";function Q({node:i}){const e=i.children[0],p=M(),t=y(j),o=y(w),l=b(),s=q(),x=u(r=>{s.sendReferencedInClickedMessage([{id:"graphqlDocsReferencedInLink",object:"link",uri:"urn:redocly:redoc:ui:link:graphqlDocsReferencedInLink",referencedIn:r}])},[s]),d=h(()=>e?.graphqlTypeName?t[e.graphqlTypeName]??[]:e?.references??[],[e,t]),R=h(()=>d.flatMap(r=>{const a=o[r.name];if(!a)return[];const f=l(a),k=r.field?l(`${a}#${r.name}-${r.field}`):void 0;return[{reference:r,typeTo:f,fieldTo:k}]}),[d,o,l]);if(d.length===0)return null;const T=L(p,i.titleTranslationKey,i.title);return c(N,{className:"panel-api-docs",children:[n(P,{children:T}),n($,{children:R.map(({reference:r,typeTo:a,fieldTo:f})=>n(z,{reference:r,typeTo:a,fieldTo:f,onReferencedInClick:x},`${r.name}.${r.field??""}`))})]})}const z=I(function({reference:e,typeTo:p,fieldTo:t,onReferencedInClick:o}){const l=u(()=>o(e.name),[o,e.name]),s=u(()=>o(e.field??""),[o,e.field]);return c(A,{children:[n(S,{clipId:"clip_ref"}),c(_,{children:[n(g,{to:p,onClick:l,children:e.name}),e.field&&t&&c(D,{children:[".",n("wbr",{}),n(g,{to:t,onClick:s,children:e.field})]})]})]})}),A=m(C)`
2
2
  align-items: flex-start;
3
3
  `,_=m.span`
4
4
  overflow-wrap: anywhere;
@@ -1,4 +1,4 @@
1
- import{Fragment as b,jsx as t,jsxs as m}from"react/jsx-runtime";import{styled as s}from"styled-components";import{useAtomValue as C}from"jotai";import{memo as M,useCallback as f,useContext as j,useMemo as A}from"react";import{Link as q}from"react-router-dom";import{Panel as K}from"@redocly/theme/components/Panel/Panel";import{Typography as P}from"@redocly/theme/components/Typography/Typography";import{ListIcon as S}from"../../../../icons/ListIcon/ListIcon.js";import{visitedChannelsAtom as T}from"../../../../jotai/app.js";import{itemStoreFieldAtom as $}from"../../../../jotai/itemStore.js";import{ItemIdContext as E}from"../../../../hooks/useDeepLinkSection.js";import{useNavigationUrlNormalizer as F}from"../../../../hooks/useNormalizeUrl.js";import{useTelemetry as N}from"../../../../hooks/useTelemetry.js";function U(o){const n=[];return o.exchanges.length>0&&n.push(`${o.exchanges.length} exchange${o.exchanges.length>1?"s":""}`),o.queues.length>0&&n.push(`${o.queues.length} queue${o.queues.length>1?"s":""}`),n.length===0?"":`Used in ${n.join(" and ")}`}const I=M(function({reference:n,to:l,isActive:c,onReferencedInClick:r}){const d=f(()=>r(n.label),[r,n.label]);return m(B,{children:[t(D,{size:"22px",color:c?"var(--color-info-border)":"var(--border-color-primary)"}),t(Q,{to:l,onClick:d,children:n.label})]})});function ie({node:o}){const n=o.children[0],l=j(E)??"",c=C(T),r=f(e=>(c??[]).some(a=>a.endsWith(e.toLowerCase())),[c]),d=F(),u=N(),h=C(A(()=>$({itemId:l,key:"activeMessageKey"}),[l])),v=f(e=>{u.sendReferencedInClickedMessage([{id:"asyncapiDocsChannelLink",object:"link",uri:"urn:redocly:redoc:ui:link:asyncapiDocsChannelLink",referencedIn:e}])},[u]);if(!n)return t(b,{});const{referencesByMessageKey:g}=n,w=Object.keys(g),x=h&&g[h]?h:w[0],i=x?g[x]:void 0;if(!i||i.exchanges.length===0&&i.queues.length===0)return t(b,{});const L=U(i),y=i.exchanges.map(e=>({reference:e,to:d(e.link)})),k=i.queues.map(e=>({reference:e,to:d(e.link)}));return m(_,{header:L,className:"panel-api-docs",isExpandable:!1,children:[y.length>0&&m(z,{children:[t(R,{children:"Exchanges"}),y.map(({reference:e,to:a})=>{const p=r(e.key);return t(I,{reference:e,to:a,isActive:p,onReferencedInClick:v},e.key)})]}),k.length>0&&m(z,{children:[t(R,{children:"Queues"}),k.map(({reference:e,to:a})=>{const p=r(e.key);return t(I,{reference:e,to:a,isActive:p,onReferencedInClick:v},e.key)})]})]})}const _=s(K)`
1
+ import{Fragment as b,jsx as t,jsxs as m}from"react/jsx-runtime";import{styled as s}from"styled-components";import{useAtomValue as C}from"jotai";import{memo as M,useCallback as f,useContext as j,useMemo as A}from"react";import{Link as q}from"react-router";import{Panel as K}from"@redocly/theme/components/Panel/Panel";import{Typography as P}from"@redocly/theme/components/Typography/Typography";import{ListIcon as S}from"../../../../icons/ListIcon/ListIcon.js";import{visitedChannelsAtom as T}from"../../../../jotai/app.js";import{itemStoreFieldAtom as $}from"../../../../jotai/itemStore.js";import{ItemIdContext as E}from"../../../../hooks/useDeepLinkSection.js";import{useNavigationUrlNormalizer as F}from"../../../../hooks/useNormalizeUrl.js";import{useTelemetry as N}from"../../../../hooks/useTelemetry.js";function U(o){const n=[];return o.exchanges.length>0&&n.push(`${o.exchanges.length} exchange${o.exchanges.length>1?"s":""}`),o.queues.length>0&&n.push(`${o.queues.length} queue${o.queues.length>1?"s":""}`),n.length===0?"":`Used in ${n.join(" and ")}`}const I=M(function({reference:n,to:l,isActive:c,onReferencedInClick:r}){const d=f(()=>r(n.label),[r,n.label]);return m(B,{children:[t(D,{size:"22px",color:c?"var(--color-info-border)":"var(--border-color-primary)"}),t(Q,{to:l,onClick:d,children:n.label})]})});function ie({node:o}){const n=o.children[0],l=j(E)??"",c=C(T),r=f(e=>(c??[]).some(a=>a.endsWith(e.toLowerCase())),[c]),d=F(),u=N(),h=C(A(()=>$({itemId:l,key:"activeMessageKey"}),[l])),v=f(e=>{u.sendReferencedInClickedMessage([{id:"asyncapiDocsChannelLink",object:"link",uri:"urn:redocly:redoc:ui:link:asyncapiDocsChannelLink",referencedIn:e}])},[u]);if(!n)return t(b,{});const{referencesByMessageKey:g}=n,w=Object.keys(g),x=h&&g[h]?h:w[0],i=x?g[x]:void 0;if(!i||i.exchanges.length===0&&i.queues.length===0)return t(b,{});const L=U(i),y=i.exchanges.map(e=>({reference:e,to:d(e.link)})),k=i.queues.map(e=>({reference:e,to:d(e.link)}));return m(_,{header:L,className:"panel-api-docs",isExpandable:!1,children:[y.length>0&&m(z,{children:[t(R,{children:"Exchanges"}),y.map(({reference:e,to:a})=>{const p=r(e.key);return t(I,{reference:e,to:a,isActive:p,onReferencedInClick:v},e.key)})]}),k.length>0&&m(z,{children:[t(R,{children:"Queues"}),k.map(({reference:e,to:a})=>{const p=r(e.key);return t(I,{reference:e,to:a,isActive:p,onReferencedInClick:v},e.key)})]})]})}const _=s(K)`
2
2
  [data-component-name='Panel/PanelBody'] {
3
3
  background-color: var(--layer-color-ontonal);
4
4
  padding: 0;
@@ -1 +1 @@
1
- import{jsx as r}from"react/jsx-runtime";import{memo as i}from"react";import{BrowserRouter as u,useInRouterContext as s}from"react-router-dom";function a(t){const e=i(o=>s()?r(t,{...o}):r(u,{children:r(t,{...o})}));return e.displayName=`WithRouter(${n(t)})`,e}function n(t){return t.displayName||t.name||"RedoclyApiDocs"}export{a as withRouter};
1
+ import{jsx as r}from"react/jsx-runtime";import{memo as i}from"react";import{BrowserRouter as u,useInRouterContext as s}from"react-router";function a(t){const e=i(o=>s()?r(t,{...o}):r(u,{children:r(t,{...o})}));return e.displayName=`WithRouter(${n(t)})`,e}function n(t){return t.displayName||t.name||"RedoclyApiDocs"}export{a as withRouter};