@qualcomm-ui/react-swagger 1.3.36 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.min.css +1 -1
- package/dist/index.js +2922 -1
- package/dist/index.js.map +1 -1
- package/package.json +10 -4
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2923 @@
|
|
|
1
|
-
"use client";import{Fragment as e,createContext as t,memo as n,useCallback as r,useContext as i,useEffect as a,useEffectEvent as o,useMemo as s,useRef as c,useState as l}from"react";import u from"swagger-ui-react";import{clsx as d}from"@qualcomm-ui/utils/clsx";import{ChevronDown as f,ChevronRightIcon as p,ChevronUp as m,ChevronUpIcon as h,DownloadIcon as g,Edit2Icon as _,ExternalLinkIcon as v,FlaskConicalIcon as y,InfinityIcon as b,Link2 as x,Link2Icon as S,LockIcon as C,LockOpenIcon as w,MinusIcon as T,PlayIcon as E,PlusIcon as D,RotateCcw as O,Trash2Icon as k,XIcon as A}from"lucide-react";import{Button as j,IconButton as M}from"@qualcomm-ui/react/button";import{Icon as N}from"@qualcomm-ui/react/icon";import{booleanDataAttr as P}from"@qualcomm-ui/utils/attributes";import{create as F,createStore as I,useStore as L}from"zustand";import{Fragment as R,jsx as z,jsxs as B}from"react/jsx-runtime";import{PasswordInput as V}from"@qualcomm-ui/react/password-input";import{Dialog as H}from"@qualcomm-ui/react/dialog";import{TextInput as U}from"@qualcomm-ui/react/text-input";import{selectCollection as W}from"@qualcomm-ui/core/select";import{Checkbox as G}from"@qualcomm-ui/react/checkbox";import{Select as K}from"@qualcomm-ui/react/select";import q from"immutable";import J from"randombytes";import ee from"sha.js";import Y from"url-parse";import{useEffectOnce as te}from"@qualcomm-ui/react-core/effects";import{langs as X}from"@uiw/codemirror-extensions-langs";import{githubDark as ne,githubLight as re}from"@uiw/codemirror-theme-github";import ie from"@uiw/react-codemirror";import{CopyToClipboardIconButton as ae}from"@qualcomm-ui/react-mdx/copy-to-clipboard";import{Tooltip as oe}from"@qualcomm-ui/react/tooltip";import{sanitizeUrl as se}from"@braintree/sanitize-url";import ce from"css.escape";import{Accordion as Z}from"@qualcomm-ui/react/accordion";import{Tab as Q,Tabs as le}from"@qualcomm-ui/react/tabs";import{Collapsible as $}from"@qualcomm-ui/react/collapsible";import{toString as ue}from"lodash-es";import{Link as de}from"@qualcomm-ui/react/link";import{InlineNotification as fe}from"@qualcomm-ui/react/inline-notification";import{Progress as pe}from"@qualcomm-ui/react/progress";var DefaultKeyRenderer=()=>null;DefaultKeyRenderer.when=()=>!1;var createJsonViewerStore=e=>F()((t,n)=>({collapseStringsAfterLength:e.collapseStringsAfterLength===!1?Number.MAX_VALUE:e.collapseStringsAfterLength??50,colorspace:Ve,defaultInspectControl:e.defaultInspectControl??void 0,defaultInspectDepth:e.defaultInspectDepth??5,displayDataTypes:e.displayDataTypes??!0,displayKeyIndicator:e.displayKeyIndicator??!0,displayNumberKeys:e.displayNumberKeys??!0,displaySize:e.displaySize??!0,getInspectCache:(e,t)=>{let r=t===void 0?e.join(`.`):`${e.join(`.`)}[${t}]nt`;return n().inspectCache[r]},groupArraysAfterLength:e.groupArraysAfterLength??100,highlightUpdates:e.highlightUpdates??!1,hoverPath:null,indentWidth:e.indentWidth??3,inspectCache:{},keyRenderer:e.keyRenderer??DefaultKeyRenderer,maxDisplayLength:e.maxDisplayLength??30,objectSortKeys:e.objectSortKeys??!1,onChange:e.onChange??(()=>{}),prevValue:void 0,quotesOnKeys:e.quotesOnKeys??!1,renderLink:e.renderLink,rootName:e.rootName??`root`,setHover:(e,n)=>{t({hoverPath:e?{nestedIndex:n,path:e}:null})},setInspectCache:(e,n,r)=>{let i=r===void 0?e.join(`.`):`${e.join(`.`)}[${r}]nt`;t(e=>({inspectCache:{...e.inspectCache,[i]:typeof n==`function`?n(e.inspectCache[i]):n}}))},value:e.value})),me=t(null);me.Provider;var useJsonViewerStore=e=>{let t=i(me);if(!t)throw Error(`JsonModelViewer components must be wrapped in <JsonViewerProvider>`);return L(t,e)};RefName.displayName=`RefName`;function RefName({inspect:e,isArray:t,refName:n}){let r=useJsonViewerStore(e=>e.renderLink);return B(`span`,{className:`data-ref-name-wrapper`,children:[B(`span`,{className:d(`data-ref-name`,{inspect:e}),children:[n,t?`[]`:``]}),z(M,{density:`compact`,icon:S,render:z(r,{href:`#model-${n}`}),size:`sm`,variant:`ghost`})]})}function isObject(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`object`)}function isReferenceObject(e){return!!(e&&typeof e==`object`&&`properties`in e&&`type`in e&&e.type===`object`)}function isReferenceArray(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`array`&&`items`in e)}function getRefName(e){let t=``;return isReferenceObject(e)?t=e.$$ref?.substring(e.$$ref?.lastIndexOf(`/`)+1):isReferenceArray(e)&&(t=e.items.$$ref?.substring(e.items.$$ref?.lastIndexOf(`/`)+1)),t}function getArrayType(e){return e?.type&&(e.type===`string`||e.type===`boolean`||e.type===`integer`||e.type===`null`)?e.type:``}Object.prototype.constructor.toString();var isCycleReference=(e,t,n)=>{if(e===null||n===null||typeof e!=`object`||typeof n!=`object`)return!1;if(Object.is(e,n)&&t.length!==0)return``;let r=[],i=[...t],a=e;for(;a!==n||i.length!==0;){if(typeof a!=`object`||!a)return!1;if(Object.is(a,n))return r.reduce((e,t,n)=>typeof t==`number`?`${e}[${t}]`:`${e}${n===0?``:`.`}${t}`,``);let e=i.shift();r.push(e),a=a[e]}return!1};function getValueSize(e){return e===null?0:Array.isArray(e)?e.length:e instanceof Map||e instanceof Set?e.size:e instanceof Date?1:typeof e==`object`?Object.keys(e).length:typeof e==`string`?e.length:1}function segmentArray(e,t){let n=[],r=0;for(;r<e.length;)n.push(e.slice(r,r+t)),r+=t;return n}var he=`{`,ge=`[`,_e=`}`,ve=`]`;function inspectMetadata(e){let t=getValueSize(e),n=``;return(e instanceof Map||e instanceof Set)&&(n=e[Symbol.toStringTag]),Object.hasOwn(e,Symbol.toStringTag)&&(n=e[Symbol.toStringTag]),`${t} Items${n?` (${n})`:``}`}function PreObjectType(e){let t=useJsonViewerStore(e=>e.colorspace.base04),n=s(()=>e.arrayOverride||Array.isArray(e.value),[e.arrayOverride,e.value]),r=s(()=>getValueSize(e.value)===0,[e.value]),i=s(()=>inspectMetadata(e.value),[e.value]),a=useJsonViewerStore(e=>e.displaySize),o=s(()=>typeof a==`function`?a(e.path,e.value):a,[a,e.path,e.value]),c=useJsonViewerStore(e=>e.colorspace.base05),l=useIsCycleReference(e.path,e.value),u=e.refName;return B(`span`,{className:`data-object-start`,style:{color:c},children:[n?ge:he,u?z(RefName,{inspect:e.inspect,refName:u}):null,!u&&o&&e.inspect&&!r&&z(`span`,{className:`data-size-label`,style:{color:t},children:i}),l&&!e.inspect&&B(R,{children:[z(N,{className:`inline-icon`,icon:b,style:{color:c}}),l]})]})}function PostObjectType(e){let t=useJsonViewerStore(e=>e.colorspace.base04),n=s(()=>Array.isArray(e.value),[e.value]),r=s(()=>getValueSize(e.value)===0,[e.value]),i=s(()=>inspectMetadata(e.value),[e.value]),a=useJsonViewerStore(e=>e.displaySize),o=s(()=>typeof a==`function`?a(e.path,e.value):a,[a,e.path,e.value]),c=useJsonViewerStore(e=>e.colorspace.base06),l=e.refName;return B(`span`,{className:`data-object-end`,style:{color:c},children:[n?ve:_e,!l&&o&&(r||!e.inspect)?z(`span`,{className:`data-size-label`,style:{color:t},children:i}):null]})}function ObjectType(e){let t=useTextColor(),n=useJsonViewerStore(e=>e.colorspace.base02),r=useJsonViewerStore(e=>e.groupArraysAfterLength),i=useIsCycleReference(e.path,e.value),[a,o]=l(useJsonViewerStore(e=>e.maxDisplayLength)),c=useJsonViewerStore(e=>e.objectSortKeys),u=s(()=>{if(!e.inspect)return null;let t=e.value;if(Array.isArray(t)){if(t.length<=r){let n=t.slice(0,a).map((t,n)=>{let i=e.nestedIndex?e.nestedIndex*r+n:n,a=[...e.path,i];return z(DataKeyPair,{path:a,prevValue:Array.isArray(e.prevValue)?e.prevValue[i]:void 0,value:t},i)});if(t.length>a){let e=t.length-a;n.push(B(`div`,{className:`rest-spread`,onClick:()=>o(e=>e*2),children:[`hidden `,e,` items…`]},`last`))}return n}let n=segmentArray(t,r),i=Array.isArray(e.prevValue)?segmentArray(e.prevValue,r):void 0;return n.map((t,n)=>z(DataKeyPair,{nestedIndex:n,path:e.path,prevValue:i?.[n],value:t},n))}if(!t)return z(R,{});if(t.type===`object`&&t.properties)return z(DataKeyPair,{path:[],prevValue:e.prevValue,requiredProperties:e.requiredProperties,value:t.properties});let n=Object.entries(t).filter(([e])=>e!==`$$ref`);c&&(n=c===!0?n.sort(([e],[t])=>e.localeCompare(t)):n.sort(([e],[t])=>c(e,t)));let i=n.slice(0,a).map(([t,n])=>{let r=[...e.path,t],i=e.requiredProperties?.includes(t);return z(DataKeyPair,{isRequired:i,path:r,prevValue:e.prevValue?.[t],value:n},t)});if(n.length>a){let e=n.length-a;i.push(B(`div`,{className:`rest-spread no-select`,onClick:()=>o(e=>e*2),children:[`hidden `,e,` items…`]},`last`))}return i},[e,c,a,r]),d=e.inspect?.8:0,f=useJsonViewerStore(e=>e.indentWidth),p=e.inspect?f-d:f;return s(()=>getValueSize(e.value)===0,[e.value])?null:z(`div`,{className:`data-object`,style:{borderLeft:e.inspect?`1px solid ${n}`:`none`,color:t,display:e.inspect?`block`:`inline-block`,marginLeft:d*8,paddingLeft:e.inspect?(p-.6)*8:0},children:e.inspect?u:!i&&!e.refName&&z(`span`,{className:`data-object-body`,onClick:()=>e.setInspect(!0),children:`…`})})}var ye={Component:ObjectType,is:e=>typeof e==`object`,PostComponent:PostObjectType,PreComponent:PreObjectType};function PreArrayType(e){let t=e.refName,n=useJsonViewerStore(e=>e.colorspace.base06),r=getArrayType(e.value);return B(`span`,{className:`data-object-start`,style:{color:n},children:[z(`div`,{className:`indicator`,children:r?``:`[{`}),t?z(RefName,{inspect:e.inspect,isArray:!0,refName:t}):null]})}function PostArrayType(e){let t=useJsonViewerStore(e=>e.colorspace.base06),n=getArrayType(e.value);return z(`span`,{className:`data-object-end`,style:{color:t},children:z(`div`,{className:`indicator`,children:n?``:`}]`})})}function ArrayType(e){let t=getArrayType(e.value),n=useJsonViewerStore(e=>e.colorspace.base09);return t?B(`span`,{style:{color:n},children:[t,`[]`]}):z(ObjectType,{...e})}var be={Component:ArrayType,is:e=>isReferenceArray(e),PostComponent:PostArrayType,PreComponent:PreArrayType},DataTypeLabel=({dataType:e,enable:t=!0})=>t?z(`div`,{className:`data-type-label`,children:e}):null;function defineEasyType({colorKey:e,deserialize:t,displayTypeLabel:r=!0,is:i,Renderer:a,serialize:o,type:s}){let c=n(a),EasyType=t=>{let n=useJsonViewerStore(e=>e.displayDataTypes),i=useJsonViewerStore(t=>t.colorspace[e]);return B(`div`,{className:`simple-type`,style:{color:i},children:[r&&n&&z(DataTypeLabel,{dataType:s}),z(`div`,{className:`${s}-value simple-value`,children:z(c,{inspect:t.inspect,isRequired:t.isRequired,path:t.path,prevValue:t.prevValue,setInspect:t.setInspect,value:t.value})})]})};return EasyType.displayName=`easy-${s}-type`,!o||!t?{Component:EasyType,is:i}:{Component:EasyType,deserialize:t,is:i,serialize:o}}var xe=defineEasyType({colorKey:`base09`,is:e=>!!(e&&typeof e==`object`&&`type`in e&&e.type===`boolean`),Renderer:()=>z(`span`,{className:`data-value`,children:`boolean`}),type:`boolean`}),Se=defineEasyType({colorKey:`base0E`,deserialize:e=>{if(e===`true`)return!0;if(e===`false`)return!1;throw Error(`Invalid boolean value`)},is:e=>typeof e==`boolean`,Renderer:({value:e})=>z(R,{children:e?`true`:`false`}),serialize:e=>e.toString(),type:`bool`}),Ce={day:`numeric`,hour:`2-digit`,minute:`2-digit`,month:`short`,weekday:`short`,year:`numeric`},we=defineEasyType({colorKey:`base0D`,is:e=>e instanceof Date,Renderer:({value:e})=>z(R,{children:e.toLocaleTimeString(`en-us`,Ce)}),type:`date`}),functionBody=e=>{let t=e.toString(),n=!0,r=t.indexOf(`)`),i=t.indexOf(`=>`);return i!==-1&&i>r&&(n=!1),n?t.substring(t.indexOf(`{`,r)+1,t.lastIndexOf(`}`)):t.substring(t.indexOf(`=>`)+2)},functionName=e=>{let t=e.toString();return t.indexOf(`function`)===-1?t.substring(0,t.indexOf(`=>`)+2).trim():t.substring(8,t.indexOf(`{`)).trim()},Te=`{`,Ee=`}`,De={Component:e=>{let t=useJsonViewerStore(e=>e.colorspace.base05);return z(R,{children:z(`div`,{className:`data-function`,style:{color:t,display:e.inspect?`block`:`inline-block`,paddingLeft:e.inspect?16:0},children:e.inspect?functionBody(e.value):z(`span`,{className:`data-function-body`,onClick:()=>e.setInspect(!0),children:`…`})})})},is:e=>typeof e==`function`,PostComponent:()=>z(R,{children:z(`span`,{className:`data-function-end`,children:Ee})}),PreComponent:e=>B(R,{children:[z(DataTypeLabel,{dataType:`function`}),B(`span`,{className:`data-function-start`,children:[functionName(e.value),` `,Te]})]})},Oe=defineEasyType({colorKey:`base08`,displayTypeLabel:!1,is:e=>e===null,Renderer:()=>{let e=useJsonViewerStore(e=>e.colorspace.base02);return z(`div`,{className:`q-font-metadata-md-mono rounded-sm px-0.5 py-[1px]`,style:{backgroundColor:e},children:`NULL`})},type:`null`}),ke=defineEasyType({colorKey:`base09`,is:e=>!!(e&&typeof e==`object`&&`type`in e&&e.type===`integer`),Renderer:()=>z(`span`,{className:`data-value`,children:`integer`}),type:`integer`}),isInt=e=>e%1==0,Ae=defineEasyType({colorKey:`base08`,deserialize:e=>parseFloat(e),displayTypeLabel:!1,is:e=>typeof e==`number`&&isNaN(e),Renderer:()=>{let e=useJsonViewerStore(e=>e.colorspace.base02);return z(`div`,{className:`rounded-sm px-0.5 py-[1px]`,style:{backgroundColor:e},children:`NaN`})},serialize:()=>`NaN`,type:`NaN`}),je=defineEasyType({colorKey:`base0B`,deserialize:e=>parseFloat(e),is:e=>typeof e==`number`&&!isInt(e)&&!isNaN(e),Renderer:({value:e})=>z(R,{children:e}),serialize:e=>e.toString(),type:`float`}),Me=defineEasyType({colorKey:`base0F`,deserialize:e=>parseFloat(e),is:e=>typeof e==`number`&&isInt(e),Renderer:({value:e})=>z(R,{children:e}),serialize:e=>e.toString(),type:`int`}),Ne=defineEasyType({colorKey:`base0F`,deserialize:e=>BigInt(e.replace(/\D/g,``)),is:e=>typeof e==`bigint`,Renderer:({value:e})=>z(R,{children:`${e}n`}),serialize:e=>e.toString(),type:`bigint`});function isEnum(e){return!!(e.value&&typeof e.value==`object`&&`enum`in e.value)}var Pe=defineEasyType({colorKey:`base09`,is:e=>!!(e&&typeof e==`object`&&`type`in e&&e.type===`string`&&isEnum({value:e})),Renderer(e){let t=e.value.enum;return B(R,{children:[z(`div`,{className:`data-value`,children:`string enum`}),B(`div`,{className:`data-value-enum`,children:[`[`,t.map(e=>typeof e==`string`?`"${e}"`:e).join(`, `),`]`]})]})},type:`string`}),Fe=defineEasyType({colorKey:`base09`,is:e=>!!(e&&typeof e==`object`&&`type`in e&&e.type===`string`&&!isEnum({value:e})),Renderer:()=>z(`span`,{className:`data-value`,children:`string`}),type:`string`}),Ie=defineEasyType({colorKey:`base09`,deserialize:e=>e,is:e=>typeof e==`string`,Renderer:e=>{let[t,n]=l(!1),r=useJsonViewerStore(e=>e.collapseStringsAfterLength),i=t?e.value:e.value.slice(0,r),a=e.value.length>r;return B(`span`,{className:`data-value`,onClick:()=>{window.getSelection()?.type!==`Range`&&a&&n(e=>!e)},style:{cursor:a?`pointer`:`inherit`},children:[`"`,i,a&&!t&&z(`span`,{className:`show-rest`,children:`…`}),`"`]})},serialize:e=>e,type:`string`}),Le=defineEasyType({colorKey:`base05`,displayTypeLabel:!1,is:e=>e===void 0,Renderer:()=>{let e=useJsonViewerStore(e=>e.colorspace.base02);return z(`div`,{className:`rounded-sm px-0.5 py-[1px]`,style:{backgroundColor:e},children:`undefined`})},type:`undefined`});function memoizeDataType(e){function compare(e,t){return Object.is(e.value,t.value)&&e.inspect&&t.inspect&&e.path?.join(`.`)===t.path?.join(`.`)}return e.Component=n(e.Component,compare),e.Editor&&=n(e.Editor,function(e,t){return Object.is(e.value,t.value)}),e.PreComponent&&=n(e.PreComponent,compare),e.PostComponent&&=n(e.PostComponent,compare),e}var Re=[memoizeDataType(Se),memoizeDataType(we),memoizeDataType(Oe),memoizeDataType(Le),memoizeDataType(Ie),memoizeDataType(De),memoizeDataType(Ae),memoizeDataType(Me),memoizeDataType(je),memoizeDataType(Ne),memoizeDataType(Fe),memoizeDataType(Pe),memoizeDataType(ke),memoizeDataType(xe),memoizeDataType(be)],createTypeRegistryStore=()=>I()(e=>({registerTypes:t=>{e(e=>({registry:typeof t==`function`?t(e.registry):t}))},registry:Re})),ze=t(null);ze.Provider;var useTypeRegistryStore=(e,t)=>{let n=i(ze);return L(n,e,t)};function matchTypeComponents(e,t,n){let r;for(let i of n)i.is(e,t)&&(r=i);if(r===void 0){if(typeof e==`object`)return ye;throw Error(`No type matched for value`,{cause:e})}return r}function useTypeComponents(e,t){let n=useTypeRegistryStore(e=>e.registry);return s(()=>matchTypeComponents(e,t,n),[e,t,n])}var useTextColor=()=>useJsonViewerStore(e=>e.colorspace.base07);function useIsCycleReference(e,t){let n=useJsonViewerStore(e=>e.value);return s(()=>e[e.length-1]!==`properties`&&isCycleReference(n,e,t),[e,t,n])}function useInspect(e,t,n){let i=e.length,o=useIsCycleReference(e,t),s=useJsonViewerStore(e=>e.getInspectCache),c=useJsonViewerStore(e=>e.setInspectCache),u=useJsonViewerStore(e=>e.defaultInspectDepth),d=useJsonViewerStore(e=>e.defaultInspectControl);a(()=>{if(s(e,n)!==void 0)return;if(n!==void 0){c(e,!1,n);return}let r=o?!1:typeof d==`function`?d(e,t):i<u;c(e,r)},[u,d,i,s,o,n,e,t,c]);let[f,p]=l(()=>{let r=s(e,n);return r===void 0?n===void 0?o?!1:typeof d==`function`?d(e,t):i<u:!1:r});return[f,r(t=>{p(r=>{let i=typeof t==`boolean`?t:t(r);return c(e,i,n),i})},[n,e,c])]}function DataKeyPair(e){let{nestedIndex:t,path:n,prevValue:i,value:o}=e,{Component:u,PostComponent:h,PreComponent:g}=useTypeComponents(o,n),_=n.length,v=n[_-1],y=useJsonViewerStore(e=>e.setHover),b=useJsonViewerStore(e=>e.value),[x,S]=useInspect(n,o,t),C=useTextColor(),w=useJsonViewerStore(e=>e.colorspace.base0C),T=useJsonViewerStore(e=>e.colorspace.base0A),E=useJsonViewerStore(e=>e.quotesOnKeys),D=useJsonViewerStore(e=>e.rootName),O=useJsonViewerStore(e=>e.displayNumberKeys),k=b===o,A=Number.isInteger(Number(v)),j=useJsonViewerStore(e=>e.highlightUpdates),F=s(()=>!j||i===void 0?!1:typeof o==typeof i?typeof o==`number`?isNaN(o)&&isNaN(i)?!1:o!==i:Array.isArray(o)===Array.isArray(i)?typeof o==`object`||typeof o==`function`?!1:o!==i:!0:!0,[j,i,o]),I=c(null);a(()=>{I.current&&F&&`animate`in I.current&&I.current.animate([{backgroundColor:T},{backgroundColor:``}],{duration:1e3,easing:`ease-in`})},[T,F,i,o]);let L=s(()=>getValueSize(o)===0,[o]),V=!L&&!!(g&&h),H=useJsonViewerStore(e=>e.keyRenderer),[U,W]=l(!1),G=s(()=>({inspect:x,isRequired:e.isRequired,nestedIndex:t,path:[...n,`properties`],prevValue:i,refName:getRefName(o),requiredProperties:typeof o==`object`&&o&&`required`in o?o.required:null,setInspect:S,value:isReferenceObject(o)?o.properties:isReferenceArray(o)?`properties`in o.items?o.items.properties:o.items:o}),[x,t,n,i,o,e.isRequired,S]),K=r(e=>{e.isDefaultPrevented()||L||S(e=>!e)},[L,S]),q=r(()=>y(n,t),[y,n,t]),J=useJsonViewerStore(e=>e.colorspace.base05),ee=useJsonViewerStore(e=>e.displayKeyIndicator),Y=typeof e.value==`object`&&e.value&&`description`in e.value?e.value.description:void 0,te=B(`span`,{children:[v,e.isRequired?z(`span`,{className:`key-required-indicator`,children:`*`}):null]});return z(`div`,{className:d(`data-key-pair`,e.className),"data-expandable":P(V),"data-has-description":P(!!Y),"data-is-enum-type":P(isEnum(e)),"data-testid":`data-key-pair-${n.join(`.`)}`,onMouseEnter:q,style:e.style,children:B(`div`,{className:`data-key-pair-content`,children:[B(`span`,{className:`data-key`,"data-expandable":P(V),onClick:K,style:{color:C},children:[V?z(`span`,{className:`inline-icon expand-icon`,children:z(N,{className:`inline-icon`,icon:p,style:{color:J,transform:x?`rotate(90deg)`:`unset`,transition:`transform 161ms ease`}})}):null,z(`span`,{ref:I,children:k&&_===0?D===!1?null:E?B(R,{children:[`"`,D,`"`]}):z(R,{children:D}):H.when(G)?z(H,{...G}):t===void 0&&(A?z(R,{children:O?z(`span`,{style:{color:w},children:v}):null}):E?B(R,{children:[`"`,te,`"`]}):z(R,{children:te}))}),ee?k?D!==!1&&z(`div`,{className:`indicator`,children:`:`}):t===void 0&&z(`div`,{className:`indicator`,children:`:`}):null,g&&z(g,{...G})]}),u?Y&&!isObject(o)&&!isReferenceArray(o)?B(`div`,{className:`data-key-description-container`,children:[z(u,{...G}),z(M,{className:`data-key-description-expand-button`,density:`compact`,icon:U?m:f,onClick:()=>W(!U),size:`sm`,variant:`ghost`})]}):z(u,{...G}):z(`span`,{className:`data-value-fallback`,children:`fallback: ${o}`}),Y&&U?z(`div`,{className:`data-key-description`,children:Y}):null,h&&z(h,{...G})]})})}var Be={author:`mac gainor (https://github.com/mac-s-g)`,base0A:`#ffd500`,base0B:`#859900`,base0C:`#6c71c4`,base0D:`#586e75`,base0E:`#2aa198`,base0F:`#268bd2`,base00:`rgba(0, 0, 0, 0)`,base01:`rgb(245, 245, 245)`,base02:`rgb(235, 235, 235)`,base03:`#93a1a1`,base04:`rgba(0, 0, 0, 0.3)`,base05:`#586e75`,base06:`#073642`,base07:`#002b36`,base08:`#d33682`,base09:`#cb4b16`,scheme:`Light Theme`},Ve={author:`Chris Kempson (http://chriskempson.com)`,base0A:`#f7ca88`,base0B:`#a1b56c`,base0C:`#86c1b9`,base0D:`#7cafc2`,base0E:`#a5d6ff`,base0F:`#e8e8e8`,base00:`#181818`,base01:`#282828`,base02:`#383838`,base03:`#585858`,base04:`#b8b8b8`,base05:`#d8d8d8`,base06:`#e8e8e8`,base07:`#d2a8ff`,base08:`#ab4642`,base09:`#a5d6ff`,scheme:`Dark Theme`},JsonViewerInternal=e=>{let{setState:t}=i(me);a(()=>{t(t=>({prevValue:t.value,value:e.value}))},[e.value,t]),a(()=>{e.theme===`light`?t({colorspace:Be}):e.theme===`dark`?t({colorspace:Ve}):typeof e.theme==`object`&&t({colorspace:e.theme})},[t,e.theme]);let n=s(()=>typeof e.theme==`object`?`json-viewer-theme-custom`:e.theme===`dark`?`json-viewer-theme-dark`:`json-viewer-theme-light`,[e.theme]),o=c(!0),l=useTypeRegistryStore(e=>e.registerTypes);o.current&&=(l(e.valueTypes?[...Re,...e.valueTypes]:[...Re]),!1),a(()=>{let t=e.valueTypes?[...Re,...e.valueTypes]:[...Re];l(t)},[e.valueTypes,l]);let u=useJsonViewerStore(e=>e.value),f=useJsonViewerStore(e=>e.prevValue),p=s(()=>[],[]),m=useJsonViewerStore(e=>e.setHover),h=r(()=>m(null),[m]);return B(`div`,{className:d(`json-model-viewer`,n,e.className),onMouseLeave:h,style:{...e.style,contentVisibility:`auto`},children:[z(`div`,{className:`model-gutter`}),z(DataKeyPair,{path:p,prevValue:f,value:u})]})};function JsonModelViewer(e){process.env.NODE_ENV!==`production`&&`displayObjectSize`in e&&console.error("`displayObjectSize` is deprecated. Use `displaySize` instead.\nSee https://viewer.textea.io/migration/migration-v3#raname-displayobjectsize-to-displaysize for more information.");let t=s(()=>e.theme===`auto`?`dark`:e.theme??`light`,[!0,e.theme]),n={...e,theme:t},r=s(()=>createJsonViewerStore(e),[]),i=s(()=>createTypeRegistryStore(),[]);return z(ze.Provider,{value:i,children:z(me.Provider,{value:r,children:z(JsonViewerInternal,{...n})})})}var He=t(`dark`),Ue=He.Provider;function useThemeContext(){return i(He)}ArrayModel.displayName=`ArrayModel`;function ArrayModel(e){let{schema:t}=e,n=e.getComponent(`RenderLink`),r=t.get(`title`)||e.displayName||e.name,i=r?z(`button`,{className:`model-box-control`,onClick:()=>e.onToggle?.(e.name,!e.expanded),children:z(`span`,{className:`model-title__text`,children:r})}):null,a=t.toJS(),o=useThemeContext();return B(`div`,{className:`array-model`,children:[i,z(JsonModelViewer,{displayDataTypes:!1,displaySize:!1,groupArraysAfterLength:100,highlightUpdates:!0,indentWidth:2,renderLink:n,rootName:!1,theme:o,value:a})]})}function ApiKeyAuth(e){let getValue=()=>{let{authorized:t,name:n}=e;return t&&t.getIn([n,`value`])},[t,n]=l({name:e.name,schema:e.schema,value:getValue()}),onChange=r=>{let i={...t,value:r};n(i),e.onChange?.(i)},{errSelectors:r,getComponent:i,name:a,schema:o}=e,s=i(`Row`),c=i(`Col`),u=i(`authError`),d=i(`Markdown`,!0),f=i(`JumpToPath`,!0),p=getValue(),m=r.allErrors().filter(e=>e.get(`authId`)===a);return B(`div`,{className:`api-key-wrapper`,children:[B(`h4`,{className:`api-key-wrapper-header`,children:[z(`code`,{children:a||o.get(`name`)}),` (apiKey)`,z(f,{path:[`securityDefinitions`,a]})]}),p&&z(`h6`,{children:`Authorized`}),z(s,{children:z(d,{source:o.get(`description`)})}),z(s,{children:B(`p`,{className:`text-body-sm`,children:[`Name: `,z(`code`,{className:`qui-code`,children:o.get(`name`)})]})}),z(s,{children:B(`p`,{className:`text-body-sm`,children:[`In: `,z(`code`,{className:`qui-code`,children:o.get(`in`)})]})}),z(s,{children:z(c,{children:z(V,{"aria-label":o.get(`name`),className:`swagger-input`,disabled:!!p,inputProps:{autoFocus:!0},onValueChange:onChange})})}),m.valueSeq().map((e,t)=>z(u,{error:e},t))]})}function AuthItem(e){let{authorized:t,errSelectors:n,getComponent:r,name:i,onAuthChange:a,schema:o}=e,s=r(`apiKeyAuth`),c=r(`basicAuth`),l,u=o.get(`type`);switch(u){case`apiKey`:l=z(s,{authorized:t,errSelectors:n,getComponent:r,name:i,onChange:a,schema:o},i);break;case`basic`:l=z(c,{authorized:t,errSelectors:n,getComponent:r,name:i,onChange:a,schema:o},i);break;default:l=B(`div`,{children:[`Unknown security definition type `,u]},i)}return z(`div`,{children:l},`${i}-jump`)}function AuthorizationPopup({authActions:e,authSelectors:t,errSelectors:n,fn:r,getComponent:i,specSelectors:a}){let close=()=>{e.showDefinitions(!1)},o=t.shownDefinitions(),s=i(`auths`);return z(H.Root,{defaultOpen:!0,onOpenChange:e=>{e||close()},size:`md`,children:z(H.FloatingPortal,{children:B(H.Body,{className:`swagger-ui`,children:[z(H.CloseButton,{}),z(H.Heading,{children:`Available Authorizations`}),z(H.Description,{className:`authorization-popup-dialog-body`,children:o.valueSeq().map((o,c)=>z(s,{AST:r.AST,authActions:e,authSelectors:t,definitions:o,errSelectors:n,getComponent:i,specSelectors:a},c))})]})})})}function AuthorizeBtn({getComponent:e,isAuthorized:t,onClick:n,showPopup:r}){let i=e(`authorizationPopup`,!0);return B(`div`,{className:`auth-wrapper`,children:[z(j,{emphasis:`primary`,endIcon:t?C:w,onClick:n,variant:`fill`,children:`Authorize`}),r&&z(i,{})]})}AuthorizeOperationBtn.displayName=`AuthorizeOperationBtn`;function AuthorizeOperationBtn(e){function onClick(t){t.stopPropagation(),e.onClick?.()}let{isAuthorized:t}=e;return z(M,{"aria-label":t?`authorization button locked`:`authorization button unlocked`,icon:t?C:w,onClick,size:`sm`,variant:`ghost`})}function Auths(e){let[t,n]=l({}),onAuthChange=e=>{let{name:r}=e;n({...t,[r]:e})},submitAuth=n=>{n.preventDefault();let{authActions:r}=e;r.authorizeWithPersistOption(t)},logoutClick=t=>{t.preventDefault();let{authActions:r,definitions:i}=e,a=i.map((e,t)=>t).toArray();n(a.reduce((e,t)=>({...e,[t]:``}),{})),r.logoutWithPersistOption(a)},close=t=>{t.preventDefault();let{authActions:n}=e;n.showDefinitions(!1)},{authSelectors:r,definitions:i,errSelectors:a,getComponent:o}=e,s=o(`AuthItem`),c=o(`oauth2`,!0),u=r.authorized(),d=i.filter((e,t)=>!!u.get(t)),f=i.filter(e=>e.get(`type`)!==`oauth2`),p=i.filter(e=>e.get(`type`)===`oauth2`),m=f.entrySeq().map(([e,t])=>z(s,{authorized:u,errSelectors:a,getComponent:o,name:e,onAuthChange,schema:t},e));return B(`div`,{className:`auth-container`,children:[!!f.size&&B(`form`,{onSubmit:submitAuth,children:[m,B(`div`,{className:`auth-btn-wrapper`,children:[f.size===d.size?z(j,{"aria-label":`Remove authorization`,onClick:logoutClick,variant:`outline`,children:`Logout`}):z(j,{"aria-label":`Apply credentials`,emphasis:`primary`,type:`submit`,variant:`fill`,children:`Authorize`}),z(j,{onClick:close,variant:`outline`,children:`Close`})]})]}),p&&p.size?B(`div`,{className:`oauth-wrapper`,children:[B(`div`,{className:`scope-def`,children:[z(`p`,{children:`Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.`}),z(`p`,{children:`API requires the following scopes. Select which ones you want to grant to Swagger UI.`})]}),i.filter(e=>e.get(`type`)===`oauth2`).entrySeq().map(([e,t])=>z(`div`,{children:z(c,{authorized:u,name:e,schema:t})},e)).toArray()]}):null]})}function BasicAuth(e){let[t,n]=l({name:e.name,schema:e.schema,value:{}}),getValue=()=>{let{authorized:t,name:n}=e;return t&&t.getIn([n,`value`])||{}},onChange=(r,i)=>{let{onChange:a}=e,o={...t.value,[i]:r};n({...t,value:o}),a(t)},{errSelectors:r,getComponent:i,name:a,schema:o}=e,s=i(`Row`),c=i(`Col`),u=i(`authError`),d=i(`JumpToPath`,!0),f=i(`Markdown`,!0),p=getValue().username,m=r.allErrors().filter(e=>e.get(`authId`)===a);return B(`div`,{children:[B(`h4`,{children:[`Basic authorization`,z(d,{path:[`securityDefinitions`,a]})]}),p&&z(`h6`,{children:`Authorized`}),z(s,{children:z(f,{source:o.get(`description`)})}),z(s,{children:p?z(U,{clearable:!1,disabled:!0,label:`Username`,value:p}):z(c,{children:z(U,{inputProps:{autoFocus:!0,id:`auth_username`},label:`Username`,name:`username`,onValueChange:e=>onChange(e,`username`)})})}),z(s,{children:p?z(V,{clearable:!1,disabled:!0,label:`Password`,value:t.value?.[t.name]||``}):z(c,{children:z(V,{inputProps:{id:`auth_password`},label:`Password`,name:`password`,onValueChange:e=>onChange(e,`password`)})})}),m.valueSeq().map((e,t)=>z(u,{error:e},t))]})}function b64toB64UrlEncoded(e){return e.replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function generateCodeVerifier(){return b64toB64UrlEncoded(J(32).toString(`base64`))}function createCodeChallenge(e){return b64toB64UrlEncoded(ee(`sha256`).update(e).digest(`base64`))}function sanitizeUrl$2(e){if(typeof e!=`string`||e.trim()===``)return``;let t=e.trim(),n=`about:blank`;try{let e=`https://base${String(Math.random()).slice(2)}`,r=new URL(t,e),i=r.protocol.slice(0,-1);return[`javascript`,`data`,`vbscript`].includes(i.toLowerCase())?n:r.origin===e?t.startsWith(`/`)?`${r.pathname}${r.search}${r.hash}`:t.startsWith(`./`)||t.startsWith(`../`)?`${t?.match(/^(\.\.?\/)+/)?.[0]}${r.pathname.substring(1)}${r.search}${r.hash}`:`${r.pathname.substring(1)}${r.search}${r.hash}`:String(r)}catch{return n}}function authorizeOauth2({auth:e,authActions:t,authConfigs:n={},configs:r,currentServer:i,errActions:a}){let{clientId:o,name:s,schema:c,scopes:l}=e,u=c.get(`flow`),d=[];switch(u){case`password`:t.authorizePassword(e);return;case`application`:t.authorizeApplication(e);return;case`accessCode`:d.push(`response_type=code`);break;case`implicit`:d.push(`response_type=token`);break;case`clientCredentials`:case`client_credentials`:t.authorizeApplication(e);return;case`authorizationCode`:case`authorization_code`:d.push(`response_type=code`)}typeof o==`string`&&d.push(`client_id=${encodeURIComponent(o)}`);let f=r.oauth2RedirectUrl;if(f===void 0){a.newAuthErr({authId:s,level:`error`,message:`oauth2RedirectUrl configuration is not passed. Oauth2 authorization cannot be performed.`,source:`validation`});return}d.push(`redirect_uri=${encodeURIComponent(f)}`);let p=[];if(Array.isArray(l)?p=l:q.List.isList(l)&&(p=l.toArray()),p.length>0){let e=n.scopeSeparator||` `;d.push(`scope=${encodeURIComponent(p.join(e))}`)}let m=btoa(new Date().toString());if(d.push(`state=${encodeURIComponent(m)}`),n.realm!==void 0&&d.push(`realm=${encodeURIComponent(n.realm)}`),(u===`authorizationCode`||u===`authorization_code`||u===`accessCode`)&&n.usePkceWithAuthorizationCodeGrant){let t=generateCodeVerifier(),n=createCodeChallenge(t);d.push(`code_challenge=${n}`),d.push(`code_challenge_method=S256`),e.codeVerifier=t}let{additionalQueryStringParams:h}=n;for(let e in h)h[e]!==void 0&&d.push([e,h[e]].map(encodeURIComponent).join(`=`));let g=c.get(`authorizationUrl`),_;_=i?Y(sanitizeUrl$2(g),i,!0).toString():sanitizeUrl$2(g);let v=[_,d.join(`&`)].join(typeof g==`string`&&!g.includes(`?`)?`?`:`&`),y;y=u===`implicit`?t.preAuthorizeImplicit:n.useBasicAuthenticationWithAccessCodeGrant?t.authorizeAccessCodeWithBasicAuthentication:t.authorizeAccessCodeWithFormParams,t.authPopup(v,{auth:e,callback:y,errCb:a.newAuthErr,redirectUrl:f,state:m})}Oauth2.displayName=`Oauth2`;function Oauth2(e){let{authorized:t,authSelectors:n,errSelectors:r,getComponent:i,name:a,schema:o,specSelectors:s}=e,c=t&&t.get(a),u=n.getConfigs()||{},d=c&&c.get(`username`)||``,f=c&&c.get(`clientId`)||u.clientId||``,p=c&&c.get(`clientSecret`)||u.clientSecret||``,m=c&&c.get(`passwordType`)||`basic`,h=c&&c.get(`scopes`)||u.scopes||[];typeof h==`string`&&(h=h.split(u.scopeSeparator||` `));let[g,_]=l({appName:u.appName,clientId:f,clientSecret:p,name:a,password:``,passwordType:m,schema:o,scopes:h,username:d}),close=t=>{t.preventDefault();let{authActions:n}=e;n.showDefinitions(!1)},authorize=()=>{let{authActions:t,authSelectors:n,errActions:r,getConfigs:i,oas3Selectors:o}=e,s=i(),c=n.getConfigs();r.clear({authId:a,source:`auth`,type:`auth`}),authorizeOauth2({auth:g,authActions:t,authConfigs:c,configs:s,currentServer:o.serverEffectiveValue(o.selectedServer()),errActions:r})},onScopeChange=(e,t)=>{if(t&&g.scopes.indexOf(e)===-1){let t=g.scopes.concat([e]);_(e=>({...e,scopes:t}))}else!t&&g.scopes.indexOf(e)>-1&&_(t=>({...t,scopes:g.scopes.filter(t=>t!==e)}))},onInputChange=(e,t)=>{let n={[e]:t};_(e=>({...e,...n}))},selectScopes=t=>{t.target.dataset.all?_(t=>({...t,scopes:Array.from((e.schema.get(`allowedScopes`)||e.schema.get(`scopes`)).keys())})):_(e=>({...e,scopes:[]}))},logout=t=>{t.preventDefault();let{authActions:n,errActions:r,name:i}=e;r.clear({authId:i,source:`auth`,type:`auth`}),n.logoutWithPersistOption([i])},v=i(`Row`),y=i(`Col`),b=i(`authError`),x=i(`JumpToPath`,!0),S=i(`Markdown`,!0),{isOAS3:C}=s,w=C()?o.get(`openIdConnectUrl`):null,T=`implicit`,E=`password`,D=C()?w?`authorization_code`:`authorizationCode`:`accessCode`,O=C()?w?`client_credentials`:`clientCredentials`:`application`;u=n.getConfigs()||{};let k=!!u.usePkceWithAuthorizationCodeGrant,A=o.get(`flow`),M=A===D&&k?`${A} with PKCE`:A;h=o.get(`allowedScopes`)||o.get(`scopes`);let N=!!n.authorized().get(a),P=r.allErrors().filter(e=>e.get(`authId`)===a),F=!P.filter(e=>e.get(`source`)===`validation`).size,I=o.get(`description`);return B(`div`,{className:`oauth2-wrapper`,children:[B(`h4`,{className:`oauth2-heading`,children:[a,` (OAuth2, `,M,`)`,` `,z(x,{path:[`securityDefinitions`,a]})]}),g.appName?B(`h5`,{children:[`Application: `,g.appName,` `]}):null,I&&z(S,{source:o.get(`description`)}),N&&z(`h6`,{children:`Authorized`}),w&&B(`p`,{className:`text-body-sm`,children:[`OpenID Connect URL: `,z(`code`,{className:`qui-code`,children:w})]}),(A===T||A===D)&&B(`p`,{className:`text-body-sm`,children:[`Authorization URL:`,` `,z(`code`,{className:`qui-code`,children:o.get(`authorizationUrl`)})]}),(A===E||A===D||A===O)&&B(`p`,{className:`text-body-sm`,children:[`Token URL:`,B(`code`,{className:`qui-code`,children:[` `,o.get(`tokenUrl`)]})]}),B(`p`,{className:`text-body-sm`,children:[`Flow: `,z(`code`,{className:`qui-code`,children:M})]}),A===E?B(v,{children:[z(v,{children:z(y,{desktop:10,tablet:10,children:z(U,{disabled:N,inputProps:{autoFocus:!0,"data-name":`username`},label:`Username`,onValueChange:e=>onInputChange(`username`,e)})})}),z(v,{children:z(y,{desktop:10,tablet:10,children:z(V,{className:`swagger-input`,disabled:N,onValueChange:e=>onInputChange(`password`,e)})})}),z(v,{children:z(y,{desktop:10,tablet:10,children:z(K,{collection:W({items:[{label:`Authorization header`,value:`basic`},{label:`Request body`,value:`request-body`}]}),defaultValue:[`basic`],disabled:N,label:`Client credentials location:`,onValueChange:e=>onInputChange(`passwordType`,e[0]),size:`sm`})})})]}):null,(A===O||A===T||A===D||A===E)&&(!N||N&&g.clientId)&&z(v,{children:z(y,{desktop:10,tablet:10,children:z(U,{className:`swagger-input`,defaultValue:g.clientId,disabled:N,label:`client_id`,onValueChange:e=>onInputChange(`clientId`,e)})})}),(A===O||A===D||A===E)&&z(v,{children:z(y,{desktop:10,tablet:10,children:z(V,{className:`swagger-input`,defaultValue:g.clientSecret,disabled:N,label:`client_secret`,onValueChange:e=>onInputChange(`clientSecret`,e)})})}),!N&&h&&h.size?B(`div`,{className:`scopes`,children:[B(`div`,{className:`scope-actions`,children:[`Scopes:`,z(`button`,{className:`q-text-link`,"data-all":!0,onClick:selectScopes,children:`select all`}),z(`button`,{className:`q-text-link`,onClick:selectScopes,children:`select none`})]}),h.map((e,t)=>z(v,{children:z(G,{checked:g.scopes.includes(t),controlProps:{"data-value":t},disabled:N,label:B(`div`,{className:`text`,children:[z(`p`,{className:`name`,children:t}),z(`p`,{className:`description`,children:e})]}),onCheckedChange:e=>{onScopeChange(t,e)}})},t)).toArray()]}):null,P.valueSeq().map((e,t)=>z(b,{error:e},t)),B(`div`,{className:`auth-btn-wrapper`,children:[F&&(N?z(j,{"aria-label":`Remove authorization`,onClick:logout,variant:`fill`,children:`Logout`}):z(j,{"aria-label":`Apply given OAuth2 credentials`,emphasis:`primary`,onClick:authorize,variant:`fill`,children:`Authorize`})),z(j,{onClick:close,variant:`outline`,children:`Close`})]})]})}function Clear(e){return z(j,{endIcon:k,onClick:()=>{let{method:t,path:n,specActions:r}=e;r.clearResponse(n,t),r.clearRequest(n,t)},variant:`outline`,children:`Clear`})}function ContentType({ariaControls:e,ariaLabel:t,contentTypes:n,label:r,onChange:i,value:o=null}){let c=s(()=>q.fromJS(n),[n]),l=s(()=>!c||!c.size?null:W({items:c.toArray()}),[c]);return te(()=>{c&&i&&i(c.first())}),a(()=>{c&&o&&!c.includes(o)&&i&&c.size&&i(c.first())},[c,i,o]),!c||!c.size||!l?null:z(K,{clearable:!1,collection:l,controlProps:{"aria-controls":e,"aria-label":t||`Content Type`},label:r?.trim()||void 0,onClick:e=>{e.preventDefault()},onValueChange:e=>i?.(e[0]),size:`sm`,style:{minWidth:180},value:o?[o]:[]})}EnumModel.displayName=`EnumModel`;var KeyRenderer=()=>null;KeyRenderer.when=()=>!0;function EnumModel({getComponent:e,value:t}){let n=e(`RenderLink`),r=useThemeContext();return z(JsonModelViewer,{defaultInspectDepth:25,displayDataTypes:!1,displayKeyIndicator:!1,displaySize:!1,groupArraysAfterLength:100,indentWidth:2,keyRenderer:KeyRenderer,renderLink:n,rootName:!1,theme:r,value:t.toJSON()})}function Execute(e){let handleValidateParameters=()=>{let{method:t,path:n,specActions:r,specSelectors:i}=e;return r.validateParams([n,t]),i.validateBeforeExecute([n,t])},handleValidateRequestBody=()=>{let{method:t,oas3Actions:n,oas3Selectors:r,path:i,specSelectors:a}=e,o={missingBodyValue:!1,missingRequiredKeys:[]};n.clearRequestBodyValidateError({method:t,path:i});let s=a.getOAS3RequiredRequestBodyContentType([i,t]),c=r.requestBodyValue(i,t),l=r.validateBeforeExecute([i,t]),u=r.requestContentType(i,t);if(!l)return o.missingBodyValue=!0,n.setRequestBodyValidateError({method:t,path:i,validationErrors:o}),!1;if(!s)return!0;let d=r.validateShallowRequired({oas3RequestBodyValue:c,oas3RequestContentType:u,oas3RequiredRequestBodyContentType:s});if(!d||d.length<1)return!0;for(let e of d)o.missingRequiredKeys.push(e);return n.setRequestBodyValidateError({method:t,path:i,validationErrors:o}),!1},handleValidationResultPass=()=>{let{method:t,operation:n,path:r,specActions:i}=e;e.onExecute&&e.onExecute(),i.execute({method:t,operation:n,path:r})},handleValidationResultFail=()=>{let{method:t,path:n,specActions:r}=e;r.clearValidateParams([n,t]),setTimeout(()=>{r.validateParams([n,t])},40)},handleValidationResult=e=>{e?handleValidationResultPass():handleValidationResultFail()},onClick=()=>{let e=handleValidateParameters(),t=handleValidateRequestBody();handleValidationResult(e&&t)},{disabled:t}=e;return z(j,{className:`execute-button`,disabled:t,emphasis:`primary`,endIcon:E,onClick,variant:`fill`,children:`Execute`})}DocsCodeMirror.displayName=`DocsCodeMirror`;function DocsCodeMirror({basicSetup:e,copyable:t,downloadable:n,handleDownload:r,language:i=`json`,theme:a=`dark`,value:o,...c}){let l=typeof e==`object`?e:{},u=s(()=>{switch(i){case`bash`:return[X.bash()];case`html`:return[X.html()];case`xml`:return[X.xml()];default:return[X.json()]}},[i]);return B(`div`,{className:`q-code-mirror`,children:[z(ie,{basicSetup:{...l,highlightActiveLine:!1,lineNumbers:!1,lintKeymap:!0,syntaxHighlighting:!0},editable:!1,extensions:u,maxHeight:`700px`,minWidth:`400px`,theme:[a===`dark`?ne:re],value:o,...c}),t||n?B(`div`,{className:`actions-wrapper`,children:[n?z(oe,{trigger:z(M,{"aria-label":`Download`,density:`compact`,emphasis:`primary`,icon:g,onClick:r,variant:`ghost`}),children:`Download`}):null,t?z(ae,{valueOrFn:()=>o}):null]}):null]})}function sanitizeUrl$1(e){return typeof e!=`string`||e===``?``:se(e)}function jsFileDownload(e,t,n,r){let i=new Blob(r===void 0?[e]:[r,e],{type:n||`application/octet-stream`}),a=window.URL&&window.URL.createObjectURL?window.URL.createObjectURL(i):window.webkitURL.createObjectURL(i),o=document.createElement(`a`);o.style.display=`none`,o.href=a,o.setAttribute(`download`,t),o.download===void 0&&o.setAttribute(`target`,`_blank`),document.body.appendChild(o),o.click(),setTimeout(function(){document.body.removeChild(o),window.URL.revokeObjectURL(a)},200)}function stringify(e){if(typeof e==`string`)return e;if(e&&e.toJS&&(e=e.toJS()),typeof e==`object`&&e)try{return JSON.stringify(e,null,2)}catch{return String(e)}return e==null?``:e.toString()}function isFunc(e){return typeof e==`function`}function isAbsoluteUrl(e){return e.match(/^(?:[a-z]+:)?\/\//i)}function addProtocol(e){return e.match(/^\/\//i)?`${window.location.protocol}${e}`:e}function buildBaseUrl(e,t){return e?isAbsoluteUrl(e)?addProtocol(e):new URL(e,t).href:t}function buildUrl(e,t,{selectedServer:n=``}={}){if(!e)return;if(isAbsoluteUrl(e))return e;let r=buildBaseUrl(n,t);return isAbsoluteUrl(r)?new URL(e,r).href:new URL(e,window.location.href).href}function safeBuildUrl(e,t,{selectedServer:n=``}={}){try{return buildUrl(e,t,{selectedServer:n})}catch{return}}var createDeepLinkPath=e=>typeof e==`string`?e.trim().replace(/\s/g,`%20`):``,escapeDeepLinkPath=e=>ce(createDeepLinkPath(e).replace(/%20/g,`_`));function getList(e,t){if(!q.Iterable.isIterable(e))return q.List();let n=e.getIn(Array.isArray(t)?t:[t]);return q.List.isList(n)?n:q.List()}var getExtensions=e=>e.filter((e,t)=>t.startsWith(`x-`));function HighlightCode({canCopy:e,children:t,downloadable:n,fileName:r=`response.txt`,language:i}){let handleDownload=()=>{jsFileDownload(t,r)},a=e||t?.startsWith(`{`)||t?.startsWith(`[`),o=useThemeContext();return z(`div`,{className:`qui-code-mirror`,style:{maxWidth:700},children:z(DocsCodeMirror,{copyable:a,downloadable:n,handleDownload,language:i,theme:o,value:t})})}JsonSchemaArrayItemFile.displayName=`JsonSchemaArrayItemFile`;function JsonSchemaArrayItemFile(e){let onFileChange=t=>{let n=t.target.files[0];e.onChange?.(n,e.keyName)},{disabled:t,errors:n,getComponent:r}=e,i=r(`Input`),a=t||!(`FormData`in window);return z(i,{className:n.size?`invalid`:``,disabled:a,onChange:onFileChange,title:n.size?n:``,type:`file`})}JsonSchemaArrayItemText.displayName=`JsonSchemaArrayItemText`;function JsonSchemaArrayItemText(e){let{description:t,disabled:n,errors:r,keyName:i=``,onChange:onChangeProp=()=>{},value:a=``}=e,onChange=e=>{onChangeProp(e,i)},o=r.toJS?r.toJS():[],s=a||``;return z(U,{className:`swagger-input`,disabled:n,errorText:o.length?o[0]:``,invalid:o.length>0,onValueChange:onChange,placeholder:t,size:`sm`,value:s})}JsonSchemaArray.displayName=`JsonSchemaArray`;function valueOrEmptyList(e){return q.List.isList(e)?e:Array.isArray(e)?q.fromJS(e):q.List()}function JsonSchemaArray(e){let{disabled:t,errors:n,fn:r,getComponent:i,onChange:onChangeProp=()=>{},required:o=!1,schema:c={},value:u=``}=e,[d,f]=l(valueOrEmptyList(u)),[p,m]=l(c);a(()=>{m(c)},[c]),a(()=>{d!==u&&f(valueOrEmptyList(u))},[d,u]);let onChange=e=>{onChangeProp?.(e)},onItemChange=(e,t)=>{let n=d.set(t,e);f(n),onChange(n)},removeItem=e=>{let t=d.delete(e);f(t),onChange(t)},addItem=()=>{let e=valueOrEmptyList(d).push(r.getSampleSchema(p.get(`items`),!1,{includeWriteOnly:!0}));f(e),onChange(e)},onEnumChange=e=>{f(e),onChange(e)},h=n.toJS?n.toJS():Array.isArray(n)?n:[],g=h.filter(e=>typeof e==`string`),_=h.filter(e=>e.needRemove!==void 0).map(e=>e.error),v=!!(d&&d.count&&d.count()>0),y=p.getIn([`items`,`enum`]),b=p.getIn([`items`,`type`]),x=p.getIn([`items`,`format`]),S=p.get(`items`),C,w=!1,E=b===`file`||b===`string`&&x===`binary`;b&&x?C=i(`JsonSchema_${b}_${x}`):(b===`boolean`||b===`array`||b===`object`)&&(C=i(`JsonSchema_${b}`)),!C&&!E&&(w=!0);let O=s(()=>y?W({items:y.toArray()}):null,[y]);if(y&&O){let e=d instanceof q.List?d.toArray():Array.from(d);return z(K,{className:`swagger-input`,clearable:!o,collection:O,disabled:t,invalid:h.length>0,multiple:!0,onValueChange:e=>onEnumChange(e),size:`sm`,value:e})}return B(`div`,{className:`json-schema-array`,children:[v?d.map((n,a)=>{let o=q.fromJS([...h.filter(e=>e.index===a).map(e=>e.error)]);return B(`div`,{className:`json-schema-form-item`,children:[E?z(JsonSchemaArrayItemFile,{...e,disabled:t,errors:o,onChange:e=>onItemChange(e,a),value:n}):w?z(JsonSchemaArrayItemText,{...e,disabled:t,errors:o,onChange:e=>onItemChange(e,a),value:n}):z(C,{...e,disabled:t,errors:o,fn:r,getComponent:i,onChange:e=>onItemChange(e,a),schema:S,value:n}),t?null:z(M,{"aria-label":_?.length?_[0]:`Remove Option`,icon:T,onClick:()=>removeItem(a),size:`sm`,variant:`outline`})]},a)}):null,t?null:B(j,{"aria-label":g.length?g[0]:``,className:`qui-json-schema-array-add-btn`,emphasis:g.length?`danger`:`neutral`,endIcon:D,onClick:addItem,variant:`fill`,children:[`Add `,b?`${b} `:``,`item`]})]})}JsonSchemaObject.displayName=`JsonSchemaObject`;function JsonSchemaObject(e){let onChange=t=>{e.onChange?.(t)},handleOnChange=e=>{onChange(e)},{disabled:t,value:n}=e,r=useThemeContext();return z(`div`,{children:z(DocsCodeMirror,{basicSetup:{foldGutter:!1,lineNumbers:!1,lintKeymap:!0},editable:!t,language:`json`,onChange:handleOnChange,theme:r,value:stringify(n)})})}JsonSchemaString.displayName=`JsonSchemaString`;function JsonSchemaString({description:e,disabled:t,errors:n,keyName:r,onChange:i,required:a,schema:o,value:c}){let onFileChange=e=>{let t=e.target.files?.[0];i?.(t,r)},l=o&&o.get?o.get(`enum`):null,u=o&&o.get?o.get(`format`):null,d=o&&o.get?o.get(`type`):null,f=o&&o.get?o.get(`in`):null,p=c||``,m=n.toJS?n.toJS():[],h=s(()=>l?W({items:[...l]}):null,[l]);if(l&&h)return z(K,{clearable:!a,collection:h,disabled:t,invalid:m.length>0,onValueChange:e=>i?.(e[0]),size:`sm`,value:p?[p]:[]});let g=t||!!(f&&f===`formData`&&!(`FormData`in window));return d&&d===`file`?z(`input`,{disabled:g,onChange:e=>onFileChange(e),type:`file`}):z(U,{className:`swagger-input`,disabled:g,errorText:m.length?m[0]:``,inputProps:{type:u&&u===`password`?`password`:`text`},invalid:m.length>0,onValueChange:e=>i?.(e,r),placeholder:e,size:`sm`,value:p})}var We=t(null),Ge=We.Provider;function useSwaggerContext(){let e=i(We);if(!e)throw Error(`QUI Swagger must be wrapped by a <SwaggerContextProvider>`);return e}Layout.displayName=`Layout`;function Layout({errSelectors:e,getComponent:t,specSelectors:n}){let r=t(`SvgAssets`),i=t(`InfoContainer`,!0),a=t(`VersionPragmaFilter`),o=t(`operations`,!0),s=t(`Models`,!0),c=t(`Webhooks`,!0),l=t(`Row`),u=t(`Col`),f=t(`errors`,!0),p=t(`ServersContainer`,!0),m=t(`SchemesContainer`,!0),h=t(`AuthorizeBtnContainer`,!0),g=t(`FilterContainer`,!0),_=n.isSwagger2(),v=n.isOAS3(),y=n.isOAS31(),b=!n.specStr(),x=n.loadingStatus(),{hideTitleSection:S}=useSwaggerContext(),C=null;if(x===`loading`&&(C=z(`div`,{className:`info`,children:z(`div`,{className:`loading-container`,children:z(`div`,{className:`loading`})})})),x===`failed`&&(C=z(`div`,{className:`info`,children:B(`div`,{className:`loading-container`,children:[z(`h4`,{className:`title`,children:`Failed to load API definition.`}),z(f,{})]})})),x===`failedConfig`){let t=e.lastError(),n=t?t.get(`message`):``;C=z(`div`,{className:`info failed-config`,children:B(`div`,{className:`loading-container`,children:[z(`h4`,{className:`title`,children:`Failed to load remote configuration.`}),z(`p`,{children:n})]})})}if(!C&&b&&(C=z(`h4`,{children:`No API definition provided.`})),C)return z(`div`,{className:`swagger-ui`,children:z(`div`,{className:`loading-container`,children:C})});let w=n.servers(),T=n.schemes(),E=w&&w.size,D=T&&T.size,O=!!n.securityDefinitions();return B(`div`,{className:`swagger-ui`,children:[z(r,{}),B(a,{alsoShow:z(f,{}),isOAS3:v,isSwagger2:_,children:[z(f,{}),S?null:z(l,{className:`information-container`,children:z(u,{mobile:12,children:z(i,{})})}),E||D||O?z(`div`,{className:d(`scheme-container`,S?`title-hidden`:``),children:B(`div`,{className:`schemes-wrapper`,children:[E||D?B(`div`,{className:`schemes-server-container`,children:[E?z(p,{}):null,D?z(m,{}):null]}):null,O?z(h,{}):null]})}):null,z(g,{}),z(l,{children:z(u,{desktop:12,mobile:12,children:z(o,{})})}),y&&z(l,{className:`webhooks-container`,children:z(u,{desktop:12,mobile:12,children:z(c,{})})}),z(l,{children:z(u,{desktop:12,mobile:12,children:z(s,{})})})]})]})}ModelCollapse.displayName=`ModelCollapse`;function ModelCollapse({children:e,classes:t,collapsedContent:n=`{...}`,expanded:i=!0,hideSelfOnExpand:s=!1,modelId:u,modelName:d,onToggle:f,title:p}){let[m,h]=l(i),g=c(!1);a(()=>{h(i)},[i]);let _=r(()=>{f?.(d,!m),h(e=>!e)},[m,d,f]),v=o(()=>{_()});a(()=>{if(!g.current&&window.location.hash&&u&&window.location.hash===`#${u}`){let e=document.getElementById(u);e&&(e.scrollIntoView(),m||v())}g.current=!0},[u,d,f,m,_]);let y=o(()=>{u&&window.location.hash===`#${u}`&&!m&&_()});return a(()=>{function onStateChange(){y()}return window.navigation?.addEventListener(`navigatesuccess`,onStateChange),()=>{window.navigation?.removeEventListener(`navigatesuccess`,onStateChange)}},[]),m&&s?z(`span`,{className:t||``,children:e}):z(`span`,{children:z(Z.Root,{onValueChange:_,value:m?[`item`]:[],children:z(Z.Item,{text:p,value:`item`,children:m?e:z(`span`,{children:n})})})})}var usePrevious=e=>{let t=c(void 0);return a(()=>{t.current=e}),t.current},useTabs=({example:e,initialTab:t,isExecute:n,schema:i})=>{let o=s(()=>({example:`example`,model:`model`}),[]),c=!s(()=>Object.keys(o),[o]).includes(t)||!i||n?o.example:t,u=usePrevious(n),[d,f]=l(c),p=r(e=>{f(e)},[]);return a(()=>{u&&!n&&e&&f(o.example)},[u,n,e,o.example]),{activeTab:d,onTabChange:p,tabs:o}};function ModelExample({example:e,getComponent:t,getConfigs:n,includeReadOnly:r=!1,includeWriteOnly:i=!1,isExecute:a=!1,schema:o,specPath:s,specSelectors:c}){let{defaultModelExpandDepth:l,defaultModelRendering:u}=n(),d=t(`ModelWrapper`),f=t(`HighlightCode`,!0),p=J(5).toString(`base64`),m=J(5).toString(`base64`),h=J(5).toString(`base64`),g=J(5).toString(`base64`),_=c.isOAS3(),{activeTab:v,onTabChange:y,tabs:b}=useTabs({example:e,initialTab:u,isExecute:a,schema:o});return z(`div`,{className:`model-example`,children:B(le.Root,{onValueChange:y,value:v,children:[B(le.List,{children:[z(le.Indicator,{}),z(Q.Root,{value:`example`,children:z(Q.Button,{children:a?`Edit Value`:`Example`})}),o?z(Q.Root,{value:`model`,children:z(Q.Button,{children:_?`Schema`:`Model`})}):null]}),z(le.Panel,{value:`example`,children:z(`div`,{"aria-hidden":v!==b.example,"aria-labelledby":p,"data-name":`examplePanel`,id:m,tabIndex:0,children:e||z(f,{children:`(no example available`})})}),o?z(le.Panel,{value:`model`,children:z(`div`,{"aria-hidden":v===b.example,"aria-labelledby":h,"data-name":`modelPanel`,id:g,tabIndex:0,children:z(d,{expandDepth:l,getComponent:t,getConfigs:n,includeReadOnly:r,includeWriteOnly:i,schema:o,specPath:s,specSelectors:c})})}):null]})})}function ModelWrapper(e){let{expandDepth:t,fullPath:n,getComponent:r,getConfigs:i,layoutActions:a,layoutSelectors:o}=e,onToggle=(e,t)=>{a&&a.show(n,t)},s=r(`Model`),c;return o&&(c=o.isShown(n)),z(`div`,{className:`model-box`,children:z(s,{...e,depth:1,expandDepth:t||0,expanded:c,getConfigs:i,onToggle})})}function useJumpToHash(e,t,n){let r=e?.(),i=c(!1);a(()=>{if(!i.current&&r&&t&&r===`#${t}`){let e=document.getElementById(t);e&&(e.scrollIntoView(),i.current||n?.())}i.current=!0},[t,r,n])}Models.displayName=`Models`;function Models(e){let getSchemaBasePath=()=>e.specSelectors.isOAS3()?[`components`,`schemas`]:[`definitions`],handleToggle=(t,n)=>{let{layoutActions:r}=e;r.show([...getSchemaBasePath(),t],n),n&&e.specActions.requestResolvedSubtree([...getSchemaBasePath(),t])},onLoadModels=t=>{t&&e.layoutActions.readyToScroll(getSchemaBasePath(),t)},onLoadModel=t=>{if(t){let n=t.getAttribute(`data-name`);e.layoutActions.readyToScroll([...getSchemaBasePath(),n],t)}},{getComponent:t,getConfigs:n,layoutActions:r,layoutSelectors:i,specSelectors:a}=e,o=a.definitions(),{defaultModelsExpandDepth:s,docExpansion:c}=n(),{hash:l}=useSwaggerContext(),u=l.substring(l.indexOf(`model-`)+6);if(useJumpToHash(e.fn?.getHash,`models`),!o.size||s<0)return null;let f=getSchemaBasePath(),p=i.isShown(f,s>0&&c!==`none`),m=a.isOAS3(),g=t(`ModelWrapper`),_=t(`ModelCollapse`),v=t(`Markdown`);return B(`section`,{ref:onLoadModels,className:p?`models is-open`:`models`,children:[B(`button`,{"aria-expanded":p,className:`model-collapse-title`,id:`models`,onClick:()=>r.show(f,!p),children:[m?`Schemas`:`Models`,z(N,{"aria-label":`Model visibility icon`,className:d(`collapse-icon`,{"is-open":p}),icon:h,size:`md`})]}),z($.Root,{open:p,children:z($.Content,{children:o.entrySeq().map(([o])=>{let c=[...f,o],l=q.List(c),d=a.specResolvedSubtree(c),p=a.specJson().getIn(c),m=q.Map.isMap(d)?d:q.Map(),h=q.Map.isMap(p)?p:q.Map(),y=m.get(`title`)||h.get(`title`)||o,b=i.isShown(c,!1),x=m.get(`description`)||h.get(`description`);b&&m.size===0&&h.size>0&&e.specActions.requestResolvedSubtree(c);let S=u&&u===o,C=z(g,{activeInHash:S,displayName:y,expandDepth:s,fullPath:c,getComponent:t,getConfigs:n,includeReadOnly:!0,includeWriteOnly:!0,layoutActions:r,layoutSelectors:i,name:o,schema:m||q.Map(),specPath:l,specSelectors:a}),w=z(`span`,{className:`model-box`,children:z(`span`,{className:`model model-title`,children:y})}),T=`model-${o}`;return B(`div`,{ref:onLoadModel,className:`model-container`,"data-name":o,children:[z(`span`,{className:`model-box-anchor`,id:T}),z(_,{activeInHash:S,classes:`model-box`,collapsedContent:``,displayName:y,expanded:s>0&&b,getHash:e.fn.getHash,hideSelfOnExpand:!0,layoutActions:r,layoutSelectors:i,modelId:T,modelName:o,onToggle:handleToggle,specPath:l,title:w,children:C}),x?z(v,{source:x}):null]},`models-section-${o}`)}).toArray()})})]})}ObjectModel.displayName=`ObjectModelOriginal`;function ObjectModel(e){let{displayName:t,isRef:n,schema:r}=e,i=useThemeContext(),o=c(!1);if(a(()=>{!e.expanded&&!o.current&&e.onToggle?.(e.name,!e.expanded),o.current=!0},[e]),!r)return null;r.mapEntries(e=>e);let s=r.toJS(),l=r.get(`title`)||t||name,u=l?z(Z.Root,{className:`object-model-accordion`,value:e.expanded?[`item`]:[],children:z(Z.Item,{onClick:()=>e.onToggle?.(e.name,!e.expanded),text:B(R,{children:[n&&r.get(`$$ref`)&&z(`span`,{className:`model-hint`,children:r.get(`$$ref`)}),z(`span`,{children:l})]}),value:`item`})}):null,d=e.getComponent(`RenderLink`);return B(`div`,{className:`object-model`,children:[u,z(JsonModelViewer,{displayDataTypes:!1,displaySize:!1,groupArraysAfterLength:100,highlightUpdates:!0,indentWidth:2,renderLink:d,rootName:!1,theme:i,value:s})]})}OperationSummaryMethod.displayName=`OperationSummaryMethod`;var Ke={delete:{emphasis:`danger`},get:{className:`q-method-get`,emphasis:`primary`},head:{className:`q-purple`,emphasis:`primary`},options:{className:`q-lime`,emphasis:`primary`},patch:{className:`q-orange`,emphasis:`neutral`},post:{emphasis:`primary`},put:{className:`q-method-put`,emphasis:`neutral`},trace:{className:`q-teal`,emphasis:`primary`}};function OperationSummaryMethod({method:e}){let t=Ke[e];return z(j,{...t,className:d(t?.className,`qui-method-button`,e),render:z(`div`,{}),size:`sm`,tabIndex:-1,variant:`fill`,children:e.toUpperCase()})}OperationSummaryPath.displayName=`OperationSummaryPath`;function OperationSummaryPath({operationProps:t}){let{deprecated:n,path:r}=t.toJS(),i=r.split(/(?=\/)/g);for(let e=1;e<i.length;e+=2)i.splice(e,0,z(`wbr`,{},e));return z(`span`,{className:n?`opblock-summary-path__deprecated`:`opblock-summary-path`,"data-path":r,children:i.map((t,n)=>z(e,{children:t},n))})}OperationSummary.displayName=`OperationSummary`;function OperationSummary({authActions:e,authSelectors:t,fn:n,getComponent:r,isShown:i,operationProps:a,specPath:o,toggleShown:s}){let{displayOperationId:c,isAuthorized:l,method:u,op:f,operationId:p,originalOperationId:m,showSummary:g,summary:_}=a.toJS(),{summary:v}=f,y=a.get(`security`),b=r(`authorizeOperationBtn`,!0),S=r(`OperationSummaryMethod`),C=r(`OperationSummaryPath`),w=y&&!!y.count(),T=w&&y.size===1&&y.first().isEmpty(),E=!w||T,D=`${p}-1`,O=r(`RenderLink`);return useJumpToHash(n.getHash,D,()=>{s()}),B(`div`,{className:`opblock-summary`,children:[z(`div`,{className:`opblock-summary-id`,id:D}),B(`button`,{"aria-expanded":i,className:`opblock-summary-control`,onClick:s,children:[z(M,{icon:x,onClick:e=>{i||s(),e.stopPropagation()},render:z(O,{href:`#${D}`}),size:`sm`,style:{marginRight:8},variant:`outline`}),z(S,{method:u}),B(`div`,{className:`opblock-summary-path-description-wrapper`,children:[z(C,{getComponent:r,operationProps:a,specPath:o}),g?z(`div`,{className:`opblock-summary-description`,children:ue(v||_)}):null]}),c&&(m||p)?z(`span`,{className:`opblock-summary-operation-id`,children:m||p}):null,z(N,{className:d(`collapse-icon`,{"is-open":i}),icon:h,size:`sm`})]}),E?null:z(b,{isAuthorized:l,onClick:()=>{let n=t.definitionsForRequirements(y);e.showDefinitions(n)}})]})}function OperationTag(e){let{children:t,getComponent:n,getConfigs:r,layoutActions:i,layoutSelectors:a,oas3Selectors:o,specUrl:s,tag:c,tagObj:l}=e,{deepLinking:u,docExpansion:f}=r(),p=n(`Markdown`,!0),m=n(`DeepLink`),g=l.getIn([`tagDetails`,`description`],null),_=l.getIn([`tagDetails`,`externalDocs`,`description`]),y=l.getIn([`tagDetails`,`externalDocs`,`url`]),b;b=isFunc(o)&&isFunc(o.selectedServer)?safeBuildUrl(y,s,{selectedServer:o.selectedServer()}):y;let x=[`operations-tag`,c],S=a.isShown(x,f===`full`||f===`list`);return B(`div`,{className:S?`opblock-tag-section is-open`:`opblock-tag-section`,children:[B(`h3`,{className:g?`opblock-tag`:`opblock-tag no-desc`,"data-is-open":S,"data-tag":c,id:x.map(e=>escapeDeepLinkPath(e)).join(`-`),onClick:()=>i.show(x,!S),children:[z(m,{enabled:u,isShown:S,path:createDeepLinkPath(c),text:c}),g?z(`small`,{children:z(p,{source:g})}):z(`small`,{}),b?z(de,{className:`info__externaldocs external-link`,endIcon:v,href:sanitizeUrl$1(b),onClick:e=>e.stopPropagation(),render:z(`a`,{target:`_blank`}),children:_||b}):null,z(`button`,{"aria-expanded":S,className:`expand-operation`,onClick:()=>i.show(x,!S),title:S?`Collapse operation`:`Expand operation`,children:z(N,{className:d(`collapse-icon`,{"is-open":S}),icon:h,size:`md`})})]}),z($.Root,{open:S,children:z($.Content,{children:t})})]})}function Operation({authActions:e,authSelectors:t,fn:n,getComponent:r,getConfigs:i,oas3Actions:o,oas3Selectors:s,onCancelClick:c,onExecute:u,onResetClick:d,onTryoutClick:f,operation:p,request:m,response:h,specActions:g,specPath:_=q.List(),specSelectors:v,toggleShown:y}){let{allowTryItOut:b,deprecated:x,displayRequestDuration:S,executeInProgress:C,isShown:w,method:T,op:E,operationId:D,path:O,tag:k,tryItOutEnabled:A}=p.toJS(),{description:j,externalDocs:M,schemes:N}=E,F=M?safeBuildUrl(M.url,v.url(),{selectedServer:s.selectedServer()}):``,I=p.getIn([`op`]),L=I.get(`responses`),R=getList(I,[`parameters`]),V=v.operationScheme(O,T),H=[`operations`,k,D],U=getExtensions(I),W=r(`responses`),G=r(`parameters`),K=r(`execute`),J=r(`Collapse`),ee=r(`clear`),Y=r(`Markdown`,!0),te=r(`schemes`),X=r(`OperationServers`),ne=r(`OperationExt`),re=r(`OperationSummary`),ie=r(`Link`),{showExtensions:ae}=i();if(L&&h&&h.size>0){let e=!L.get(String(h.get(`status`)))&&!L.get(`default`);h=h.set(`notDocumented`,e)}let oe=[O,T],se=v.validationErrors([O,T]),[ce,Z]=l(!1);a(()=>{let e=!0;return w&&setTimeout(()=>{e&&Z(!0)},50),()=>{e=!1}},[w]);let Q=B(`div`,{className:`opblock-body`,children:[I&&I.size||I===null?null:z(pe,{}),x&&z(`h4`,{className:`opblock-title_normal`,children:` Warning: Deprecated`}),j&&z(`div`,{className:`opblock-description-wrapper`,children:z(`div`,{className:`opblock-description`,children:z(Y,{source:j})})}),F?B(`div`,{className:`opblock-external-docs-wrapper`,children:[z(`h4`,{className:`opblock-title_normal`,children:`Find more details`}),B(`div`,{className:`opblock-external-docs`,children:[M.description&&z(`span`,{className:`opblock-external-docs__description`,children:z(Y,{source:M.description})}),z(ie,{className:`opblock-external-docs__link`,href:sanitizeUrl$1(F),target:`_blank`,children:F})]})]}):null,!I||!I.size?null:z(G,{allowTryItOut:b,fn:n,getComponent:r,getConfigs:i,oas3Actions:o,oas3Selectors:s,onCancelClick:c,onChangeKey:oe,onResetClick:d,onTryoutClick:f,operation:I,parameters:R,pathMethod:[O,T],specActions:g,specPath:_.push(`parameters`),specSelectors:v,tryItOutEnabled:A}),A?z(X,{getComponent:r,getEffectiveServerValue:s.serverEffectiveValue,getSelectedServer:s.selectedServer,getServerVariable:s.serverVariableValue,method:T,operationServers:I.get(`servers`),path:O,pathServers:v.paths().getIn([O,`servers`]),setSelectedServer:o.setSelectedServer,setServerVariableValue:o.setServerVariableValue}):null,!A||!b?null:N&&N.size?z(`div`,{className:`opblock-schemes`,children:z(te,{currentScheme:V,method:T,path:O,schemes:N,specActions:g})}):null,!A||!b||se.length<=0?null:z(`div`,{className:`errors-wrapper`,children:z(fe,{description:z(`div`,{children:`Please correct the following validation errors and try again.`}),emphasis:`danger`,label:`Error`})}),B(`div`,{className:!A||!h||!b?`execute-wrapper`:`btn-group`,"data-enabled":P(A),children:[!A||!b?null:z(K,{disabled:C,method:T,oas3Actions:o,oas3Selectors:s,onExecute:u,operation:I,path:O,specActions:g,specSelectors:v}),!A||!h||!b?null:z(ee,{method:T,path:O,specActions:g})]}),C?z(pe,{}):z(`div`,{style:{height:4}}),L?z(W,{displayRequestDuration:S,fn:n,getComponent:r,getConfigs:i,method:T,oas3Actions:o,oas3Selectors:s,path:O,produces:v.producesOptionsFor([O,T]),producesValue:v.currentProducesFor([O,T]),request:m,responses:L,specActions:g,specPath:_.push(`responses`),specSelectors:v,tryItOutResponse:h}):null,!ae||!U.size?null:z(ne,{extensions:U,getComponent:r})]});return B(`div`,{className:x?`opblock opblock-deprecated`:w?`opblock opblock-${T} is-open`:`opblock opblock-${T}`,id:escapeDeepLinkPath(H.join(`-`)),children:[z(re,{authActions:e,authSelectors:t,fn:n,getComponent:r,isShown:w,operationProps:p,specPath:_,toggleShown:y}),ce?z($.Root,{open:w,children:z($.Content,{children:Q})}):z(J,{isOpened:w,children:Q})]})}ParamBody.displayName=`ParamBody`;function ParamBody({consumes:e,consumesValue:t,fn:n,getComponent:i,isExecute:o,language:s,onChange:c,onChangeConsumes:u,param:d=q.fromJS({}),pathMethod:f,specSelectors:p}){let[m,h]=l({isEditBox:!1,value:``}),g=r((e,{isEditBox:t,isXml:n})=>{h({isEditBox:t,value:e}),c?.(e,n)},[c]),v=r(e=>{let t=n.inferSchema(d.toJS());return n.getSampleSchema(t,e,{includeWriteOnly:!0})},[n,d]),y=r(()=>{let e=/xml/i.test(t),n=/json/i.test(t),r=e?d.get(`value_xml`):d.get(`value`);if(r!==void 0){let t=!r&&n?`{}`:r;h(e=>({...e,value:t})),g(t,{isEditBox:o,isXml:e})}else e?g(v(`xml`),{isEditBox:o,isXml:e}):g(v(),{isEditBox:o})},[t,o,g,d,v]);a(()=>{y()},[y]);let handleOnChange=e=>{let n=/xml/i.test(t);g(e,{isEditBox:m.isEditBox,isXml:n})},toggleIsEditBox=()=>h(e=>({...e,isEditBox:!e.isEditBox})),b=i(`contentType`),x=p.contentTypeValues(f).get(`requestContentType`),S=e&&e.size?e:q.fromJS([`application/json`]),{isEditBox:C,value:w}=m,T=`${createHtmlReadyId(`${f[1]}${f[0]}_parameters`)}_select`,E=useThemeContext();return B(`div`,{className:`body-param`,"data-param-in":d.get(`in`),"data-param-name":d.get(`name`),children:[z(DocsCodeMirror,{copyable:!0,editable:C,language:s||`json`,onChange:handleOnChange,theme:E,value:w}),B(`div`,{className:`body-param-options`,children:[o?z(`div`,{className:`body-param-edit`,children:C?z(j,{emphasis:`danger`,endIcon:A,onClick:toggleIsEditBox,variant:`outline`,children:`Cancel`}):z(j,{emphasis:`primary`,endIcon:_,onClick:toggleIsEditBox,variant:`fill`,children:`Edit`})}):null,z(b,{contentTypes:S,controlId:T,label:`Parameter content type`,onChange:u,value:x})]})]})}function createHtmlReadyId(e,t=`_`){return e.replace(/[^\w-]/g,t)}RequestBodyEditor.displayName=`RequestBodyEditor`;function RequestBodyEditor(e){let[t,n]=l(stringify(e.value||e.defaultValue));a(()=>{n(stringify(e.value||e.defaultValue))},[e.defaultValue,e.value]);let r=useThemeContext();return z(DocsCodeMirror,{editable:!0,language:`json`,onChange:t=>{e.onChange?.(t)},theme:r,value:t})}Schemes.displayName=`Schemes`;function Schemes(e){let{currentScheme:t,method:n,path:i,schemes:o,specActions:c}=e,l=r(e=>{c.setScheme(e,i,n)},[n,i,c]),u=s(()=>W({items:o.valueSeq().toArray()}),[o]);return a(()=>{(!t||!o.includes(t))&&l(o.first())},[t,o,l]),z(K,{clearable:!1,collection:u,label:`Schemes`,onValueChange:e=>l(e[0]),size:`sm`,style:{minWidth:100},value:t?[t]:[]})}function Servers({currentServer:e,getEffectiveServerValue:t,getServerVariable:n,servers:i,setSelectedServer:o,setServerVariableValue:c}){let l=(i.find(t=>t.get(`url`)===e)||q.OrderedMap()).get(`variables`)||q.OrderedMap(),u=l.size!==0;a(()=>{e||o(i.first()?.get(`url`))},[e,i,o]),a(()=>{let t=i.find(t=>t.get(`url`)===e);if(!t){o(i.first().get(`url`));return}(t.get(`variables`)||q.OrderedMap()).map((t,n)=>{c({key:n,server:e,val:t.get(`default`)||``})})},[e,i,o,c]);let d=r(e=>{o(e)},[o]),f=r((t,n)=>{c({key:t,server:e,val:n})},[c,e]),p=i.toArray().map(e=>e.get(`url`)),m=s(()=>W({items:p}),[p]);return B(`div`,{className:`servers`,children:[z(K,{className:`swagger-input`,clearable:!1,collection:m,controlProps:{id:`servers`},onValueChange:e=>d(e[0]),value:e?[e]:[]}),u&&B(`div`,{children:[B(`div`,{className:`computed-url`,children:[`Computed URL:`,z(`code`,{children:t(e)})]}),z(`h4`,{children:`Server variables`}),z(`table`,{children:z(`tbody`,{children:l.entrySeq().map(([t,r])=>{let i=r.get(`enum`)?r.get(`enum`).toArray():[];return B(`tr`,{children:[z(`td`,{children:t}),z(`td`,{children:i.length?z(K,{collection:W({items:i}),onValueChange:e=>f(t,e[0]),value:n(e,t)?[n(e,t)]:[]}):z(U,{onValueChange:e=>f(t,e),value:n(e,t)||``})})]},t)})})})]})]})}SyntaxHighlighter.displayName=`SyntaxHighlighter`;function SyntaxHighlighter({children:e,...t}){let n=useThemeContext();return z(DocsCodeMirror,{language:t.language,theme:n,value:e})}TryItOutButton.displayName=`TryItOutButton`;function TryItOutButton({enabled:e,hasUserEditedBody:t,isOAS3:n,onCancelClick:r,onResetClick:i,onTryoutClick:a}){let o=n&&t;return B(`div`,{className:o?`try-out btn-group`:`try-out`,children:[e?z(j,{emphasis:`danger`,endIcon:A,onClick:r,variant:`outline`,children:`Cancel`}):z(j,{emphasis:`primary`,endIcon:y,onClick:a,variant:`outline`,children:`Try it out`}),o&&z(j,{emphasis:`neutral`,endIcon:O,onClick:i,variant:`outline`,children:`Reset`})]})}var quiSwaggerPlugin=()=>({components:{apiKeyAuth:ApiKeyAuth,ArrayModel,AuthItem,authorizationPopup:AuthorizationPopup,authorizeBtn:AuthorizeBtn,authorizeOperationBtn:AuthorizeOperationBtn,auths:Auths,basicAuth:BasicAuth,clear:Clear,contentType:n(ContentType),EnumModel,execute:Execute,HighlightCode,JsonSchema_array:JsonSchemaArray,JsonSchema_object:JsonSchemaObject,JsonSchema_string:JsonSchemaString,Layout,ModelCollapse,modelExample:ModelExample,Models,ModelWrapper,oauth2:Oauth2,ObjectModel,operation:Operation,OperationSummary:n(OperationSummary),OperationSummaryMethod:n(OperationSummaryMethod),OperationSummaryPath:n(OperationSummaryPath),OperationTag,ParamBody,RequestBodyEditor,schemes:Schemes,Servers,SyntaxHighlighter,TryItOutButton:n(TryItOutButton)}});function Swagger({getHash:e,hideTitleSection:t,plugins:n,renderLink:r,theme:i,...a}){let o=s(()=>{let t=[()=>({fn:{getHash:e}}),()=>({components:{RenderLink:r}}),quiSwaggerPlugin];return n?[...t,...n]:t},[r,e,n]),c={hash:e(),hideTitleSection:t};return z(Ge,{value:c,children:z(Ue,{value:i,children:z(u,{defaultModelExpandDepth:1e3,defaultModelRendering:`model`,defaultModelsExpandDepth:1e3,layout:`Layout`,plugins:o,...a})})})}export{Swagger};
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as e, createContext as t, memo as n, useCallback as r, useContext as i, useEffect as a, useEffectEvent as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
3
|
+
import u from "swagger-ui-react";
|
|
4
|
+
import { clsx as d } from "@qualcomm-ui/utils/clsx";
|
|
5
|
+
import { ChevronDown as f, ChevronRightIcon as p, ChevronUp as m, ChevronUpIcon as h, DownloadIcon as g, Edit2Icon as _, ExternalLinkIcon as v, FlaskConicalIcon as y, InfinityIcon as b, Link2 as x, Link2Icon as S, LockIcon as C, LockOpenIcon as w, MinusIcon as T, PlayIcon as E, PlusIcon as D, RotateCcw as O, Trash2Icon as k, XIcon as A } from "lucide-react";
|
|
6
|
+
import { Button as j, IconButton as M } from "@qualcomm-ui/react/button";
|
|
7
|
+
import { Icon as N } from "@qualcomm-ui/react/icon";
|
|
8
|
+
import { booleanDataAttr as P } from "@qualcomm-ui/utils/attributes";
|
|
9
|
+
import { create as F, createStore as I, useStore as L } from "zustand";
|
|
10
|
+
import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
11
|
+
import { PasswordInput as V } from "@qualcomm-ui/react/password-input";
|
|
12
|
+
import { Dialog as H } from "@qualcomm-ui/react/dialog";
|
|
13
|
+
import { TextInput as U } from "@qualcomm-ui/react/text-input";
|
|
14
|
+
import { selectCollection as W } from "@qualcomm-ui/core/select";
|
|
15
|
+
import { Checkbox as G } from "@qualcomm-ui/react/checkbox";
|
|
16
|
+
import { Select as K } from "@qualcomm-ui/react/select";
|
|
17
|
+
import q from "immutable";
|
|
18
|
+
import J from "randombytes";
|
|
19
|
+
import ee from "sha.js";
|
|
20
|
+
import Y from "url-parse";
|
|
21
|
+
import { useEffectOnce as te } from "@qualcomm-ui/react-core/effects";
|
|
22
|
+
import { langs as X } from "@uiw/codemirror-extensions-langs";
|
|
23
|
+
import { githubDark as ne, githubLight as re } from "@uiw/codemirror-theme-github";
|
|
24
|
+
import ie from "@uiw/react-codemirror";
|
|
25
|
+
import { CopyToClipboardIconButton as ae } from "@qualcomm-ui/react-mdx/copy-to-clipboard";
|
|
26
|
+
import { Tooltip as oe } from "@qualcomm-ui/react/tooltip";
|
|
27
|
+
import { sanitizeUrl as se } from "@braintree/sanitize-url";
|
|
28
|
+
import ce from "css.escape";
|
|
29
|
+
import { Accordion as Z } from "@qualcomm-ui/react/accordion";
|
|
30
|
+
import { Tab as Q, Tabs as le } from "@qualcomm-ui/react/tabs";
|
|
31
|
+
import { Collapsible as $ } from "@qualcomm-ui/react/collapsible";
|
|
32
|
+
import { toString as ue } from "lodash-es";
|
|
33
|
+
import { Link as de } from "@qualcomm-ui/react/link";
|
|
34
|
+
import { InlineNotification as fe } from "@qualcomm-ui/react/inline-notification";
|
|
35
|
+
import { Progress as pe } from "@qualcomm-ui/react/progress";
|
|
36
|
+
// src/internal/json-model-viewer/stores/json-viewer-store.ts
|
|
37
|
+
var DefaultKeyRenderer = () => null;
|
|
38
|
+
DefaultKeyRenderer.when = () => !1;
|
|
39
|
+
var createJsonViewerStore = (e) => F()((t, n) => ({
|
|
40
|
+
collapseStringsAfterLength: e.collapseStringsAfterLength === !1 ? Number.MAX_VALUE : e.collapseStringsAfterLength ?? 50,
|
|
41
|
+
colorspace: Ve,
|
|
42
|
+
defaultInspectControl: e.defaultInspectControl ?? void 0,
|
|
43
|
+
defaultInspectDepth: e.defaultInspectDepth ?? 5,
|
|
44
|
+
displayDataTypes: e.displayDataTypes ?? !0,
|
|
45
|
+
displayKeyIndicator: e.displayKeyIndicator ?? !0,
|
|
46
|
+
displayNumberKeys: e.displayNumberKeys ?? !0,
|
|
47
|
+
displaySize: e.displaySize ?? !0,
|
|
48
|
+
getInspectCache: (e, t) => {
|
|
49
|
+
let r = t === void 0 ? e.join(".") : `${e.join(".")}[${t}]nt`;
|
|
50
|
+
return n().inspectCache[r];
|
|
51
|
+
},
|
|
52
|
+
groupArraysAfterLength: e.groupArraysAfterLength ?? 100,
|
|
53
|
+
highlightUpdates: e.highlightUpdates ?? !1,
|
|
54
|
+
hoverPath: null,
|
|
55
|
+
indentWidth: e.indentWidth ?? 3,
|
|
56
|
+
inspectCache: {},
|
|
57
|
+
keyRenderer: e.keyRenderer ?? DefaultKeyRenderer,
|
|
58
|
+
maxDisplayLength: e.maxDisplayLength ?? 30,
|
|
59
|
+
objectSortKeys: e.objectSortKeys ?? !1,
|
|
60
|
+
onChange: e.onChange ?? (() => {}),
|
|
61
|
+
prevValue: void 0,
|
|
62
|
+
quotesOnKeys: e.quotesOnKeys ?? !1,
|
|
63
|
+
renderLink: e.renderLink,
|
|
64
|
+
rootName: e.rootName ?? "root",
|
|
65
|
+
setHover: (e, n) => {
|
|
66
|
+
t({ hoverPath: e ? {
|
|
67
|
+
nestedIndex: n,
|
|
68
|
+
path: e
|
|
69
|
+
} : null });
|
|
70
|
+
},
|
|
71
|
+
setInspectCache: (e, n, r) => {
|
|
72
|
+
let i = r === void 0 ? e.join(".") : `${e.join(".")}[${r}]nt`;
|
|
73
|
+
t((e) => ({ inspectCache: {
|
|
74
|
+
...e.inspectCache,
|
|
75
|
+
[i]: typeof n == "function" ? n(e.inspectCache[i]) : n
|
|
76
|
+
} }));
|
|
77
|
+
},
|
|
78
|
+
value: e.value
|
|
79
|
+
})), me = t(null);
|
|
80
|
+
me.Provider;
|
|
81
|
+
var useJsonViewerStore = (e) => {
|
|
82
|
+
let t = i(me);
|
|
83
|
+
if (!t) throw Error("JsonModelViewer components must be wrapped in <JsonViewerProvider>");
|
|
84
|
+
return L(t, e);
|
|
85
|
+
};
|
|
86
|
+
// src/internal/json-model-viewer/components/internal/ref-name.tsx
|
|
87
|
+
RefName.displayName = "RefName";
|
|
88
|
+
function RefName({ inspect: e, isArray: t, refName: n }) {
|
|
89
|
+
let r = useJsonViewerStore((e) => e.renderLink);
|
|
90
|
+
return /* @__PURE__ */ B("span", {
|
|
91
|
+
className: "data-ref-name-wrapper",
|
|
92
|
+
children: [/* @__PURE__ */ B("span", {
|
|
93
|
+
className: d("data-ref-name", { inspect: e }),
|
|
94
|
+
children: [n, t ? "[]" : ""]
|
|
95
|
+
}), /* @__PURE__ */ z(M, {
|
|
96
|
+
density: "compact",
|
|
97
|
+
icon: S,
|
|
98
|
+
render: /* @__PURE__ */ z(r, { href: `#model-${n}` }),
|
|
99
|
+
size: "sm",
|
|
100
|
+
variant: "ghost"
|
|
101
|
+
})]
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
// src/internal/json-model-viewer/components/internal/utils.ts
|
|
105
|
+
function isObject(e) {
|
|
106
|
+
return !!(e && typeof e == "object" && "type" in e && e.type === "object");
|
|
107
|
+
}
|
|
108
|
+
function isReferenceObject(e) {
|
|
109
|
+
return !!(e && typeof e == "object" && "properties" in e && "type" in e && e.type === "object");
|
|
110
|
+
}
|
|
111
|
+
function isReferenceArray(e) {
|
|
112
|
+
return !!(e && typeof e == "object" && "type" in e && e.type === "array" && "items" in e);
|
|
113
|
+
}
|
|
114
|
+
function getRefName(e) {
|
|
115
|
+
let t = "";
|
|
116
|
+
return isReferenceObject(e) ? t = e.$$ref?.substring(e.$$ref?.lastIndexOf("/") + 1) : isReferenceArray(e) && (t = e.items.$$ref?.substring(e.items.$$ref?.lastIndexOf("/") + 1)), t;
|
|
117
|
+
}
|
|
118
|
+
function getArrayType(e) {
|
|
119
|
+
return e?.type && (e.type === "string" || e.type === "boolean" || e.type === "integer" || e.type === "null") ? e.type : "";
|
|
120
|
+
}
|
|
121
|
+
Object.prototype.constructor.toString();
|
|
122
|
+
var isCycleReference = (e, t, n) => {
|
|
123
|
+
if (e === null || n === null || typeof e != "object" || typeof n != "object") return !1;
|
|
124
|
+
if (Object.is(e, n) && t.length !== 0) return "";
|
|
125
|
+
let r = [], i = [...t], a = e;
|
|
126
|
+
for (; a !== n || i.length !== 0;) {
|
|
127
|
+
if (typeof a != "object" || !a) return !1;
|
|
128
|
+
if (Object.is(a, n)) return r.reduce((e, t, n) => typeof t == "number" ? `${e}[${t}]` : `${e}${n === 0 ? "" : "."}${t}`, "");
|
|
129
|
+
let e = i.shift();
|
|
130
|
+
r.push(e), a = a[e];
|
|
131
|
+
}
|
|
132
|
+
return !1;
|
|
133
|
+
};
|
|
134
|
+
function getValueSize(e) {
|
|
135
|
+
return e === null ? 0 : Array.isArray(e) ? e.length : e instanceof Map || e instanceof Set ? e.size : e instanceof Date ? 1 : typeof e == "object" ? Object.keys(e).length : typeof e == "string" ? e.length : 1;
|
|
136
|
+
}
|
|
137
|
+
function segmentArray(e, t) {
|
|
138
|
+
let n = [], r = 0;
|
|
139
|
+
for (; r < e.length;) n.push(e.slice(r, r + t)), r += t;
|
|
140
|
+
return n;
|
|
141
|
+
}
|
|
142
|
+
// src/internal/json-model-viewer/components/data-types/object.tsx
|
|
143
|
+
var he = "{", ge = "[", _e = "}", ve = "]";
|
|
144
|
+
function inspectMetadata(e) {
|
|
145
|
+
let t = getValueSize(e), n = "";
|
|
146
|
+
return (e instanceof Map || e instanceof Set) && (n = e[Symbol.toStringTag]), Object.hasOwn(e, Symbol.toStringTag) && (n = e[Symbol.toStringTag]), `${t} Items${n ? ` (${n})` : ""}`;
|
|
147
|
+
}
|
|
148
|
+
function PreObjectType(e) {
|
|
149
|
+
let t = useJsonViewerStore((e) => e.colorspace.base04), n = s(() => e.arrayOverride || Array.isArray(e.value), [e.arrayOverride, e.value]), r = s(() => getValueSize(e.value) === 0, [e.value]), i = s(() => inspectMetadata(e.value), [e.value]), a = useJsonViewerStore((e) => e.displaySize), o = s(() => typeof a == "function" ? a(e.path, e.value) : a, [
|
|
150
|
+
a,
|
|
151
|
+
e.path,
|
|
152
|
+
e.value
|
|
153
|
+
]), c = useJsonViewerStore((e) => e.colorspace.base05), l = useIsCycleReference(e.path, e.value), u = e.refName;
|
|
154
|
+
return /* @__PURE__ */ B("span", {
|
|
155
|
+
className: "data-object-start",
|
|
156
|
+
style: { color: c },
|
|
157
|
+
children: [
|
|
158
|
+
n ? ge : he,
|
|
159
|
+
u ? /* @__PURE__ */ z(RefName, {
|
|
160
|
+
inspect: e.inspect,
|
|
161
|
+
refName: u
|
|
162
|
+
}) : null,
|
|
163
|
+
!u && o && e.inspect && !r && /* @__PURE__ */ z("span", {
|
|
164
|
+
className: "data-size-label",
|
|
165
|
+
style: { color: t },
|
|
166
|
+
children: i
|
|
167
|
+
}),
|
|
168
|
+
l && !e.inspect && /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(N, {
|
|
169
|
+
className: "inline-icon",
|
|
170
|
+
icon: b,
|
|
171
|
+
style: { color: c }
|
|
172
|
+
}), l] })
|
|
173
|
+
]
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function PostObjectType(e) {
|
|
177
|
+
let t = useJsonViewerStore((e) => e.colorspace.base04), n = s(() => Array.isArray(e.value), [e.value]), r = s(() => getValueSize(e.value) === 0, [e.value]), i = s(() => inspectMetadata(e.value), [e.value]), a = useJsonViewerStore((e) => e.displaySize), o = s(() => typeof a == "function" ? a(e.path, e.value) : a, [
|
|
178
|
+
a,
|
|
179
|
+
e.path,
|
|
180
|
+
e.value
|
|
181
|
+
]), c = useJsonViewerStore((e) => e.colorspace.base06), l = e.refName;
|
|
182
|
+
return /* @__PURE__ */ B("span", {
|
|
183
|
+
className: "data-object-end",
|
|
184
|
+
style: { color: c },
|
|
185
|
+
children: [n ? ve : _e, !l && o && (r || !e.inspect) ? /* @__PURE__ */ z("span", {
|
|
186
|
+
className: "data-size-label",
|
|
187
|
+
style: { color: t },
|
|
188
|
+
children: i
|
|
189
|
+
}) : null]
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function ObjectType(e) {
|
|
193
|
+
let t = useTextColor(), n = useJsonViewerStore((e) => e.colorspace.base02), r = useJsonViewerStore((e) => e.groupArraysAfterLength), i = useIsCycleReference(e.path, e.value), [a, o] = l(useJsonViewerStore((e) => e.maxDisplayLength)), c = useJsonViewerStore((e) => e.objectSortKeys), u = s(() => {
|
|
194
|
+
if (!e.inspect) return null;
|
|
195
|
+
let t = e.value;
|
|
196
|
+
if (Array.isArray(t)) {
|
|
197
|
+
if (t.length <= r) {
|
|
198
|
+
let n = t.slice(0, a).map((t, n) => {
|
|
199
|
+
let i = e.nestedIndex ? e.nestedIndex * r + n : n, a = [...e.path, i];
|
|
200
|
+
return /* @__PURE__ */ z(DataKeyPair, {
|
|
201
|
+
path: a,
|
|
202
|
+
prevValue: Array.isArray(e.prevValue) ? e.prevValue[i] : void 0,
|
|
203
|
+
value: t
|
|
204
|
+
}, i);
|
|
205
|
+
});
|
|
206
|
+
if (t.length > a) {
|
|
207
|
+
let e = t.length - a;
|
|
208
|
+
n.push(/* @__PURE__ */ B("div", {
|
|
209
|
+
className: "rest-spread",
|
|
210
|
+
onClick: () => o((e) => e * 2),
|
|
211
|
+
children: [
|
|
212
|
+
"hidden ",
|
|
213
|
+
e,
|
|
214
|
+
" items…"
|
|
215
|
+
]
|
|
216
|
+
}, "last"));
|
|
217
|
+
}
|
|
218
|
+
return n;
|
|
219
|
+
}
|
|
220
|
+
let n = segmentArray(t, r), i = Array.isArray(e.prevValue) ? segmentArray(e.prevValue, r) : void 0;
|
|
221
|
+
return n.map((t, n) => /* @__PURE__ */ z(DataKeyPair, {
|
|
222
|
+
nestedIndex: n,
|
|
223
|
+
path: e.path,
|
|
224
|
+
prevValue: i?.[n],
|
|
225
|
+
value: t
|
|
226
|
+
}, n));
|
|
227
|
+
}
|
|
228
|
+
if (!t) return /* @__PURE__ */ z(R, {});
|
|
229
|
+
if (t.type === "object" && t.properties) return /* @__PURE__ */ z(DataKeyPair, {
|
|
230
|
+
path: [],
|
|
231
|
+
prevValue: e.prevValue,
|
|
232
|
+
requiredProperties: e.requiredProperties,
|
|
233
|
+
value: t.properties
|
|
234
|
+
});
|
|
235
|
+
let n = Object.entries(t).filter(([e]) => e !== "$$ref");
|
|
236
|
+
c && (n = c === !0 ? n.sort(([e], [t]) => e.localeCompare(t)) : n.sort(([e], [t]) => c(e, t)));
|
|
237
|
+
let i = n.slice(0, a).map(([t, n]) => {
|
|
238
|
+
let r = [...e.path, t], i = e.requiredProperties?.includes(t);
|
|
239
|
+
return /* @__PURE__ */ z(DataKeyPair, {
|
|
240
|
+
isRequired: i,
|
|
241
|
+
path: r,
|
|
242
|
+
prevValue: e.prevValue?.[t],
|
|
243
|
+
value: n
|
|
244
|
+
}, t);
|
|
245
|
+
});
|
|
246
|
+
if (n.length > a) {
|
|
247
|
+
let e = n.length - a;
|
|
248
|
+
i.push(/* @__PURE__ */ B("div", {
|
|
249
|
+
className: "rest-spread no-select",
|
|
250
|
+
onClick: () => o((e) => e * 2),
|
|
251
|
+
children: [
|
|
252
|
+
"hidden ",
|
|
253
|
+
e,
|
|
254
|
+
" items…"
|
|
255
|
+
]
|
|
256
|
+
}, "last"));
|
|
257
|
+
}
|
|
258
|
+
return i;
|
|
259
|
+
}, [
|
|
260
|
+
e,
|
|
261
|
+
c,
|
|
262
|
+
a,
|
|
263
|
+
r
|
|
264
|
+
]), d = e.inspect ? .8 : 0, f = useJsonViewerStore((e) => e.indentWidth), p = e.inspect ? f - d : f;
|
|
265
|
+
return s(() => getValueSize(e.value) === 0, [e.value]) ? null : /* @__PURE__ */ z("div", {
|
|
266
|
+
className: "data-object",
|
|
267
|
+
style: {
|
|
268
|
+
borderLeft: e.inspect ? `1px solid ${n}` : "none",
|
|
269
|
+
color: t,
|
|
270
|
+
display: e.inspect ? "block" : "inline-block",
|
|
271
|
+
marginLeft: d * 8,
|
|
272
|
+
paddingLeft: e.inspect ? (p - .6) * 8 : 0
|
|
273
|
+
},
|
|
274
|
+
children: e.inspect ? u : !i && !e.refName && /* @__PURE__ */ z("span", {
|
|
275
|
+
className: "data-object-body",
|
|
276
|
+
onClick: () => e.setInspect(!0),
|
|
277
|
+
children: "…"
|
|
278
|
+
})
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
var ye = {
|
|
282
|
+
Component: ObjectType,
|
|
283
|
+
is: (e) => typeof e == "object",
|
|
284
|
+
PostComponent: PostObjectType,
|
|
285
|
+
PreComponent: PreObjectType
|
|
286
|
+
};
|
|
287
|
+
// src/internal/json-model-viewer/components/data-types/array-schema.tsx
|
|
288
|
+
function PreArrayType(e) {
|
|
289
|
+
let t = e.refName, n = useJsonViewerStore((e) => e.colorspace.base06), r = getArrayType(e.value);
|
|
290
|
+
return /* @__PURE__ */ B("span", {
|
|
291
|
+
className: "data-object-start",
|
|
292
|
+
style: { color: n },
|
|
293
|
+
children: [/* @__PURE__ */ z("div", {
|
|
294
|
+
className: "indicator",
|
|
295
|
+
children: r ? "" : "[{"
|
|
296
|
+
}), t ? /* @__PURE__ */ z(RefName, {
|
|
297
|
+
inspect: e.inspect,
|
|
298
|
+
isArray: !0,
|
|
299
|
+
refName: t
|
|
300
|
+
}) : null]
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
function PostArrayType(e) {
|
|
304
|
+
let t = useJsonViewerStore((e) => e.colorspace.base06), n = getArrayType(e.value);
|
|
305
|
+
return /* @__PURE__ */ z("span", {
|
|
306
|
+
className: "data-object-end",
|
|
307
|
+
style: { color: t },
|
|
308
|
+
children: /* @__PURE__ */ z("div", {
|
|
309
|
+
className: "indicator",
|
|
310
|
+
children: n ? "" : "}]"
|
|
311
|
+
})
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
function ArrayType(e) {
|
|
315
|
+
let t = getArrayType(e.value), n = useJsonViewerStore((e) => e.colorspace.base09);
|
|
316
|
+
return t ? /* @__PURE__ */ B("span", {
|
|
317
|
+
style: { color: n },
|
|
318
|
+
children: [t, "[]"]
|
|
319
|
+
}) : /* @__PURE__ */ z(ObjectType, { ...e });
|
|
320
|
+
}
|
|
321
|
+
var be = {
|
|
322
|
+
Component: ArrayType,
|
|
323
|
+
is: (e) => isReferenceArray(e),
|
|
324
|
+
PostComponent: PostArrayType,
|
|
325
|
+
PreComponent: PreArrayType
|
|
326
|
+
}, DataTypeLabel = ({ dataType: e, enable: t = !0 }) => t ? /* @__PURE__ */ z("div", {
|
|
327
|
+
className: "data-type-label",
|
|
328
|
+
children: e
|
|
329
|
+
}) : null;
|
|
330
|
+
// src/internal/json-model-viewer/components/data-types/define-easy-type.tsx
|
|
331
|
+
function defineEasyType({ colorKey: e, deserialize: t, displayTypeLabel: r = !0, is: i, Renderer: a, serialize: o, type: s }) {
|
|
332
|
+
let c = n(a), EasyType = (t) => {
|
|
333
|
+
let n = useJsonViewerStore((e) => e.displayDataTypes), i = useJsonViewerStore((t) => t.colorspace[e]);
|
|
334
|
+
return /* @__PURE__ */ B("div", {
|
|
335
|
+
className: "simple-type",
|
|
336
|
+
style: { color: i },
|
|
337
|
+
children: [r && n && /* @__PURE__ */ z(DataTypeLabel, { dataType: s }), /* @__PURE__ */ z("div", {
|
|
338
|
+
className: `${s}-value simple-value`,
|
|
339
|
+
children: /* @__PURE__ */ z(c, {
|
|
340
|
+
inspect: t.inspect,
|
|
341
|
+
isRequired: t.isRequired,
|
|
342
|
+
path: t.path,
|
|
343
|
+
prevValue: t.prevValue,
|
|
344
|
+
setInspect: t.setInspect,
|
|
345
|
+
value: t.value
|
|
346
|
+
})
|
|
347
|
+
})]
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
return EasyType.displayName = `easy-${s}-type`, !o || !t ? {
|
|
351
|
+
Component: EasyType,
|
|
352
|
+
is: i
|
|
353
|
+
} : {
|
|
354
|
+
Component: EasyType,
|
|
355
|
+
deserialize: t,
|
|
356
|
+
is: i,
|
|
357
|
+
serialize: o
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
// src/internal/json-model-viewer/components/data-types/boolean-schema.tsx
|
|
361
|
+
var xe = defineEasyType({
|
|
362
|
+
colorKey: "base09",
|
|
363
|
+
is: (e) => !!(e && typeof e == "object" && "type" in e && e.type === "boolean"),
|
|
364
|
+
Renderer: () => /* @__PURE__ */ z("span", {
|
|
365
|
+
className: "data-value",
|
|
366
|
+
children: "boolean"
|
|
367
|
+
}),
|
|
368
|
+
type: "boolean"
|
|
369
|
+
}), Se = defineEasyType({
|
|
370
|
+
colorKey: "base0E",
|
|
371
|
+
deserialize: (e) => {
|
|
372
|
+
if (e === "true") return !0;
|
|
373
|
+
if (e === "false") return !1;
|
|
374
|
+
throw Error("Invalid boolean value");
|
|
375
|
+
},
|
|
376
|
+
is: (e) => typeof e == "boolean",
|
|
377
|
+
Renderer: ({ value: e }) => /* @__PURE__ */ z(R, { children: e ? "true" : "false" }),
|
|
378
|
+
serialize: (e) => e.toString(),
|
|
379
|
+
type: "bool"
|
|
380
|
+
}), Ce = {
|
|
381
|
+
day: "numeric",
|
|
382
|
+
hour: "2-digit",
|
|
383
|
+
minute: "2-digit",
|
|
384
|
+
month: "short",
|
|
385
|
+
weekday: "short",
|
|
386
|
+
year: "numeric"
|
|
387
|
+
}, we = defineEasyType({
|
|
388
|
+
colorKey: "base0D",
|
|
389
|
+
is: (e) => e instanceof Date,
|
|
390
|
+
Renderer: ({ value: e }) => /* @__PURE__ */ z(R, { children: e.toLocaleTimeString("en-us", Ce) }),
|
|
391
|
+
type: "date"
|
|
392
|
+
}), functionBody = (e) => {
|
|
393
|
+
let t = e.toString(), n = !0, r = t.indexOf(")"), i = t.indexOf("=>");
|
|
394
|
+
return i !== -1 && i > r && (n = !1), n ? t.substring(t.indexOf("{", r) + 1, t.lastIndexOf("}")) : t.substring(t.indexOf("=>") + 2);
|
|
395
|
+
}, functionName = (e) => {
|
|
396
|
+
let t = e.toString();
|
|
397
|
+
return t.indexOf("function") === -1 ? t.substring(0, t.indexOf("=>") + 2).trim() : t.substring(8, t.indexOf("{")).trim();
|
|
398
|
+
}, Te = "{", Ee = "}", De = {
|
|
399
|
+
Component: (e) => {
|
|
400
|
+
let t = useJsonViewerStore((e) => e.colorspace.base05);
|
|
401
|
+
return /* @__PURE__ */ z(R, { children: /* @__PURE__ */ z("div", {
|
|
402
|
+
className: "data-function",
|
|
403
|
+
style: {
|
|
404
|
+
color: t,
|
|
405
|
+
display: e.inspect ? "block" : "inline-block",
|
|
406
|
+
paddingLeft: e.inspect ? 16 : 0
|
|
407
|
+
},
|
|
408
|
+
children: e.inspect ? functionBody(e.value) : /* @__PURE__ */ z("span", {
|
|
409
|
+
className: "data-function-body",
|
|
410
|
+
onClick: () => e.setInspect(!0),
|
|
411
|
+
children: "…"
|
|
412
|
+
})
|
|
413
|
+
}) });
|
|
414
|
+
},
|
|
415
|
+
is: (e) => typeof e == "function",
|
|
416
|
+
PostComponent: () => /* @__PURE__ */ z(R, { children: /* @__PURE__ */ z("span", {
|
|
417
|
+
className: "data-function-end",
|
|
418
|
+
children: Ee
|
|
419
|
+
}) }),
|
|
420
|
+
PreComponent: (e) => /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(DataTypeLabel, { dataType: "function" }), /* @__PURE__ */ B("span", {
|
|
421
|
+
className: "data-function-start",
|
|
422
|
+
children: [
|
|
423
|
+
functionName(e.value),
|
|
424
|
+
" ",
|
|
425
|
+
Te
|
|
426
|
+
]
|
|
427
|
+
})] })
|
|
428
|
+
}, Oe = defineEasyType({
|
|
429
|
+
colorKey: "base08",
|
|
430
|
+
displayTypeLabel: !1,
|
|
431
|
+
is: (e) => e === null,
|
|
432
|
+
Renderer: () => {
|
|
433
|
+
let e = useJsonViewerStore((e) => e.colorspace.base02);
|
|
434
|
+
return /* @__PURE__ */ z("div", {
|
|
435
|
+
className: "q-font-metadata-md-mono rounded-sm px-0.5 py-[1px]",
|
|
436
|
+
style: { backgroundColor: e },
|
|
437
|
+
children: "NULL"
|
|
438
|
+
});
|
|
439
|
+
},
|
|
440
|
+
type: "null"
|
|
441
|
+
}), ke = defineEasyType({
|
|
442
|
+
colorKey: "base09",
|
|
443
|
+
is: (e) => !!(e && typeof e == "object" && "type" in e && e.type === "integer"),
|
|
444
|
+
Renderer: () => /* @__PURE__ */ z("span", {
|
|
445
|
+
className: "data-value",
|
|
446
|
+
children: "integer"
|
|
447
|
+
}),
|
|
448
|
+
type: "integer"
|
|
449
|
+
}), isInt = (e) => e % 1 == 0, Ae = defineEasyType({
|
|
450
|
+
colorKey: "base08",
|
|
451
|
+
deserialize: (e) => parseFloat(e),
|
|
452
|
+
displayTypeLabel: !1,
|
|
453
|
+
is: (e) => typeof e == "number" && isNaN(e),
|
|
454
|
+
Renderer: () => {
|
|
455
|
+
let e = useJsonViewerStore((e) => e.colorspace.base02);
|
|
456
|
+
return /* @__PURE__ */ z("div", {
|
|
457
|
+
className: "rounded-sm px-0.5 py-[1px]",
|
|
458
|
+
style: { backgroundColor: e },
|
|
459
|
+
children: "NaN"
|
|
460
|
+
});
|
|
461
|
+
},
|
|
462
|
+
serialize: () => "NaN",
|
|
463
|
+
type: "NaN"
|
|
464
|
+
}), je = defineEasyType({
|
|
465
|
+
colorKey: "base0B",
|
|
466
|
+
deserialize: (e) => parseFloat(e),
|
|
467
|
+
is: (e) => typeof e == "number" && !isInt(e) && !isNaN(e),
|
|
468
|
+
Renderer: ({ value: e }) => /* @__PURE__ */ z(R, { children: e }),
|
|
469
|
+
serialize: (e) => e.toString(),
|
|
470
|
+
type: "float"
|
|
471
|
+
}), Me = defineEasyType({
|
|
472
|
+
colorKey: "base0F",
|
|
473
|
+
deserialize: (e) => parseFloat(e),
|
|
474
|
+
is: (e) => typeof e == "number" && isInt(e),
|
|
475
|
+
Renderer: ({ value: e }) => /* @__PURE__ */ z(R, { children: e }),
|
|
476
|
+
serialize: (e) => e.toString(),
|
|
477
|
+
type: "int"
|
|
478
|
+
}), Ne = defineEasyType({
|
|
479
|
+
colorKey: "base0F",
|
|
480
|
+
deserialize: (e) => BigInt(e.replace(/\D/g, "")),
|
|
481
|
+
is: (e) => typeof e == "bigint",
|
|
482
|
+
Renderer: ({ value: e }) => /* @__PURE__ */ z(R, { children: `${e}n` }),
|
|
483
|
+
serialize: (e) => e.toString(),
|
|
484
|
+
type: "bigint"
|
|
485
|
+
});
|
|
486
|
+
// src/internal/json-model-viewer/components/data-types/string-enum-type.tsx
|
|
487
|
+
function isEnum(e) {
|
|
488
|
+
return !!(e.value && typeof e.value == "object" && "enum" in e.value);
|
|
489
|
+
}
|
|
490
|
+
var Pe = defineEasyType({
|
|
491
|
+
colorKey: "base09",
|
|
492
|
+
is: (e) => !!(e && typeof e == "object" && "type" in e && e.type === "string" && isEnum({ value: e })),
|
|
493
|
+
Renderer(e) {
|
|
494
|
+
let t = e.value.enum;
|
|
495
|
+
return /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("div", {
|
|
496
|
+
className: "data-value",
|
|
497
|
+
children: "string enum"
|
|
498
|
+
}), /* @__PURE__ */ B("div", {
|
|
499
|
+
className: "data-value-enum",
|
|
500
|
+
children: [
|
|
501
|
+
"[",
|
|
502
|
+
t.map((e) => typeof e == "string" ? `"${e}"` : e).join(", "),
|
|
503
|
+
"]"
|
|
504
|
+
]
|
|
505
|
+
})] });
|
|
506
|
+
},
|
|
507
|
+
type: "string"
|
|
508
|
+
}), Fe = defineEasyType({
|
|
509
|
+
colorKey: "base09",
|
|
510
|
+
is: (e) => !!(e && typeof e == "object" && "type" in e && e.type === "string" && !isEnum({ value: e })),
|
|
511
|
+
Renderer: () => /* @__PURE__ */ z("span", {
|
|
512
|
+
className: "data-value",
|
|
513
|
+
children: "string"
|
|
514
|
+
}),
|
|
515
|
+
type: "string"
|
|
516
|
+
}), Ie = defineEasyType({
|
|
517
|
+
colorKey: "base09",
|
|
518
|
+
deserialize: (e) => e,
|
|
519
|
+
is: (e) => typeof e == "string",
|
|
520
|
+
Renderer: (e) => {
|
|
521
|
+
let [t, n] = l(!1), r = useJsonViewerStore((e) => e.collapseStringsAfterLength), i = t ? e.value : e.value.slice(0, r), a = e.value.length > r;
|
|
522
|
+
return /* @__PURE__ */ B("span", {
|
|
523
|
+
className: "data-value",
|
|
524
|
+
onClick: () => {
|
|
525
|
+
window.getSelection()?.type !== "Range" && a && n((e) => !e);
|
|
526
|
+
},
|
|
527
|
+
style: { cursor: a ? "pointer" : "inherit" },
|
|
528
|
+
children: [
|
|
529
|
+
"\"",
|
|
530
|
+
i,
|
|
531
|
+
a && !t && /* @__PURE__ */ z("span", {
|
|
532
|
+
className: "show-rest",
|
|
533
|
+
children: "…"
|
|
534
|
+
}),
|
|
535
|
+
"\""
|
|
536
|
+
]
|
|
537
|
+
});
|
|
538
|
+
},
|
|
539
|
+
serialize: (e) => e,
|
|
540
|
+
type: "string"
|
|
541
|
+
}), Le = defineEasyType({
|
|
542
|
+
colorKey: "base05",
|
|
543
|
+
displayTypeLabel: !1,
|
|
544
|
+
is: (e) => e === void 0,
|
|
545
|
+
Renderer: () => {
|
|
546
|
+
let e = useJsonViewerStore((e) => e.colorspace.base02);
|
|
547
|
+
return /* @__PURE__ */ z("div", {
|
|
548
|
+
className: "rounded-sm px-0.5 py-[1px]",
|
|
549
|
+
style: { backgroundColor: e },
|
|
550
|
+
children: "undefined"
|
|
551
|
+
});
|
|
552
|
+
},
|
|
553
|
+
type: "undefined"
|
|
554
|
+
});
|
|
555
|
+
// src/internal/json-model-viewer/stores/type-registry.tsx
|
|
556
|
+
function memoizeDataType(e) {
|
|
557
|
+
function compare(e, t) {
|
|
558
|
+
return Object.is(e.value, t.value) && e.inspect && t.inspect && e.path?.join(".") === t.path?.join(".");
|
|
559
|
+
}
|
|
560
|
+
return e.Component = n(e.Component, compare), e.Editor &&= n(e.Editor, function(e, t) {
|
|
561
|
+
return Object.is(e.value, t.value);
|
|
562
|
+
}), e.PreComponent &&= n(e.PreComponent, compare), e.PostComponent &&= n(e.PostComponent, compare), e;
|
|
563
|
+
}
|
|
564
|
+
var Re = [
|
|
565
|
+
memoizeDataType(Se),
|
|
566
|
+
memoizeDataType(we),
|
|
567
|
+
memoizeDataType(Oe),
|
|
568
|
+
memoizeDataType(Le),
|
|
569
|
+
memoizeDataType(Ie),
|
|
570
|
+
memoizeDataType(De),
|
|
571
|
+
memoizeDataType(Ae),
|
|
572
|
+
memoizeDataType(Me),
|
|
573
|
+
memoizeDataType(je),
|
|
574
|
+
memoizeDataType(Ne),
|
|
575
|
+
memoizeDataType(Fe),
|
|
576
|
+
memoizeDataType(Pe),
|
|
577
|
+
memoizeDataType(ke),
|
|
578
|
+
memoizeDataType(xe),
|
|
579
|
+
memoizeDataType(be)
|
|
580
|
+
], createTypeRegistryStore = () => I()((e) => ({
|
|
581
|
+
registerTypes: (t) => {
|
|
582
|
+
e((e) => ({ registry: typeof t == "function" ? t(e.registry) : t }));
|
|
583
|
+
},
|
|
584
|
+
registry: Re
|
|
585
|
+
})), ze = t(null);
|
|
586
|
+
ze.Provider;
|
|
587
|
+
var useTypeRegistryStore = (e, t) => {
|
|
588
|
+
let n = i(ze);
|
|
589
|
+
return L(n, e, t);
|
|
590
|
+
};
|
|
591
|
+
function matchTypeComponents(e, t, n) {
|
|
592
|
+
let r;
|
|
593
|
+
for (let i of n) i.is(e, t) && (r = i);
|
|
594
|
+
if (r === void 0) {
|
|
595
|
+
if (typeof e == "object") return ye;
|
|
596
|
+
throw Error("No type matched for value", { cause: e });
|
|
597
|
+
}
|
|
598
|
+
return r;
|
|
599
|
+
}
|
|
600
|
+
function useTypeComponents(e, t) {
|
|
601
|
+
let n = useTypeRegistryStore((e) => e.registry);
|
|
602
|
+
return s(() => matchTypeComponents(e, t, n), [
|
|
603
|
+
e,
|
|
604
|
+
t,
|
|
605
|
+
n
|
|
606
|
+
]);
|
|
607
|
+
}
|
|
608
|
+
// src/internal/json-model-viewer/hooks/use-color.ts
|
|
609
|
+
var useTextColor = () => useJsonViewerStore((e) => e.colorspace.base07);
|
|
610
|
+
// src/internal/json-model-viewer/hooks/use-is-cycle-reference.ts
|
|
611
|
+
function useIsCycleReference(e, t) {
|
|
612
|
+
let n = useJsonViewerStore((e) => e.value);
|
|
613
|
+
return s(() => e[e.length - 1] !== "properties" && isCycleReference(n, e, t), [
|
|
614
|
+
e,
|
|
615
|
+
t,
|
|
616
|
+
n
|
|
617
|
+
]);
|
|
618
|
+
}
|
|
619
|
+
// src/internal/json-model-viewer/hooks/use-inspect.ts
|
|
620
|
+
function useInspect(e, t, n) {
|
|
621
|
+
let i = e.length, o = useIsCycleReference(e, t), s = useJsonViewerStore((e) => e.getInspectCache), c = useJsonViewerStore((e) => e.setInspectCache), u = useJsonViewerStore((e) => e.defaultInspectDepth), d = useJsonViewerStore((e) => e.defaultInspectControl);
|
|
622
|
+
a(() => {
|
|
623
|
+
if (s(e, n) !== void 0) return;
|
|
624
|
+
if (n !== void 0) {
|
|
625
|
+
c(e, !1, n);
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
let r = o ? !1 : typeof d == "function" ? d(e, t) : i < u;
|
|
629
|
+
c(e, r);
|
|
630
|
+
}, [
|
|
631
|
+
u,
|
|
632
|
+
d,
|
|
633
|
+
i,
|
|
634
|
+
s,
|
|
635
|
+
o,
|
|
636
|
+
n,
|
|
637
|
+
e,
|
|
638
|
+
t,
|
|
639
|
+
c
|
|
640
|
+
]);
|
|
641
|
+
let [f, p] = l(() => {
|
|
642
|
+
let r = s(e, n);
|
|
643
|
+
return r === void 0 ? n === void 0 ? o ? !1 : typeof d == "function" ? d(e, t) : i < u : !1 : r;
|
|
644
|
+
});
|
|
645
|
+
return [f, r((t) => {
|
|
646
|
+
p((r) => {
|
|
647
|
+
let i = typeof t == "boolean" ? t : t(r);
|
|
648
|
+
return c(e, i, n), i;
|
|
649
|
+
});
|
|
650
|
+
}, [
|
|
651
|
+
n,
|
|
652
|
+
e,
|
|
653
|
+
c
|
|
654
|
+
])];
|
|
655
|
+
}
|
|
656
|
+
// src/internal/json-model-viewer/components/data-key-pair.tsx
|
|
657
|
+
function DataKeyPair(e) {
|
|
658
|
+
let { nestedIndex: t, path: n, prevValue: i, value: o } = e, { Component: u, PostComponent: h, PreComponent: g } = useTypeComponents(o, n), _ = n.length, v = n[_ - 1], y = useJsonViewerStore((e) => e.setHover), b = useJsonViewerStore((e) => e.value), [x, S] = useInspect(n, o, t), C = useTextColor(), w = useJsonViewerStore((e) => e.colorspace.base0C), T = useJsonViewerStore((e) => e.colorspace.base0A), E = useJsonViewerStore((e) => e.quotesOnKeys), D = useJsonViewerStore((e) => e.rootName), O = useJsonViewerStore((e) => e.displayNumberKeys), k = b === o, A = Number.isInteger(Number(v)), j = useJsonViewerStore((e) => e.highlightUpdates), F = s(() => !j || i === void 0 ? !1 : typeof o == typeof i ? typeof o == "number" ? isNaN(o) && isNaN(i) ? !1 : o !== i : Array.isArray(o) === Array.isArray(i) ? typeof o == "object" || typeof o == "function" ? !1 : o !== i : !0 : !0, [
|
|
659
|
+
j,
|
|
660
|
+
i,
|
|
661
|
+
o
|
|
662
|
+
]), I = c(null);
|
|
663
|
+
a(() => {
|
|
664
|
+
I.current && F && "animate" in I.current && I.current.animate([{ backgroundColor: T }, { backgroundColor: "" }], {
|
|
665
|
+
duration: 1e3,
|
|
666
|
+
easing: "ease-in"
|
|
667
|
+
});
|
|
668
|
+
}, [
|
|
669
|
+
T,
|
|
670
|
+
F,
|
|
671
|
+
i,
|
|
672
|
+
o
|
|
673
|
+
]);
|
|
674
|
+
let L = s(() => getValueSize(o) === 0, [o]), V = !L && !!(g && h), H = useJsonViewerStore((e) => e.keyRenderer), [U, W] = l(!1), G = s(() => ({
|
|
675
|
+
inspect: x,
|
|
676
|
+
isRequired: e.isRequired,
|
|
677
|
+
nestedIndex: t,
|
|
678
|
+
path: [...n, "properties"],
|
|
679
|
+
prevValue: i,
|
|
680
|
+
refName: getRefName(o),
|
|
681
|
+
requiredProperties: typeof o == "object" && o && "required" in o ? o.required : null,
|
|
682
|
+
setInspect: S,
|
|
683
|
+
value: isReferenceObject(o) ? o.properties : isReferenceArray(o) ? "properties" in o.items ? o.items.properties : o.items : o
|
|
684
|
+
}), [
|
|
685
|
+
x,
|
|
686
|
+
t,
|
|
687
|
+
n,
|
|
688
|
+
i,
|
|
689
|
+
o,
|
|
690
|
+
e.isRequired,
|
|
691
|
+
S
|
|
692
|
+
]), K = r((e) => {
|
|
693
|
+
e.isDefaultPrevented() || L || S((e) => !e);
|
|
694
|
+
}, [L, S]), q = r(() => y(n, t), [
|
|
695
|
+
y,
|
|
696
|
+
n,
|
|
697
|
+
t
|
|
698
|
+
]), J = useJsonViewerStore((e) => e.colorspace.base05), ee = useJsonViewerStore((e) => e.displayKeyIndicator), Y = typeof e.value == "object" && e.value && "description" in e.value ? e.value.description : void 0, te = /* @__PURE__ */ B("span", { children: [v, e.isRequired ? /* @__PURE__ */ z("span", {
|
|
699
|
+
className: "key-required-indicator",
|
|
700
|
+
children: "*"
|
|
701
|
+
}) : null] });
|
|
702
|
+
return /* @__PURE__ */ z("div", {
|
|
703
|
+
className: d("data-key-pair", e.className),
|
|
704
|
+
"data-expandable": P(V),
|
|
705
|
+
"data-has-description": P(!!Y),
|
|
706
|
+
"data-is-enum-type": P(isEnum(e)),
|
|
707
|
+
"data-testid": `data-key-pair-${n.join(".")}`,
|
|
708
|
+
onMouseEnter: q,
|
|
709
|
+
style: e.style,
|
|
710
|
+
children: /* @__PURE__ */ B("div", {
|
|
711
|
+
className: "data-key-pair-content",
|
|
712
|
+
children: [
|
|
713
|
+
/* @__PURE__ */ B("span", {
|
|
714
|
+
className: "data-key",
|
|
715
|
+
"data-expandable": P(V),
|
|
716
|
+
onClick: K,
|
|
717
|
+
style: { color: C },
|
|
718
|
+
children: [
|
|
719
|
+
V ? /* @__PURE__ */ z("span", {
|
|
720
|
+
className: "inline-icon expand-icon",
|
|
721
|
+
children: /* @__PURE__ */ z(N, {
|
|
722
|
+
className: "inline-icon",
|
|
723
|
+
icon: p,
|
|
724
|
+
style: {
|
|
725
|
+
color: J,
|
|
726
|
+
transform: x ? "rotate(90deg)" : "unset",
|
|
727
|
+
transition: "transform 161ms ease"
|
|
728
|
+
}
|
|
729
|
+
})
|
|
730
|
+
}) : null,
|
|
731
|
+
/* @__PURE__ */ z("span", {
|
|
732
|
+
ref: I,
|
|
733
|
+
children: k && _ === 0 ? D === !1 ? null : E ? /* @__PURE__ */ B(R, { children: [
|
|
734
|
+
"\"",
|
|
735
|
+
D,
|
|
736
|
+
"\""
|
|
737
|
+
] }) : /* @__PURE__ */ z(R, { children: D }) : H.when(G) ? /* @__PURE__ */ z(H, { ...G }) : t === void 0 && (A ? /* @__PURE__ */ z(R, { children: O ? /* @__PURE__ */ z("span", {
|
|
738
|
+
style: { color: w },
|
|
739
|
+
children: v
|
|
740
|
+
}) : null }) : E ? /* @__PURE__ */ B(R, { children: [
|
|
741
|
+
"\"",
|
|
742
|
+
te,
|
|
743
|
+
"\""
|
|
744
|
+
] }) : /* @__PURE__ */ z(R, { children: te }))
|
|
745
|
+
}),
|
|
746
|
+
ee ? k ? D !== !1 && /* @__PURE__ */ z("div", {
|
|
747
|
+
className: "indicator",
|
|
748
|
+
children: ":"
|
|
749
|
+
}) : t === void 0 && /* @__PURE__ */ z("div", {
|
|
750
|
+
className: "indicator",
|
|
751
|
+
children: ":"
|
|
752
|
+
}) : null,
|
|
753
|
+
g && /* @__PURE__ */ z(g, { ...G })
|
|
754
|
+
]
|
|
755
|
+
}),
|
|
756
|
+
u ? Y && !isObject(o) && !isReferenceArray(o) ? /* @__PURE__ */ B("div", {
|
|
757
|
+
className: "data-key-description-container",
|
|
758
|
+
children: [/* @__PURE__ */ z(u, { ...G }), /* @__PURE__ */ z(M, {
|
|
759
|
+
className: "data-key-description-expand-button",
|
|
760
|
+
density: "compact",
|
|
761
|
+
icon: U ? m : f,
|
|
762
|
+
onClick: () => W(!U),
|
|
763
|
+
size: "sm",
|
|
764
|
+
variant: "ghost"
|
|
765
|
+
})]
|
|
766
|
+
}) : /* @__PURE__ */ z(u, { ...G }) : /* @__PURE__ */ z("span", {
|
|
767
|
+
className: "data-value-fallback",
|
|
768
|
+
children: `fallback: ${o}`
|
|
769
|
+
}),
|
|
770
|
+
Y && U ? /* @__PURE__ */ z("div", {
|
|
771
|
+
className: "data-key-description",
|
|
772
|
+
children: Y
|
|
773
|
+
}) : null,
|
|
774
|
+
h && /* @__PURE__ */ z(h, { ...G })
|
|
775
|
+
]
|
|
776
|
+
})
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
// src/internal/json-model-viewer/theme/base16.ts
|
|
780
|
+
var Be = {
|
|
781
|
+
author: "mac gainor (https://github.com/mac-s-g)",
|
|
782
|
+
base0A: "#ffd500",
|
|
783
|
+
base0B: "#859900",
|
|
784
|
+
base0C: "#6c71c4",
|
|
785
|
+
base0D: "#586e75",
|
|
786
|
+
base0E: "#2aa198",
|
|
787
|
+
base0F: "#268bd2",
|
|
788
|
+
base00: "rgba(0, 0, 0, 0)",
|
|
789
|
+
base01: "rgb(245, 245, 245)",
|
|
790
|
+
base02: "rgb(235, 235, 235)",
|
|
791
|
+
base03: "#93a1a1",
|
|
792
|
+
base04: "rgba(0, 0, 0, 0.3)",
|
|
793
|
+
base05: "#586e75",
|
|
794
|
+
base06: "#073642",
|
|
795
|
+
base07: "#002b36",
|
|
796
|
+
base08: "#d33682",
|
|
797
|
+
base09: "#cb4b16",
|
|
798
|
+
scheme: "Light Theme"
|
|
799
|
+
}, Ve = {
|
|
800
|
+
author: "Chris Kempson (http://chriskempson.com)",
|
|
801
|
+
base0A: "#f7ca88",
|
|
802
|
+
base0B: "#a1b56c",
|
|
803
|
+
base0C: "#86c1b9",
|
|
804
|
+
base0D: "#7cafc2",
|
|
805
|
+
base0E: "#a5d6ff",
|
|
806
|
+
base0F: "#e8e8e8",
|
|
807
|
+
base00: "#181818",
|
|
808
|
+
base01: "#282828",
|
|
809
|
+
base02: "#383838",
|
|
810
|
+
base03: "#585858",
|
|
811
|
+
base04: "#b8b8b8",
|
|
812
|
+
base05: "#d8d8d8",
|
|
813
|
+
base06: "#e8e8e8",
|
|
814
|
+
base07: "#d2a8ff",
|
|
815
|
+
base08: "#ab4642",
|
|
816
|
+
base09: "#a5d6ff",
|
|
817
|
+
scheme: "Dark Theme"
|
|
818
|
+
}, JsonViewerInternal = (e) => {
|
|
819
|
+
let { setState: t } = i(me);
|
|
820
|
+
a(() => {
|
|
821
|
+
t((t) => ({
|
|
822
|
+
prevValue: t.value,
|
|
823
|
+
value: e.value
|
|
824
|
+
}));
|
|
825
|
+
}, [e.value, t]), a(() => {
|
|
826
|
+
e.theme === "light" ? t({ colorspace: Be }) : e.theme === "dark" ? t({ colorspace: Ve }) : typeof e.theme == "object" && t({ colorspace: e.theme });
|
|
827
|
+
}, [t, e.theme]);
|
|
828
|
+
let n = s(() => typeof e.theme == "object" ? "json-viewer-theme-custom" : e.theme === "dark" ? "json-viewer-theme-dark" : "json-viewer-theme-light", [e.theme]), o = c(!0), l = useTypeRegistryStore((e) => e.registerTypes);
|
|
829
|
+
o.current &&= (l(e.valueTypes ? [...Re, ...e.valueTypes] : [...Re]), !1), a(() => {
|
|
830
|
+
let t = e.valueTypes ? [...Re, ...e.valueTypes] : [...Re];
|
|
831
|
+
l(t);
|
|
832
|
+
}, [e.valueTypes, l]);
|
|
833
|
+
let u = useJsonViewerStore((e) => e.value), f = useJsonViewerStore((e) => e.prevValue), p = s(() => [], []), m = useJsonViewerStore((e) => e.setHover), h = r(() => m(null), [m]);
|
|
834
|
+
return /* @__PURE__ */ B("div", {
|
|
835
|
+
className: d("json-model-viewer", n, e.className),
|
|
836
|
+
onMouseLeave: h,
|
|
837
|
+
style: {
|
|
838
|
+
...e.style,
|
|
839
|
+
contentVisibility: "auto"
|
|
840
|
+
},
|
|
841
|
+
children: [/* @__PURE__ */ z("div", { className: "model-gutter" }), /* @__PURE__ */ z(DataKeyPair, {
|
|
842
|
+
path: p,
|
|
843
|
+
prevValue: f,
|
|
844
|
+
value: u
|
|
845
|
+
})]
|
|
846
|
+
});
|
|
847
|
+
};
|
|
848
|
+
function JsonModelViewer(e) {
|
|
849
|
+
process.env.NODE_ENV !== "production" && "displayObjectSize" in e && console.error("`displayObjectSize` is deprecated. Use `displaySize` instead.\nSee https://viewer.textea.io/migration/migration-v3#raname-displayobjectsize-to-displaysize for more information.");
|
|
850
|
+
let t = s(() => e.theme === "auto" ? "dark" : e.theme ?? "light", [!0, e.theme]), n = {
|
|
851
|
+
...e,
|
|
852
|
+
theme: t
|
|
853
|
+
}, r = s(() => createJsonViewerStore(e), []), i = s(() => createTypeRegistryStore(), []);
|
|
854
|
+
return /* @__PURE__ */ z(ze.Provider, {
|
|
855
|
+
value: i,
|
|
856
|
+
children: /* @__PURE__ */ z(me.Provider, {
|
|
857
|
+
value: r,
|
|
858
|
+
children: /* @__PURE__ */ z(JsonViewerInternal, { ...n })
|
|
859
|
+
})
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
// src/internal/use-theme-context.tsx
|
|
863
|
+
var He = t("dark"), Ue = He.Provider;
|
|
864
|
+
function useThemeContext() {
|
|
865
|
+
return i(He);
|
|
866
|
+
}
|
|
867
|
+
// src/internal/array-model.tsx
|
|
868
|
+
ArrayModel.displayName = "ArrayModel";
|
|
869
|
+
function ArrayModel(e) {
|
|
870
|
+
let { schema: t } = e, n = e.getComponent("RenderLink"), r = t.get("title") || e.displayName || e.name, i = r ? /* @__PURE__ */ z("button", {
|
|
871
|
+
className: "model-box-control",
|
|
872
|
+
onClick: () => e.onToggle?.(e.name, !e.expanded),
|
|
873
|
+
children: /* @__PURE__ */ z("span", {
|
|
874
|
+
className: "model-title__text",
|
|
875
|
+
children: r
|
|
876
|
+
})
|
|
877
|
+
}) : null, a = t.toJS(), o = useThemeContext();
|
|
878
|
+
return /* @__PURE__ */ B("div", {
|
|
879
|
+
className: "array-model",
|
|
880
|
+
children: [i, /* @__PURE__ */ z(JsonModelViewer, {
|
|
881
|
+
displayDataTypes: !1,
|
|
882
|
+
displaySize: !1,
|
|
883
|
+
groupArraysAfterLength: 100,
|
|
884
|
+
highlightUpdates: !0,
|
|
885
|
+
indentWidth: 2,
|
|
886
|
+
renderLink: n,
|
|
887
|
+
rootName: !1,
|
|
888
|
+
theme: o,
|
|
889
|
+
value: a
|
|
890
|
+
})]
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
// src/internal/auth/api-key-auth.tsx
|
|
894
|
+
function ApiKeyAuth(e) {
|
|
895
|
+
let getValue = () => {
|
|
896
|
+
let { authorized: t, name: n } = e;
|
|
897
|
+
return t && t.getIn([n, "value"]);
|
|
898
|
+
}, [t, n] = l({
|
|
899
|
+
name: e.name,
|
|
900
|
+
schema: e.schema,
|
|
901
|
+
value: getValue()
|
|
902
|
+
}), onChange = (r) => {
|
|
903
|
+
let i = {
|
|
904
|
+
...t,
|
|
905
|
+
value: r
|
|
906
|
+
};
|
|
907
|
+
n(i), e.onChange?.(i);
|
|
908
|
+
}, { errSelectors: r, getComponent: i, name: a, schema: o } = e, s = i("Row"), c = i("Col"), u = i("authError"), d = i("Markdown", !0), f = i("JumpToPath", !0), p = getValue(), m = r.allErrors().filter((e) => e.get("authId") === a);
|
|
909
|
+
return /* @__PURE__ */ B("div", {
|
|
910
|
+
className: "api-key-wrapper",
|
|
911
|
+
children: [
|
|
912
|
+
/* @__PURE__ */ B("h4", {
|
|
913
|
+
className: "api-key-wrapper-header",
|
|
914
|
+
children: [
|
|
915
|
+
/* @__PURE__ */ z("code", { children: a || o.get("name") }),
|
|
916
|
+
" (apiKey)",
|
|
917
|
+
/* @__PURE__ */ z(f, { path: ["securityDefinitions", a] })
|
|
918
|
+
]
|
|
919
|
+
}),
|
|
920
|
+
p && /* @__PURE__ */ z("h6", { children: "Authorized" }),
|
|
921
|
+
/* @__PURE__ */ z(s, { children: /* @__PURE__ */ z(d, { source: o.get("description") }) }),
|
|
922
|
+
/* @__PURE__ */ z(s, { children: /* @__PURE__ */ B("p", {
|
|
923
|
+
className: "text-body-sm",
|
|
924
|
+
children: ["Name: ", /* @__PURE__ */ z("code", {
|
|
925
|
+
className: "qui-code",
|
|
926
|
+
children: o.get("name")
|
|
927
|
+
})]
|
|
928
|
+
}) }),
|
|
929
|
+
/* @__PURE__ */ z(s, { children: /* @__PURE__ */ B("p", {
|
|
930
|
+
className: "text-body-sm",
|
|
931
|
+
children: ["In: ", /* @__PURE__ */ z("code", {
|
|
932
|
+
className: "qui-code",
|
|
933
|
+
children: o.get("in")
|
|
934
|
+
})]
|
|
935
|
+
}) }),
|
|
936
|
+
/* @__PURE__ */ z(s, { children: /* @__PURE__ */ z(c, { children: /* @__PURE__ */ z(V, {
|
|
937
|
+
"aria-label": o.get("name"),
|
|
938
|
+
className: "swagger-input",
|
|
939
|
+
disabled: !!p,
|
|
940
|
+
inputProps: { autoFocus: !0 },
|
|
941
|
+
onValueChange: onChange
|
|
942
|
+
}) }) }),
|
|
943
|
+
m.valueSeq().map((e, t) => /* @__PURE__ */ z(u, { error: e }, t))
|
|
944
|
+
]
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
// src/internal/auth/auth-item.tsx
|
|
948
|
+
function AuthItem(e) {
|
|
949
|
+
let { authorized: t, errSelectors: n, getComponent: r, name: i, onAuthChange: a, schema: o } = e, s = r("apiKeyAuth"), c = r("basicAuth"), l, u = o.get("type");
|
|
950
|
+
switch (u) {
|
|
951
|
+
case "apiKey":
|
|
952
|
+
l = /* @__PURE__ */ z(s, {
|
|
953
|
+
authorized: t,
|
|
954
|
+
errSelectors: n,
|
|
955
|
+
getComponent: r,
|
|
956
|
+
name: i,
|
|
957
|
+
onChange: a,
|
|
958
|
+
schema: o
|
|
959
|
+
}, i);
|
|
960
|
+
break;
|
|
961
|
+
case "basic":
|
|
962
|
+
l = /* @__PURE__ */ z(c, {
|
|
963
|
+
authorized: t,
|
|
964
|
+
errSelectors: n,
|
|
965
|
+
getComponent: r,
|
|
966
|
+
name: i,
|
|
967
|
+
onChange: a,
|
|
968
|
+
schema: o
|
|
969
|
+
}, i);
|
|
970
|
+
break;
|
|
971
|
+
default: l = /* @__PURE__ */ B("div", { children: ["Unknown security definition type ", u] }, i);
|
|
972
|
+
}
|
|
973
|
+
return /* @__PURE__ */ z("div", { children: l }, `${i}-jump`);
|
|
974
|
+
}
|
|
975
|
+
// src/internal/auth/authorization-popup.tsx
|
|
976
|
+
function AuthorizationPopup({ authActions: e, authSelectors: t, errSelectors: n, fn: r, getComponent: i, specSelectors: a }) {
|
|
977
|
+
let close = () => {
|
|
978
|
+
e.showDefinitions(!1);
|
|
979
|
+
}, o = t.shownDefinitions(), s = i("auths");
|
|
980
|
+
return /* @__PURE__ */ z(H.Root, {
|
|
981
|
+
defaultOpen: !0,
|
|
982
|
+
onOpenChange: (e) => {
|
|
983
|
+
e || close();
|
|
984
|
+
},
|
|
985
|
+
size: "md",
|
|
986
|
+
children: /* @__PURE__ */ z(H.FloatingPortal, { children: /* @__PURE__ */ B(H.Body, {
|
|
987
|
+
className: "swagger-ui",
|
|
988
|
+
children: [
|
|
989
|
+
/* @__PURE__ */ z(H.CloseButton, {}),
|
|
990
|
+
/* @__PURE__ */ z(H.Heading, { children: "Available Authorizations" }),
|
|
991
|
+
/* @__PURE__ */ z(H.Description, {
|
|
992
|
+
className: "authorization-popup-dialog-body",
|
|
993
|
+
children: o.valueSeq().map((o, c) => /* @__PURE__ */ z(s, {
|
|
994
|
+
AST: r.AST,
|
|
995
|
+
authActions: e,
|
|
996
|
+
authSelectors: t,
|
|
997
|
+
definitions: o,
|
|
998
|
+
errSelectors: n,
|
|
999
|
+
getComponent: i,
|
|
1000
|
+
specSelectors: a
|
|
1001
|
+
}, c))
|
|
1002
|
+
})
|
|
1003
|
+
]
|
|
1004
|
+
}) })
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
// src/internal/auth/authorize-btn.tsx
|
|
1008
|
+
function AuthorizeBtn({ getComponent: e, isAuthorized: t, onClick: n, showPopup: r }) {
|
|
1009
|
+
let i = e("authorizationPopup", !0);
|
|
1010
|
+
return /* @__PURE__ */ B("div", {
|
|
1011
|
+
className: "auth-wrapper",
|
|
1012
|
+
children: [/* @__PURE__ */ z(j, {
|
|
1013
|
+
emphasis: "primary",
|
|
1014
|
+
endIcon: t ? C : w,
|
|
1015
|
+
onClick: n,
|
|
1016
|
+
variant: "fill",
|
|
1017
|
+
children: "Authorize"
|
|
1018
|
+
}), r && /* @__PURE__ */ z(i, {})]
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
// src/internal/auth/authorize-operation-btn.tsx
|
|
1022
|
+
AuthorizeOperationBtn.displayName = "AuthorizeOperationBtn";
|
|
1023
|
+
function AuthorizeOperationBtn(e) {
|
|
1024
|
+
function onClick(t) {
|
|
1025
|
+
t.stopPropagation(), e.onClick?.();
|
|
1026
|
+
}
|
|
1027
|
+
let { isAuthorized: t } = e;
|
|
1028
|
+
return /* @__PURE__ */ z(M, {
|
|
1029
|
+
"aria-label": t ? "authorization button locked" : "authorization button unlocked",
|
|
1030
|
+
icon: t ? C : w,
|
|
1031
|
+
onClick,
|
|
1032
|
+
size: "sm",
|
|
1033
|
+
variant: "ghost"
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
// src/internal/auth/auths.tsx
|
|
1037
|
+
function Auths(e) {
|
|
1038
|
+
let [t, n] = l({}), onAuthChange = (e) => {
|
|
1039
|
+
let { name: r } = e;
|
|
1040
|
+
n({
|
|
1041
|
+
...t,
|
|
1042
|
+
[r]: e
|
|
1043
|
+
});
|
|
1044
|
+
}, submitAuth = (n) => {
|
|
1045
|
+
n.preventDefault();
|
|
1046
|
+
let { authActions: r } = e;
|
|
1047
|
+
r.authorizeWithPersistOption(t);
|
|
1048
|
+
}, logoutClick = (t) => {
|
|
1049
|
+
t.preventDefault();
|
|
1050
|
+
let { authActions: r, definitions: i } = e, a = i.map((e, t) => t).toArray();
|
|
1051
|
+
n(a.reduce((e, t) => ({
|
|
1052
|
+
...e,
|
|
1053
|
+
[t]: ""
|
|
1054
|
+
}), {})), r.logoutWithPersistOption(a);
|
|
1055
|
+
}, close = (t) => {
|
|
1056
|
+
t.preventDefault();
|
|
1057
|
+
let { authActions: n } = e;
|
|
1058
|
+
n.showDefinitions(!1);
|
|
1059
|
+
}, { authSelectors: r, definitions: i, errSelectors: a, getComponent: o } = e, s = o("AuthItem"), c = o("oauth2", !0), u = r.authorized(), d = i.filter((e, t) => !!u.get(t)), f = i.filter((e) => e.get("type") !== "oauth2"), p = i.filter((e) => e.get("type") === "oauth2"), m = f.entrySeq().map(([e, t]) => /* @__PURE__ */ z(s, {
|
|
1060
|
+
authorized: u,
|
|
1061
|
+
errSelectors: a,
|
|
1062
|
+
getComponent: o,
|
|
1063
|
+
name: e,
|
|
1064
|
+
onAuthChange,
|
|
1065
|
+
schema: t
|
|
1066
|
+
}, e));
|
|
1067
|
+
return /* @__PURE__ */ B("div", {
|
|
1068
|
+
className: "auth-container",
|
|
1069
|
+
children: [!!f.size && /* @__PURE__ */ B("form", {
|
|
1070
|
+
onSubmit: submitAuth,
|
|
1071
|
+
children: [m, /* @__PURE__ */ B("div", {
|
|
1072
|
+
className: "auth-btn-wrapper",
|
|
1073
|
+
children: [f.size === d.size ? /* @__PURE__ */ z(j, {
|
|
1074
|
+
"aria-label": "Remove authorization",
|
|
1075
|
+
onClick: logoutClick,
|
|
1076
|
+
variant: "outline",
|
|
1077
|
+
children: "Logout"
|
|
1078
|
+
}) : /* @__PURE__ */ z(j, {
|
|
1079
|
+
"aria-label": "Apply credentials",
|
|
1080
|
+
emphasis: "primary",
|
|
1081
|
+
type: "submit",
|
|
1082
|
+
variant: "fill",
|
|
1083
|
+
children: "Authorize"
|
|
1084
|
+
}), /* @__PURE__ */ z(j, {
|
|
1085
|
+
onClick: close,
|
|
1086
|
+
variant: "outline",
|
|
1087
|
+
children: "Close"
|
|
1088
|
+
})]
|
|
1089
|
+
})]
|
|
1090
|
+
}), p && p.size ? /* @__PURE__ */ B("div", {
|
|
1091
|
+
className: "oauth-wrapper",
|
|
1092
|
+
children: [/* @__PURE__ */ B("div", {
|
|
1093
|
+
className: "scope-def",
|
|
1094
|
+
children: [/* @__PURE__ */ z("p", { children: "Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes." }), /* @__PURE__ */ z("p", { children: "API requires the following scopes. Select which ones you want to grant to Swagger UI." })]
|
|
1095
|
+
}), i.filter((e) => e.get("type") === "oauth2").entrySeq().map(([e, t]) => /* @__PURE__ */ z("div", { children: /* @__PURE__ */ z(c, {
|
|
1096
|
+
authorized: u,
|
|
1097
|
+
name: e,
|
|
1098
|
+
schema: t
|
|
1099
|
+
}) }, e)).toArray()]
|
|
1100
|
+
}) : null]
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
// src/internal/auth/basic-auth.tsx
|
|
1104
|
+
function BasicAuth(e) {
|
|
1105
|
+
let [t, n] = l({
|
|
1106
|
+
name: e.name,
|
|
1107
|
+
schema: e.schema,
|
|
1108
|
+
value: {}
|
|
1109
|
+
}), getValue = () => {
|
|
1110
|
+
let { authorized: t, name: n } = e;
|
|
1111
|
+
return t && t.getIn([n, "value"]) || {};
|
|
1112
|
+
}, onChange = (r, i) => {
|
|
1113
|
+
let { onChange: a } = e, o = {
|
|
1114
|
+
...t.value,
|
|
1115
|
+
[i]: r
|
|
1116
|
+
};
|
|
1117
|
+
n({
|
|
1118
|
+
...t,
|
|
1119
|
+
value: o
|
|
1120
|
+
}), a(t);
|
|
1121
|
+
}, { errSelectors: r, getComponent: i, name: a, schema: o } = e, s = i("Row"), c = i("Col"), u = i("authError"), d = i("JumpToPath", !0), f = i("Markdown", !0), p = getValue().username, m = r.allErrors().filter((e) => e.get("authId") === a);
|
|
1122
|
+
return /* @__PURE__ */ B("div", { children: [
|
|
1123
|
+
/* @__PURE__ */ B("h4", { children: ["Basic authorization", /* @__PURE__ */ z(d, { path: ["securityDefinitions", a] })] }),
|
|
1124
|
+
p && /* @__PURE__ */ z("h6", { children: "Authorized" }),
|
|
1125
|
+
/* @__PURE__ */ z(s, { children: /* @__PURE__ */ z(f, { source: o.get("description") }) }),
|
|
1126
|
+
/* @__PURE__ */ z(s, { children: p ? /* @__PURE__ */ z(U, {
|
|
1127
|
+
clearable: !1,
|
|
1128
|
+
disabled: !0,
|
|
1129
|
+
label: "Username",
|
|
1130
|
+
value: p
|
|
1131
|
+
}) : /* @__PURE__ */ z(c, { children: /* @__PURE__ */ z(U, {
|
|
1132
|
+
inputProps: {
|
|
1133
|
+
autoFocus: !0,
|
|
1134
|
+
id: "auth_username"
|
|
1135
|
+
},
|
|
1136
|
+
label: "Username",
|
|
1137
|
+
name: "username",
|
|
1138
|
+
onValueChange: (e) => onChange(e, "username")
|
|
1139
|
+
}) }) }),
|
|
1140
|
+
/* @__PURE__ */ z(s, { children: p ? /* @__PURE__ */ z(V, {
|
|
1141
|
+
clearable: !1,
|
|
1142
|
+
disabled: !0,
|
|
1143
|
+
label: "Password",
|
|
1144
|
+
value: t.value?.[t.name] || ""
|
|
1145
|
+
}) : /* @__PURE__ */ z(c, { children: /* @__PURE__ */ z(V, {
|
|
1146
|
+
inputProps: { id: "auth_password" },
|
|
1147
|
+
label: "Password",
|
|
1148
|
+
name: "password",
|
|
1149
|
+
onValueChange: (e) => onChange(e, "password")
|
|
1150
|
+
}) }) }),
|
|
1151
|
+
m.valueSeq().map((e, t) => /* @__PURE__ */ z(u, { error: e }, t))
|
|
1152
|
+
] });
|
|
1153
|
+
}
|
|
1154
|
+
// src/internal/auth/utils.ts
|
|
1155
|
+
function b64toB64UrlEncoded(e) {
|
|
1156
|
+
return e.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
1157
|
+
}
|
|
1158
|
+
function generateCodeVerifier() {
|
|
1159
|
+
return b64toB64UrlEncoded(J(32).toString("base64"));
|
|
1160
|
+
}
|
|
1161
|
+
function createCodeChallenge(e) {
|
|
1162
|
+
return b64toB64UrlEncoded(ee("sha256").update(e).digest("base64"));
|
|
1163
|
+
}
|
|
1164
|
+
function sanitizeUrl$2(e) {
|
|
1165
|
+
if (typeof e != "string" || e.trim() === "") return "";
|
|
1166
|
+
let t = e.trim(), n = "about:blank";
|
|
1167
|
+
try {
|
|
1168
|
+
let e = `https://base${String(Math.random()).slice(2)}`, r = new URL(t, e), i = r.protocol.slice(0, -1);
|
|
1169
|
+
return [
|
|
1170
|
+
"javascript",
|
|
1171
|
+
"data",
|
|
1172
|
+
"vbscript"
|
|
1173
|
+
].includes(i.toLowerCase()) ? n : r.origin === e ? t.startsWith("/") ? `${r.pathname}${r.search}${r.hash}` : t.startsWith("./") || t.startsWith("../") ? `${t?.match(/^(\.\.?\/)+/)?.[0]}${r.pathname.substring(1)}${r.search}${r.hash}` : `${r.pathname.substring(1)}${r.search}${r.hash}` : String(r);
|
|
1174
|
+
} catch {
|
|
1175
|
+
return n;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
function authorizeOauth2({ auth: e, authActions: t, authConfigs: n = {}, configs: r, currentServer: i, errActions: a }) {
|
|
1179
|
+
let { clientId: o, name: s, schema: c, scopes: l } = e, u = c.get("flow"), d = [];
|
|
1180
|
+
switch (u) {
|
|
1181
|
+
case "password":
|
|
1182
|
+
t.authorizePassword(e);
|
|
1183
|
+
return;
|
|
1184
|
+
case "application":
|
|
1185
|
+
t.authorizeApplication(e);
|
|
1186
|
+
return;
|
|
1187
|
+
case "accessCode":
|
|
1188
|
+
d.push("response_type=code");
|
|
1189
|
+
break;
|
|
1190
|
+
case "implicit":
|
|
1191
|
+
d.push("response_type=token");
|
|
1192
|
+
break;
|
|
1193
|
+
case "clientCredentials":
|
|
1194
|
+
case "client_credentials":
|
|
1195
|
+
t.authorizeApplication(e);
|
|
1196
|
+
return;
|
|
1197
|
+
case "authorizationCode":
|
|
1198
|
+
case "authorization_code": d.push("response_type=code");
|
|
1199
|
+
}
|
|
1200
|
+
typeof o == "string" && d.push(`client_id=${encodeURIComponent(o)}`);
|
|
1201
|
+
let f = r.oauth2RedirectUrl;
|
|
1202
|
+
if (f === void 0) {
|
|
1203
|
+
a.newAuthErr({
|
|
1204
|
+
authId: s,
|
|
1205
|
+
level: "error",
|
|
1206
|
+
message: "oauth2RedirectUrl configuration is not passed. Oauth2 authorization cannot be performed.",
|
|
1207
|
+
source: "validation"
|
|
1208
|
+
});
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
d.push(`redirect_uri=${encodeURIComponent(f)}`);
|
|
1212
|
+
let p = [];
|
|
1213
|
+
if (Array.isArray(l) ? p = l : q.List.isList(l) && (p = l.toArray()), p.length > 0) {
|
|
1214
|
+
let e = n.scopeSeparator || " ";
|
|
1215
|
+
d.push(`scope=${encodeURIComponent(p.join(e))}`);
|
|
1216
|
+
}
|
|
1217
|
+
let m = btoa((/* @__PURE__ */ new Date()).toString());
|
|
1218
|
+
if (d.push(`state=${encodeURIComponent(m)}`), n.realm !== void 0 && d.push(`realm=${encodeURIComponent(n.realm)}`), (u === "authorizationCode" || u === "authorization_code" || u === "accessCode") && n.usePkceWithAuthorizationCodeGrant) {
|
|
1219
|
+
let t = generateCodeVerifier(), n = createCodeChallenge(t);
|
|
1220
|
+
d.push(`code_challenge=${n}`), d.push("code_challenge_method=S256"), e.codeVerifier = t;
|
|
1221
|
+
}
|
|
1222
|
+
let { additionalQueryStringParams: h } = n;
|
|
1223
|
+
for (let e in h) h[e] !== void 0 && d.push([e, h[e]].map(encodeURIComponent).join("="));
|
|
1224
|
+
let g = c.get("authorizationUrl"), _;
|
|
1225
|
+
_ = i ? Y(sanitizeUrl$2(g), i, !0).toString() : sanitizeUrl$2(g);
|
|
1226
|
+
let v = [_, d.join("&")].join(typeof g == "string" && !g.includes("?") ? "?" : "&"), y;
|
|
1227
|
+
y = u === "implicit" ? t.preAuthorizeImplicit : n.useBasicAuthenticationWithAccessCodeGrant ? t.authorizeAccessCodeWithBasicAuthentication : t.authorizeAccessCodeWithFormParams, t.authPopup(v, {
|
|
1228
|
+
auth: e,
|
|
1229
|
+
callback: y,
|
|
1230
|
+
errCb: a.newAuthErr,
|
|
1231
|
+
redirectUrl: f,
|
|
1232
|
+
state: m
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
// src/internal/auth/oauth2.tsx
|
|
1236
|
+
Oauth2.displayName = "Oauth2";
|
|
1237
|
+
function Oauth2(e) {
|
|
1238
|
+
let { authorized: t, authSelectors: n, errSelectors: r, getComponent: i, name: a, schema: o, specSelectors: s } = e, c = t && t.get(a), u = n.getConfigs() || {}, d = c && c.get("username") || "", f = c && c.get("clientId") || u.clientId || "", p = c && c.get("clientSecret") || u.clientSecret || "", m = c && c.get("passwordType") || "basic", h = c && c.get("scopes") || u.scopes || [];
|
|
1239
|
+
typeof h == "string" && (h = h.split(u.scopeSeparator || " "));
|
|
1240
|
+
let [g, _] = l({
|
|
1241
|
+
appName: u.appName,
|
|
1242
|
+
clientId: f,
|
|
1243
|
+
clientSecret: p,
|
|
1244
|
+
name: a,
|
|
1245
|
+
password: "",
|
|
1246
|
+
passwordType: m,
|
|
1247
|
+
schema: o,
|
|
1248
|
+
scopes: h,
|
|
1249
|
+
username: d
|
|
1250
|
+
}), close = (t) => {
|
|
1251
|
+
t.preventDefault();
|
|
1252
|
+
let { authActions: n } = e;
|
|
1253
|
+
n.showDefinitions(!1);
|
|
1254
|
+
}, authorize = () => {
|
|
1255
|
+
let { authActions: t, authSelectors: n, errActions: r, getConfigs: i, oas3Selectors: o } = e, s = i(), c = n.getConfigs();
|
|
1256
|
+
r.clear({
|
|
1257
|
+
authId: a,
|
|
1258
|
+
source: "auth",
|
|
1259
|
+
type: "auth"
|
|
1260
|
+
}), authorizeOauth2({
|
|
1261
|
+
auth: g,
|
|
1262
|
+
authActions: t,
|
|
1263
|
+
authConfigs: c,
|
|
1264
|
+
configs: s,
|
|
1265
|
+
currentServer: o.serverEffectiveValue(o.selectedServer()),
|
|
1266
|
+
errActions: r
|
|
1267
|
+
});
|
|
1268
|
+
}, onScopeChange = (e, t) => {
|
|
1269
|
+
if (t && g.scopes.indexOf(e) === -1) {
|
|
1270
|
+
let t = g.scopes.concat([e]);
|
|
1271
|
+
_((e) => ({
|
|
1272
|
+
...e,
|
|
1273
|
+
scopes: t
|
|
1274
|
+
}));
|
|
1275
|
+
} else !t && g.scopes.indexOf(e) > -1 && _((t) => ({
|
|
1276
|
+
...t,
|
|
1277
|
+
scopes: g.scopes.filter((t) => t !== e)
|
|
1278
|
+
}));
|
|
1279
|
+
}, onInputChange = (e, t) => {
|
|
1280
|
+
let n = { [e]: t };
|
|
1281
|
+
_((e) => ({
|
|
1282
|
+
...e,
|
|
1283
|
+
...n
|
|
1284
|
+
}));
|
|
1285
|
+
}, selectScopes = (t) => {
|
|
1286
|
+
t.target.dataset.all ? _((t) => ({
|
|
1287
|
+
...t,
|
|
1288
|
+
scopes: Array.from((e.schema.get("allowedScopes") || e.schema.get("scopes")).keys())
|
|
1289
|
+
})) : _((e) => ({
|
|
1290
|
+
...e,
|
|
1291
|
+
scopes: []
|
|
1292
|
+
}));
|
|
1293
|
+
}, logout = (t) => {
|
|
1294
|
+
t.preventDefault();
|
|
1295
|
+
let { authActions: n, errActions: r, name: i } = e;
|
|
1296
|
+
r.clear({
|
|
1297
|
+
authId: i,
|
|
1298
|
+
source: "auth",
|
|
1299
|
+
type: "auth"
|
|
1300
|
+
}), n.logoutWithPersistOption([i]);
|
|
1301
|
+
}, v = i("Row"), y = i("Col"), b = i("authError"), x = i("JumpToPath", !0), S = i("Markdown", !0), { isOAS3: C } = s, w = C() ? o.get("openIdConnectUrl") : null, T = "implicit", E = "password", D = C() ? w ? "authorization_code" : "authorizationCode" : "accessCode", O = C() ? w ? "client_credentials" : "clientCredentials" : "application";
|
|
1302
|
+
u = n.getConfigs() || {};
|
|
1303
|
+
let k = !!u.usePkceWithAuthorizationCodeGrant, A = o.get("flow"), M = A === D && k ? `${A} with PKCE` : A;
|
|
1304
|
+
h = o.get("allowedScopes") || o.get("scopes");
|
|
1305
|
+
let N = !!n.authorized().get(a), P = r.allErrors().filter((e) => e.get("authId") === a), F = !P.filter((e) => e.get("source") === "validation").size, I = o.get("description");
|
|
1306
|
+
return /* @__PURE__ */ B("div", {
|
|
1307
|
+
className: "oauth2-wrapper",
|
|
1308
|
+
children: [
|
|
1309
|
+
/* @__PURE__ */ B("h4", {
|
|
1310
|
+
className: "oauth2-heading",
|
|
1311
|
+
children: [
|
|
1312
|
+
a,
|
|
1313
|
+
" (OAuth2, ",
|
|
1314
|
+
M,
|
|
1315
|
+
")",
|
|
1316
|
+
" ",
|
|
1317
|
+
/* @__PURE__ */ z(x, { path: ["securityDefinitions", a] })
|
|
1318
|
+
]
|
|
1319
|
+
}),
|
|
1320
|
+
g.appName ? /* @__PURE__ */ B("h5", { children: [
|
|
1321
|
+
"Application: ",
|
|
1322
|
+
g.appName,
|
|
1323
|
+
" "
|
|
1324
|
+
] }) : null,
|
|
1325
|
+
I && /* @__PURE__ */ z(S, { source: o.get("description") }),
|
|
1326
|
+
N && /* @__PURE__ */ z("h6", { children: "Authorized" }),
|
|
1327
|
+
w && /* @__PURE__ */ B("p", {
|
|
1328
|
+
className: "text-body-sm",
|
|
1329
|
+
children: ["OpenID Connect URL: ", /* @__PURE__ */ z("code", {
|
|
1330
|
+
className: "qui-code",
|
|
1331
|
+
children: w
|
|
1332
|
+
})]
|
|
1333
|
+
}),
|
|
1334
|
+
(A === T || A === D) && /* @__PURE__ */ B("p", {
|
|
1335
|
+
className: "text-body-sm",
|
|
1336
|
+
children: [
|
|
1337
|
+
"Authorization URL:",
|
|
1338
|
+
" ",
|
|
1339
|
+
/* @__PURE__ */ z("code", {
|
|
1340
|
+
className: "qui-code",
|
|
1341
|
+
children: o.get("authorizationUrl")
|
|
1342
|
+
})
|
|
1343
|
+
]
|
|
1344
|
+
}),
|
|
1345
|
+
(A === E || A === D || A === O) && /* @__PURE__ */ B("p", {
|
|
1346
|
+
className: "text-body-sm",
|
|
1347
|
+
children: ["Token URL:", /* @__PURE__ */ B("code", {
|
|
1348
|
+
className: "qui-code",
|
|
1349
|
+
children: [" ", o.get("tokenUrl")]
|
|
1350
|
+
})]
|
|
1351
|
+
}),
|
|
1352
|
+
/* @__PURE__ */ B("p", {
|
|
1353
|
+
className: "text-body-sm",
|
|
1354
|
+
children: ["Flow: ", /* @__PURE__ */ z("code", {
|
|
1355
|
+
className: "qui-code",
|
|
1356
|
+
children: M
|
|
1357
|
+
})]
|
|
1358
|
+
}),
|
|
1359
|
+
A === E ? /* @__PURE__ */ B(v, { children: [
|
|
1360
|
+
/* @__PURE__ */ z(v, { children: /* @__PURE__ */ z(y, {
|
|
1361
|
+
desktop: 10,
|
|
1362
|
+
tablet: 10,
|
|
1363
|
+
children: /* @__PURE__ */ z(U, {
|
|
1364
|
+
disabled: N,
|
|
1365
|
+
inputProps: {
|
|
1366
|
+
autoFocus: !0,
|
|
1367
|
+
"data-name": "username"
|
|
1368
|
+
},
|
|
1369
|
+
label: "Username",
|
|
1370
|
+
onValueChange: (e) => onInputChange("username", e)
|
|
1371
|
+
})
|
|
1372
|
+
}) }),
|
|
1373
|
+
/* @__PURE__ */ z(v, { children: /* @__PURE__ */ z(y, {
|
|
1374
|
+
desktop: 10,
|
|
1375
|
+
tablet: 10,
|
|
1376
|
+
children: /* @__PURE__ */ z(V, {
|
|
1377
|
+
className: "swagger-input",
|
|
1378
|
+
disabled: N,
|
|
1379
|
+
onValueChange: (e) => onInputChange("password", e)
|
|
1380
|
+
})
|
|
1381
|
+
}) }),
|
|
1382
|
+
/* @__PURE__ */ z(v, { children: /* @__PURE__ */ z(y, {
|
|
1383
|
+
desktop: 10,
|
|
1384
|
+
tablet: 10,
|
|
1385
|
+
children: /* @__PURE__ */ z(K, {
|
|
1386
|
+
collection: W({ items: [{
|
|
1387
|
+
label: "Authorization header",
|
|
1388
|
+
value: "basic"
|
|
1389
|
+
}, {
|
|
1390
|
+
label: "Request body",
|
|
1391
|
+
value: "request-body"
|
|
1392
|
+
}] }),
|
|
1393
|
+
defaultValue: ["basic"],
|
|
1394
|
+
disabled: N,
|
|
1395
|
+
label: "Client credentials location:",
|
|
1396
|
+
onValueChange: (e) => onInputChange("passwordType", e[0]),
|
|
1397
|
+
size: "sm"
|
|
1398
|
+
})
|
|
1399
|
+
}) })
|
|
1400
|
+
] }) : null,
|
|
1401
|
+
(A === O || A === T || A === D || A === E) && (!N || N && g.clientId) && /* @__PURE__ */ z(v, { children: /* @__PURE__ */ z(y, {
|
|
1402
|
+
desktop: 10,
|
|
1403
|
+
tablet: 10,
|
|
1404
|
+
children: /* @__PURE__ */ z(U, {
|
|
1405
|
+
className: "swagger-input",
|
|
1406
|
+
defaultValue: g.clientId,
|
|
1407
|
+
disabled: N,
|
|
1408
|
+
label: "client_id",
|
|
1409
|
+
onValueChange: (e) => onInputChange("clientId", e)
|
|
1410
|
+
})
|
|
1411
|
+
}) }),
|
|
1412
|
+
(A === O || A === D || A === E) && /* @__PURE__ */ z(v, { children: /* @__PURE__ */ z(y, {
|
|
1413
|
+
desktop: 10,
|
|
1414
|
+
tablet: 10,
|
|
1415
|
+
children: /* @__PURE__ */ z(V, {
|
|
1416
|
+
className: "swagger-input",
|
|
1417
|
+
defaultValue: g.clientSecret,
|
|
1418
|
+
disabled: N,
|
|
1419
|
+
label: "client_secret",
|
|
1420
|
+
onValueChange: (e) => onInputChange("clientSecret", e)
|
|
1421
|
+
})
|
|
1422
|
+
}) }),
|
|
1423
|
+
!N && h && h.size ? /* @__PURE__ */ B("div", {
|
|
1424
|
+
className: "scopes",
|
|
1425
|
+
children: [/* @__PURE__ */ B("div", {
|
|
1426
|
+
className: "scope-actions",
|
|
1427
|
+
children: [
|
|
1428
|
+
"Scopes:",
|
|
1429
|
+
/* @__PURE__ */ z("button", {
|
|
1430
|
+
className: "q-text-link",
|
|
1431
|
+
"data-all": !0,
|
|
1432
|
+
onClick: selectScopes,
|
|
1433
|
+
children: "select all"
|
|
1434
|
+
}),
|
|
1435
|
+
/* @__PURE__ */ z("button", {
|
|
1436
|
+
className: "q-text-link",
|
|
1437
|
+
onClick: selectScopes,
|
|
1438
|
+
children: "select none"
|
|
1439
|
+
})
|
|
1440
|
+
]
|
|
1441
|
+
}), h.map((e, t) => /* @__PURE__ */ z(v, { children: /* @__PURE__ */ z(G, {
|
|
1442
|
+
checked: g.scopes.includes(t),
|
|
1443
|
+
controlProps: { "data-value": t },
|
|
1444
|
+
disabled: N,
|
|
1445
|
+
label: /* @__PURE__ */ B("div", {
|
|
1446
|
+
className: "text",
|
|
1447
|
+
children: [/* @__PURE__ */ z("p", {
|
|
1448
|
+
className: "name",
|
|
1449
|
+
children: t
|
|
1450
|
+
}), /* @__PURE__ */ z("p", {
|
|
1451
|
+
className: "description",
|
|
1452
|
+
children: e
|
|
1453
|
+
})]
|
|
1454
|
+
}),
|
|
1455
|
+
onCheckedChange: (e) => {
|
|
1456
|
+
onScopeChange(t, e);
|
|
1457
|
+
}
|
|
1458
|
+
}) }, t)).toArray()]
|
|
1459
|
+
}) : null,
|
|
1460
|
+
P.valueSeq().map((e, t) => /* @__PURE__ */ z(b, { error: e }, t)),
|
|
1461
|
+
/* @__PURE__ */ B("div", {
|
|
1462
|
+
className: "auth-btn-wrapper",
|
|
1463
|
+
children: [F && (N ? /* @__PURE__ */ z(j, {
|
|
1464
|
+
"aria-label": "Remove authorization",
|
|
1465
|
+
onClick: logout,
|
|
1466
|
+
variant: "fill",
|
|
1467
|
+
children: "Logout"
|
|
1468
|
+
}) : /* @__PURE__ */ z(j, {
|
|
1469
|
+
"aria-label": "Apply given OAuth2 credentials",
|
|
1470
|
+
emphasis: "primary",
|
|
1471
|
+
onClick: authorize,
|
|
1472
|
+
variant: "fill",
|
|
1473
|
+
children: "Authorize"
|
|
1474
|
+
})), /* @__PURE__ */ z(j, {
|
|
1475
|
+
onClick: close,
|
|
1476
|
+
variant: "outline",
|
|
1477
|
+
children: "Close"
|
|
1478
|
+
})]
|
|
1479
|
+
})
|
|
1480
|
+
]
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
// src/internal/clear.tsx
|
|
1484
|
+
function Clear(e) {
|
|
1485
|
+
return /* @__PURE__ */ z(j, {
|
|
1486
|
+
endIcon: k,
|
|
1487
|
+
onClick: () => {
|
|
1488
|
+
let { method: t, path: n, specActions: r } = e;
|
|
1489
|
+
r.clearResponse(n, t), r.clearRequest(n, t);
|
|
1490
|
+
},
|
|
1491
|
+
variant: "outline",
|
|
1492
|
+
children: "Clear"
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
// src/internal/content-type.tsx
|
|
1496
|
+
function ContentType({ ariaControls: e, ariaLabel: t, contentTypes: n, label: r, onChange: i, value: o = null }) {
|
|
1497
|
+
let c = s(() => q.fromJS(n), [n]), l = s(() => !c || !c.size ? null : W({ items: c.toArray() }), [c]);
|
|
1498
|
+
return te(() => {
|
|
1499
|
+
c && i && i(c.first());
|
|
1500
|
+
}), a(() => {
|
|
1501
|
+
c && o && !c.includes(o) && i && c.size && i(c.first());
|
|
1502
|
+
}, [
|
|
1503
|
+
c,
|
|
1504
|
+
i,
|
|
1505
|
+
o
|
|
1506
|
+
]), !c || !c.size || !l ? null : /* @__PURE__ */ z(K, {
|
|
1507
|
+
clearable: !1,
|
|
1508
|
+
collection: l,
|
|
1509
|
+
controlProps: {
|
|
1510
|
+
"aria-controls": e,
|
|
1511
|
+
"aria-label": t || "Content Type"
|
|
1512
|
+
},
|
|
1513
|
+
label: r?.trim() || void 0,
|
|
1514
|
+
onClick: (e) => {
|
|
1515
|
+
e.preventDefault();
|
|
1516
|
+
},
|
|
1517
|
+
onValueChange: (e) => i?.(e[0]),
|
|
1518
|
+
size: "sm",
|
|
1519
|
+
style: { minWidth: 180 },
|
|
1520
|
+
value: o ? [o] : []
|
|
1521
|
+
});
|
|
1522
|
+
}
|
|
1523
|
+
// src/internal/enum-model.tsx
|
|
1524
|
+
EnumModel.displayName = "EnumModel";
|
|
1525
|
+
var KeyRenderer = () => null;
|
|
1526
|
+
KeyRenderer.when = () => !0;
|
|
1527
|
+
function EnumModel({ getComponent: e, value: t }) {
|
|
1528
|
+
let n = e("RenderLink"), r = useThemeContext();
|
|
1529
|
+
return /* @__PURE__ */ z(JsonModelViewer, {
|
|
1530
|
+
defaultInspectDepth: 25,
|
|
1531
|
+
displayDataTypes: !1,
|
|
1532
|
+
displayKeyIndicator: !1,
|
|
1533
|
+
displaySize: !1,
|
|
1534
|
+
groupArraysAfterLength: 100,
|
|
1535
|
+
indentWidth: 2,
|
|
1536
|
+
keyRenderer: KeyRenderer,
|
|
1537
|
+
renderLink: n,
|
|
1538
|
+
rootName: !1,
|
|
1539
|
+
theme: r,
|
|
1540
|
+
value: t.toJSON()
|
|
1541
|
+
});
|
|
1542
|
+
}
|
|
1543
|
+
// src/internal/execute.tsx
|
|
1544
|
+
function Execute(e) {
|
|
1545
|
+
let handleValidateParameters = () => {
|
|
1546
|
+
let { method: t, path: n, specActions: r, specSelectors: i } = e;
|
|
1547
|
+
return r.validateParams([n, t]), i.validateBeforeExecute([n, t]);
|
|
1548
|
+
}, handleValidateRequestBody = () => {
|
|
1549
|
+
let { method: t, oas3Actions: n, oas3Selectors: r, path: i, specSelectors: a } = e, o = {
|
|
1550
|
+
missingBodyValue: !1,
|
|
1551
|
+
missingRequiredKeys: []
|
|
1552
|
+
};
|
|
1553
|
+
n.clearRequestBodyValidateError({
|
|
1554
|
+
method: t,
|
|
1555
|
+
path: i
|
|
1556
|
+
});
|
|
1557
|
+
let s = a.getOAS3RequiredRequestBodyContentType([i, t]), c = r.requestBodyValue(i, t), l = r.validateBeforeExecute([i, t]), u = r.requestContentType(i, t);
|
|
1558
|
+
if (!l) return o.missingBodyValue = !0, n.setRequestBodyValidateError({
|
|
1559
|
+
method: t,
|
|
1560
|
+
path: i,
|
|
1561
|
+
validationErrors: o
|
|
1562
|
+
}), !1;
|
|
1563
|
+
if (!s) return !0;
|
|
1564
|
+
let d = r.validateShallowRequired({
|
|
1565
|
+
oas3RequestBodyValue: c,
|
|
1566
|
+
oas3RequestContentType: u,
|
|
1567
|
+
oas3RequiredRequestBodyContentType: s
|
|
1568
|
+
});
|
|
1569
|
+
if (!d || d.length < 1) return !0;
|
|
1570
|
+
for (let e of d) o.missingRequiredKeys.push(e);
|
|
1571
|
+
return n.setRequestBodyValidateError({
|
|
1572
|
+
method: t,
|
|
1573
|
+
path: i,
|
|
1574
|
+
validationErrors: o
|
|
1575
|
+
}), !1;
|
|
1576
|
+
}, handleValidationResultPass = () => {
|
|
1577
|
+
let { method: t, operation: n, path: r, specActions: i } = e;
|
|
1578
|
+
e.onExecute && e.onExecute(), i.execute({
|
|
1579
|
+
method: t,
|
|
1580
|
+
operation: n,
|
|
1581
|
+
path: r
|
|
1582
|
+
});
|
|
1583
|
+
}, handleValidationResultFail = () => {
|
|
1584
|
+
let { method: t, path: n, specActions: r } = e;
|
|
1585
|
+
r.clearValidateParams([n, t]), setTimeout(() => {
|
|
1586
|
+
r.validateParams([n, t]);
|
|
1587
|
+
}, 40);
|
|
1588
|
+
}, handleValidationResult = (e) => {
|
|
1589
|
+
e ? handleValidationResultPass() : handleValidationResultFail();
|
|
1590
|
+
}, onClick = () => {
|
|
1591
|
+
let e = handleValidateParameters(), t = handleValidateRequestBody();
|
|
1592
|
+
handleValidationResult(e && t);
|
|
1593
|
+
}, { disabled: t } = e;
|
|
1594
|
+
return /* @__PURE__ */ z(j, {
|
|
1595
|
+
className: "execute-button",
|
|
1596
|
+
disabled: t,
|
|
1597
|
+
emphasis: "primary",
|
|
1598
|
+
endIcon: E,
|
|
1599
|
+
onClick,
|
|
1600
|
+
variant: "fill",
|
|
1601
|
+
children: "Execute"
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1604
|
+
// src/code-mirror/docs-code-mirror.tsx
|
|
1605
|
+
DocsCodeMirror.displayName = "DocsCodeMirror";
|
|
1606
|
+
function DocsCodeMirror({ basicSetup: e, copyable: t, downloadable: n, handleDownload: r, language: i = "json", theme: a = "dark", value: o, ...c }) {
|
|
1607
|
+
let l = typeof e == "object" ? e : {}, u = s(() => {
|
|
1608
|
+
switch (i) {
|
|
1609
|
+
case "bash": return [X.bash()];
|
|
1610
|
+
case "html": return [X.html()];
|
|
1611
|
+
case "xml": return [X.xml()];
|
|
1612
|
+
default: return [X.json()];
|
|
1613
|
+
}
|
|
1614
|
+
}, [i]);
|
|
1615
|
+
return /* @__PURE__ */ B("div", {
|
|
1616
|
+
className: "q-code-mirror",
|
|
1617
|
+
children: [/* @__PURE__ */ z(ie, {
|
|
1618
|
+
basicSetup: {
|
|
1619
|
+
...l,
|
|
1620
|
+
highlightActiveLine: !1,
|
|
1621
|
+
lineNumbers: !1,
|
|
1622
|
+
lintKeymap: !0,
|
|
1623
|
+
syntaxHighlighting: !0
|
|
1624
|
+
},
|
|
1625
|
+
editable: !1,
|
|
1626
|
+
extensions: u,
|
|
1627
|
+
maxHeight: "700px",
|
|
1628
|
+
minWidth: "400px",
|
|
1629
|
+
theme: [a === "dark" ? ne : re],
|
|
1630
|
+
value: o,
|
|
1631
|
+
...c
|
|
1632
|
+
}), t || n ? /* @__PURE__ */ B("div", {
|
|
1633
|
+
className: "actions-wrapper",
|
|
1634
|
+
children: [n ? /* @__PURE__ */ z(oe, {
|
|
1635
|
+
trigger: /* @__PURE__ */ z(M, {
|
|
1636
|
+
"aria-label": "Download",
|
|
1637
|
+
density: "compact",
|
|
1638
|
+
emphasis: "primary",
|
|
1639
|
+
icon: g,
|
|
1640
|
+
onClick: r,
|
|
1641
|
+
variant: "ghost"
|
|
1642
|
+
}),
|
|
1643
|
+
children: "Download"
|
|
1644
|
+
}) : null, t ? /* @__PURE__ */ z(ae, { valueOrFn: () => o }) : null]
|
|
1645
|
+
}) : null]
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
// src/internal/utils.ts
|
|
1649
|
+
function sanitizeUrl$1(e) {
|
|
1650
|
+
return typeof e != "string" || e === "" ? "" : se(e);
|
|
1651
|
+
}
|
|
1652
|
+
function jsFileDownload(e, t, n, r) {
|
|
1653
|
+
let i = new Blob(r === void 0 ? [e] : [r, e], { type: n || "application/octet-stream" }), a = window.URL && window.URL.createObjectURL ? window.URL.createObjectURL(i) : window.webkitURL.createObjectURL(i), o = document.createElement("a");
|
|
1654
|
+
o.style.display = "none", o.href = a, o.setAttribute("download", t), o.download === void 0 && o.setAttribute("target", "_blank"), document.body.appendChild(o), o.click(), setTimeout(function() {
|
|
1655
|
+
document.body.removeChild(o), window.URL.revokeObjectURL(a);
|
|
1656
|
+
}, 200);
|
|
1657
|
+
}
|
|
1658
|
+
function stringify(e) {
|
|
1659
|
+
if (typeof e == "string") return e;
|
|
1660
|
+
if (e && e.toJS && (e = e.toJS()), typeof e == "object" && e) try {
|
|
1661
|
+
return JSON.stringify(e, null, 2);
|
|
1662
|
+
} catch {
|
|
1663
|
+
return String(e);
|
|
1664
|
+
}
|
|
1665
|
+
return e == null ? "" : e.toString();
|
|
1666
|
+
}
|
|
1667
|
+
function isFunc(e) {
|
|
1668
|
+
return typeof e == "function";
|
|
1669
|
+
}
|
|
1670
|
+
function isAbsoluteUrl(e) {
|
|
1671
|
+
return e.match(/^(?:[a-z]+:)?\/\//i);
|
|
1672
|
+
}
|
|
1673
|
+
function addProtocol(e) {
|
|
1674
|
+
return e.match(/^\/\//i) ? `${window.location.protocol}${e}` : e;
|
|
1675
|
+
}
|
|
1676
|
+
function buildBaseUrl(e, t) {
|
|
1677
|
+
return e ? isAbsoluteUrl(e) ? addProtocol(e) : new URL(e, t).href : t;
|
|
1678
|
+
}
|
|
1679
|
+
function buildUrl(e, t, { selectedServer: n = "" } = {}) {
|
|
1680
|
+
if (!e) return;
|
|
1681
|
+
if (isAbsoluteUrl(e)) return e;
|
|
1682
|
+
let r = buildBaseUrl(n, t);
|
|
1683
|
+
return isAbsoluteUrl(r) ? new URL(e, r).href : new URL(e, window.location.href).href;
|
|
1684
|
+
}
|
|
1685
|
+
function safeBuildUrl(e, t, { selectedServer: n = "" } = {}) {
|
|
1686
|
+
try {
|
|
1687
|
+
return buildUrl(e, t, { selectedServer: n });
|
|
1688
|
+
} catch {
|
|
1689
|
+
return;
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
var createDeepLinkPath = (e) => typeof e == "string" ? e.trim().replace(/\s/g, "%20") : "", escapeDeepLinkPath = (e) => ce(createDeepLinkPath(e).replace(/%20/g, "_"));
|
|
1693
|
+
function getList(e, t) {
|
|
1694
|
+
if (!q.Iterable.isIterable(e)) return q.List();
|
|
1695
|
+
let n = e.getIn(Array.isArray(t) ? t : [t]);
|
|
1696
|
+
return q.List.isList(n) ? n : q.List();
|
|
1697
|
+
}
|
|
1698
|
+
var getExtensions = (e) => e.filter((e, t) => t.startsWith("x-"));
|
|
1699
|
+
// src/internal/highlight-code.tsx
|
|
1700
|
+
function HighlightCode({ canCopy: e, children: t, downloadable: n, fileName: r = "response.txt", language: i }) {
|
|
1701
|
+
let handleDownload = () => {
|
|
1702
|
+
jsFileDownload(t, r);
|
|
1703
|
+
}, a = e || t?.startsWith("{") || t?.startsWith("["), o = useThemeContext();
|
|
1704
|
+
return /* @__PURE__ */ z("div", {
|
|
1705
|
+
className: "qui-code-mirror",
|
|
1706
|
+
style: { maxWidth: 700 },
|
|
1707
|
+
children: /* @__PURE__ */ z(DocsCodeMirror, {
|
|
1708
|
+
copyable: a,
|
|
1709
|
+
downloadable: n,
|
|
1710
|
+
handleDownload,
|
|
1711
|
+
language: i,
|
|
1712
|
+
theme: o,
|
|
1713
|
+
value: t
|
|
1714
|
+
})
|
|
1715
|
+
});
|
|
1716
|
+
}
|
|
1717
|
+
// src/internal/json-schema-array-item-file.tsx
|
|
1718
|
+
JsonSchemaArrayItemFile.displayName = "JsonSchemaArrayItemFile";
|
|
1719
|
+
function JsonSchemaArrayItemFile(e) {
|
|
1720
|
+
let onFileChange = (t) => {
|
|
1721
|
+
let n = t.target.files[0];
|
|
1722
|
+
e.onChange?.(n, e.keyName);
|
|
1723
|
+
}, { disabled: t, errors: n, getComponent: r } = e, i = r("Input"), a = t || !("FormData" in window);
|
|
1724
|
+
return /* @__PURE__ */ z(i, {
|
|
1725
|
+
className: n.size ? "invalid" : "",
|
|
1726
|
+
disabled: a,
|
|
1727
|
+
onChange: onFileChange,
|
|
1728
|
+
title: n.size ? n : "",
|
|
1729
|
+
type: "file"
|
|
1730
|
+
});
|
|
1731
|
+
}
|
|
1732
|
+
// src/internal/json-schema-array-item-text.tsx
|
|
1733
|
+
JsonSchemaArrayItemText.displayName = "JsonSchemaArrayItemText";
|
|
1734
|
+
function JsonSchemaArrayItemText(e) {
|
|
1735
|
+
let { description: t, disabled: n, errors: r, keyName: i = "", onChange: onChangeProp = () => {}, value: a = "" } = e, onChange = (e) => {
|
|
1736
|
+
onChangeProp(e, i);
|
|
1737
|
+
}, o = r.toJS ? r.toJS() : [], s = a || "";
|
|
1738
|
+
return /* @__PURE__ */ z(U, {
|
|
1739
|
+
className: "swagger-input",
|
|
1740
|
+
disabled: n,
|
|
1741
|
+
errorText: o.length ? o[0] : "",
|
|
1742
|
+
invalid: o.length > 0,
|
|
1743
|
+
onValueChange: onChange,
|
|
1744
|
+
placeholder: t,
|
|
1745
|
+
size: "sm",
|
|
1746
|
+
value: s
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1749
|
+
// src/internal/json-schema-array.tsx
|
|
1750
|
+
JsonSchemaArray.displayName = "JsonSchemaArray";
|
|
1751
|
+
function valueOrEmptyList(e) {
|
|
1752
|
+
return q.List.isList(e) ? e : Array.isArray(e) ? q.fromJS(e) : q.List();
|
|
1753
|
+
}
|
|
1754
|
+
function JsonSchemaArray(e) {
|
|
1755
|
+
let { disabled: t, errors: n, fn: r, getComponent: i, onChange: onChangeProp = () => {}, required: o = !1, schema: c = {}, value: u = "" } = e, [d, f] = l(valueOrEmptyList(u)), [p, m] = l(c);
|
|
1756
|
+
a(() => {
|
|
1757
|
+
m(c);
|
|
1758
|
+
}, [c]), a(() => {
|
|
1759
|
+
d !== u && f(valueOrEmptyList(u));
|
|
1760
|
+
}, [d, u]);
|
|
1761
|
+
let onChange = (e) => {
|
|
1762
|
+
onChangeProp?.(e);
|
|
1763
|
+
}, onItemChange = (e, t) => {
|
|
1764
|
+
let n = d.set(t, e);
|
|
1765
|
+
f(n), onChange(n);
|
|
1766
|
+
}, removeItem = (e) => {
|
|
1767
|
+
let t = d.delete(e);
|
|
1768
|
+
f(t), onChange(t);
|
|
1769
|
+
}, addItem = () => {
|
|
1770
|
+
let e = valueOrEmptyList(d).push(r.getSampleSchema(p.get("items"), !1, { includeWriteOnly: !0 }));
|
|
1771
|
+
f(e), onChange(e);
|
|
1772
|
+
}, onEnumChange = (e) => {
|
|
1773
|
+
f(e), onChange(e);
|
|
1774
|
+
}, h = n.toJS ? n.toJS() : Array.isArray(n) ? n : [], g = h.filter((e) => typeof e == "string"), _ = h.filter((e) => e.needRemove !== void 0).map((e) => e.error), v = !!(d && d.count && d.count() > 0), y = p.getIn(["items", "enum"]), b = p.getIn(["items", "type"]), x = p.getIn(["items", "format"]), S = p.get("items"), C, w = !1, E = b === "file" || b === "string" && x === "binary";
|
|
1775
|
+
b && x ? C = i(`JsonSchema_${b}_${x}`) : (b === "boolean" || b === "array" || b === "object") && (C = i(`JsonSchema_${b}`)), !C && !E && (w = !0);
|
|
1776
|
+
let O = s(() => y ? W({ items: y.toArray() }) : null, [y]);
|
|
1777
|
+
if (y && O) {
|
|
1778
|
+
let e = d instanceof q.List ? d.toArray() : Array.from(d);
|
|
1779
|
+
return /* @__PURE__ */ z(K, {
|
|
1780
|
+
className: "swagger-input",
|
|
1781
|
+
clearable: !o,
|
|
1782
|
+
collection: O,
|
|
1783
|
+
disabled: t,
|
|
1784
|
+
invalid: h.length > 0,
|
|
1785
|
+
multiple: !0,
|
|
1786
|
+
onValueChange: (e) => onEnumChange(e),
|
|
1787
|
+
size: "sm",
|
|
1788
|
+
value: e
|
|
1789
|
+
});
|
|
1790
|
+
}
|
|
1791
|
+
return /* @__PURE__ */ B("div", {
|
|
1792
|
+
className: "json-schema-array",
|
|
1793
|
+
children: [v ? d.map((n, a) => {
|
|
1794
|
+
let o = q.fromJS([...h.filter((e) => e.index === a).map((e) => e.error)]);
|
|
1795
|
+
return /* @__PURE__ */ B("div", {
|
|
1796
|
+
className: "json-schema-form-item",
|
|
1797
|
+
children: [E ? /* @__PURE__ */ z(JsonSchemaArrayItemFile, {
|
|
1798
|
+
...e,
|
|
1799
|
+
disabled: t,
|
|
1800
|
+
errors: o,
|
|
1801
|
+
onChange: (e) => onItemChange(e, a),
|
|
1802
|
+
value: n
|
|
1803
|
+
}) : w ? /* @__PURE__ */ z(JsonSchemaArrayItemText, {
|
|
1804
|
+
...e,
|
|
1805
|
+
disabled: t,
|
|
1806
|
+
errors: o,
|
|
1807
|
+
onChange: (e) => onItemChange(e, a),
|
|
1808
|
+
value: n
|
|
1809
|
+
}) : /* @__PURE__ */ z(C, {
|
|
1810
|
+
...e,
|
|
1811
|
+
disabled: t,
|
|
1812
|
+
errors: o,
|
|
1813
|
+
fn: r,
|
|
1814
|
+
getComponent: i,
|
|
1815
|
+
onChange: (e) => onItemChange(e, a),
|
|
1816
|
+
schema: S,
|
|
1817
|
+
value: n
|
|
1818
|
+
}), t ? null : /* @__PURE__ */ z(M, {
|
|
1819
|
+
"aria-label": _?.length ? _[0] : "Remove Option",
|
|
1820
|
+
icon: T,
|
|
1821
|
+
onClick: () => removeItem(a),
|
|
1822
|
+
size: "sm",
|
|
1823
|
+
variant: "outline"
|
|
1824
|
+
})]
|
|
1825
|
+
}, a);
|
|
1826
|
+
}) : null, t ? null : /* @__PURE__ */ B(j, {
|
|
1827
|
+
"aria-label": g.length ? g[0] : "",
|
|
1828
|
+
className: "qui-json-schema-array-add-btn",
|
|
1829
|
+
emphasis: g.length ? "danger" : "neutral",
|
|
1830
|
+
endIcon: D,
|
|
1831
|
+
onClick: addItem,
|
|
1832
|
+
variant: "fill",
|
|
1833
|
+
children: [
|
|
1834
|
+
"Add ",
|
|
1835
|
+
b ? `${b} ` : "",
|
|
1836
|
+
"item"
|
|
1837
|
+
]
|
|
1838
|
+
})]
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1841
|
+
// src/internal/json-schema-object.tsx
|
|
1842
|
+
JsonSchemaObject.displayName = "JsonSchemaObject";
|
|
1843
|
+
function JsonSchemaObject(e) {
|
|
1844
|
+
let onChange = (t) => {
|
|
1845
|
+
e.onChange?.(t);
|
|
1846
|
+
}, handleOnChange = (e) => {
|
|
1847
|
+
onChange(e);
|
|
1848
|
+
}, { disabled: t, value: n } = e, r = useThemeContext();
|
|
1849
|
+
return /* @__PURE__ */ z("div", { children: /* @__PURE__ */ z(DocsCodeMirror, {
|
|
1850
|
+
basicSetup: {
|
|
1851
|
+
foldGutter: !1,
|
|
1852
|
+
lineNumbers: !1,
|
|
1853
|
+
lintKeymap: !0
|
|
1854
|
+
},
|
|
1855
|
+
editable: !t,
|
|
1856
|
+
language: "json",
|
|
1857
|
+
onChange: handleOnChange,
|
|
1858
|
+
theme: r,
|
|
1859
|
+
value: stringify(n)
|
|
1860
|
+
}) });
|
|
1861
|
+
}
|
|
1862
|
+
// src/internal/json-schema-string.tsx
|
|
1863
|
+
JsonSchemaString.displayName = "JsonSchemaString";
|
|
1864
|
+
function JsonSchemaString({ description: e, disabled: t, errors: n, keyName: r, onChange: i, required: a, schema: o, value: c }) {
|
|
1865
|
+
let onFileChange = (e) => {
|
|
1866
|
+
let t = e.target.files?.[0];
|
|
1867
|
+
i?.(t, r);
|
|
1868
|
+
}, l = o && o.get ? o.get("enum") : null, u = o && o.get ? o.get("format") : null, d = o && o.get ? o.get("type") : null, f = o && o.get ? o.get("in") : null, p = c || "", m = n.toJS ? n.toJS() : [], h = s(() => l ? W({ items: [...l] }) : null, [l]);
|
|
1869
|
+
if (l && h) return /* @__PURE__ */ z(K, {
|
|
1870
|
+
clearable: !a,
|
|
1871
|
+
collection: h,
|
|
1872
|
+
disabled: t,
|
|
1873
|
+
invalid: m.length > 0,
|
|
1874
|
+
onValueChange: (e) => i?.(e[0]),
|
|
1875
|
+
size: "sm",
|
|
1876
|
+
value: p ? [p] : []
|
|
1877
|
+
});
|
|
1878
|
+
let g = t || !(!f || f !== "formData" || "FormData" in window);
|
|
1879
|
+
return d && d === "file" ? /* @__PURE__ */ z("input", {
|
|
1880
|
+
disabled: g,
|
|
1881
|
+
onChange: (e) => onFileChange(e),
|
|
1882
|
+
type: "file"
|
|
1883
|
+
}) : /* @__PURE__ */ z(U, {
|
|
1884
|
+
className: "swagger-input",
|
|
1885
|
+
disabled: g,
|
|
1886
|
+
errorText: m.length ? m[0] : "",
|
|
1887
|
+
inputProps: { type: u && u === "password" ? "password" : "text" },
|
|
1888
|
+
invalid: m.length > 0,
|
|
1889
|
+
onValueChange: (e) => i?.(e, r),
|
|
1890
|
+
placeholder: e,
|
|
1891
|
+
size: "sm",
|
|
1892
|
+
value: p
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
// src/internal/use-swagger-context.tsx
|
|
1896
|
+
var We = t(null), Ge = We.Provider;
|
|
1897
|
+
function useSwaggerContext() {
|
|
1898
|
+
let e = i(We);
|
|
1899
|
+
if (!e) throw Error("QUI Swagger must be wrapped by a <SwaggerContextProvider>");
|
|
1900
|
+
return e;
|
|
1901
|
+
}
|
|
1902
|
+
// src/internal/layout.tsx
|
|
1903
|
+
Layout.displayName = "Layout";
|
|
1904
|
+
function Layout({ errSelectors: e, getComponent: t, specSelectors: n }) {
|
|
1905
|
+
let r = t("SvgAssets"), i = t("InfoContainer", !0), a = t("VersionPragmaFilter"), o = t("operations", !0), s = t("Models", !0), c = t("Webhooks", !0), l = t("Row"), u = t("Col"), f = t("errors", !0), p = t("ServersContainer", !0), m = t("SchemesContainer", !0), h = t("AuthorizeBtnContainer", !0), g = t("FilterContainer", !0), _ = n.isSwagger2(), v = n.isOAS3(), y = n.isOAS31(), b = !n.specStr(), x = n.loadingStatus(), { hideTitleSection: S } = useSwaggerContext(), C = null;
|
|
1906
|
+
if (x === "loading" && (C = /* @__PURE__ */ z("div", {
|
|
1907
|
+
className: "info",
|
|
1908
|
+
children: /* @__PURE__ */ z("div", {
|
|
1909
|
+
className: "loading-container",
|
|
1910
|
+
children: /* @__PURE__ */ z("div", { className: "loading" })
|
|
1911
|
+
})
|
|
1912
|
+
})), x === "failed" && (C = /* @__PURE__ */ z("div", {
|
|
1913
|
+
className: "info",
|
|
1914
|
+
children: /* @__PURE__ */ B("div", {
|
|
1915
|
+
className: "loading-container",
|
|
1916
|
+
children: [/* @__PURE__ */ z("h4", {
|
|
1917
|
+
className: "title",
|
|
1918
|
+
children: "Failed to load API definition."
|
|
1919
|
+
}), /* @__PURE__ */ z(f, {})]
|
|
1920
|
+
})
|
|
1921
|
+
})), x === "failedConfig") {
|
|
1922
|
+
let t = e.lastError(), n = t ? t.get("message") : "";
|
|
1923
|
+
C = /* @__PURE__ */ z("div", {
|
|
1924
|
+
className: "info failed-config",
|
|
1925
|
+
children: /* @__PURE__ */ B("div", {
|
|
1926
|
+
className: "loading-container",
|
|
1927
|
+
children: [/* @__PURE__ */ z("h4", {
|
|
1928
|
+
className: "title",
|
|
1929
|
+
children: "Failed to load remote configuration."
|
|
1930
|
+
}), /* @__PURE__ */ z("p", { children: n })]
|
|
1931
|
+
})
|
|
1932
|
+
});
|
|
1933
|
+
}
|
|
1934
|
+
if (!C && b && (C = /* @__PURE__ */ z("h4", { children: "No API definition provided." })), C) return /* @__PURE__ */ z("div", {
|
|
1935
|
+
className: "swagger-ui",
|
|
1936
|
+
children: /* @__PURE__ */ z("div", {
|
|
1937
|
+
className: "loading-container",
|
|
1938
|
+
children: C
|
|
1939
|
+
})
|
|
1940
|
+
});
|
|
1941
|
+
let w = n.servers(), T = n.schemes(), E = w && w.size, D = T && T.size, O = !!n.securityDefinitions();
|
|
1942
|
+
return /* @__PURE__ */ B("div", {
|
|
1943
|
+
className: "swagger-ui",
|
|
1944
|
+
children: [/* @__PURE__ */ z(r, {}), /* @__PURE__ */ B(a, {
|
|
1945
|
+
alsoShow: /* @__PURE__ */ z(f, {}),
|
|
1946
|
+
isOAS3: v,
|
|
1947
|
+
isSwagger2: _,
|
|
1948
|
+
children: [
|
|
1949
|
+
/* @__PURE__ */ z(f, {}),
|
|
1950
|
+
S ? null : /* @__PURE__ */ z(l, {
|
|
1951
|
+
className: "information-container",
|
|
1952
|
+
children: /* @__PURE__ */ z(u, {
|
|
1953
|
+
mobile: 12,
|
|
1954
|
+
children: /* @__PURE__ */ z(i, {})
|
|
1955
|
+
})
|
|
1956
|
+
}),
|
|
1957
|
+
E || D || O ? /* @__PURE__ */ z("div", {
|
|
1958
|
+
className: d("scheme-container", S ? "title-hidden" : ""),
|
|
1959
|
+
children: /* @__PURE__ */ B("div", {
|
|
1960
|
+
className: "schemes-wrapper",
|
|
1961
|
+
children: [E || D ? /* @__PURE__ */ B("div", {
|
|
1962
|
+
className: "schemes-server-container",
|
|
1963
|
+
children: [E ? /* @__PURE__ */ z(p, {}) : null, D ? /* @__PURE__ */ z(m, {}) : null]
|
|
1964
|
+
}) : null, O ? /* @__PURE__ */ z(h, {}) : null]
|
|
1965
|
+
})
|
|
1966
|
+
}) : null,
|
|
1967
|
+
/* @__PURE__ */ z(g, {}),
|
|
1968
|
+
/* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(u, {
|
|
1969
|
+
desktop: 12,
|
|
1970
|
+
mobile: 12,
|
|
1971
|
+
children: /* @__PURE__ */ z(o, {})
|
|
1972
|
+
}) }),
|
|
1973
|
+
y && /* @__PURE__ */ z(l, {
|
|
1974
|
+
className: "webhooks-container",
|
|
1975
|
+
children: /* @__PURE__ */ z(u, {
|
|
1976
|
+
desktop: 12,
|
|
1977
|
+
mobile: 12,
|
|
1978
|
+
children: /* @__PURE__ */ z(c, {})
|
|
1979
|
+
})
|
|
1980
|
+
}),
|
|
1981
|
+
/* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(u, {
|
|
1982
|
+
desktop: 12,
|
|
1983
|
+
mobile: 12,
|
|
1984
|
+
children: /* @__PURE__ */ z(s, {})
|
|
1985
|
+
}) })
|
|
1986
|
+
]
|
|
1987
|
+
})]
|
|
1988
|
+
});
|
|
1989
|
+
}
|
|
1990
|
+
// src/internal/model-collapse.tsx
|
|
1991
|
+
ModelCollapse.displayName = "ModelCollapse";
|
|
1992
|
+
function ModelCollapse({ children: e, classes: t, collapsedContent: n = "{...}", expanded: i = !0, hideSelfOnExpand: s = !1, modelId: u, modelName: d, onToggle: f, title: p }) {
|
|
1993
|
+
let [m, h] = l(i), g = c(!1);
|
|
1994
|
+
a(() => {
|
|
1995
|
+
h(i);
|
|
1996
|
+
}, [i]);
|
|
1997
|
+
let _ = r(() => {
|
|
1998
|
+
f?.(d, !m), h((e) => !e);
|
|
1999
|
+
}, [
|
|
2000
|
+
m,
|
|
2001
|
+
d,
|
|
2002
|
+
f
|
|
2003
|
+
]), v = o(() => {
|
|
2004
|
+
_();
|
|
2005
|
+
});
|
|
2006
|
+
a(() => {
|
|
2007
|
+
if (!g.current && window.location.hash && u && window.location.hash === `#${u}`) {
|
|
2008
|
+
let e = document.getElementById(u);
|
|
2009
|
+
e && (e.scrollIntoView(), m || v());
|
|
2010
|
+
}
|
|
2011
|
+
g.current = !0;
|
|
2012
|
+
}, [
|
|
2013
|
+
u,
|
|
2014
|
+
d,
|
|
2015
|
+
f,
|
|
2016
|
+
m,
|
|
2017
|
+
_
|
|
2018
|
+
]);
|
|
2019
|
+
let y = o(() => {
|
|
2020
|
+
u && window.location.hash === `#${u}` && !m && _();
|
|
2021
|
+
});
|
|
2022
|
+
return a(() => {
|
|
2023
|
+
function onStateChange() {
|
|
2024
|
+
y();
|
|
2025
|
+
}
|
|
2026
|
+
return window.navigation?.addEventListener("navigatesuccess", onStateChange), () => {
|
|
2027
|
+
window.navigation?.removeEventListener("navigatesuccess", onStateChange);
|
|
2028
|
+
};
|
|
2029
|
+
}, []), m && s ? /* @__PURE__ */ z("span", {
|
|
2030
|
+
className: t || "",
|
|
2031
|
+
children: e
|
|
2032
|
+
}) : /* @__PURE__ */ z("span", { children: /* @__PURE__ */ z(Z.Root, {
|
|
2033
|
+
onValueChange: _,
|
|
2034
|
+
value: m ? ["item"] : [],
|
|
2035
|
+
children: /* @__PURE__ */ z(Z.Item, {
|
|
2036
|
+
text: p,
|
|
2037
|
+
value: "item",
|
|
2038
|
+
children: m ? e : /* @__PURE__ */ z("span", { children: n })
|
|
2039
|
+
})
|
|
2040
|
+
}) });
|
|
2041
|
+
}
|
|
2042
|
+
// src/internal/model-example.tsx
|
|
2043
|
+
var usePrevious = (e) => {
|
|
2044
|
+
let t = c(void 0);
|
|
2045
|
+
return a(() => {
|
|
2046
|
+
t.current = e;
|
|
2047
|
+
}), t.current;
|
|
2048
|
+
}, useTabs = ({ example: e, initialTab: t, isExecute: n, schema: i }) => {
|
|
2049
|
+
let o = s(() => ({
|
|
2050
|
+
example: "example",
|
|
2051
|
+
model: "model"
|
|
2052
|
+
}), []), c = !s(() => Object.keys(o), [o]).includes(t) || !i || n ? o.example : t, u = usePrevious(n), [d, f] = l(c), p = r((e) => {
|
|
2053
|
+
f(e);
|
|
2054
|
+
}, []);
|
|
2055
|
+
return a(() => {
|
|
2056
|
+
u && !n && e && f(o.example);
|
|
2057
|
+
}, [
|
|
2058
|
+
u,
|
|
2059
|
+
n,
|
|
2060
|
+
e,
|
|
2061
|
+
o.example
|
|
2062
|
+
]), {
|
|
2063
|
+
activeTab: d,
|
|
2064
|
+
onTabChange: p,
|
|
2065
|
+
tabs: o
|
|
2066
|
+
};
|
|
2067
|
+
};
|
|
2068
|
+
function ModelExample({ example: e, getComponent: t, getConfigs: n, includeReadOnly: r = !1, includeWriteOnly: i = !1, isExecute: a = !1, schema: o, specPath: s, specSelectors: c }) {
|
|
2069
|
+
let { defaultModelExpandDepth: l, defaultModelRendering: u } = n(), d = t("ModelWrapper"), f = t("HighlightCode", !0), p = J(5).toString("base64"), m = J(5).toString("base64"), h = J(5).toString("base64"), g = J(5).toString("base64"), _ = c.isOAS3(), { activeTab: v, onTabChange: y, tabs: b } = useTabs({
|
|
2070
|
+
example: e,
|
|
2071
|
+
initialTab: u,
|
|
2072
|
+
isExecute: a,
|
|
2073
|
+
schema: o
|
|
2074
|
+
});
|
|
2075
|
+
return /* @__PURE__ */ z("div", {
|
|
2076
|
+
className: "model-example",
|
|
2077
|
+
children: /* @__PURE__ */ B(le.Root, {
|
|
2078
|
+
onValueChange: y,
|
|
2079
|
+
value: v,
|
|
2080
|
+
children: [
|
|
2081
|
+
/* @__PURE__ */ B(le.List, { children: [
|
|
2082
|
+
/* @__PURE__ */ z(le.Indicator, {}),
|
|
2083
|
+
/* @__PURE__ */ z(Q.Root, {
|
|
2084
|
+
value: "example",
|
|
2085
|
+
children: /* @__PURE__ */ z(Q.Button, { children: a ? "Edit Value" : "Example" })
|
|
2086
|
+
}),
|
|
2087
|
+
o ? /* @__PURE__ */ z(Q.Root, {
|
|
2088
|
+
value: "model",
|
|
2089
|
+
children: /* @__PURE__ */ z(Q.Button, { children: _ ? "Schema" : "Model" })
|
|
2090
|
+
}) : null
|
|
2091
|
+
] }),
|
|
2092
|
+
/* @__PURE__ */ z(le.Panel, {
|
|
2093
|
+
value: "example",
|
|
2094
|
+
children: /* @__PURE__ */ z("div", {
|
|
2095
|
+
"aria-hidden": v !== b.example,
|
|
2096
|
+
"aria-labelledby": p,
|
|
2097
|
+
"data-name": "examplePanel",
|
|
2098
|
+
id: m,
|
|
2099
|
+
tabIndex: 0,
|
|
2100
|
+
children: e || /* @__PURE__ */ z(f, { children: "(no example available" })
|
|
2101
|
+
})
|
|
2102
|
+
}),
|
|
2103
|
+
o ? /* @__PURE__ */ z(le.Panel, {
|
|
2104
|
+
value: "model",
|
|
2105
|
+
children: /* @__PURE__ */ z("div", {
|
|
2106
|
+
"aria-hidden": v === b.example,
|
|
2107
|
+
"aria-labelledby": h,
|
|
2108
|
+
"data-name": "modelPanel",
|
|
2109
|
+
id: g,
|
|
2110
|
+
tabIndex: 0,
|
|
2111
|
+
children: /* @__PURE__ */ z(d, {
|
|
2112
|
+
expandDepth: l,
|
|
2113
|
+
getComponent: t,
|
|
2114
|
+
getConfigs: n,
|
|
2115
|
+
includeReadOnly: r,
|
|
2116
|
+
includeWriteOnly: i,
|
|
2117
|
+
schema: o,
|
|
2118
|
+
specPath: s,
|
|
2119
|
+
specSelectors: c
|
|
2120
|
+
})
|
|
2121
|
+
})
|
|
2122
|
+
}) : null
|
|
2123
|
+
]
|
|
2124
|
+
})
|
|
2125
|
+
});
|
|
2126
|
+
}
|
|
2127
|
+
// src/internal/model-wrapper.tsx
|
|
2128
|
+
function ModelWrapper(e) {
|
|
2129
|
+
let { expandDepth: t, fullPath: n, getComponent: r, getConfigs: i, layoutActions: a, layoutSelectors: o } = e, onToggle = (e, t) => {
|
|
2130
|
+
a && a.show(n, t);
|
|
2131
|
+
}, s = r("Model"), c;
|
|
2132
|
+
return o && (c = o.isShown(n)), /* @__PURE__ */ z("div", {
|
|
2133
|
+
className: "model-box",
|
|
2134
|
+
children: /* @__PURE__ */ z(s, {
|
|
2135
|
+
...e,
|
|
2136
|
+
depth: 1,
|
|
2137
|
+
expandDepth: t || 0,
|
|
2138
|
+
expanded: c,
|
|
2139
|
+
getConfigs: i,
|
|
2140
|
+
onToggle
|
|
2141
|
+
})
|
|
2142
|
+
});
|
|
2143
|
+
}
|
|
2144
|
+
// src/internal/use-jump-to-hash.tsx
|
|
2145
|
+
function useJumpToHash(e, t, n) {
|
|
2146
|
+
let r = e?.(), i = c(!1);
|
|
2147
|
+
a(() => {
|
|
2148
|
+
if (!i.current && r && t && r === `#${t}`) {
|
|
2149
|
+
let e = document.getElementById(t);
|
|
2150
|
+
e && (e.scrollIntoView(), i.current || n?.());
|
|
2151
|
+
}
|
|
2152
|
+
i.current = !0;
|
|
2153
|
+
}, [
|
|
2154
|
+
t,
|
|
2155
|
+
r,
|
|
2156
|
+
n
|
|
2157
|
+
]);
|
|
2158
|
+
}
|
|
2159
|
+
// src/internal/models.tsx
|
|
2160
|
+
Models.displayName = "Models";
|
|
2161
|
+
function Models(e) {
|
|
2162
|
+
let getSchemaBasePath = () => e.specSelectors.isOAS3() ? ["components", "schemas"] : ["definitions"], handleToggle = (t, n) => {
|
|
2163
|
+
let { layoutActions: r } = e;
|
|
2164
|
+
r.show([...getSchemaBasePath(), t], n), n && e.specActions.requestResolvedSubtree([...getSchemaBasePath(), t]);
|
|
2165
|
+
}, onLoadModels = (t) => {
|
|
2166
|
+
t && e.layoutActions.readyToScroll(getSchemaBasePath(), t);
|
|
2167
|
+
}, onLoadModel = (t) => {
|
|
2168
|
+
if (t) {
|
|
2169
|
+
let n = t.getAttribute("data-name");
|
|
2170
|
+
e.layoutActions.readyToScroll([...getSchemaBasePath(), n], t);
|
|
2171
|
+
}
|
|
2172
|
+
}, { getComponent: t, getConfigs: n, layoutActions: r, layoutSelectors: i, specSelectors: a } = e, o = a.definitions(), { defaultModelsExpandDepth: s, docExpansion: c } = n(), { hash: l } = useSwaggerContext(), u = l.substring(l.indexOf("model-") + 6);
|
|
2173
|
+
if (useJumpToHash(e.fn?.getHash, "models"), !o.size || s < 0) return null;
|
|
2174
|
+
let f = getSchemaBasePath(), p = i.isShown(f, s > 0 && c !== "none"), m = a.isOAS3(), g = t("ModelWrapper"), _ = t("ModelCollapse"), v = t("Markdown");
|
|
2175
|
+
return /* @__PURE__ */ B("section", {
|
|
2176
|
+
ref: onLoadModels,
|
|
2177
|
+
className: p ? "models is-open" : "models",
|
|
2178
|
+
children: [/* @__PURE__ */ B("button", {
|
|
2179
|
+
"aria-expanded": p,
|
|
2180
|
+
className: "model-collapse-title",
|
|
2181
|
+
id: "models",
|
|
2182
|
+
onClick: () => r.show(f, !p),
|
|
2183
|
+
children: [m ? "Schemas" : "Models", /* @__PURE__ */ z(N, {
|
|
2184
|
+
"aria-label": "Model visibility icon",
|
|
2185
|
+
className: d("collapse-icon", { "is-open": p }),
|
|
2186
|
+
icon: h,
|
|
2187
|
+
size: "md"
|
|
2188
|
+
})]
|
|
2189
|
+
}), /* @__PURE__ */ z($.Root, {
|
|
2190
|
+
open: p,
|
|
2191
|
+
children: /* @__PURE__ */ z($.Content, { children: o.entrySeq().map(([o]) => {
|
|
2192
|
+
let c = [...f, o], l = q.List(c), d = a.specResolvedSubtree(c), p = a.specJson().getIn(c), m = q.Map.isMap(d) ? d : q.Map(), h = q.Map.isMap(p) ? p : q.Map(), y = m.get("title") || h.get("title") || o, b = i.isShown(c, !1), x = m.get("description") || h.get("description");
|
|
2193
|
+
b && m.size === 0 && h.size > 0 && e.specActions.requestResolvedSubtree(c);
|
|
2194
|
+
let S = u && u === o, C = /* @__PURE__ */ z(g, {
|
|
2195
|
+
activeInHash: S,
|
|
2196
|
+
displayName: y,
|
|
2197
|
+
expandDepth: s,
|
|
2198
|
+
fullPath: c,
|
|
2199
|
+
getComponent: t,
|
|
2200
|
+
getConfigs: n,
|
|
2201
|
+
includeReadOnly: !0,
|
|
2202
|
+
includeWriteOnly: !0,
|
|
2203
|
+
layoutActions: r,
|
|
2204
|
+
layoutSelectors: i,
|
|
2205
|
+
name: o,
|
|
2206
|
+
schema: m || q.Map(),
|
|
2207
|
+
specPath: l,
|
|
2208
|
+
specSelectors: a
|
|
2209
|
+
}), w = /* @__PURE__ */ z("span", {
|
|
2210
|
+
className: "model-box",
|
|
2211
|
+
children: /* @__PURE__ */ z("span", {
|
|
2212
|
+
className: "model model-title",
|
|
2213
|
+
children: y
|
|
2214
|
+
})
|
|
2215
|
+
}), T = `model-${o}`;
|
|
2216
|
+
return /* @__PURE__ */ B("div", {
|
|
2217
|
+
ref: onLoadModel,
|
|
2218
|
+
className: "model-container",
|
|
2219
|
+
"data-name": o,
|
|
2220
|
+
children: [
|
|
2221
|
+
/* @__PURE__ */ z("span", {
|
|
2222
|
+
className: "model-box-anchor",
|
|
2223
|
+
id: T
|
|
2224
|
+
}),
|
|
2225
|
+
/* @__PURE__ */ z(_, {
|
|
2226
|
+
activeInHash: S,
|
|
2227
|
+
classes: "model-box",
|
|
2228
|
+
collapsedContent: "",
|
|
2229
|
+
displayName: y,
|
|
2230
|
+
expanded: s > 0 && b,
|
|
2231
|
+
getHash: e.fn.getHash,
|
|
2232
|
+
hideSelfOnExpand: !0,
|
|
2233
|
+
layoutActions: r,
|
|
2234
|
+
layoutSelectors: i,
|
|
2235
|
+
modelId: T,
|
|
2236
|
+
modelName: o,
|
|
2237
|
+
onToggle: handleToggle,
|
|
2238
|
+
specPath: l,
|
|
2239
|
+
title: w,
|
|
2240
|
+
children: C
|
|
2241
|
+
}),
|
|
2242
|
+
x ? /* @__PURE__ */ z(v, { source: x }) : null
|
|
2243
|
+
]
|
|
2244
|
+
}, `models-section-${o}`);
|
|
2245
|
+
}).toArray() })
|
|
2246
|
+
})]
|
|
2247
|
+
});
|
|
2248
|
+
}
|
|
2249
|
+
// src/internal/object-model.tsx
|
|
2250
|
+
ObjectModel.displayName = "ObjectModelOriginal";
|
|
2251
|
+
function ObjectModel(e) {
|
|
2252
|
+
let { displayName: t, isRef: n, schema: r } = e, i = useThemeContext(), o = c(!1);
|
|
2253
|
+
if (a(() => {
|
|
2254
|
+
!e.expanded && !o.current && e.onToggle?.(e.name, !e.expanded), o.current = !0;
|
|
2255
|
+
}, [e]), !r) return null;
|
|
2256
|
+
r.mapEntries((e) => e);
|
|
2257
|
+
let s = r.toJS(), l = r.get("title") || t || name, u = l ? /* @__PURE__ */ z(Z.Root, {
|
|
2258
|
+
className: "object-model-accordion",
|
|
2259
|
+
value: e.expanded ? ["item"] : [],
|
|
2260
|
+
children: /* @__PURE__ */ z(Z.Item, {
|
|
2261
|
+
onClick: () => e.onToggle?.(e.name, !e.expanded),
|
|
2262
|
+
text: /* @__PURE__ */ B(R, { children: [n && r.get("$$ref") && /* @__PURE__ */ z("span", {
|
|
2263
|
+
className: "model-hint",
|
|
2264
|
+
children: r.get("$$ref")
|
|
2265
|
+
}), /* @__PURE__ */ z("span", { children: l })] }),
|
|
2266
|
+
value: "item"
|
|
2267
|
+
})
|
|
2268
|
+
}) : null, d = e.getComponent("RenderLink");
|
|
2269
|
+
return /* @__PURE__ */ B("div", {
|
|
2270
|
+
className: "object-model",
|
|
2271
|
+
children: [u, /* @__PURE__ */ z(JsonModelViewer, {
|
|
2272
|
+
displayDataTypes: !1,
|
|
2273
|
+
displaySize: !1,
|
|
2274
|
+
groupArraysAfterLength: 100,
|
|
2275
|
+
highlightUpdates: !0,
|
|
2276
|
+
indentWidth: 2,
|
|
2277
|
+
renderLink: d,
|
|
2278
|
+
rootName: !1,
|
|
2279
|
+
theme: i,
|
|
2280
|
+
value: s
|
|
2281
|
+
})]
|
|
2282
|
+
});
|
|
2283
|
+
}
|
|
2284
|
+
// src/internal/operation-summary-method.tsx
|
|
2285
|
+
OperationSummaryMethod.displayName = "OperationSummaryMethod";
|
|
2286
|
+
var Ke = {
|
|
2287
|
+
delete: { emphasis: "danger" },
|
|
2288
|
+
get: {
|
|
2289
|
+
className: "q-method-get",
|
|
2290
|
+
emphasis: "primary"
|
|
2291
|
+
},
|
|
2292
|
+
head: {
|
|
2293
|
+
className: "q-purple",
|
|
2294
|
+
emphasis: "primary"
|
|
2295
|
+
},
|
|
2296
|
+
options: {
|
|
2297
|
+
className: "q-lime",
|
|
2298
|
+
emphasis: "primary"
|
|
2299
|
+
},
|
|
2300
|
+
patch: {
|
|
2301
|
+
className: "q-orange",
|
|
2302
|
+
emphasis: "neutral"
|
|
2303
|
+
},
|
|
2304
|
+
post: { emphasis: "primary" },
|
|
2305
|
+
put: {
|
|
2306
|
+
className: "q-method-put",
|
|
2307
|
+
emphasis: "neutral"
|
|
2308
|
+
},
|
|
2309
|
+
trace: {
|
|
2310
|
+
className: "q-teal",
|
|
2311
|
+
emphasis: "primary"
|
|
2312
|
+
}
|
|
2313
|
+
};
|
|
2314
|
+
function OperationSummaryMethod({ method: e }) {
|
|
2315
|
+
let t = Ke[e];
|
|
2316
|
+
return /* @__PURE__ */ z(j, {
|
|
2317
|
+
...t,
|
|
2318
|
+
className: d(t?.className, "qui-method-button", e),
|
|
2319
|
+
render: /* @__PURE__ */ z("div", {}),
|
|
2320
|
+
size: "sm",
|
|
2321
|
+
tabIndex: -1,
|
|
2322
|
+
variant: "fill",
|
|
2323
|
+
children: e.toUpperCase()
|
|
2324
|
+
});
|
|
2325
|
+
}
|
|
2326
|
+
// src/internal/operation-summary-path.tsx
|
|
2327
|
+
OperationSummaryPath.displayName = "OperationSummaryPath";
|
|
2328
|
+
function OperationSummaryPath({ operationProps: t }) {
|
|
2329
|
+
let { deprecated: n, path: r } = t.toJS(), i = r.split(/(?=\/)/g);
|
|
2330
|
+
for (let e = 1; e < i.length; e += 2) i.splice(e, 0, /* @__PURE__ */ z("wbr", {}, e));
|
|
2331
|
+
return /* @__PURE__ */ z("span", {
|
|
2332
|
+
className: n ? "opblock-summary-path__deprecated" : "opblock-summary-path",
|
|
2333
|
+
"data-path": r,
|
|
2334
|
+
children: i.map((t, n) => /* @__PURE__ */ z(e, { children: t }, n))
|
|
2335
|
+
});
|
|
2336
|
+
}
|
|
2337
|
+
// src/internal/operation-summary.tsx
|
|
2338
|
+
OperationSummary.displayName = "OperationSummary";
|
|
2339
|
+
function OperationSummary({ authActions: e, authSelectors: t, fn: n, getComponent: r, isShown: i, operationProps: a, specPath: o, toggleShown: s }) {
|
|
2340
|
+
let { displayOperationId: c, isAuthorized: l, method: u, op: f, operationId: p, originalOperationId: m, showSummary: g, summary: _ } = a.toJS(), { summary: v } = f, y = a.get("security"), b = r("authorizeOperationBtn", !0), S = r("OperationSummaryMethod"), C = r("OperationSummaryPath"), w = y && !!y.count(), T = w && y.size === 1 && y.first().isEmpty(), E = !w || T, D = `${p}-1`, O = r("RenderLink");
|
|
2341
|
+
return useJumpToHash(n.getHash, D, () => {
|
|
2342
|
+
s();
|
|
2343
|
+
}), /* @__PURE__ */ B("div", {
|
|
2344
|
+
className: "opblock-summary",
|
|
2345
|
+
children: [
|
|
2346
|
+
/* @__PURE__ */ z("div", {
|
|
2347
|
+
className: "opblock-summary-id",
|
|
2348
|
+
id: D
|
|
2349
|
+
}),
|
|
2350
|
+
/* @__PURE__ */ B("button", {
|
|
2351
|
+
"aria-expanded": i,
|
|
2352
|
+
className: "opblock-summary-control",
|
|
2353
|
+
onClick: s,
|
|
2354
|
+
children: [
|
|
2355
|
+
/* @__PURE__ */ z(M, {
|
|
2356
|
+
icon: x,
|
|
2357
|
+
onClick: (e) => {
|
|
2358
|
+
i || s(), e.stopPropagation();
|
|
2359
|
+
},
|
|
2360
|
+
render: /* @__PURE__ */ z(O, { href: `#${D}` }),
|
|
2361
|
+
size: "sm",
|
|
2362
|
+
style: { marginRight: 8 },
|
|
2363
|
+
variant: "outline"
|
|
2364
|
+
}),
|
|
2365
|
+
/* @__PURE__ */ z(S, { method: u }),
|
|
2366
|
+
/* @__PURE__ */ B("div", {
|
|
2367
|
+
className: "opblock-summary-path-description-wrapper",
|
|
2368
|
+
children: [/* @__PURE__ */ z(C, {
|
|
2369
|
+
getComponent: r,
|
|
2370
|
+
operationProps: a,
|
|
2371
|
+
specPath: o
|
|
2372
|
+
}), g ? /* @__PURE__ */ z("div", {
|
|
2373
|
+
className: "opblock-summary-description",
|
|
2374
|
+
children: ue(v || _)
|
|
2375
|
+
}) : null]
|
|
2376
|
+
}),
|
|
2377
|
+
c && (m || p) ? /* @__PURE__ */ z("span", {
|
|
2378
|
+
className: "opblock-summary-operation-id",
|
|
2379
|
+
children: m || p
|
|
2380
|
+
}) : null,
|
|
2381
|
+
/* @__PURE__ */ z(N, {
|
|
2382
|
+
className: d("collapse-icon", { "is-open": i }),
|
|
2383
|
+
icon: h,
|
|
2384
|
+
size: "sm"
|
|
2385
|
+
})
|
|
2386
|
+
]
|
|
2387
|
+
}),
|
|
2388
|
+
E ? null : /* @__PURE__ */ z(b, {
|
|
2389
|
+
isAuthorized: l,
|
|
2390
|
+
onClick: () => {
|
|
2391
|
+
let n = t.definitionsForRequirements(y);
|
|
2392
|
+
e.showDefinitions(n);
|
|
2393
|
+
}
|
|
2394
|
+
})
|
|
2395
|
+
]
|
|
2396
|
+
});
|
|
2397
|
+
}
|
|
2398
|
+
// src/internal/operation-tag.tsx
|
|
2399
|
+
function OperationTag(e) {
|
|
2400
|
+
let { children: t, getComponent: n, getConfigs: r, layoutActions: i, layoutSelectors: a, oas3Selectors: o, specUrl: s, tag: c, tagObj: l } = e, { deepLinking: u, docExpansion: f } = r(), p = n("Markdown", !0), m = n("DeepLink"), g = l.getIn(["tagDetails", "description"], null), _ = l.getIn([
|
|
2401
|
+
"tagDetails",
|
|
2402
|
+
"externalDocs",
|
|
2403
|
+
"description"
|
|
2404
|
+
]), y = l.getIn([
|
|
2405
|
+
"tagDetails",
|
|
2406
|
+
"externalDocs",
|
|
2407
|
+
"url"
|
|
2408
|
+
]), b;
|
|
2409
|
+
b = isFunc(o) && isFunc(o.selectedServer) ? safeBuildUrl(y, s, { selectedServer: o.selectedServer() }) : y;
|
|
2410
|
+
let x = ["operations-tag", c], S = a.isShown(x, f === "full" || f === "list");
|
|
2411
|
+
return /* @__PURE__ */ B("div", {
|
|
2412
|
+
className: S ? "opblock-tag-section is-open" : "opblock-tag-section",
|
|
2413
|
+
children: [/* @__PURE__ */ B("h3", {
|
|
2414
|
+
className: g ? "opblock-tag" : "opblock-tag no-desc",
|
|
2415
|
+
"data-is-open": S,
|
|
2416
|
+
"data-tag": c,
|
|
2417
|
+
id: x.map((e) => escapeDeepLinkPath(e)).join("-"),
|
|
2418
|
+
onClick: () => i.show(x, !S),
|
|
2419
|
+
children: [
|
|
2420
|
+
/* @__PURE__ */ z(m, {
|
|
2421
|
+
enabled: u,
|
|
2422
|
+
isShown: S,
|
|
2423
|
+
path: createDeepLinkPath(c),
|
|
2424
|
+
text: c
|
|
2425
|
+
}),
|
|
2426
|
+
g ? /* @__PURE__ */ z("small", { children: /* @__PURE__ */ z(p, { source: g }) }) : /* @__PURE__ */ z("small", {}),
|
|
2427
|
+
b ? /* @__PURE__ */ z(de, {
|
|
2428
|
+
className: "info__externaldocs external-link",
|
|
2429
|
+
endIcon: v,
|
|
2430
|
+
href: sanitizeUrl$1(b),
|
|
2431
|
+
onClick: (e) => e.stopPropagation(),
|
|
2432
|
+
render: /* @__PURE__ */ z("a", { target: "_blank" }),
|
|
2433
|
+
children: _ || b
|
|
2434
|
+
}) : null,
|
|
2435
|
+
/* @__PURE__ */ z("button", {
|
|
2436
|
+
"aria-expanded": S,
|
|
2437
|
+
className: "expand-operation",
|
|
2438
|
+
onClick: () => i.show(x, !S),
|
|
2439
|
+
title: S ? "Collapse operation" : "Expand operation",
|
|
2440
|
+
children: /* @__PURE__ */ z(N, {
|
|
2441
|
+
className: d("collapse-icon", { "is-open": S }),
|
|
2442
|
+
icon: h,
|
|
2443
|
+
size: "md"
|
|
2444
|
+
})
|
|
2445
|
+
})
|
|
2446
|
+
]
|
|
2447
|
+
}), /* @__PURE__ */ z($.Root, {
|
|
2448
|
+
open: S,
|
|
2449
|
+
children: /* @__PURE__ */ z($.Content, { children: t })
|
|
2450
|
+
})]
|
|
2451
|
+
});
|
|
2452
|
+
}
|
|
2453
|
+
// src/internal/operation.tsx
|
|
2454
|
+
function Operation({ authActions: e, authSelectors: t, fn: n, getComponent: r, getConfigs: i, oas3Actions: o, oas3Selectors: s, onCancelClick: c, onExecute: u, onResetClick: d, onTryoutClick: f, operation: p, request: m, response: h, specActions: g, specPath: _ = q.List(), specSelectors: v, toggleShown: y }) {
|
|
2455
|
+
let { allowTryItOut: b, deprecated: x, displayRequestDuration: S, executeInProgress: C, isShown: w, method: T, op: E, operationId: D, path: O, tag: k, tryItOutEnabled: A } = p.toJS(), { description: j, externalDocs: M, schemes: N } = E, F = M ? safeBuildUrl(M.url, v.url(), { selectedServer: s.selectedServer() }) : "", I = p.getIn(["op"]), L = I.get("responses"), R = getList(I, ["parameters"]), V = v.operationScheme(O, T), H = [
|
|
2456
|
+
"operations",
|
|
2457
|
+
k,
|
|
2458
|
+
D
|
|
2459
|
+
], U = getExtensions(I), W = r("responses"), G = r("parameters"), K = r("execute"), J = r("Collapse"), ee = r("clear"), Y = r("Markdown", !0), te = r("schemes"), X = r("OperationServers"), ne = r("OperationExt"), re = r("OperationSummary"), ie = r("Link"), { showExtensions: ae } = i();
|
|
2460
|
+
if (L && h && h.size > 0) {
|
|
2461
|
+
let e = !L.get(String(h.get("status"))) && !L.get("default");
|
|
2462
|
+
h = h.set("notDocumented", e);
|
|
2463
|
+
}
|
|
2464
|
+
let oe = [O, T], se = v.validationErrors([O, T]), [ce, Z] = l(!1);
|
|
2465
|
+
a(() => {
|
|
2466
|
+
let e = !0;
|
|
2467
|
+
return w && setTimeout(() => {
|
|
2468
|
+
e && Z(!0);
|
|
2469
|
+
}, 50), () => {
|
|
2470
|
+
e = !1;
|
|
2471
|
+
};
|
|
2472
|
+
}, [w]);
|
|
2473
|
+
let Q = /* @__PURE__ */ B("div", {
|
|
2474
|
+
className: "opblock-body",
|
|
2475
|
+
children: [
|
|
2476
|
+
I && I.size || I === null ? null : /* @__PURE__ */ z(pe, {}),
|
|
2477
|
+
x && /* @__PURE__ */ z("h4", {
|
|
2478
|
+
className: "opblock-title_normal",
|
|
2479
|
+
children: " Warning: Deprecated"
|
|
2480
|
+
}),
|
|
2481
|
+
j && /* @__PURE__ */ z("div", {
|
|
2482
|
+
className: "opblock-description-wrapper",
|
|
2483
|
+
children: /* @__PURE__ */ z("div", {
|
|
2484
|
+
className: "opblock-description",
|
|
2485
|
+
children: /* @__PURE__ */ z(Y, { source: j })
|
|
2486
|
+
})
|
|
2487
|
+
}),
|
|
2488
|
+
F ? /* @__PURE__ */ B("div", {
|
|
2489
|
+
className: "opblock-external-docs-wrapper",
|
|
2490
|
+
children: [/* @__PURE__ */ z("h4", {
|
|
2491
|
+
className: "opblock-title_normal",
|
|
2492
|
+
children: "Find more details"
|
|
2493
|
+
}), /* @__PURE__ */ B("div", {
|
|
2494
|
+
className: "opblock-external-docs",
|
|
2495
|
+
children: [M.description && /* @__PURE__ */ z("span", {
|
|
2496
|
+
className: "opblock-external-docs__description",
|
|
2497
|
+
children: /* @__PURE__ */ z(Y, { source: M.description })
|
|
2498
|
+
}), /* @__PURE__ */ z(ie, {
|
|
2499
|
+
className: "opblock-external-docs__link",
|
|
2500
|
+
href: sanitizeUrl$1(F),
|
|
2501
|
+
target: "_blank",
|
|
2502
|
+
children: F
|
|
2503
|
+
})]
|
|
2504
|
+
})]
|
|
2505
|
+
}) : null,
|
|
2506
|
+
!I || !I.size ? null : /* @__PURE__ */ z(G, {
|
|
2507
|
+
allowTryItOut: b,
|
|
2508
|
+
fn: n,
|
|
2509
|
+
getComponent: r,
|
|
2510
|
+
getConfigs: i,
|
|
2511
|
+
oas3Actions: o,
|
|
2512
|
+
oas3Selectors: s,
|
|
2513
|
+
onCancelClick: c,
|
|
2514
|
+
onChangeKey: oe,
|
|
2515
|
+
onResetClick: d,
|
|
2516
|
+
onTryoutClick: f,
|
|
2517
|
+
operation: I,
|
|
2518
|
+
parameters: R,
|
|
2519
|
+
pathMethod: [O, T],
|
|
2520
|
+
specActions: g,
|
|
2521
|
+
specPath: _.push("parameters"),
|
|
2522
|
+
specSelectors: v,
|
|
2523
|
+
tryItOutEnabled: A
|
|
2524
|
+
}),
|
|
2525
|
+
A ? /* @__PURE__ */ z(X, {
|
|
2526
|
+
getComponent: r,
|
|
2527
|
+
getEffectiveServerValue: s.serverEffectiveValue,
|
|
2528
|
+
getSelectedServer: s.selectedServer,
|
|
2529
|
+
getServerVariable: s.serverVariableValue,
|
|
2530
|
+
method: T,
|
|
2531
|
+
operationServers: I.get("servers"),
|
|
2532
|
+
path: O,
|
|
2533
|
+
pathServers: v.paths().getIn([O, "servers"]),
|
|
2534
|
+
setSelectedServer: o.setSelectedServer,
|
|
2535
|
+
setServerVariableValue: o.setServerVariableValue
|
|
2536
|
+
}) : null,
|
|
2537
|
+
!A || !b ? null : N && N.size ? /* @__PURE__ */ z("div", {
|
|
2538
|
+
className: "opblock-schemes",
|
|
2539
|
+
children: /* @__PURE__ */ z(te, {
|
|
2540
|
+
currentScheme: V,
|
|
2541
|
+
method: T,
|
|
2542
|
+
path: O,
|
|
2543
|
+
schemes: N,
|
|
2544
|
+
specActions: g
|
|
2545
|
+
})
|
|
2546
|
+
}) : null,
|
|
2547
|
+
!A || !b || se.length <= 0 ? null : /* @__PURE__ */ z("div", {
|
|
2548
|
+
className: "errors-wrapper",
|
|
2549
|
+
children: /* @__PURE__ */ z(fe, {
|
|
2550
|
+
description: /* @__PURE__ */ z("div", { children: "Please correct the following validation errors and try again." }),
|
|
2551
|
+
emphasis: "danger",
|
|
2552
|
+
label: "Error"
|
|
2553
|
+
})
|
|
2554
|
+
}),
|
|
2555
|
+
/* @__PURE__ */ B("div", {
|
|
2556
|
+
className: !A || !h || !b ? "execute-wrapper" : "btn-group",
|
|
2557
|
+
"data-enabled": P(A),
|
|
2558
|
+
children: [!A || !b ? null : /* @__PURE__ */ z(K, {
|
|
2559
|
+
disabled: C,
|
|
2560
|
+
method: T,
|
|
2561
|
+
oas3Actions: o,
|
|
2562
|
+
oas3Selectors: s,
|
|
2563
|
+
onExecute: u,
|
|
2564
|
+
operation: I,
|
|
2565
|
+
path: O,
|
|
2566
|
+
specActions: g,
|
|
2567
|
+
specSelectors: v
|
|
2568
|
+
}), !A || !h || !b ? null : /* @__PURE__ */ z(ee, {
|
|
2569
|
+
method: T,
|
|
2570
|
+
path: O,
|
|
2571
|
+
specActions: g
|
|
2572
|
+
})]
|
|
2573
|
+
}),
|
|
2574
|
+
C ? /* @__PURE__ */ z(pe, {}) : /* @__PURE__ */ z("div", { style: { height: 4 } }),
|
|
2575
|
+
L ? /* @__PURE__ */ z(W, {
|
|
2576
|
+
displayRequestDuration: S,
|
|
2577
|
+
fn: n,
|
|
2578
|
+
getComponent: r,
|
|
2579
|
+
getConfigs: i,
|
|
2580
|
+
method: T,
|
|
2581
|
+
oas3Actions: o,
|
|
2582
|
+
oas3Selectors: s,
|
|
2583
|
+
path: O,
|
|
2584
|
+
produces: v.producesOptionsFor([O, T]),
|
|
2585
|
+
producesValue: v.currentProducesFor([O, T]),
|
|
2586
|
+
request: m,
|
|
2587
|
+
responses: L,
|
|
2588
|
+
specActions: g,
|
|
2589
|
+
specPath: _.push("responses"),
|
|
2590
|
+
specSelectors: v,
|
|
2591
|
+
tryItOutResponse: h
|
|
2592
|
+
}) : null,
|
|
2593
|
+
!ae || !U.size ? null : /* @__PURE__ */ z(ne, {
|
|
2594
|
+
extensions: U,
|
|
2595
|
+
getComponent: r
|
|
2596
|
+
})
|
|
2597
|
+
]
|
|
2598
|
+
});
|
|
2599
|
+
return /* @__PURE__ */ B("div", {
|
|
2600
|
+
className: x ? "opblock opblock-deprecated" : w ? `opblock opblock-${T} is-open` : `opblock opblock-${T}`,
|
|
2601
|
+
id: escapeDeepLinkPath(H.join("-")),
|
|
2602
|
+
children: [/* @__PURE__ */ z(re, {
|
|
2603
|
+
authActions: e,
|
|
2604
|
+
authSelectors: t,
|
|
2605
|
+
fn: n,
|
|
2606
|
+
getComponent: r,
|
|
2607
|
+
isShown: w,
|
|
2608
|
+
operationProps: p,
|
|
2609
|
+
specPath: _,
|
|
2610
|
+
toggleShown: y
|
|
2611
|
+
}), ce ? /* @__PURE__ */ z($.Root, {
|
|
2612
|
+
open: w,
|
|
2613
|
+
children: /* @__PURE__ */ z($.Content, { children: Q })
|
|
2614
|
+
}) : /* @__PURE__ */ z(J, {
|
|
2615
|
+
isOpened: w,
|
|
2616
|
+
children: Q
|
|
2617
|
+
})]
|
|
2618
|
+
});
|
|
2619
|
+
}
|
|
2620
|
+
// src/internal/param-body.tsx
|
|
2621
|
+
ParamBody.displayName = "ParamBody";
|
|
2622
|
+
function ParamBody({ consumes: e, consumesValue: t, fn: n, getComponent: i, isExecute: o, language: s, onChange: c, onChangeConsumes: u, param: d = q.fromJS({}), pathMethod: f, specSelectors: p }) {
|
|
2623
|
+
let [m, h] = l({
|
|
2624
|
+
isEditBox: !1,
|
|
2625
|
+
value: ""
|
|
2626
|
+
}), g = r((e, { isEditBox: t, isXml: n }) => {
|
|
2627
|
+
h({
|
|
2628
|
+
isEditBox: t,
|
|
2629
|
+
value: e
|
|
2630
|
+
}), c?.(e, n);
|
|
2631
|
+
}, [c]), v = r((e) => {
|
|
2632
|
+
let t = n.inferSchema(d.toJS());
|
|
2633
|
+
return n.getSampleSchema(t, e, { includeWriteOnly: !0 });
|
|
2634
|
+
}, [n, d]), y = r(() => {
|
|
2635
|
+
let e = /xml/i.test(t), n = /json/i.test(t), r = e ? d.get("value_xml") : d.get("value");
|
|
2636
|
+
if (r !== void 0) {
|
|
2637
|
+
let t = !r && n ? "{}" : r;
|
|
2638
|
+
h((e) => ({
|
|
2639
|
+
...e,
|
|
2640
|
+
value: t
|
|
2641
|
+
})), g(t, {
|
|
2642
|
+
isEditBox: o,
|
|
2643
|
+
isXml: e
|
|
2644
|
+
});
|
|
2645
|
+
} else e ? g(v("xml"), {
|
|
2646
|
+
isEditBox: o,
|
|
2647
|
+
isXml: e
|
|
2648
|
+
}) : g(v(), { isEditBox: o });
|
|
2649
|
+
}, [
|
|
2650
|
+
t,
|
|
2651
|
+
o,
|
|
2652
|
+
g,
|
|
2653
|
+
d,
|
|
2654
|
+
v
|
|
2655
|
+
]);
|
|
2656
|
+
a(() => {
|
|
2657
|
+
y();
|
|
2658
|
+
}, [y]);
|
|
2659
|
+
let handleOnChange = (e) => {
|
|
2660
|
+
let n = /xml/i.test(t);
|
|
2661
|
+
g(e, {
|
|
2662
|
+
isEditBox: m.isEditBox,
|
|
2663
|
+
isXml: n
|
|
2664
|
+
});
|
|
2665
|
+
}, toggleIsEditBox = () => h((e) => ({
|
|
2666
|
+
...e,
|
|
2667
|
+
isEditBox: !e.isEditBox
|
|
2668
|
+
})), b = i("contentType"), x = p.contentTypeValues(f).get("requestContentType"), S = e && e.size ? e : q.fromJS(["application/json"]), { isEditBox: C, value: w } = m, T = `${createHtmlReadyId(`${f[1]}${f[0]}_parameters`)}_select`, E = useThemeContext();
|
|
2669
|
+
return /* @__PURE__ */ B("div", {
|
|
2670
|
+
className: "body-param",
|
|
2671
|
+
"data-param-in": d.get("in"),
|
|
2672
|
+
"data-param-name": d.get("name"),
|
|
2673
|
+
children: [/* @__PURE__ */ z(DocsCodeMirror, {
|
|
2674
|
+
copyable: !0,
|
|
2675
|
+
editable: C,
|
|
2676
|
+
language: s || "json",
|
|
2677
|
+
onChange: handleOnChange,
|
|
2678
|
+
theme: E,
|
|
2679
|
+
value: w
|
|
2680
|
+
}), /* @__PURE__ */ B("div", {
|
|
2681
|
+
className: "body-param-options",
|
|
2682
|
+
children: [o ? /* @__PURE__ */ z("div", {
|
|
2683
|
+
className: "body-param-edit",
|
|
2684
|
+
children: C ? /* @__PURE__ */ z(j, {
|
|
2685
|
+
emphasis: "danger",
|
|
2686
|
+
endIcon: A,
|
|
2687
|
+
onClick: toggleIsEditBox,
|
|
2688
|
+
variant: "outline",
|
|
2689
|
+
children: "Cancel"
|
|
2690
|
+
}) : /* @__PURE__ */ z(j, {
|
|
2691
|
+
emphasis: "primary",
|
|
2692
|
+
endIcon: _,
|
|
2693
|
+
onClick: toggleIsEditBox,
|
|
2694
|
+
variant: "fill",
|
|
2695
|
+
children: "Edit"
|
|
2696
|
+
})
|
|
2697
|
+
}) : null, /* @__PURE__ */ z(b, {
|
|
2698
|
+
contentTypes: S,
|
|
2699
|
+
controlId: T,
|
|
2700
|
+
label: "Parameter content type",
|
|
2701
|
+
onChange: u,
|
|
2702
|
+
value: x
|
|
2703
|
+
})]
|
|
2704
|
+
})]
|
|
2705
|
+
});
|
|
2706
|
+
}
|
|
2707
|
+
function createHtmlReadyId(e, t = "_") {
|
|
2708
|
+
return e.replace(/[^\w-]/g, t);
|
|
2709
|
+
}
|
|
2710
|
+
// src/internal/request-body-editor.tsx
|
|
2711
|
+
RequestBodyEditor.displayName = "RequestBodyEditor";
|
|
2712
|
+
function RequestBodyEditor(e) {
|
|
2713
|
+
let [t, n] = l(stringify(e.value || e.defaultValue));
|
|
2714
|
+
a(() => {
|
|
2715
|
+
n(stringify(e.value || e.defaultValue));
|
|
2716
|
+
}, [e.defaultValue, e.value]);
|
|
2717
|
+
let r = useThemeContext();
|
|
2718
|
+
return /* @__PURE__ */ z(DocsCodeMirror, {
|
|
2719
|
+
editable: !0,
|
|
2720
|
+
language: "json",
|
|
2721
|
+
onChange: (t) => {
|
|
2722
|
+
e.onChange?.(t);
|
|
2723
|
+
},
|
|
2724
|
+
theme: r,
|
|
2725
|
+
value: t
|
|
2726
|
+
});
|
|
2727
|
+
}
|
|
2728
|
+
// src/internal/schemes.tsx
|
|
2729
|
+
Schemes.displayName = "Schemes";
|
|
2730
|
+
function Schemes(e) {
|
|
2731
|
+
let { currentScheme: t, method: n, path: i, schemes: o, specActions: c } = e, l = r((e) => {
|
|
2732
|
+
c.setScheme(e, i, n);
|
|
2733
|
+
}, [
|
|
2734
|
+
n,
|
|
2735
|
+
i,
|
|
2736
|
+
c
|
|
2737
|
+
]), u = s(() => W({ items: o.valueSeq().toArray() }), [o]);
|
|
2738
|
+
return a(() => {
|
|
2739
|
+
t && o.includes(t) || l(o.first());
|
|
2740
|
+
}, [
|
|
2741
|
+
t,
|
|
2742
|
+
o,
|
|
2743
|
+
l
|
|
2744
|
+
]), /* @__PURE__ */ z(K, {
|
|
2745
|
+
clearable: !1,
|
|
2746
|
+
collection: u,
|
|
2747
|
+
label: "Schemes",
|
|
2748
|
+
onValueChange: (e) => l(e[0]),
|
|
2749
|
+
size: "sm",
|
|
2750
|
+
style: { minWidth: 100 },
|
|
2751
|
+
value: t ? [t] : []
|
|
2752
|
+
});
|
|
2753
|
+
}
|
|
2754
|
+
// src/internal/servers.tsx
|
|
2755
|
+
function Servers({ currentServer: e, getEffectiveServerValue: t, getServerVariable: n, servers: i, setSelectedServer: o, setServerVariableValue: c }) {
|
|
2756
|
+
let l = (i.find((t) => t.get("url") === e) || q.OrderedMap()).get("variables") || q.OrderedMap(), u = l.size !== 0;
|
|
2757
|
+
a(() => {
|
|
2758
|
+
e || o(i.first()?.get("url"));
|
|
2759
|
+
}, [
|
|
2760
|
+
e,
|
|
2761
|
+
i,
|
|
2762
|
+
o
|
|
2763
|
+
]), a(() => {
|
|
2764
|
+
let t = i.find((t) => t.get("url") === e);
|
|
2765
|
+
t ? (t.get("variables") || q.OrderedMap()).map((t, n) => {
|
|
2766
|
+
c({
|
|
2767
|
+
key: n,
|
|
2768
|
+
server: e,
|
|
2769
|
+
val: t.get("default") || ""
|
|
2770
|
+
});
|
|
2771
|
+
}) : o(i.first().get("url"));
|
|
2772
|
+
}, [
|
|
2773
|
+
e,
|
|
2774
|
+
i,
|
|
2775
|
+
o,
|
|
2776
|
+
c
|
|
2777
|
+
]);
|
|
2778
|
+
let d = r((e) => {
|
|
2779
|
+
o(e);
|
|
2780
|
+
}, [o]), f = r((t, n) => {
|
|
2781
|
+
c({
|
|
2782
|
+
key: t,
|
|
2783
|
+
server: e,
|
|
2784
|
+
val: n
|
|
2785
|
+
});
|
|
2786
|
+
}, [c, e]), p = i.toArray().map((e) => e.get("url")), m = s(() => W({ items: p }), [p]);
|
|
2787
|
+
return /* @__PURE__ */ B("div", {
|
|
2788
|
+
className: "servers",
|
|
2789
|
+
children: [/* @__PURE__ */ z(K, {
|
|
2790
|
+
className: "swagger-input",
|
|
2791
|
+
clearable: !1,
|
|
2792
|
+
collection: m,
|
|
2793
|
+
controlProps: { id: "servers" },
|
|
2794
|
+
onValueChange: (e) => d(e[0]),
|
|
2795
|
+
value: e ? [e] : []
|
|
2796
|
+
}), u && /* @__PURE__ */ B("div", { children: [
|
|
2797
|
+
/* @__PURE__ */ B("div", {
|
|
2798
|
+
className: "computed-url",
|
|
2799
|
+
children: ["Computed URL:", /* @__PURE__ */ z("code", { children: t(e) })]
|
|
2800
|
+
}),
|
|
2801
|
+
/* @__PURE__ */ z("h4", { children: "Server variables" }),
|
|
2802
|
+
/* @__PURE__ */ z("table", { children: /* @__PURE__ */ z("tbody", { children: l.entrySeq().map(([t, r]) => {
|
|
2803
|
+
let i = r.get("enum") ? r.get("enum").toArray() : [];
|
|
2804
|
+
return /* @__PURE__ */ B("tr", { children: [/* @__PURE__ */ z("td", { children: t }), /* @__PURE__ */ z("td", { children: i.length ? /* @__PURE__ */ z(K, {
|
|
2805
|
+
collection: W({ items: i }),
|
|
2806
|
+
onValueChange: (e) => f(t, e[0]),
|
|
2807
|
+
value: n(e, t) ? [n(e, t)] : []
|
|
2808
|
+
}) : /* @__PURE__ */ z(U, {
|
|
2809
|
+
onValueChange: (e) => f(t, e),
|
|
2810
|
+
value: n(e, t) || ""
|
|
2811
|
+
}) })] }, t);
|
|
2812
|
+
}) }) })
|
|
2813
|
+
] })]
|
|
2814
|
+
});
|
|
2815
|
+
}
|
|
2816
|
+
// src/internal/syntax-highlighter.tsx
|
|
2817
|
+
SyntaxHighlighter.displayName = "SyntaxHighlighter";
|
|
2818
|
+
function SyntaxHighlighter({ children: e, ...t }) {
|
|
2819
|
+
let n = useThemeContext();
|
|
2820
|
+
return /* @__PURE__ */ z(DocsCodeMirror, {
|
|
2821
|
+
language: t.language,
|
|
2822
|
+
theme: n,
|
|
2823
|
+
value: e
|
|
2824
|
+
});
|
|
2825
|
+
}
|
|
2826
|
+
// src/internal/try-it-out-button.tsx
|
|
2827
|
+
TryItOutButton.displayName = "TryItOutButton";
|
|
2828
|
+
function TryItOutButton({ enabled: e, hasUserEditedBody: t, isOAS3: n, onCancelClick: r, onResetClick: i, onTryoutClick: a }) {
|
|
2829
|
+
let o = n && t;
|
|
2830
|
+
return /* @__PURE__ */ B("div", {
|
|
2831
|
+
className: o ? "try-out btn-group" : "try-out",
|
|
2832
|
+
children: [e ? /* @__PURE__ */ z(j, {
|
|
2833
|
+
emphasis: "danger",
|
|
2834
|
+
endIcon: A,
|
|
2835
|
+
onClick: r,
|
|
2836
|
+
variant: "outline",
|
|
2837
|
+
children: "Cancel"
|
|
2838
|
+
}) : /* @__PURE__ */ z(j, {
|
|
2839
|
+
emphasis: "primary",
|
|
2840
|
+
endIcon: y,
|
|
2841
|
+
onClick: a,
|
|
2842
|
+
variant: "outline",
|
|
2843
|
+
children: "Try it out"
|
|
2844
|
+
}), o && /* @__PURE__ */ z(j, {
|
|
2845
|
+
emphasis: "neutral",
|
|
2846
|
+
endIcon: O,
|
|
2847
|
+
onClick: i,
|
|
2848
|
+
variant: "outline",
|
|
2849
|
+
children: "Reset"
|
|
2850
|
+
})]
|
|
2851
|
+
});
|
|
2852
|
+
}
|
|
2853
|
+
// src/swagger.tsx
|
|
2854
|
+
var quiSwaggerPlugin = () => ({ components: {
|
|
2855
|
+
apiKeyAuth: ApiKeyAuth,
|
|
2856
|
+
ArrayModel,
|
|
2857
|
+
AuthItem,
|
|
2858
|
+
authorizationPopup: AuthorizationPopup,
|
|
2859
|
+
authorizeBtn: AuthorizeBtn,
|
|
2860
|
+
authorizeOperationBtn: AuthorizeOperationBtn,
|
|
2861
|
+
auths: Auths,
|
|
2862
|
+
basicAuth: BasicAuth,
|
|
2863
|
+
clear: Clear,
|
|
2864
|
+
contentType: n(ContentType),
|
|
2865
|
+
EnumModel,
|
|
2866
|
+
execute: Execute,
|
|
2867
|
+
HighlightCode,
|
|
2868
|
+
JsonSchema_array: JsonSchemaArray,
|
|
2869
|
+
JsonSchema_object: JsonSchemaObject,
|
|
2870
|
+
JsonSchema_string: JsonSchemaString,
|
|
2871
|
+
Layout,
|
|
2872
|
+
ModelCollapse,
|
|
2873
|
+
modelExample: ModelExample,
|
|
2874
|
+
Models,
|
|
2875
|
+
ModelWrapper,
|
|
2876
|
+
oauth2: Oauth2,
|
|
2877
|
+
ObjectModel,
|
|
2878
|
+
operation: Operation,
|
|
2879
|
+
OperationSummary: n(OperationSummary),
|
|
2880
|
+
OperationSummaryMethod: n(OperationSummaryMethod),
|
|
2881
|
+
OperationSummaryPath: n(OperationSummaryPath),
|
|
2882
|
+
OperationTag,
|
|
2883
|
+
ParamBody,
|
|
2884
|
+
RequestBodyEditor,
|
|
2885
|
+
schemes: Schemes,
|
|
2886
|
+
Servers,
|
|
2887
|
+
SyntaxHighlighter,
|
|
2888
|
+
TryItOutButton: n(TryItOutButton)
|
|
2889
|
+
} });
|
|
2890
|
+
function Swagger({ getHash: e, hideTitleSection: t, plugins: n, renderLink: r, theme: i, ...a }) {
|
|
2891
|
+
let o = s(() => {
|
|
2892
|
+
let t = [
|
|
2893
|
+
() => ({ fn: { getHash: e } }),
|
|
2894
|
+
() => ({ components: { RenderLink: r } }),
|
|
2895
|
+
quiSwaggerPlugin
|
|
2896
|
+
];
|
|
2897
|
+
return n ? [...t, ...n] : t;
|
|
2898
|
+
}, [
|
|
2899
|
+
r,
|
|
2900
|
+
e,
|
|
2901
|
+
n
|
|
2902
|
+
]), c = {
|
|
2903
|
+
hash: e(),
|
|
2904
|
+
hideTitleSection: t
|
|
2905
|
+
};
|
|
2906
|
+
return /* @__PURE__ */ z(Ge, {
|
|
2907
|
+
value: c,
|
|
2908
|
+
children: /* @__PURE__ */ z(Ue, {
|
|
2909
|
+
value: i,
|
|
2910
|
+
children: /* @__PURE__ */ z(u, {
|
|
2911
|
+
defaultModelExpandDepth: 1e3,
|
|
2912
|
+
defaultModelRendering: "model",
|
|
2913
|
+
defaultModelsExpandDepth: 1e3,
|
|
2914
|
+
layout: "Layout",
|
|
2915
|
+
plugins: o,
|
|
2916
|
+
...a
|
|
2917
|
+
})
|
|
2918
|
+
})
|
|
2919
|
+
});
|
|
2920
|
+
}
|
|
2921
|
+
export { Swagger };
|
|
2922
|
+
|
|
2
2923
|
//# sourceMappingURL=index.js.map
|