From a62a975631787f23cec64331f52f512665a89e2e Mon Sep 17 00:00:00 2001 From: Carolina Menezes Date: Tue, 14 Oct 2025 12:45:17 -0300 Subject: [PATCH] styles: update layout --- dist/rapidoc-min.js | 10 +- dist/rapidoc-min.js.map | 2 +- dist/rapidoc.js | 22 +-- src/components/api-dropdown-actions.js | 195 +++++++++++++++++++ src/components/api-request.js | 105 ++++++++-- src/components/assets/check-symbol.js | 25 ++- src/components/assets/copy-symbol.js | 31 ++- src/components/assets/icon-caret.js | 25 +++ src/components/assets/openapi-icon.js | 56 ++---- src/components/assets/play-icon.js | 24 +++ src/components/assets/postman-icon.js | 204 ++++++++++---------- src/components/assets/trash-icon.js | 39 ++++ src/components/base-url.js | 9 +- src/components/content-copy-button.js | 5 - src/rapidoc.js | 16 +- src/styles/custom-styles.js | 48 ++--- src/styles/flex-styles.js | 28 +-- src/styles/font-styles.js | 7 +- src/styles/input-styles.js | 71 +++++-- src/templates/code-samples-template.js | 7 +- src/templates/endpoint-template.js | 6 + src/templates/expanded-endpoint-template.js | 71 +------ src/templates/overview-template.js | 30 +-- src/templates/security-scheme-template.js | 2 +- src/utils/common-utils.js | 43 +++-- src/utils/theme.js | 6 +- 26 files changed, 706 insertions(+), 381 deletions(-) create mode 100644 src/components/api-dropdown-actions.js create mode 100644 src/components/assets/icon-caret.js create mode 100644 src/components/assets/play-icon.js create mode 100644 src/components/assets/trash-icon.js diff --git a/dist/rapidoc-min.js b/dist/rapidoc-min.js index 7844093c7..77db3fb71 100644 --- a/dist/rapidoc-min.js +++ b/dist/rapidoc-min.js @@ -3261,7 +3261,7 @@ pre[class*="language-"] {
${this.codeExampleTemplate("flex")} -
+
${this.responseMessage?B`
@@ -4872,7 +4872,7 @@ pre[class*="language-"] { } .expanded-endpoint-body { position: relative; - padding: 6px 0px; + padding: 0px; } .expanded-endpoint-body .tag-description { background: var(--code-bg); @@ -4973,7 +4973,7 @@ pre[class*="language-"] { padding: 24px 8px; } .section-gap--read-mode { - padding: 24px 8px; + padding: 0px 80px; } .endpoint-body { position: relative; @@ -4994,10 +4994,10 @@ pre[class*="language-"] { display:flex; } .section-gap--focused-mode { - padding: 12px 80px 12px 80px; + padding: 0px 0px 12px 80px; } .section-gap--read-mode { - padding: 24px 80px 12px 80px; + padding: 0px 80px; } }`,ot]}connectedCallback(){super.connectedCallback();const e=this.parentElement;if(e&&"BODY"===e.tagName&&(e.style.marginTop||(e.style.marginTop="0"),e.style.marginRight||(e.style.marginRight="0"),e.style.marginBottom||(e.style.marginBottom="0"),e.style.marginLeft||(e.style.marginLeft="0")),"false"!==this.loadFonts){const e={family:"Open Sans",style:"normal",weight:"300",unicodeRange:"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD"},t=new FontFace("Open Sans","url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UN_r8OUuhpKKSTjw.woff2) format('woff2')",e);e.weight="600";const r=new FontFace("Open Sans","url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UNirkOUuhpKKSTjw.woff2) format('woff2')",e);t.load().then((e=>{document.fonts.add(e)})),r.load().then((e=>{document.fonts.add(e)}))}this.layout&&"row, column,".includes(`${this.layout},`)||(this.layout="row"),this.renderStyle&&"read, view, focused,".includes(`${this.renderStyle},`)||(this.renderStyle="focused"),this.schemaStyle&&"tree, table,".includes(`${this.schemaStyle},`)||(this.schemaStyle="tree"),this.theme&&"light, dark,".includes(`${this.theme},`)||(this.theme=window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"),this.defaultSchemaTab&&"example, schema, model,".includes(`${this.defaultSchemaTab},`)?"model"===this.defaultSchemaTab&&(this.defaultSchemaTab="schema"):this.defaultSchemaTab="example",(!this.schemaExpandLevel||this.schemaExpandLevel<1)&&(this.schemaExpandLevel=99999),this.schemaDescriptionExpanded&&"true, false,".includes(`${this.schemaDescriptionExpanded},`)||(this.schemaDescriptionExpanded="false"),this.schemaHideReadOnly&&"default, never,".includes(`${this.schemaHideReadOnly},`)||(this.schemaHideReadOnly="default"),this.schemaHideWriteOnly&&"default, never,".includes(`${this.schemaHideWriteOnly},`)||(this.schemaHideWriteOnly="default"),this.fillRequestFieldsWithExample&&"true, false,".includes(`${this.fillRequestFieldsWithExample},`)||(this.fillRequestFieldsWithExample="true"),this.persistAuth&&"true, false,".includes(`${this.persistAuth},`)||(this.persistAuth="false"),this.responseAreaHeight||(this.responseAreaHeight="400px"),this.allowSearch&&"true, false,".includes(`${this.allowSearch},`)||(this.allowSearch="true"),this.allowAdvancedSearch&&"true, false,".includes(`${this.allowAdvancedSearch},`)||(this.allowAdvancedSearch="true"),this.allowTry&&"true, false,".includes(`${this.allowTry},`)||(this.allowTry="true"),this.apiKeyValue||(this.apiKeyValue="-"),this.apiKeyLocation||(this.apiKeyLocation="header"),this.apiKeyName||(this.apiKeyName=""),this.oauthReceiver||(this.oauthReceiver="oauth-receiver.html"),this.updateRoute&&"true, false,".includes(`${this.updateRoute},`)||(this.updateRoute="true"),this.routePrefix||(this.routePrefix="#"),this.sortTags&&"true, false,".includes(`${this.sortTags},`)||(this.sortTags="false"),this.generateMissingTags&&"true, false,".includes(`${this.generateMissingTags},`)||(this.generateMissingTags="false"),this.sortEndpointsBy&&"method, path, summary, none,".includes(`${this.sortEndpointsBy},`)||(this.sortEndpointsBy="path"),this.onNavTagClick&&"expand-collapse, show-description,".includes(`${this.onNavTagClick},`)||(this.onNavTagClick="expand-collapse"),this.navItemSpacing&&"compact, relaxed, default,".includes(`${this.navItemSpacing},`)||(this.navItemSpacing="default"),this.showMethodInNavBar&&"false, as-plain-text, as-colored-text, as-colored-block,".includes(`${this.showMethodInNavBar},`)||(this.showMethodInNavBar="false"),this.usePathInNavBar&&"true, false,".includes(`${this.usePathInNavBar},`)||(this.usePathInNavBar="false"),this.navActiveItemMarker&&"left-bar, colored-block".includes(`${this.navActiveItemMarker},`)||(this.navActiveItemMarker="left-bar"),this.fontSize&&"default, large, largest,".includes(`${this.fontSize},`)||(this.fontSize="default"),this.showInfo&&"true, false,".includes(`${this.showInfo},`)||(this.showInfo="true"),this.allowServerSelection&&"true, false,".includes(`${this.allowServerSelection},`)||(this.allowServerSelection="true"),this.allowAuthentication&&"true, false,".includes(`${this.allowAuthentication},`)||(this.allowAuthentication="true"),this.allowSchemaDescriptionExpandToggle&&"true, false,".includes(`${this.allowSchemaDescriptionExpandToggle},`)||(this.allowSchemaDescriptionExpandToggle="true"),this.showSideNav&&"true false".includes(this.showSideNav)||(this.showSideNav="true"),this.showComponents&&"true false".includes(this.showComponents)||(this.showComponents="false"),this.infoDescriptionHeadingsInNavBar&&"true, false,".includes(`${this.infoDescriptionHeadingsInNavBar},`)||(this.infoDescriptionHeadingsInNavBar="false"),this.fetchCredentials&&"omit, same-origin, include,".includes(`${this.fetchCredentials},`)||(this.fetchCredentials=""),this.matchType&&"includes regex".includes(this.matchType)||(this.matchType="includes"),this.showAdvancedSearchDialog||(this.showAdvancedSearchDialog=!1),this.cssFile||(this.cssFile=null),this.cssClasses||(this.cssClasses=""),Ke().languages.node=Ke().languages.javascript,Ze.setOptions({highlight:(e,t)=>("curl"===t&&(t="bash"),Ke().languages[t]?Ke().highlight(e,Ke().languages[t],t):e)}),window.addEventListener("hashchange",(()=>{this.scrollToPath(this.getElementIDFromURL())}),!0)}disconnectedCallback(){super.disconnectedCallback()}infoDescriptionHeadingRenderer(){const e=new Ze.Renderer;return e.heading=(e,t,r,n)=>`${e}`,e}render(){return kn.call(this)}attributeChangedCallback(e,t,r){if("spec-url"===e&&t!==r&&window.setTimeout((async()=>{await this.loadSpec(r),this.gotoPath&&!window.location.hash&&this.scrollToPath(this.gotoPath)}),0),"render-style"===e&&"read"===r&&window.setTimeout((()=>{this.observeExpandedContent()}),100),"api-key-name"===e||"api-key-location"===e||"api-key-value"===e){let t=!1,n="",a="",o="";if("api-key-name"===e?this.getAttribute("api-key-location")&&this.getAttribute("api-key-value")&&(n=r,a=this.getAttribute("api-key-location"),o=this.getAttribute("api-key-value"),t=!0):"api-key-location"===e?this.getAttribute("api-key-name")&&this.getAttribute("api-key-value")&&(a=r,n=this.getAttribute("api-key-name"),o=this.getAttribute("api-key-value"),t=!0):"api-key-value"===e&&this.getAttribute("api-key-name")&&this.getAttribute("api-key-location")&&(o=r,a=this.getAttribute("api-key-location"),n=this.getAttribute("api-key-name"),t=!0),t&&this.resolvedSpec){const e=this.resolvedSpec.securitySchemes.find((e=>e.securitySchemeId===lt));e?(e.name=n,e.in=a,e.value=o,e.finalKeyValue=o):this.resolvedSpec.securitySchemes.push({securitySchemeId:lt,description:"api-key provided in rapidoc element attributes",type:"apiKey",name:n,in:a,value:o,finalKeyValue:o}),this.requestUpdate()}}super.attributeChangedCallback(e,t,r)}onSpecUrlChange(){this.setAttribute("spec-url",this.shadowRoot.getElementById("spec-url").value)}onSpecFileChange(e){this.setAttribute("spec-file",this.shadowRoot.getElementById("spec-file").value);const t=e.target.files[0],r=new FileReader;r.onload=()=>{try{const e=JSON.parse(r.result);this.loadSpec(e),this.shadowRoot.getElementById("spec-url").value=""}catch(e){An.error("RapiDoc: Unable to read or parse json")}},r.readAsText(t)}onFileLoadClick(){this.shadowRoot.getElementById("spec-file").click()}onSearchChange(e){this.matchPaths=e.target.value,this.resolvedSpec.tags.forEach((e=>e.paths.filter((t=>{this.matchPaths&&dt(this.matchPaths,t,this.matchType)&&(e.expanded=!0)})))),this.resolvedSpec.components.forEach((e=>e.subComponents.filter((e=>{e.expanded=!1,this.matchPaths&&!function(e,t){return t.name.toLowerCase().includes(e.toLowerCase())}(this.matchPaths,e)||(e.expanded=!0)})))),this.requestUpdate()}onClearSearch(){this.shadowRoot.getElementById("nav-bar-search").value="",this.matchPaths="",this.resolvedSpec.components.forEach((e=>e.subComponents.filter((e=>{e.expanded=!0}))))}onShowSearchModalClicked(){this.showAdvancedSearchDialog=!0}async onOpenSearchDialog(e){const t=e.detail.querySelector("input");await ct(0),t&&t.focus()}async loadSpec(e){if(e){this.matchPaths="";try{this.resolvedSpec={specLoadError:!1,isSpecLoading:!0,tags:[]},this.loading=!0,this.loadFailed=!1;const t=await vt.call(this,e,this.spec,"true"===this.generateMissingTags,"true"===this.sortTags,this.getAttribute("sort-endpoints-by"),this.getAttribute("api-key-name"),this.getAttribute("api-key-location"),this.getAttribute("api-key-value"),this.getAttribute("server-url"));this.loading=!1,this.afterSpecParsedAndValidated(t)}catch(e){this.loading=!1,this.loadFailed=!0,this.resolvedSpec=null,An.error(`RapiDoc: Unable to resolve the API spec.. ${e.message}`)}}}async afterSpecParsedAndValidated(e){for(this.resolvedSpec=e,this.selectedServer=void 0,this.defaultApiServerUrl&&(this.defaultApiServerUrl===this.serverUrl?this.selectedServer={url:this.serverUrl,computedUrl:this.serverUrl}:this.resolvedSpec.servers&&(this.selectedServer=this.resolvedSpec.servers.find((e=>e.url===this.defaultApiServerUrl)))),this.selectedServer||this.resolvedSpec.servers&&(this.selectedServer=this.resolvedSpec.servers[0]),this.requestUpdate();!await this.updateComplete;);const t=new CustomEvent("spec-loaded",{detail:e});this.dispatchEvent(t),"read"===this.renderStyle&&(await ct(100),this.observeExpandedContent()),this.isIntersectionObserverActive=!0;const r=this.getElementIDFromURL();if(r)"view"===this.renderStyle?this.expandAndGotoOperation(r,!0,!0):this.scrollToPath(r);else if("focused"===this.renderStyle&&!this.gotoPath){var n;const e=this.showInfo?"overview":null===(n=this.resolvedSpec.tags[0])||void 0===n?void 0:n.paths[0];this.scrollToPath(e)}}getComponentBaseURL(){const{href:e}=window.location,t=this.routePrefix.replace(/(#|\/)$/,"");if(!t)return e.split("#")[0];const r=e.lastIndexOf(t);return-1===r?e:e.slice(0,r)}getElementIDFromURL(){const e=this.getComponentBaseURL();return window.location.href.replace(e+this.routePrefix,"")}replaceHistoryState(e){const t=this.getComponentBaseURL();window.history.replaceState(null,null,`${t}${this.routePrefix||"#"}${e}`)}expandAndGotoOperation(e,t=!0){if(!this.resolvedSpec)return;let r=!0;const n=-1===e.indexOf("#")?e:e.substring(1);if(n.startsWith("overview")||"servers"===n||"auth"===n)r=!1;else for(let t=0;t<(null===(a=this.resolvedSpec.tags)||void 0===a?void 0:a.length);t++){var a,o;const n=this.resolvedSpec.tags[t],i=null===(o=n.paths)||void 0===o?void 0:o.find((t=>t.elementId===e));i&&(i.expanded&&n.expanded?r=!1:(i.expanded=!0,n.expanded=!0))}t&&(r&&this.requestUpdate(),window.setTimeout((()=>{const e=this.shadowRoot.getElementById(n);e&&(e.scrollIntoView({behavior:"auto",block:"start"}),"true"===this.updateRoute&&this.replaceHistoryState(n))}),r?150:0))}isValidTopId(e){return e.startsWith("overview")||"servers"===e||"auth"===e}isValidPathId(e){var t,r,n,a;return!("overview"!==e||!this.showInfo)||(!("servers"!==e||!this.allowServerSelection)||(!("auth"!==e||!this.allowAuthentication)||(e.startsWith("tag--")?null===(n=this.resolvedSpec)||void 0===n||null===(a=n.tags)||void 0===a?void 0:a.find((t=>t.elementId===e)):null===(t=this.resolvedSpec)||void 0===t||null===(r=t.tags)||void 0===r?void 0:r.find((t=>t.paths.find((t=>t.elementId===e)))))))}onIntersect(e){!1!==this.isIntersectionObserverActive&&e.forEach((e=>{if(e.isIntersecting&&e.intersectionRatio>0){const t=this.shadowRoot.querySelector(".nav-bar-tag.active, .nav-bar-path.active, .nav-bar-info.active, .nav-bar-h1.active, .nav-bar-h2.active, .operations.active"),r=this.shadowRoot.getElementById(`link-${e.target.id}`);r&&("true"===this.updateRoute&&this.replaceHistoryState(e.target.id),r.classList.add("active"),r.part.add("section-navbar-active-item")),t&&t!==r&&(t.classList.remove("active"),t.part.remove("section-navbar-active-item"))}}))}handleHref(e){if("a"===e.target.tagName.toLowerCase()&&e.target.getAttribute("href").startsWith("#")){const t=this.shadowRoot.getElementById(e.target.getAttribute("href").replace("#",""));t&&t.scrollIntoView({behavior:"auto",block:"start"})}}async scrollToEventTarget(e,t=!0){if("click"!==e.type&&("keyup"!==e.type||13!==e.keyCode))return;const r=e.target;if(r.dataset.contentId){if(this.isIntersectionObserverActive=!1,"focused"===this.renderStyle){const e=this.shadowRoot.querySelector("api-request");e&&e.beforeNavigationFocusedMode()}this.scrollToPath(r.dataset.contentId,!0,t),setTimeout((()=>{this.isIntersectionObserverActive=!0}),300)}}async scrollToPath(e,t=!0,r=!0){if("focused"===this.renderStyle&&(this.focusedElementId=e,await ct(0)),"view"===this.renderStyle)this.expandAndGotoOperation(e,t,!0);else{let t=!1;const n=this.shadowRoot.getElementById(e);if(n?(t=!0,n.scrollIntoView({behavior:"auto",block:"start"})):t=!1,t){if("focused"===this.renderStyle){const e=this.shadowRoot.querySelector("api-request");e&&e.afterNavigationFocusedMode();const t=this.shadowRoot.querySelector("api-response");t&&t.resetSelection()}"true"===this.updateRoute&&this.replaceHistoryState(e);const t=this.shadowRoot.getElementById(`link-${e}`);if(t){r&&t.scrollIntoView({behavior:"auto",block:"center"}),await ct(0);const e=this.shadowRoot.querySelector(".nav-bar-tag.active, .nav-bar-path.active, .nav-bar-info.active, .nav-bar-h1.active, .nav-bar-h2.active, .operations.active");e&&(e.classList.remove("active"),e.part.remove("active"),e.part.remove("section-navbar-active-item")),t.classList.add("active"),t.part.add("section-navbar-active-item")}}}}setHttpUserNameAndPassword(e,t,r){return er.call(this,e,t,r)}setApiKey(e,t){return er.call(this,e,"","",t)}removeAllSecurityKeys(){return tr.call(this)}setApiServer(e){return Lr.call(this,e)}onAdvancedSearch(e,t){const r=e.target;clearTimeout(this.timeoutId),this.timeoutId=setTimeout((()=>{let e;e="text"===r.type?r:r.closest(".advanced-search-options").querySelector("input[type=text]");const t=[...r.closest(".advanced-search-options").querySelectorAll("input:checked")].map((e=>e.id));this.advancedSearchMatches=function(e,t,r=[]){if(!e.trim()||0===r.length)return;const n=[];return t.forEach((t=>{t.paths.forEach((t=>{let a="";var o;if(r.includes("search-api-path")&&(a=t.path),r.includes("search-api-descr")&&(a=`${a} ${t.summary||t.description||""}`),r.includes("search-api-params")&&(a=`${a} ${(null===(o=t.parameters)||void 0===o?void 0:o.map((e=>e.name)).join(" "))||""}`),r.includes("search-api-request-body")&&t.requestBody){let e=new Set;for(const r in null===(i=t.requestBody)||void 0===i?void 0:i.content){var i,s,l;null!==(s=t.requestBody.content[r].schema)&&void 0!==s&&s.properties&&(e=ut(null===(l=t.requestBody.content[r].schema)||void 0===l?void 0:l.properties)),a=`${a} ${[...e].join(" ")}`}}r.includes("search-api-resp-descr")&&(a=`${a} ${Object.values(t.responses).map((e=>e.description||"")).join(" ")}`),a.toLowerCase().includes(e.trim().toLowerCase())&&n.push({elementId:t.elementId,method:t.method,path:t.path,summary:t.summary||t.description||"",deprecated:t.deprecated})}))})),n}(e.value,this.resolvedSpec.tags,t)}),t)}}customElements.get("rapi-doc")||customElements.define("rapi-doc",_n);var On=r(5108);customElements.get("rapi-doc-mini")||customElements.define("rapi-doc-mini",class extends se{constructor(){super(),this.isMini=!0,this.updateRoute="false",this.renderStyle="view",this.showHeader="false",this.allowAdvancedSearch="false"}static get properties(){return{specUrl:{type:String,attribute:"spec-url"},sortEndpointsBy:{type:String,attribute:"sort-endpoints-by"},layout:{type:String},pathsExpanded:{type:String,attribute:"paths-expanded"},defaultSchemaTab:{type:String,attribute:"default-schema-tab"},responseAreaHeight:{type:String,attribute:"response-area-height"},showSummaryWhenCollapsed:{type:String,attribute:"show-summary-when-collapsed"},fillRequestFieldsWithExample:{type:String,attribute:"fill-request-fields-with-example"},persistAuth:{type:String,attribute:"persist-auth"},schemaStyle:{type:String,attribute:"schema-style"},schemaExpandLevel:{type:Number,attribute:"schema-expand-level"},schemaDescriptionExpanded:{type:String,attribute:"schema-description-expanded"},apiKeyName:{type:String,attribute:"api-key-name"},apiKeyLocation:{type:String,attribute:"api-key-location"},apiKeyValue:{type:String,attribute:"api-key-value"},defaultApiServerUrl:{type:String,attribute:"default-api-server"},serverUrl:{type:String,attribute:"server-url"},oauthReceiver:{type:String,attribute:"oauth-receiver"},allowTry:{type:String,attribute:"allow-try"},theme:{type:String},bgColor:{type:String,attribute:"bg-color"},textColor:{type:String,attribute:"text-color"},primaryColor:{type:String,attribute:"primary-color"},fontSize:{type:String,attribute:"font-size"},regularFont:{type:String,attribute:"regular-font"},monoFont:{type:String,attribute:"mono-font"},mediumFont:{type:String,attribute:"medium-font"},loadFonts:{type:String,attribute:"load-fonts"},fetchCredentials:{type:String,attribute:"fetch-credentials"},matchPaths:{type:String,attribute:"match-paths"},matchType:{type:String,attribute:"match-type"},loading:{type:Boolean}}}static get styles(){return[Ye,Je,Xe,Qe,et,tt,rt,nt,at,c` :host { diff --git a/dist/rapidoc-min.js.map b/dist/rapidoc-min.js.map index d8d7d4aa4..e2a639e17 100644 --- a/dist/rapidoc-min.js.map +++ b/dist/rapidoc-min.js.map @@ -1 +1 @@ -{"version":3,"file":"rapidoc-min.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;ACKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC0RA;AACA;AACA;AAIA;AAIA;AAIA;AAEA;;;AAIA;;AAEA;AACA;AACA;AACA;;;;;AAKA;AAGA;;AAGA;AACA;AACA;;AAIA;;AAGA;AACA;;;;AAIA;AAGA;AACA;;;AAIA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AAGA;;AAGA;AACA;;;AAKA;;AAKA;AA+BA;;;AAGA;;AAGA;AACA;AACA;AACA;;AAGA;AACA;;AAIA;;AAGA;;;;AAKA;AACA;AACA;AACA;AAGA;AAGA;;;;;;;AAQA;;;AAGA;;AAEA;;;;;;AASA;AACA;;AAEA;;;AAMA;;;AAGA;;AAEA;;AAIA;;AAGA;;AAEA;;AAIA;AAGA;;;;;;AA1FA;;;AA0IA;AACA;AAEA;;;AAGA;;;AAMA;;AAEA;;;;;AAOA;;AAEA;AAKA;;AAGA;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;;;AAMA;;;AAvFA;;;;;AC/eA;;;ACAA;;AAYA;;AAEA;AACA;AACA;AACA;AACA;;AAIA;;AC3BA;;AAEA;AACA;;;AAGA;;;AAGA;;AAEA;;AAEA;;;;AAIA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;AAQA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;;;;;;AAOA;;;;;;;;;;;;;;;;;;;;;ACrEA;;;;;;;;;;;;;;;;;AAmBA;;;;;;;;;;;;;;;;;;;;;;;;AA0BA;;;;;;;;;;;;;;;;;;;;;;;;AAgDA;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACTA;AAQA;;AAEA;;AAEA;;AAGA;AAYA;;AAEA;;AAEA;AACA;;;AAIA;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC0PA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA7RA;AAQA;;AAEA;AACA;;;AAIA;AACA;;AAIA;AACA;AAEA;;AASA;AA0BA;AACA;AASA;AAyDA;AACA;AACA;AAMA;AACA;AACA;AAGA;;AAEA;;AAEA;AACA;AAGA;AACA;AAwBA;;;AAIA;AASA;AA4BA;AACA;AACA;AACA;AAMA;AACA;AACA;;;;AAIA;AAEA;AAKA;AAIA;AACA;AACA;AACA;;;AAIA;;AChUA;AACA;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiHA;AC3HA;;;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC0EA;;AAwBA;AACA;;;;;;;;;;AAUA;;AAEA;AACA;;AAEA;;AAEA;AC3HA;;;;;;AD2HA;AACA;;AC9HA;ADiIA;;;;AAKA;AEzEA;AACA;;AAEA;AACA;;AAEA;ACnEA;AAIA;;;;AAKA;;;AD+DA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwHA;;AEjHA;AACA;AACA;;AAEA;;;;;;AAUA;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiHA;;AC3KA;;AAEA;;AAEA;;AAGA;AACA;;AAEA;;;AAIA;AACA;AACA;;AAGA;AACA;;AAGA;;;;;;AAOA;AACA;AACA;;;;AAIA;;;AAMA;AAOA;;;AAGA;AAEA;;AAEA;;;AAGA;;AAKA;ACtGA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;;;;;;;;;;;AAcA;ACdA;;;AAIA;ACMA;AACA;ACXA;;;AAIA;ADQA;AACA;;;AAGA;AACA;;AAEA;AACA;;;;;AAMA;AAQA;;;;AAIA;;AAEA;AACA;AACA;;AAEA;AACA;;;;AAIA;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AE8KA;AAOA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;;AAIA;AA0DA;;;;AAIA;AACA;AACA;AACA;AACA;AAQA;AACA;AAEA;AAIA;AACA;AAKA;;AAEA;AACA;AACA;;AAEA;AAEA;AC9JA;ADkPA;AACA;;;AAGA;AAIA;AACA;;;;AAIA;AAEA;;;AAIA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAIA;AAOA;AACA;;AAEA;;;;AAKA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;;;;;;AAOA;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AAIA;AAIA;AACA;AAGA;;;AAKA;;AAEA;;;;;;;AAgBA;;;AAIA;AA0EA;AACA;AACA;AACA;;;AAOA;AAqBA;;AAEA;AAGA;AACA;AACA;;;;AAKA;AAGA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA;;;;;;AAWA;;AAoBA;;AAOA;AAIA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAIA;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAKA;AAIA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AAEA;AACA;;AAIA;;;AAmBA;AAiBA;AACA;;;AAGA;AACA;;;;;;AAMA;AACA;AACA;AACA;;;;AAKA;AACA;;AAEA;AACA;AACA;AACA;;;;AAMA;AAgBA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AAGA;;;;;;AAMA;AACA;;;;;;;;AAQA;;;AAIA;AACA;AACA;;;AAGA;;;AAGA;AAEA;AAGA;AAEA;;AAEA;;;AAGA;AACA;AACA;;AAEA;AAIA;;;AAOA;;AAIA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA;;AAIA;;;AAMA;;;;AAMA;AACA;;;AAKA;;AAGA;;AAGA;;AAIA;;;;AAIA;AACA;;;AAGA;AAEA;AAIA;AACA;AACA;;AAGA;AAsBA;;AAEA;;AAEA;;AAGA;AACA;AACA;AAGA;AAEA;AACA;;;AAGA;AAIA;AAEA;;AAEA;AACA;AACA;;AAMA;AAMA;AACA;;AAIA;;AAEA;AACA;;;AAIA;;AAEA;;AAMA;;;;AAeA;;;;AAIA;AAEA;AAEA;AAIA;;;AAOA;AAGA;;;AAGA;;AAEA;AAGA;;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEnhCA;AAQA;;AAEA;AACA;;;AAIA;;AAEA;;AAIA;AAIA;;;;;;AAOA;;AAMA;;AAKA;AAyBA;AACA;;;AAGA;;AAQA;AAIA;AAsCA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAGA;AAMA;;AAEA;AACA;AACA;;AAEA;AACA;AAEA;;;;AAKA;;;AAGA;;AAKA;AAGA;AACA;AAwBA;;;AASA;AAaA;AACA;AAGA;AACA;AACA;AAGA;AACA;AACA;AACA;AAEA;;AAMA;;AAEA;AACA;AACA;;AAOA;AACA;AACA;AACA;;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnNA;AAOA;AACA;;AAGA;AA6DA;AAEA;AACA;AAGA;AACA;;;;AAWA;;;;;AAKA;;;AAGA;;;;AAIA;;;AAOA;AACA;;;;AAIA;AACA;;;;;AAKA;;;AAGA;;;;;;AAMA;AACA;;AAKA;;AAIA;AAIA;AACA;AACA;;;AAGA;AAEA;AACA;AAEA;;;;;;;AASA;AAEA;;;AAMA;;;AAGA;;;AAGA;AAEA;AACA;;AAIA;AAEA;AACA;;AAIA;;AAGA;AACA;;AAIA;AAEA;AAIA;AACA;AAEA;AAkBA;AAEA;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AAEA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAGA;AACA;;AAEA;;;;;AAzCA;AACA;AAiDA;AASA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAvBA;AACA;AA0BA;AChZA;AACA;AACA;;AAEA;;;;AAQA;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA;ACpHA;AACA;AACA;AACA;AACA;AACA;;AAGA;;AAKA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAIA;AACA;;;AAGA;;;;AAKA;AAEA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;;;AAGA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAOA;AAKA;AACA;AACA;AACA;;AAEA;;;;AAQA;;;AAfA;;AC3IA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAEA;;AAEA;;AAGA;AACA;AACA;AACA;;AAEA;;;AAKA;;AAQA;AACA;AACA;AACA;;AAGA;AACA;;;AAKA;AAKA;AACA;AACA;;AAEA;;;;AAIA;;;AAVA;ACxCA;;AAEA;AAEA;;AAGA;AACA;AACA;;AAIA;AACA;;AAEA;AAFA;;;AAOA;AAEA;AACA;AAGA;AAIA;AAEA;AAMA;;;;AAOA;;AASA;;AAKA;;;;AChBA;AACA;;AAEA;AAGA;AACA;;;;;;;AASA;;;;;AAKA;AAEA;;AAEA;;AAKA;AAGA;;;;;;AAQA;AACA;AAGA;AAEA;AAEA;AACA;;AAIA;;AAEA;AACA;;AAEA;;AAEA;;;AAIA;AACA;AAEA;;AA1BA;;AAgCA;AAIA;;AAKA;;AAEA;;;;;;;;;;AAWA;;;;;;AAQA;AAGA;AACA;;AAIA;;AAEA;AACA;AACA;AACA;;;AAGA;;;;AAKA;AAEA;;AAIA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AAIA;;AAEA;;AAOA;;;AAGA;AACA;;;AAGA;AACA;AACA;;AAGA;AACA;;;;;AAQA;;;AAIA;;;;;AAMA;;;;AAKA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAUA;;ACzPA;AAEA;AAiBA;AACA;;AAGA;AAMA;AAIA;;;AAsBA;ACzBA;AACA;AACA;AACA;AACA;;AAEA;;;AAIA;AAGA;;AAGA;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EA;;AAEA;AAMA;;AAGA;;AAKA;;AAIA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;;;;AAIA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAOA;AAKA;;AAGA;;;;AAIA;;;;AAIA;AAGA;AACA;AAEA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AAMA;AACA;AACA;;;AAIA;;AAGA;AAMA;AACA;AACA;;;;AAnDA;;;;AC5OA;AAEA;;;;;;;;;;;;;ACOA;;;AAGA;;;;;;;AASA;AACA;;;;;AAMA;;;;;AAOA;AACA;;;AAGA;;;AAIA;AAGA;;;;AAKA;AAGA;;;;;ADtDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AECA;;;AAOA;;;;;;;;;AASA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;;;AAMA;;;AAGA;AACA;;AAEA;;AASA;AACA;AACA;;;;AAMA;ACvBA;;;;AAKA;AACA;;;;;;AAMA;;;;;;;AC6JA;AACA;AACA;AACA;;AAEA;;AAMA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAGA;ACvSA;AACA;AAGA;AACA;;AAEA;;;;AAIA;AACA;;;AAKA;AAEA;;;AAGA;;;;AAOA;AACA;;;AAGA;;;AAGA;;AAEA;;AAEA;;;;;AASA;AACA;AAGA;AAGA;AACA;AAGA;;;;AAIA;;;;;;;;AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACoSA;;;;;;;;;AASA;;;;;;;;;;;;;;;;;;;;;;;AChSA;;;;;;;;;ACxGA;;;;;;AAMA;AACA;AACA;;AAIA;;;;AAMA;AAKA;;AAEA;AAIA;;AAEA;AACA;;;;;AAKA;AACA;AACA;AACA;;;;;;AAMA;AAEA;AACA;AACA;;AAGA;AAGA;;AAEA;AACA;;AAEA;;;;AAKA;;AAKA;AAyBA;AACA;AAGA;AACA;;AAEA;;;;;AAKA;AACA;;;AAKA;AAEA;;;AAGA;;;;AAOA;AACA;;;AAGA;;AAEA;;;AAGA;;;;;AAKA;AACA;AAGA;AAGA;AACA;;;;;;;AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACTA","sources":["webpack://rapidoc/./src/styles/input-styles.js","webpack://rapidoc/./src/styles/flex-styles.js","webpack://rapidoc/./src/styles/table-styles.js","webpack://rapidoc/./src/styles/endpoint-styles.js","webpack://rapidoc/./src/styles/prism-styles.js","webpack://rapidoc/./src/styles/tab-styles.js","webpack://rapidoc/./src/styles/nav-styles.js","webpack://rapidoc/./src/styles/info-styles.js","webpack://rapidoc/./src/styles/custom-styles.js","webpack://rapidoc/./src/templates/security-scheme-template.js","webpack://rapidoc/./src/components/assets/copy-symbol.js","webpack://rapidoc/./src/templates/code-samples-template.js","webpack://rapidoc/./src/templates/callback-template.js","webpack://rapidoc/./src/styles/prism-languages-styles.js","webpack://rapidoc/./src/components/json-tree.js","webpack://rapidoc/./src/components/schema-tree.js","webpack://rapidoc/./src/components/tag-input.js","webpack://rapidoc/./src/components/assets/check-symbol.js","webpack://rapidoc/./src/components/breadcrumbs.js","webpack://rapidoc/./src/components/assets/corner-arrow-symbol.js","webpack://rapidoc/./src/components/toast-component.js","webpack://rapidoc/./src/components/assets/close-symbol.js","webpack://rapidoc/./src/components/base-url.js","webpack://rapidoc/./src/templates/server-template.js","webpack://rapidoc/./src/components/assets/languages/c-icon.js","webpack://rapidoc/./src/components/assets/languages/clojure-icon.js","webpack://rapidoc/./src/components/assets/languages/csharp-icon.js","webpack://rapidoc/./src/components/assets/languages/go-icon.js","webpack://rapidoc/./src/components/assets/languages/java-icon.js","webpack://rapidoc/./src/components/assets/languages/javascript-icon.js","webpack://rapidoc/./src/components/assets/languages/kotlin-icon.js","webpack://rapidoc/./src/components/assets/languages/node-icon.js","webpack://rapidoc/./src/components/assets/languages/objc-icon.js","webpack://rapidoc/./src/components/assets/languages/ocaml-icon.js","webpack://rapidoc/./src/components/assets/languages/php-icon.js","webpack://rapidoc/./src/components/assets/languages/python-icon.js","webpack://rapidoc/./src/components/assets/languages/r-icon.js","webpack://rapidoc/./src/components/assets/languages/ruby-icon.js","webpack://rapidoc/./src/components/assets/languages/shell-icon.js","webpack://rapidoc/./src/components/assets/languages/swift-icon.js","webpack://rapidoc/./src/templates/language-picker-template.js","webpack://rapidoc/./src/components/assets/three-dots.js","webpack://rapidoc/./src/components/api-request.js","webpack://rapidoc/./src/utils/schema-utils.js","webpack://rapidoc/./src/components/schema-table.js","webpack://rapidoc/./src/components/api-response.js","webpack://rapidoc/./src/components/content-copy-button.js","webpack://rapidoc/./src/templates/expanded-endpoint-template.js","webpack://rapidoc/./src/templates/components-template.js","webpack://rapidoc/./src/templates/overview-template.js","webpack://rapidoc/./src/templates/navbar-template.js","webpack://rapidoc/./src/templates/focused-endpoint-template.js","webpack://rapidoc/./src/templates/endpoint-template.js","webpack://rapidoc/./src/templates/logo-template.js","webpack://rapidoc/./src/templates/header-template.js","webpack://rapidoc/./src/templates/advance-search-template.js","webpack://rapidoc/./src/components/dialog-box.js","webpack://rapidoc/./src/utils/theme.js","webpack://rapidoc/./src/templates/main-body-template.js","webpack://rapidoc/./src/rapidoc.js","webpack://rapidoc/./src/rapidoc-mini.js","webpack://rapidoc/./src/templates/json-schema-viewer-template.js","webpack://rapidoc/./src/json-schema-viewer.js"],"sourcesContent":["import { css } from 'lit';\n\n/* eslint-disable max-len */\nexport default css`\n/* Button */\n.m-btn {\n display: flex;\n flex-direction: column;\n align-items: center;\n border-radius: var(--border-radius);\n font-weight: 400;\n padding: 7px 12px 6px;\n outline: none;\n border: none;\n text-align: center;\n white-space: nowrap;\n transition: background-color 0.2s;\n user-select: none;\n cursor: pointer;\n font-family: var(--font-medium);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n.m-btn-primary {\n background-color: var(--primary-color);\n color: var(--primary-color-invert);\n}\n.m-btn-primary:hover {\n background-color: #000711;\n}\n.m-btn-secondary{\n background: #e7e9ee;\n color: #142032;\n}\n.m-btn-secondary:hover {\n background: #ccced8;\n}\n.m-btn-tertiary {\n background: #ffffff;\n color: #142032;\n}\n.m-btn-tertiary:hover {\n color: #000711;\n}\n.m-btn.thin-border { border-width: 1px; }\n.m-btn.large { padding:8px 14px; }\n.m-btn.small { padding:5px 12px; }\n.m-btn.tiny { padding:5px 6px; }\n.m-btn.circle { border-radius: 50%; }\n.m-btn.nav:hover { \n background-color: var(--nav-accent-color);\n}\n.m-btn:disabled{ \n background-color: var(--bg3);\n color: var(--fg3);\n border-color: var(--fg3);\n cursor: not-allowed;\n opacity: 0.4;\n}\n.toolbar-btn{\n cursor: pointer;\n padding: 4px;\n margin:0 2px;\n font-size: var(--font-size-small);\n min-width: 50px;\n color: var(--primary-color-invert);\n border-radius: 2px;\n border: none;\n background-color: var(--primary-color);\n}\n.copy-code {\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n cursor: pointer;\n outline: inherit;\n display: block;\n}\n.copy-button{\n opacity: 0.3;\n}\n.check-button, .copy-button:hover{\n opacity: 1;\n}\n\ninput, textarea, select, pre {\n color: #000000;\n outline: none;\n background-color: var(--input-bg);\n border: 1px solid #B9B9B9;\n border-radius: var(--border-radius);\n}\nbutton {\n font-family: var(--font-regular);\n}\n\n/* Form Inputs */\npre,\nselect,\ntextarea,\ninput[type=\"file\"],\ninput[type=\"text\"],\ninput[type=\"password\"] {\n font-family:var(--font-mono); \n font-size: var(--font-size-mono);\n transition: border .2s;\n padding: 6px 8px;\n line-height: 140%;\n}\n\nselect {\n font-family: var(--font-regular);\n padding: 8px;\n background-image: url(\"data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%3E%3Cpath%20d%3D%22M10.3%203.3L6%207.6%201.7%203.3A1%201%200%2000.3%204.7l5%205a1%201%200%20001.4%200l5-5a1%201%200%2010-1.4-1.4z%22%20fill%3D%22%23777777%22%2F%3E%3C%2Fsvg%3E\"); \n background-position: calc(100% - 14px) center;\n background-repeat: no-repeat; \n background-size: 10px;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n cursor: pointer;\n}\n\nselect:hover {\n border-color: var(--primary-color);\n}\n\ninput[type=\"text\"]:hover {\n border-color: var(--fg2);\n}\n\ntextarea::placeholder,\ninput[type=\"text\"]::placeholder,\ninput[type=\"password\"]::placeholder {\n color: var(--placeholder-color);\n opacity:1;\n}\n\nselect:focus,\ntextarea:focus,\ninput[type=\"text\"]:focus,\ninput[type=\"password\"]:focus,\ntextarea:active,\ninput[type=\"text\"]:active,\ninput[type=\"password\"]:active {\n border-color: none;\n}\n\ninput[type=\"file\"]{\n font-family: var(--font-regular);\n padding:2px;\n cursor:pointer;\n border: 1px solid var(--primary-color);\n min-height: calc(var(--font-size-small) + 18px);\n}\n\ninput[type=\"file\"]::-webkit-file-upload-button {\n font-family: var(--font-regular);\n font-size: var(--font-size-small);\n outline: none;\n cursor:pointer;\n padding: 3px 8px;\n border: 1px solid var(--primary-color);\n background-color: var(--primary-color);\n color: var(--primary-color-invert);\n border-radius: var(--border-radius);;\n -webkit-appearance: none;\n}\n\npre,\ntextarea {\n scrollbar-width: thin;\n scrollbar-color: var(--border-color) var(--input-bg);\n}\n\npre::-webkit-scrollbar,\ntextarea::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\n\npre::-webkit-scrollbar-track,\ntextarea::-webkit-scrollbar-track {\n background:var(--input-bg);\n}\n \npre::-webkit-scrollbar-thumb,\ntextarea::-webkit-scrollbar-thumb {\n border-radius: 2px;\n background-color: var(--border-color);\n}\n\n.link {\n font-size:var(--font-size-small);\n text-decoration: underline;\n color:var(--rebel-pink);\n font-family:var(--font-mono);\n margin-bottom:2px;\n}\n\n/* Toggle Body */\ninput[type=\"checkbox\"] {\n appearance: none;\n display: inline-block;\n background-color: var(--light-bg);\n border: 1px solid var(--light-bg);\n border-radius: 9px;\n cursor: pointer;\n height: 18px;\n position: relative;\n transition: border .25s .15s, box-shadow .25s .3s, padding .25s;\n min-width: 36px;\n width: 36px;\n vertical-align: top;\n}\n/* Toggle Thumb */\ninput[type=\"checkbox\"]:after {\n position: absolute;\n background-color: var(--bg);\n border: 1px solid var(--light-bg);\n border-radius: 8px;\n content: '';\n top: 0px;\n left: 0px;\n right: 16px;\n display: block;\n height: 16px;\n transition: border .25s .15s, left .25s .1s, right .15s .175s;\n}\n\n/* Toggle Body - Checked */\ninput[type=\"checkbox\"]:checked {\n background-color: var(--green);\n border-color: var(--green);\n}\n/* Toggle Thumb - Checked*/\ninput[type=\"checkbox\"]:checked:after {\n border: 1px solid var(--green);\n left: 16px;\n right: 1px;\n transition: border .25s, left .15s .25s, right .25s .175s;\n}`;\n","import { css } from 'lit';\n\nexport default css`\n .flex,\n .row,\n .col,\n .row-api {\n display: flex;\n }\n .row-api {\n flex: 1fr 1fr;\n align-items: center;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-evenly;\n }\n .row {\n align-items: center;\n }\n .col {\n align-items: stretch;\n flex-direction: column;\n }\n .row-api-left {\n min-width: 288px;\n max-width: 720px;\n flex: 2 1 0%;\n justify-content: flex-end;\n padding-right: 32px;\n }\n .row-api-right {\n min-width: 288px;\n max-width: 702px;\n flex: 1;\n justify-content: flex-start;\n border-left: 1px solid #E7E9EE;\n }\n .row-api-right-box{\n text-align:left; \n direction:ltr; \n margin-block: 32px 16px; \n padding-left: 32px;\n }\n .clear-btn{\n margin-left: 32px\n }\n\n @media (max-width: 1280px) {\n .row-api {\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n }\n .row-api-right-box{\n padding-left: 0px;\n }\n .clear-btn{\n margin-left: 0px\n }\n\n .row-api-left,\n .row-api-right {\n max-width: unset;\n width: 100%;\n border: none;\n padding: 10px;\n }\n }\n`;\n","import { css } from 'lit';\n\nexport default css`\n.m-table {\n border-spacing: 0; \n border-collapse: separate;\n border: 1px solid var(--light-border-color);\n border-radius: var(--border-radius);\n margin: 0;\n max-width: 100%;\n direction: ltr;\n}\n.m-table tr:first-child td,\n.m-table tr:first-child th {\n border-top: 0 none;\n}\n.m-table td, \n.m-table th {\n font-size: var(--font-size-small);\n line-height: calc(var(--font-size-small) + 4px);\n padding: 4px 5px 4px;\n vertical-align: top;\n}\n\n.m-table.padded-12 td, \n.m-table.padded-12 th {\n padding: 12px;\n}\n\n.m-table td:not([align]), \n.m-table th:not([align]) {\n text-align: left;\n}\n\n.m-table th {\n color: var(--fg2);\n font-size: var(--font-size-small);\n line-height: calc(var(--font-size-small) + 18px);\n font-weight: 600;\n letter-spacing: normal;\n background-color: var(--bg2);\n vertical-align: bottom;\n border-bottom: 1px solid var(--light-border-color);\n}\n\n.m-table > tbody > tr > td,\n.m-table > tr > td {\n border-top: 1px solid var(--light-border-color);\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.table-title {\n font-size: 16px;\n font-weight: 400;\n line-height: 18px;\n}\n`;\n","import { css } from 'lit';\n\nexport default css`\n.only-large-screen { display:none; }\n.endpoint-head .path{\n display: flex;\n font-family:var(--font-mono);\n font-size: var(--font-size-small);\n align-items: center;\n overflow-wrap: break-word;\n word-break: break-all;\n}\n\n.endpoint-head .descr {\n font-size: var(--font-size-small);\n color:var(--light-fg);\n font-weight:400;\n align-items: center;\n overflow-wrap: break-word;\n word-break: break-all;\n display:none;\n}\n\n.m-endpoint.expanded{margin-bottom:16px; }\n.m-endpoint > .endpoint-head{\n border-width:1px 1px 1px 5px;\n border-style:solid;\n border-color:transparent;\n border-top-color:var(--light-border-color);\n display:flex;\n padding:6px 16px;\n align-items: center;\n cursor: pointer;\n}\n.m-endpoint > .endpoint-head.put:hover,\n.m-endpoint > .endpoint-head.put.expanded{\n color:var(--put-color); \n background-color:var(--put-bg-color);\n border-color:var(--put-border-color);\n}\n.m-endpoint > .endpoint-head.post:hover,\n.m-endpoint > .endpoint-head.post.expanded {\n color:var(--post-color);\n background-color:var(--post-bg-color);\n border-color:var(--post-border-color);\n}\n.m-endpoint > .endpoint-head.get:hover,\n.m-endpoint > .endpoint-head.get.expanded {\n color:var(--get-color); \n background-color:var(--get-bg-color);\n border-color:var(--get-border-color);\n}\n.m-endpoint > .endpoint-head.patch:hover,\n.m-endpoint > .endpoint-head.patch.expanded {\n color:var(--patch-color); \n background-color:var(--patch-bg-color);\n border-color:var(--patch-border-color);\n}\n.m-endpoint > .endpoint-head.delete:hover,\n.m-endpoint > .endpoint-head.delete.expanded {\n color:var(--delete-color); \n background-color:var(--delete-bg-color);\n border-color:var(--delete-border-color);\n}\n\n.m-endpoint > .endpoint-head.head:hover,\n.m-endpoint > .endpoint-head.head.expanded,\n.m-endpoint > .endpoint-head.patch:hover,\n.m-endpoint > .endpoint-head.patch.expanded,\n.m-endpoint > .endpoint-head.options:hover,\n.m-endpoint > .endpoint-head.options.expanded {\n border-color:var(--yellow); \n background-color:var(--light-yellow); \n}\n\n.m-endpoint > .endpoint-head.deprecated:hover,\n.m-endpoint > .endpoint-head.deprecated.expanded {\n border-color:var(--border-color); \n filter:opacity(0.6);\n}\n\n.m-endpoint .endpoint-body {\n flex-wrap:wrap;\n padding:16px 0px 0 0px;\n}\n.m-endpoint .endpoint-body.delete{ border-color:var(--delete-border-color); }\n.m-endpoint .endpoint-body.put{ border-color:var(--put-border-color); }\n.m-endpoint .endpoint-body.post{ border-color:var(--post-border-color); }\n.m-endpoint .endpoint-body.get{ border-color:var(--get-border-color); }\n.m-endpoint .endpoint-body.head,\n.m-endpoint .endpoint-body.patch,\n.m-endpoint .endpoint-body.options { \n border-color:var(--yellow); \n}\n\n.m-endpoint .endpoint-body.deprecated{ \n border-color:var(--border-color);\n filter:opacity(0.6);\n}\n\n.endpoint-head .deprecated{\n color: var(--light-fg);\n filter:opacity(0.6);\n}\n\n.summary{\n padding: 24px 16px;\n}\n.summary .title{\n font-size: 28px;\n margin-bottom: 24px;\n word-break: break-all;\n}\n\n.path-description p {\n font-size: 18px;\n line-height: 24px;\n margin: 0;\n}\n\n.endpoint-head .method{\n padding:2px 5px;\n vertical-align: middle;\n font-size:var(--font-size-small);\n height: calc(var(--font-size-small) + 16px);\n line-height: calc(var(--font-size-small) + 8px);\n width: 60px;\n border-radius: 2px;\n display:inline-block;\n text-align: center;\n font-weight: bold;\n text-transform:uppercase;\n margin-right:5px;\n}\n.endpoint-head .method.delete{ border: 2px solid var(--delete-border-color);}\n.endpoint-head .method.put{ border: 2px solid var(--put-border-color); }\n.endpoint-head .method.post{ border: 2px solid var(--post-border-color); }\n.endpoint-head .method.get{ border: 2px solid var(--get-border-color); }\n.endpoint-head .method.get.deprecated{ border: 2px solid var(--border-color); }\n.endpoint-head .method.head,\n.endpoint-head .method.patch,\n.endpoint-head .method.options { \n border: 2px solid var(--yellow); \n}\n\n.req-resp-container {\n display: flex;\n align-items: stretch;\n flex-wrap: wrap;\n flex-direction: column;\n border-top:1px solid var(--light-border-color);\n}\n\n.view-mode-request,\napi-response.view-mode {\n flex:1; \n min-height:100px;\n padding: 0 16px 24px 16px;\n overflow:hidden;\n}\n.view-mode-request {\n border-width: 0;\n border-style:dashed;\n}\n\n.head .view-mode-request,\n.patch .view-mode-request,\n.options .view-mode-request { \n border-color:var(--yellow); \n}\n.put .view-mode-request { \n border-color:var(--put-color); \n}\n.post .view-mode-request { \n border-color:var(--post-color); \n}\n.get .view-mode-request { \n border-color:var(--get-color); \n}\n.delete .view-mode-request { \n border-color:var(--delete-color); \n}\n\nblockquote {\n padding: 20px;\n}\n\nblockquote h3 {\n margin: 0;\n padding: 0;\n}\n\nblockquote.warning {\n border-left: 3px solid #f0ad4e;\n background-color: #fcf8f2;\n}\n\nblockquote.warning h3 {\n color: #f0ad4e;\n}\n\nblockquote.danger {\n border-left: 3px solid #d9534f;\n background-color: #fdf7f7;\n}\n\nblockquote.danger h3 {\n color: #d9534f;\n}\n\nblockquote.info {\n border-left: 3px solid #5bc0de;\n background-color: #e3edf2;\n}\n\nblockquote.info h3 {\n color: #5bc0de;\n}\n\nblockquote.success {\n border-left: 3px solid #50af51;\n background-color: #f3f8f3;\n}\n\nblockquote.success h3 {\n color: #50af51;\n}\n\npre {\n overflow: scroll;\n max-height: 1000px;\n margin-top: 15px!important;\n margin-bottom: 15px!important;\n}\n\ntable {\n border-spacing: 0px;\n border-collapse: collapse;\n}\n\ntable th {\n border: 1px solid #dfe2e5;\n padding: 6px 13px;\n}\n\ntable td {\n border: 1px solid #dfe2e5;\n padding: 6px 13px;\n}\n\n@media only screen and (min-width: 1024px) {\n .only-large-screen { display:block; }\n .endpoint-head .path{\n font-size: var(--font-size-regular);\n }\n .endpoint-head .descr{\n display: flex;\n }\n .endpoint-head .m-markdown-small,\n .descr .m-markdown-small{\n display:block;\n }\n .req-resp-container{\n flex-direction: var(--layout, row);\n flex-wrap: nowrap;\n }\n api-response.view-mode {\n padding:16px;\n }\n .view-mode-request.row-layout {\n border-width:0 1px 0 0;\n padding:16px;\n }\n .summary{\n padding:24px 16px;\n }\n}\n`;\n","import { css } from 'lit';\n\nexport default css`\ncode[class*=\"language-\"],\npre[class*=\"language-\"] {\n text-align: left;\n white-space: pre;\n word-spacing: normal;\n word-break: normal;\n word-wrap: normal;\n line-height: 1.5;\n tab-size: 2;\n\n -webkit-hyphens: none;\n -moz-hyphens: none;\n -ms-hyphens: none;\n hyphens: none;\n}\n\n/* Code blocks */\npre[class*=\"language-\"] {\n padding: 1em;\n margin: .5em 0;\n overflow: auto;\n}\n\n/* Inline code */\n:not(pre) > code[class*=\"language-\"] {\n white-space: normal;\n}\n\n.token.comment,\n.token.block-comment,\n.token.prolog,\n.token.doctype,\n.token.cdata {\n color: var(--light-fg)\n}\n\n.token.punctuation {\n color: var(--fg);\n}\n\n.token.tag,\n.token.attr-name,\n.token.namespace,\n.token.deleted {\n color:var(--pink);\n}\n\n.token.function-name {\n color: var(--rebel-pink);\n}\n\n.token.boolean,\n.token.number{\n color: var(--red);\n}\n\n.token.function {\n color: #2953B2;\n}\n\n.token.property,\n.token.class-name,\n.token.constant,\n.token.symbol {\n color: var(--code-property-color);\n}\n\n.token.selector,\n.token.important,\n.token.atrule,\n.token.keyword,\n.token.builtin {\n color: var(--code-keyword-color);\n}\n\n.token.string,\n.token.char,\n.token.attr-value,\n.token.regex,\n.token.variable { \n color: var(--green);\n}\n\n.token.operator,\n.token.entity,\n.token.url {\n color: var(--code-operator-color);\n}\n\n.token.important,\n.token.bold {\n font-weight: bold;\n}\n.token.italic {\n font-style: italic;\n}\n\n.token.entity {\n cursor: help;\n}\n\n.token.inserted {\n color: green;\n}\n`;\n","import { css } from 'lit';\n\nexport default css`\n.tab-panel {\n border: none;\n}\n.tab-buttons {\n height:30px;\n padding: 4px 4px 0 4px;\n border-bottom: 1px solid var(--light-border-color) ;\n align-items: stretch;\n overflow-y: hidden;\n overflow-x: auto;\n scrollbar-width: thin;\n}\n.tab-buttons::-webkit-scrollbar {\n height: 1px;\n background-color: var(--border-color);\n}\n.tab-btn {\n border: none;\n border-bottom: 1px solid transparent; \n color: var(--light-fg);\n background-color: transparent;\n white-space: nowrap;\n cursor:pointer;\n outline:none;\n font-family:var(--font-regular); \n width:100%;\n font-weight: bold;\n font-size: 16px;\n}\n.tab-btn.active {\n border-bottom: 1px solid #D71D55; \n font-weight:bold;\n color:#D71D55;\n}\n\n.tab-btn:hover {\n color:#c81e51;\n}\n.tab-content {\n margin:16px 0 0 0;\n position:relative;\n min-height: 50px;\n}\n`;\n","import { css } from 'lit';\n\nexport default css`\n.nav-bar-info:focus-visible,\n.nav-bar-tag:focus-visible,\n.nav-bar-path:focus-visible {\n outline: 1px solid;\n box-shadow: none;\n outline-offset: -4px;\n}\n.nav-bar-expand-all:focus-visible,\n.nav-bar-collapse-all:focus-visible,\n.nav-bar-tag-icon:focus-visible {\n outline: 1px solid;\n box-shadow: none;\n outline-offset: 2px;\n}\n.nav-bar {\n width:0;\n height:100%;\n overflow: hidden;\n color:var(--nav-text-color);\n background-color: var(--nav-bg-color);\n background-blend-mode: multiply;\n line-height: calc(var(--font-size-small) + 4px);\n display:none;\n position:relative;\n flex-direction:column;\n flex-wrap:nowrap;\n word-break:break-word;\n}\n::slotted([slot=nav-logo]){\n padding:16px 16px 0 16px;\n}\n.nav-scroll {\n overflow-x: hidden;\n overflow-y: auto;\n overflow-y: overlay;\n scrollbar-width: thin;\n scrollbar-color: var(--nav-hover-bg-color) transparent;\n}\n\n.nav-bar-tag {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-direction: row;\n}\n.nav-bar.read .nav-bar-tag-icon {\n display:none;\n}\n.nav-bar-paths-under-tag {\n overflow:hidden;\n transition: max-height .2s ease-out, visibility .3s;\n}\n.collapsed .nav-bar-paths-under-tag {\n visibility: hidden;\n}\n\n.nav-bar-expand-all {\n transform: rotate(90deg); \n cursor:pointer; \n margin-right:10px;\n}\n.nav-bar-collapse-all {\n transform: rotate(270deg); \n cursor:pointer;\n}\n.nav-bar-expand-all:hover, .nav-bar-collapse-all:hover {\n color: var(--primary-color);\n}\n\n.nav-bar-tag-icon {\n color: var(--nav-text-color);\n font-size: 20px; \n}\n.nav-bar-tag-icon:hover {\n color:var(--nav-hover-text-color);\n}\n.nav-bar.focused .nav-bar-tag-and-paths.collapsed .nav-bar-tag-icon::after {\n content: '⌵';\n width:16px;\n height:16px;\n text-align: center;\n display: inline-block;\n transform: rotate(-90deg);\n transition: transform 0.2s ease-out 0s;\n}\n.nav-bar.focused .nav-bar-tag-and-paths.expanded .nav-bar-tag-icon::after {\n content: '⌵';\n width:16px;\n height:16px;\n text-align: center;\n display: inline-block;\n transition: transform 0.2s ease-out 0s;\n}\n.nav-scroll::-webkit-scrollbar {\n width: var(--scroll-bar-width, 8px);\n}\n.nav-scroll::-webkit-scrollbar-track {\n background:transparent;\n}\n.nav-scroll::-webkit-scrollbar-thumb {\n background-color: var(--nav-hover-bg-color);\n}\n\n.nav-bar-tag {\n font-size: var(--font-size-regular);\n color: var(--nav-accent-color);\n border-left:4px solid transparent;\n font-weight:bold;\n padding: 15px 15px 15px 10px;\n text-transform: capitalize;\n}\n\n.nav-bar-components,\n.nav-bar-h1,\n.nav-bar-h2,\n.nav-bar-info,\n.nav-bar-tag,\n.nav-bar-path {\n display:flex;\n cursor: pointer;\n width: 100%;\n border: none;\n border-radius:4px; \n color: var(--nav-text-color);\n background: transparent;\n border-left:4px solid transparent;\n}\n\n.nav-bar-h1,\n.nav-bar-h2,\n.nav-bar-path {\n font-size: calc(var(--font-size-small) + 1px);\n padding: var(--nav-item-padding);\n}\n.nav-bar-path.small-font {\n font-size: var(--font-size-small);\n}\n\n.nav-bar-info {\n font-size: var(--font-size-regular);\n padding: 16px 10px;\n font-weight:bold;\n}\n.nav-bar-section {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n font-size: var(--font-size-small);\n color: var(--nav-text-color);\n padding: var(--nav-item-padding);\n font-weight:bold;\n}\n.nav-bar-section.operations {\n cursor:pointer;\n}\n.nav-bar-section.operations:hover {\n color:var(--nav-hover-text-color);\n background-color:var(--nav-hover-bg-color);\n}\n\n.nav-bar-section:first-child {\n display: none;\n}\n.nav-bar-h2 {margin-left:12px;}\n\n.nav-bar-h1.left-bar.active,\n.nav-bar-h2.left-bar.active,\n.nav-bar-info.left-bar.active,\n.nav-bar-tag.left-bar.active,\n.nav-bar-path.left-bar.active,\n.nav-bar-section.left-bar.operations.active {\n border-left:4px solid var(--nav-accent-color);\n color:var(--nav-hover-text-color);\n}\n\n.nav-bar-h1.colored-block.active,\n.nav-bar-h2.colored-block.active,\n.nav-bar-info.colored-block.active,\n.nav-bar-tag.colored-block.active,\n.nav-bar-path.colored-block.active,\n.nav-bar-section.colored-block.operations.active {\n background-color: var(--nav-accent-color);\n color: var(--nav-accent-text-color);\n border-radius: 0;\n}\n\n.nav-bar-h1:hover,\n.nav-bar-h2:hover,\n.nav-bar-info:hover,\n.nav-bar-tag:hover,\n.nav-bar-path:hover {\n color:var(--nav-hover-text-color);\n background-color:var(--nav-hover-bg-color);\n}\n`;\n","import { css } from 'lit';\n\nexport default css`\n#api-info {\n font-size: calc(var(--font-size-regular) - 1px);\n margin-top: 8px;\n}\n\n#api-info span:before {\n content: \"|\";\n display: inline-block;\n opacity: 0.5;\n width: 15px;\n text-align: center;\n}\n#api-info span:first-child:before {\n content: \"\";\n width: 0px;\n}\n`;\n","import { css } from 'lit';\n\n/*\nThis file is reserved for any custom css that developers want to add to\ncustomize their theme. Simply add your css to this file and yarn build.\n*/\n\nexport default css`\n.code-container {\n padding-inline: 32px;\n padding-top: 16px;\n}\n.code-container > code {\n font-size: 14px;\n line-height: 20px;\n}\n\n.request-card {\n border: 1px solid #CCCED8;\n border-radius: 4px;\n padding-block: 24px;\n margin-top: 24px;\n}\n\n.request-title-container {\n margin-left: 16px;\n}\n\n.request-title {\n margin-bottom: 8px;\n font-size: 18px;\n font-weight: 400;\n line-height: 18px;\n color: #4A4A4A;\n}\n\n.label-operation-container {\n text-align: left;\n direction: ltr;\n padding: 8px 0;\n color: var(--fg3);\n display: flex;\n width: 100%;\n overflow: hidden;\n}\n\n.label-operation-path-container {\n display: inline-flex;\n flex-direction: row;\n flex-grow: 1;\n justify-content: space-between;\n align-items: stretch;\n width: auto;\n height: 28px;\n left: 0;\n top: 0;\n border: 1px solid var(--border-color);\n border-radius: 0px 4px 4px 0px;\n margin: 4px 0px;\n flex-wrap: nowrap;\n overflow-x: auto;\n position: relative;\n scrollbar-color: transparent transparent;\n}\n\n.label-operation-path-container::-webkit-scrollbar {\n display: none;\n}\n\n.label-operation-path-item {\n flex: 0 0 auto;\n}\n\n.label-operation-method-container {\n display: inline-flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n padding: 4px 8px;\n width: auto;\n height: 28px;\n left: 0;\n top: 0;\n border-width: 1px 0px 1px 1px;\n border-style: solid;\n border-radius: 4px 0px 0px 4px;\n margin: 4px 0px;\n text-transform: uppercase;\n}\n\n.right-box-title {\n color: #4A4A4A;\n font-size: 18px;\n line-height: 20px;\n font-weight: 400;\n}\n\n.right-box-container {\n margin-top: 16px;\n}\n\n.right-box-label {\n color: var(--fg2);\n margin-bottom: 4px;\n font-size: 14px;\n font-weight: 400;\n}\n\n.right-box-input {\n width: 100%;\n height: 44px;\n}\n\n.server-template {\n position: relative;\n}\n\n.server-template-vars {\n position: absolute;\n top: calc(100% + 2px);\n \n background-color: var(--bg);\n\n border: 1px solid rgb(204, 206, 216);\n border-radius: 4px;\n box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.1);\n \n z-index: 1;\n\n max-height: 300px;\n max-width: 100%;\n}\n\n.server-vars {\n padding: 10px 10px 0px 10px;\n overflow-x: hidden;\n overflow-y: auto;\n}\n\n.language-picker {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n\n padding: 16px 0px;\n gap: 5px;\n}\n\n.language-picker-buttons {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 5px;\n}\n\n.square-language-button {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 4px;\n gap: 5px;\n\n width: max-content;\n min-width: 50px;\n height: 50px;\n\n flex: none;\n order: 1;\n flex-grow: 0;\n\n background-color: rgba(0, 0, 0, 0);\n border: 1px solid rgba(0, 0, 0, 0);\n border-radius: 4px;\n\n color: var(--fg2);\n font-style: normal;\n font-weight: 400;\n font-size: 12px;\n line-height: 16px;\n\n cursor: pointer;\n}\n\n.square-language-button:hover {\n border: 1px solid rgb(59, 59, 59);\n}\n\n.square-language-button:active {\n border-color: rgb(59, 59, 59);\n box-shadow: rgb(255 255 255) 0px 0px 0px 1px, rgb(185 185 185) 0px 0px 0px 3px;\n}\n\n.rectangle-language-button {\n display: flex;\n gap: 5px;\n\n width: 100%;\n text-align: left;\n\n background-color: rgba(0, 0, 0, 0);\n border: 1px solid rgba(0, 0, 0, 0);\n border-radius: 0px;\n padding: 6px 6px;\n\n color: var(--fg2);\n cursor: pointer;\n}\n\n.rectangle-language-button:hover {\n background-color: rgb(248, 247, 252);\n}\n\n.rectangle-language-button:active {\n background-color: rgb(204, 206, 216);\n}\n\n.selected-language {\n border: 1px solid rgb(204, 206, 216);\n}\n\n.language-show-more {\n height: 30px;\n width: 30px;\n padding: 4px;\n\n border: 1px solid rgba(0, 0, 0, 0);\n border-radius: 4px;\n\n cursor: pointer;\n}\n\n.language-show-more:hover {\n border: 1px solid rgb(59, 59, 59);\n}\n\n.data-example{\n background: #FFF3F6;\n border: 1px solid #FFE0EF;\n border-radius: 4px;\n font-family: var(--font-mono);\n font-size: var(--font-size-small);\n width: max-content;\n padding: 0.2em 0.4em;\n}\n\n.data-example:hover{\n border: 1px solid #ffb5cb;\n}\n\n.language-show-more:active {\n border-color: rgb(59, 59, 59);\n box-shadow: rgb(255 255 255) 0px 0px 0px 1px, rgb(185 185 185) 0px 0px 0px 3px;\n}\n\n.more-languages-dropdown {\n position: absolute;\n top: 105%;\n right: 0%;\n min-width: 140px;\n\n background-color: var(--bg);\n\n border: 1px solid rgb(204, 206, 216);\n border-radius: 4px;\n box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.1);\n \n z-index: 1;\n\n transition: visibility 0.3s linear,opacity 0.3s linear;\n}\n`;\n","/* eslint-disable arrow-body-style */\nimport { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport updateCodeExample from '../utils/update-code-example';\n\nconst codeVerifier = '731DB1C3F7EA533B85E29492D26AA-1234567890-1234567890';\nconst codeChallenge = '4FatVDBJKPAo4JgLLaaQFMUcQPn5CrPRvLlaob9PTYc'; // Base64 encoded SHA-256\n\nconst localStorageKey = 'rapidoc';\n\nexport function applyApiKey(securitySchemeId, username = '', password = '', providedApikeyVal = '') {\n const securityObj = this.resolvedSpec.securitySchemes?.find((v) => (v.securitySchemeId === securitySchemeId));\n if (!securityObj) {\n return false;\n }\n let finalApiKeyValue = '';\n if (securityObj.scheme?.toLowerCase() === 'basic') {\n if (username) {\n finalApiKeyValue = `Basic ${Buffer.from(`${username}:${password}`, 'utf8').toString('base64')}`;\n }\n } else if (providedApikeyVal) {\n securityObj.value = providedApikeyVal;\n finalApiKeyValue = `${securityObj.scheme?.toLowerCase() === 'bearer' ? 'Bearer ' : ''}${providedApikeyVal}`;\n }\n if (finalApiKeyValue) {\n securityObj.finalKeyValue = finalApiKeyValue;\n this.requestUpdate();\n return true;\n }\n return false;\n}\n\nexport function onClearAllApiKeys() {\n this.resolvedSpec.securitySchemes?.forEach((v) => {\n v.user = '';\n v.password = '';\n v.value = '';\n v.finalKeyValue = '';\n });\n this.requestUpdate();\n}\n\nfunction getPersistedApiKeys() {\n return JSON.parse(localStorage.getItem(localStorageKey)) || {};\n}\n\nfunction setPersistedApiKeys(obj) {\n localStorage.setItem(localStorageKey, JSON.stringify(obj));\n}\n\nexport function recoverPersistedApiKeys() {\n const rapidocLs = getPersistedApiKeys.call(this);\n Object.values(rapidocLs).forEach((p) => {\n applyApiKey.call(this, p.securitySchemeId, p.username, p.password, p.value);\n });\n}\n\nfunction onApiKeyChange(securitySchemeId) {\n let apiKeyValue = '';\n const securityObj = this.resolvedSpec.securitySchemes.find((v) => (v.securitySchemeId === securitySchemeId));\n if (securityObj) {\n const trEl = this.shadowRoot.getElementById(`security-scheme-${securitySchemeId}`);\n if (trEl) {\n if (securityObj.type && securityObj.scheme && securityObj.type === 'http' && securityObj.scheme.toLowerCase() === 'basic') {\n const userVal = trEl.querySelector('.api-key-user').value.trim();\n const passwordVal = trEl.querySelector('.api-key-password').value.trim();\n applyApiKey.call(this, securitySchemeId, userVal, passwordVal);\n } else {\n apiKeyValue = trEl.querySelector('.api-key-input').value.trim();\n applyApiKey.call(this, securitySchemeId, '', '', apiKeyValue);\n }\n if (this.persistAuth === 'true') {\n const rapidocLs = getPersistedApiKeys.call(this);\n rapidocLs[securitySchemeId] = securityObj;\n setPersistedApiKeys.call(this, rapidocLs);\n }\n }\n }\n}\n\n// Updates the OAuth Access Token (API key), so it reflects in UI and gets used in TRY calls\nfunction updateOAuthKey(securitySchemeId, accessToken, tokenType = 'Bearer') {\n const securityObj = this.resolvedSpec.securitySchemes.find((v) => (v.securitySchemeId === securitySchemeId));\n securityObj.finalKeyValue = `${(tokenType.toLowerCase() === 'bearer' ? 'Bearer' : (tokenType.toLowerCase() === 'mac' ? 'MAC' : tokenType))} ${accessToken}`;\n this.requestUpdate();\n}\n\n/* eslint-disable no-console */\n// Gets Access-Token in exchange of Authorization Code\nasync function fetchAccessToken(tokenUrl, clientId, clientSecret, redirectUrl, grantType, authCode, securitySchemeId, authFlowDivEl, sendClientSecretIn = 'header', scopes = null, username = null, password = null) {\n const respDisplayEl = authFlowDivEl ? authFlowDivEl.querySelector('.oauth-resp-display') : undefined;\n const urlFormParams = new URLSearchParams();\n const headers = new Headers();\n urlFormParams.append('grant_type', grantType);\n if (grantType === 'authorization_code') {\n urlFormParams.append('client_id', clientId);\n urlFormParams.append('client_secret', clientSecret);\n }\n if (grantType !== 'client_credentials' && grantType !== 'password') {\n urlFormParams.append('redirect_uri', redirectUrl);\n }\n if (authCode) {\n urlFormParams.append('code', authCode);\n urlFormParams.append('code_verifier', codeVerifier); // for PKCE\n }\n if (sendClientSecretIn === 'header') {\n headers.set('Authorization', `Basic ${Buffer.from(`${clientId}:${clientSecret}`, 'utf8').toString('base64')}`);\n } else if (grantType !== 'authorization_code') {\n urlFormParams.append('client_id', clientId);\n urlFormParams.append('client_secret', clientSecret);\n }\n if (grantType === 'password') {\n urlFormParams.append('username', username);\n urlFormParams.append('password', password);\n }\n if (scopes) {\n urlFormParams.append('scope', scopes);\n }\n\n try {\n const resp = await fetch(tokenUrl, { method: 'POST', headers, body: urlFormParams });\n const tokenResp = await resp.json();\n if (resp.ok) {\n if (tokenResp.token_type && tokenResp.access_token) {\n updateOAuthKey.call(this, securitySchemeId, tokenResp.access_token, tokenResp.token_type);\n if (respDisplayEl) {\n respDisplayEl.innerHTML = 'Access Token Received';\n }\n return true;\n }\n } else {\n if (respDisplayEl) {\n respDisplayEl.innerHTML = `${tokenResp.error_description || tokenResp.error_description || 'Unable to get access token'}`;\n }\n return false;\n }\n } catch (err) {\n if (respDisplayEl) {\n respDisplayEl.innerHTML = 'Failed to get access token';\n }\n return false;\n }\n}\n\n// Gets invoked when it receives the Authorization Code from the other window via message-event\nasync function onWindowMessageEvent(msgEvent, winObj, tokenUrl, clientId, clientSecret, redirectUrl, grantType, sendClientSecretIn, securitySchemeId, authFlowDivEl) {\n sessionStorage.removeItem('winMessageEventActive');\n winObj.close();\n if (msgEvent.data.fake) {\n return;\n }\n if (!msgEvent.data) {\n console.warn('RapiDoc: Received no data with authorization message');\n }\n if (msgEvent.data.error) {\n console.warn('RapiDoc: Error while receiving data');\n }\n if (msgEvent.data) {\n if (msgEvent.data.responseType === 'code') {\n // Authorization Code flow\n fetchAccessToken.call(this, tokenUrl, clientId, clientSecret, redirectUrl, grantType, msgEvent.data.code, securitySchemeId, authFlowDivEl, sendClientSecretIn);\n } else if (msgEvent.data.responseType === 'token') {\n // Implicit flow\n updateOAuthKey.call(this, securitySchemeId, msgEvent.data.access_token, msgEvent.data.token_type);\n }\n }\n}\n\n// code_challenge generator for PKCE flow\n// TODO: Implement dynamic generation of code-challenge based on code-verifier\n/*\nasync function generateCodeChallenge() {\n const encoder = new TextEncoder();\n const data = encoder.encode(codeVerifier);\n const sha256Hash = await window.crypto.subtle.digest('SHA-256', data); // returns Unit8Array\n // const utf8Decoder = new TextDecoder();\n // const b64EncodedSha256 = btoa(utf8Decoder.decode(sha256Hash));\n const b64EncodedSha256 = base64encode(sha256Hash);\n return b64EncodedSha256;\n}\n*/\n\nasync function onInvokeOAuthFlow(securitySchemeId, flowType, authUrl, tokenUrl, e) {\n const authFlowDivEl = e.target.closest('.oauth-flow');\n const clientId = authFlowDivEl.querySelector('.oauth-client-id') ? authFlowDivEl.querySelector('.oauth-client-id').value.trim() : '';\n const clientSecret = authFlowDivEl.querySelector('.oauth-client-secret') ? authFlowDivEl.querySelector('.oauth-client-secret').value.trim() : '';\n const username = authFlowDivEl.querySelector('.api-key-user') ? authFlowDivEl.querySelector('.api-key-user').value.trim() : '';\n const password = authFlowDivEl.querySelector('.api-key-password') ? authFlowDivEl.querySelector('.api-key-password').value.trim() : '';\n const sendClientSecretIn = authFlowDivEl.querySelector('.oauth-send-client-secret-in') ? authFlowDivEl.querySelector('.oauth-send-client-secret-in').value.trim() : 'header';\n const checkedScopeEls = [...authFlowDivEl.querySelectorAll('.scope-checkbox:checked')];\n const pkceCheckboxEl = authFlowDivEl.querySelector(`#${securitySchemeId}-pkce`);\n const state = (`${Math.random().toString(36).slice(2, 9)}random${Math.random().toString(36).slice(2, 9)}`);\n const nonce = (`${Math.random().toString(36).slice(2, 9)}random${Math.random().toString(36).slice(2, 9)}`);\n // const codeChallenge = await generateCodeChallenge(codeVerifier);\n const redirectUrlObj = new URL(`${window.location.origin}${window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'))}/${this.oauthReceiver}`);\n let grantType = '';\n let responseType = '';\n let newWindow;\n\n // clear previous error messages\n const errEls = [...authFlowDivEl.parentNode.querySelectorAll('.oauth-resp-display')];\n errEls.forEach((v) => { v.innerHTML = ''; });\n\n if (flowType === 'authorizationCode' || flowType === 'implicit') {\n const authUrlObj = new URL(authUrl);\n if (flowType === 'authorizationCode') {\n grantType = 'authorization_code';\n responseType = 'code';\n } else if (flowType === 'implicit') {\n responseType = 'token';\n }\n const authCodeParams = new URLSearchParams(authUrlObj.search);\n const selectedScopes = checkedScopeEls.map((v) => v.value).join(' ');\n if (selectedScopes) {\n authCodeParams.set('scope', selectedScopes);\n }\n authCodeParams.set('client_id', clientId);\n authCodeParams.set('redirect_uri', redirectUrlObj.toString());\n authCodeParams.set('response_type', responseType);\n authCodeParams.set('state', state);\n authCodeParams.set('nonce', nonce);\n if (pkceCheckboxEl && pkceCheckboxEl.checked) {\n authCodeParams.set('code_challenge', codeChallenge);\n authCodeParams.set('code_challenge_method', 'S256');\n }\n authCodeParams.set('show_dialog', true);\n authUrlObj.search = authCodeParams.toString();\n // If any older message-event-listener is active then fire a fake message to remove it (these are single time listeners)\n if (sessionStorage.getItem('winMessageEventActive') === 'true') {\n window.postMessage({ fake: true }, this);\n }\n setTimeout(() => {\n newWindow = window.open(authUrlObj.toString());\n if (!newWindow) {\n console.error(`RapiDoc: Unable to open ${authUrlObj.toString()} in a new window`);\n } else {\n sessionStorage.setItem('winMessageEventActive', 'true');\n window.addEventListener(\n 'message',\n (msgEvent) => onWindowMessageEvent.call(this, msgEvent, newWindow, tokenUrl, clientId, clientSecret, redirectUrlObj.toString(), grantType, sendClientSecretIn, securitySchemeId, authFlowDivEl),\n { once: true },\n );\n }\n }, 10);\n } else if (flowType === 'clientCredentials') {\n grantType = 'client_credentials';\n const selectedScopes = checkedScopeEls.map((v) => v.value).join(' ');\n fetchAccessToken.call(this, tokenUrl, clientId, clientSecret, redirectUrlObj.toString(), grantType, '', securitySchemeId, authFlowDivEl, sendClientSecretIn, selectedScopes);\n } else if (flowType === 'password') {\n grantType = 'password';\n const selectedScopes = checkedScopeEls.map((v) => v.value).join(' ');\n fetchAccessToken.call(this, tokenUrl, clientId, clientSecret, redirectUrlObj.toString(), grantType, '', securitySchemeId, authFlowDivEl, sendClientSecretIn, selectedScopes, username, password);\n }\n}\n/* eslint-enable no-console */\n\n/* eslint-disable indent */\n\nfunction oAuthFlowTemplate(flowName, clientId, clientSecret, securitySchemeId, authFlow, defaultScopes = [], receiveTokenIn = 'header') {\n let { authorizationUrl, tokenUrl, refreshUrl } = authFlow;\n const pkceOnly = authFlow['x-pkce-only'] || false;\n const isUrlAbsolute = (url) => (url.indexOf('://') > 0 || url.indexOf('//') === 0);\n // Calculcate base URL\n const url = new URL(this.selectedServer.computedUrl);\n const baseUrl = url.origin;\n\n if (refreshUrl && !isUrlAbsolute(refreshUrl)) {\n refreshUrl = `${baseUrl}/${refreshUrl.replace(/^\\//, '')}`;\n }\n if (tokenUrl && !isUrlAbsolute(tokenUrl)) {\n tokenUrl = `${baseUrl}/${tokenUrl.replace(/^\\//, '')}`;\n }\n if (authorizationUrl && !isUrlAbsolute(authorizationUrl)) {\n authorizationUrl = `${baseUrl}/${authorizationUrl.replace(/^\\//, '')}`;\n }\n let flowNameDisplay;\n if (flowName === 'authorizationCode') {\n flowNameDisplay = 'Authorization Code Flow';\n } else if (flowName === 'clientCredentials') {\n flowNameDisplay = 'Client Credentials Flow';\n } else if (flowName === 'implicit') {\n flowNameDisplay = 'Implicit Flow';\n } else if (flowName === 'password') {\n flowNameDisplay = 'Password Flow';\n } else {\n flowNameDisplay = flowName;\n }\n return html`\n
\n
${flowNameDisplay}
\n ${authorizationUrl\n ? html`
Auth URL ${authorizationUrl}
`\n : ''\n }\n ${tokenUrl\n ? html`
Token URL ${tokenUrl}
`\n : ''\n }\n ${refreshUrl\n ? html`
Refresh URL ${refreshUrl}
`\n : ''\n }\n ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'implicit' || flowName === 'password'\n ? html`\n ${authFlow.scopes\n ? html`\n Scopes \n
\n ${Object.entries(authFlow.scopes).map((scopeAndDescr, index) => html`\n
\n \n \n
\n `)}\n
\n `\n : ''\n }\n ${flowName === 'password'\n ? html`\n
\n \n \n
`\n : ''\n }\n
\n ${flowName === 'authorizationCode'\n ? html`\n
\n \n \n
\n `\n : ''\n }\n \n ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'password'\n ? html`\n \n `\n : ''\n }\n ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'implicit' || flowName === 'password'\n ? html`\n `\n : ''\n }\n
\n
\n `\n : ''\n }\n
\n `;\n}\n\nfunction removeApiKey(securitySchemeId) {\n const securityObj = this.resolvedSpec.securitySchemes?.find((v) => (v.securitySchemeId === securitySchemeId));\n securityObj.user = '';\n securityObj.password = '';\n securityObj.value = '';\n securityObj.finalKeyValue = '';\n if (this.persistAuth === 'true') {\n const rapidocLs = getPersistedApiKeys.call(this);\n delete rapidocLs[securityObj.securitySchemeId];\n setPersistedApiKeys.call(this, rapidocLs);\n }\n this.requestUpdate();\n}\n\nfunction handleApiKeyChange(e, securitySchemeId, apiKey) {\n if (apiKey === '') removeApiKey.call(this, securitySchemeId);\n else onApiKeyChange.call(this, securitySchemeId);\n\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n}\n\nexport default function securitySchemeTemplate() {\n if (!this.resolvedSpec) { return ''; }\n const providedApiKeys = this.resolvedSpec.securitySchemes?.filter((v) => (v.finalKeyValue));\n if (!providedApiKeys) {\n return;\n }\n return html`\n
\n
Header Auth
\n\n ${this.resolvedSpec.securitySchemes && this.resolvedSpec.securitySchemes.length > 0\n ? html`\n
\n ${this.resolvedSpec.securitySchemes.map((v) => html`\n
\n
${v.name}
\n ${v.description\n ? html`\n
\n ${unsafeHTML(marked(v.description || ''))}\n
`\n : ''\n }\n\n ${(v.type.toLowerCase() === 'apikey') || (v.type.toLowerCase() === 'http' && v.scheme.toLowerCase() === 'bearer')\n ? html`\n
\n ${v.in !== 'cookie'\n ? html`\n { handleApiKeyChange.call(this, e, v.securitySchemeId, e.target.value); }}\"\n >`\n : html` cookies cannot be set from here`\n }\n
`\n : ''\n }\n ${v.type.toLowerCase() === 'http' && v.scheme.toLowerCase() === 'basic'\n ? html`\n
\n Send Authorization in header containing the word Basic followed by a space and a base64 encoded string of username:password.\n
\n
\n {\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n }}\n >\n {\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n }}\n >\n \n
`\n : ''\n }\n
\n ${v.type.toLowerCase() === 'oauth2'\n ? html`\n
\n ${Object.keys(v.flows).map((f) => oAuthFlowTemplate.call(this, f, v['x-client-id'], v['x-client-secret'], v.securitySchemeId, v.flows[f], v['x-default-scopes'], v['x-receive-token-in']))}\n
\n `\n : ''\n }\n `)}\n
`\n : ''\n }\n \n \n \n
\n`;\n}\n\nexport function pathSecurityTemplate(pathSecurity) {\n if (this.resolvedSpec.securitySchemes && pathSecurity) {\n const orSecurityKeys1 = [];\n if (Array.isArray(pathSecurity)) {\n if (pathSecurity.length === 0) {\n return '';\n }\n } else {\n return '';\n }\n pathSecurity.forEach((pSecurity) => {\n const andSecurityKeys1 = [];\n const andKeyTypes = [];\n if (Object.keys(pSecurity).length === 0) {\n orSecurityKeys1.push({\n securityTypes: 'None',\n securityDefs: [],\n });\n } else {\n Object.keys(pSecurity).forEach((pathSecurityKey) => {\n let pathScopes = '';\n const s = this.resolvedSpec.securitySchemes.find((ss) => ss.securitySchemeId === pathSecurityKey);\n if (pSecurity[pathSecurityKey] && Array.isArray(pSecurity[pathSecurityKey])) {\n pathScopes = pSecurity[pathSecurityKey].join(', ');\n }\n if (s) {\n andKeyTypes.push(s.typeDisplay);\n andSecurityKeys1.push({ ...s, ...({ scopes: pathScopes }) });\n }\n });\n orSecurityKeys1.push({\n securityTypes: andKeyTypes.length > 1 ? `${andKeyTypes[0]} + ${andKeyTypes.length - 1} more` : andKeyTypes[0],\n securityDefs: andSecurityKeys1,\n });\n }\n });\n return html`
\n
\n \n ${orSecurityKeys1.map((orSecurityItem1, i) => html`\n ${orSecurityItem1.securityTypes\n ? html`\n ${i !== 0 ? html`
OR
` : ''}\n
\n
\n ${this.updateRoute === 'true' && this.allowAuthentication === 'true'\n ? html` ${orSecurityItem1.securityTypes} `\n : html`${orSecurityItem1.securityTypes}`\n }\n
\n
\n ${orSecurityItem1.securityDefs.length > 1 ? html`
Requires all of the following
` : ''}\n
\n ${orSecurityItem1.securityDefs.map((andSecurityItem, j) => {\n const scopeHtml = html`${andSecurityItem.scopes !== ''\n ? html`\n
\n Required scopes:\n
\n
\n ${andSecurityItem.scopes.split(',').map((scope, cnt) => html`${cnt === 0 ? '' : '┃'}${scope}`)}\n
\n
`\n : ''\n }`;\n\n return html`\n ${andSecurityItem.type === 'oauth2'\n ? html`\n
\n ${orSecurityItem1.securityDefs.length > 1\n ? html`${j + 1}.  `\n : 'Needs'\n }\n OAuth Token ${andSecurityItem.securitySchemeId} in Authorization header\n ${scopeHtml}\n
`\n : andSecurityItem.type === 'http'\n ? html`\n
\n ${orSecurityItem1.securityDefs.length > 1 ? html`${j + 1}.  ` : html`Requires`}\n ${andSecurityItem.scheme === 'basic' ? 'Base 64 encoded username:password' : 'Bearer Token'} in Authorization header\n ${scopeHtml}\n
`\n : html`\n
\n ${orSecurityItem1.securityDefs.length > 1 ? html`${j + 1}.  ` : html`Requires`}\n Token in ${andSecurityItem.name} ${andSecurityItem.in}\n ${scopeHtml}\n
`\n }`;\n })}\n
\n
\n
\n `\n : ''\n }\n `)\n }\n
\n `;\n }\n return '';\n}\n\n/* eslint-enable indent */\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\n/* eslint-disable indent */\nexport default function copySymbol() {\nreturn html`\n \n \n \n \n`;\n}\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport Prism from 'prismjs';\nimport { copyToClipboard } from '../utils/common-utils';\nimport copySymbol from '../components/assets/copy-symbol';\n\n/* eslint-disable indent */\nexport default function codeSamplesTemplate(xCodeSamples) {\n return html`\n
CODE SAMPLES
\n
{\n if (!e.target.classList.contains('tab-btn')) { return; }\n const clickedTab = e.target.dataset.tab;\n\n const tabButtons = [...e.currentTarget.querySelectorAll('.tab-btn')];\n const tabContents = [...e.currentTarget.querySelectorAll('.tab-content')];\n tabButtons.forEach((tabBtnEl) => tabBtnEl.classList[tabBtnEl.dataset.tab === clickedTab ? 'add' : 'remove']('active'));\n tabContents.forEach((tabBodyEl) => { tabBodyEl.style.display = (tabBodyEl.dataset.tab === clickedTab ? 'block' : 'none'); });\n }\n }\">\n
\n ${xCodeSamples.map((v, i) => html``)}\n
\n ${xCodeSamples.map((v, i) => html`\n
\n \n
${Prism.languages[v.lang?.toLowerCase()] ? unsafeHTML(Prism.highlight(v.source, Prism.languages[v.lang?.toLowerCase()], v.lang?.toLowerCase())) : v.source}
\n
`)\n }\n
\n `;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\n\n/* eslint-disable indent */\nexport default function callbackTemplate(callbacks) {\n return html`\n
CALLBACKS
\n ${Object.entries(callbacks).map((kv) => html`\n
\n ${kv[0]}\n ${Object.entries(kv[1]).map((pathObj) => html`\n
\n
\n ${Object.entries(pathObj[1]).map((method) => html`\n
\n
\n
\n \n ${method[0]} \n
\n ${pathObj[0]} \n
\n
\n \n\n \n
\n
\n `)}\n
\n
\n `)}\n
\n `)}\n `;\n}\n/* eslint-enable indent */\n","import { css } from 'lit';\n\nconst ShellStyle = css`\n.shell-token.shell-function {\n color: #2953B2;\n}\n\n.shell-token.shell-method {\n color: #4A4A4A;\n}\n\n.shell-token.shell-punctuation {\n color: #4A4A4A;\n}\n\n.shell-token.shell-string {\n color: var(--green);\n}\n\n`;\n\nconst JavascriptStyle = css`\n.node-token.node-builtin {\n color: #4A4A4A;\n}\n\n.node-token.node-keyword {\n color: #2953B2;\n}\n\n.node-token.node-punctuation {\n color: #4A4A4A;\n}\n\n.node-token.node-operator {\n color: #4A4A4A;\n}\n\n.node-token.node-string {\n color: var(--green);\n}\n\n.node-token.node-property {\n color: var(--green);\n}\n`;\n\nconst RubyStyle = css``;\n\nconst PhpStyle = css``;\n\nconst JsonStyle = css`\n.json-token.json-boolean {\n color: #2953B2;\n}\n\n.json-token.json-keyword {\n color: #2953B2;\n}\n\n.json-token.json-punctuation {\n color: #4A4A4A;\n}\n\n.json-token.json-comment {\n color: #4A4A4A;\n}\n\n.json-token.json-string {\n color: var(--green);\n}\n\n.json-token.json-property {\n color: var(--green);\n}\n`;\n\nconst PythonStyle = css`\n.python-token.python-builtin {\n color: #4A4A4A;\n}\n\n.python-token.python-keyword {\n color: #2953B2;\n}\n\n.python-token.python-punctuation {\n color: #4A4A4A;\n}\n\n.python-token.python-string {\n color: var(--green);\n}\n`;\n\nexport default [\n ShellStyle,\n JavascriptStyle,\n RubyStyle,\n PhpStyle,\n PythonStyle,\n JsonStyle,\n];\n","import { LitElement, html, css } from 'lit';\nimport { copyToClipboard } from '../utils/common-utils';\nimport FontStyles from '../styles/font-styles';\nimport BorderStyles from '../styles/border-styles';\nimport InputStyles from '../styles/input-styles';\nimport CustomStyles from '../styles/custom-styles';\nimport copySymbol from './assets/copy-symbol';\n\nexport default class JsonTree extends LitElement {\n static get properties() {\n return {\n data: { type: Object },\n renderStyle: { type: String, attribute: 'render-style' },\n };\n }\n\n static get styles() {\n return [\n FontStyles,\n BorderStyles,\n InputStyles,\n css`\n :host{\n display:flex;\n }\n :where(button, input[type=\"checkbox\"], [tabindex=\"0\"]):focus-visible { box-shadow: var(--focus-shadow); }\n :where(input[type=\"text\"], input[type=\"password\"], select, textarea):focus-visible { border-color: var(--primary-color); }\n .json-tree {\n position: relative;\n font-family: var(--font-mono);\n font-size: var(--font-size-small);\n display:inline-block;\n overflow:hidden;\n word-break: break-all;\n flex:1;\n line-height: calc(var(--font-size-small) + 6px);\n min-height: 40px;\n direction: ltr; \n text-align: left;\n }\n\n .open-bracket {\n display:inline-block;\n padding: 0 20px 0 0;\n cursor:pointer;\n border: 1px solid transparent;\n border-radius:3px;\n }\n .close-bracket {\n border: 1px solid transparent;\n border-radius:3px;\n display:inline-block;\n }\n .open-bracket:hover {\n color:var(--primary-color);\n background-color:var(--hover-color);\n border: 1px solid var(--border-color);\n }\n .open-bracket.expanded:hover ~ .inside-bracket {\n border-left: 1px solid var(--fg3);\n }\n .open-bracket.expanded:hover ~ .close-bracket {\n color:var(--primary-color);\n }\n .inside-bracket {\n padding-left:12px;\n overflow: hidden;\n border-left:1px dotted var(--border-color);\n }\n .open-bracket.collapsed + .inside-bracket,\n .open-bracket.collapsed + .inside-bracket + .close-bracket {\n display:none;\n }\n\n .string{color:var(--green);}\n .number{color:var(--blue);}\n .null{color:var(--red);}\n .boolean{color:var(--purple);}\n .object{color:var(--fg)}\n .toolbar {\n position: absolute;\n top:5px;\n right:6px;\n display:flex;\n padding:2px;\n align-items: center;\n }`,\n CustomStyles,\n ];\n }\n\n /* eslint-disable indent */\n render() {\n return html`\n
\n
\n \n
\n ${this.generateTree(this.data, true)}\n
\n `;\n }\n\n generateTree(data, isLast = false) {\n if (data === null) {\n return html`
null
`;\n }\n if (typeof data === 'object' && (data instanceof Date === false)) {\n const detailType = Array.isArray(data) ? 'array' : 'pure_object';\n if (Object.keys(data).length === 0) {\n return html`${(Array.isArray(data) ? '[ ],' : '{ },')}`;\n }\n return html`\n
${detailType === 'array' ? '[' : '{'}
\n
\n ${Object.keys(data).map((key, i, a) => html`\n
\n ${detailType === 'pure_object' ? html`\"${key}\":` : ''}\n ${this.generateTree(data[key], i === (a.length - 1))}\n
`)\n }\n
\n
${detailType === 'array' ? ']' : '}'}${isLast ? '' : ','}
\n `;\n }\n return (typeof data === 'string' || data instanceof Date)\n ? html`\"${data}\"${isLast ? '' : ','}`\n : html`${data}${isLast ? '' : ','}`;\n }\n /* eslint-enable indent */\n\n toggleExpand(e) {\n const openBracketEl = e.target;\n if (e.target.classList.contains('open-bracket')) {\n if (openBracketEl.classList.contains('expanded')) {\n openBracketEl.classList.replace('expanded', 'collapsed');\n e.target.innerHTML = e.target.classList.contains('array') ? '[...]' : '{...}';\n } else {\n openBracketEl.classList.replace('collapsed', 'expanded');\n e.target.innerHTML = e.target.classList.contains('array') ? '[' : '{';\n }\n }\n }\n}\n// Register the element with the browser\nif (!customElements.get('json-tree')) customElements.define('json-tree', JsonTree);\n","import { LitElement, html, css } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport FontStyles from '../styles/font-styles';\nimport SchemaStyles from '../styles/schema-styles';\nimport BorderStyles from '../styles/border-styles';\nimport CustomStyles from '../styles/custom-styles';\n\nexport default class SchemaTree extends LitElement {\n static get properties() {\n return {\n data: { type: Object },\n schemaExpandLevel: { type: Number, attribute: 'schema-expand-level' },\n schemaDescriptionExpanded: { type: String, attribute: 'schema-description-expanded' },\n allowSchemaDescriptionExpandToggle: { type: String, attribute: 'allow-schema-description-expand-toggle' },\n schemaHideReadOnly: { type: String, attribute: 'schema-hide-read-only' },\n schemaHideWriteOnly: { type: String, attribute: 'schema-hide-write-only' },\n };\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) { this.schemaExpandLevel = 99999; }\n if (!this.schemaDescriptionExpanded || !'true false'.includes(this.schemaDescriptionExpanded)) { this.schemaDescriptionExpanded = 'false'; }\n if (!this.schemaHideReadOnly || !'true false'.includes(this.schemaHideReadOnly)) { this.schemaHideReadOnly = 'true'; }\n if (!this.schemaHideWriteOnly || !'true false'.includes(this.schemaHideWriteOnly)) { this.schemaHideWriteOnly = 'true'; }\n }\n\n static get styles() {\n return [\n FontStyles,\n SchemaStyles,\n BorderStyles,\n css`\n .tree {\n font-size:var(--font-size-small);\n text-align: left;\n direction: ltr;\n line-height:calc(var(--font-size-small) + 6px);\n }\n .tree .tr:hover{\n background-color:var(--hover-color);\n }\n .collapsed-all-descr .tr:not(.expanded-descr) {\n overflow: hidden;\n max-height:calc(var(--font-size-small) + 8px);\n }\n .tree .key {\n max-width: 300px;\n }\n .key.deprecated .key-label {\n color: var(--red);\n }\n .tr.expanded:hover > .td.key > .open-bracket {\n color: var(--primary-color);\n }\n .tr.expanded:hover + .inside-bracket {\n border-left: 1px solid var(--fg3);\n }\n .tr.expanded:hover + .inside-bracket + .close-bracket {\n color: var(--primary-color);\n }\n .inside-bracket.xxx-of-option {\n border-left: 1px solid transparent;\n }\n .open-bracket{\n display:inline-block;\n padding: 0 20px 0 0;\n cursor:pointer;\n border: 1px solid transparent;\n border-radius:3px;\n }\n .open-bracket:hover {\n color:var(--primary-color);\n background-color:var(--hover-color);\n border: 1px solid var(--border-color);\n }\n .close-bracket{\n display:inline-block;\n font-family: var(--font-mono);\n }\n .tr.collapsed + .inside-bracket,\n .tr.collapsed + .inside-bracket + .close-bracket{\n overflow: hidden;\n display:none;\n }\n .inside-bracket.object,\n .inside-bracket.array {\n border-left: 1px dotted var(--border-color);\n }`,\n CustomStyles,\n ];\n }\n\n /* eslint-disable indent */\n render() {\n return html`\n
this.handleAllEvents(e)}\">\n
\n
${this.data?.['::type'] || ''}
\n ${this.allowSchemaDescriptionExpandToggle === 'true'\n ? html`\n
\n
\n ${this.schemaDescriptionExpanded === 'true' ? 'Single line description' : 'Multiline description'}\n
`\n : ''\n }\n
\n ${unsafeHTML(marked(this.data?.['::description'] || ''))}\n ${this.data\n ? html`\n ${this.generateTree(\n this.data['::type'] === 'array' ? this.data['::props'] : this.data,\n this.data['::type'],\n this.data['::array-type'] || '',\n )}`\n : html` Schema not found `\n }\n
\n `;\n }\n\n generateTree(data, dataType = 'object', arrayType = '', key = '', description = '', schemaLevel = 0, indentLevel = 0, readOrWrite = '') {\n if (this.schemaHideReadOnly === 'true') {\n if (dataType === 'array') {\n if (readOrWrite === 'readonly') {\n return;\n }\n }\n if (data?.['::readwrite'] === 'readonly') {\n return;\n }\n }\n if (this.schemaHideWriteOnly === 'true') {\n if (dataType === 'array') {\n if (readOrWrite === 'writeonly') {\n return;\n }\n }\n if (data?.['::readwrite'] === 'writeonly') {\n return;\n }\n }\n\n if (!data) {\n return html`
\n ${key.replace('::OPTION~', '')}\n ${\n dataType === 'array'\n ? html` [ ] `\n : dataType === 'object'\n ? html` { } `\n : html` schema undefined `\n }\n
`;\n }\n if (Object.keys(data).length === 0) {\n return html`${key}:{ }`;\n }\n let keyLabel = '';\n let keyDescr = '';\n if (key.startsWith('::ONE~OF') || key.startsWith('::ANY~OF')) {\n keyLabel = key.replace('::', '').replace('~', ' ');\n } else if (key.startsWith('::OPTION')) {\n const parts = key.split('~');\n [, keyLabel, keyDescr] = parts;\n } else {\n keyLabel = key;\n }\n\n const leftPadding = 12;\n const minFieldColWidth = 400 - (indentLevel * leftPadding);\n let openBracket = '';\n let closeBracket = '';\n const newSchemaLevel = data['::type']?.startsWith('xxx-of') ? schemaLevel : (schemaLevel + 1);\n // const newIndentLevel = dataType === 'xxx-of-option' || data['::type'] === 'xxx-of-option' ? indentLevel : (indentLevel + 1);\n const newIndentLevel = dataType === 'xxx-of-option' || data['::type'] === 'xxx-of-option' || key.startsWith('::OPTION') ? indentLevel : (indentLevel + 1);\n if (data['::type'] === 'object') {\n if (dataType === 'array') {\n if (schemaLevel < this.schemaExpandLevel) {\n openBracket = html`[{`;\n } else {\n openBracket = html`[{...}]`;\n }\n closeBracket = '}]';\n } else {\n if (schemaLevel < this.schemaExpandLevel) {\n openBracket = html`{`;\n } else {\n openBracket = html`{...}`;\n }\n closeBracket = '}';\n }\n } else if (data['::type'] === 'array') {\n if (dataType === 'array') {\n const arrType = arrayType !== 'object' ? arrayType : '';\n if (schemaLevel < this.schemaExpandLevel) {\n openBracket = html`[[ ${arrType} `;\n } else {\n openBracket = html`[[...]]`;\n }\n closeBracket = ']]';\n } else {\n if (schemaLevel < this.schemaExpandLevel) {\n openBracket = html`[`;\n } else {\n openBracket = html`[...]`;\n }\n closeBracket = ']';\n }\n }\n if (typeof data === 'object') {\n return html`\n
\n
\n ${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' || key.startsWith('::OPTION')\n ? html` ${keyLabel}${keyDescr}`\n : keyLabel === '::props' || keyLabel === '::ARRAY~OF'\n ? ''\n : schemaLevel > 0\n ? html`\n ${data['::deprecated'] ? '✗' : ''}\n ${keyLabel.replace(/\\*$/, '')}${keyLabel.endsWith('*') ? html`*` : ''}${readOrWrite === 'readonly' ? html` 🆁` : readOrWrite === 'writeonly' ? html` 🆆` : readOrWrite}:\n `\n : ''\n }\n ${openBracket}\n
\n
${unsafeHTML(marked(description || ''))}
\n
\n
\n ${Array.isArray(data) && data[0]\n ? html`${this.generateTree(data[0], 'xxx-of-option', '', '::ARRAY~OF', '', newSchemaLevel, newIndentLevel, data[0]['::readwrite'])}`\n : html`\n ${Object.keys(data).map((dataKey) => html`\n ${['::title', '::description', '::type', '::props', '::deprecated', '::array-type', '::readwrite', '::dataTypeLabel'].includes(dataKey)\n ? data[dataKey]['::type'] === 'array' || data[dataKey]['::type'] === 'object'\n ? html`${this.generateTree(\n data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey],\n data[dataKey]['::type'],\n data[dataKey]['::array-type'] || '',\n dataKey,\n data[dataKey]['::description'],\n newSchemaLevel,\n newIndentLevel,\n data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '',\n )}`\n : ''\n : html`${this.generateTree(\n data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey],\n data[dataKey]['::type'],\n data[dataKey]['::array-type'] || '',\n dataKey,\n data[dataKey]?.['::description'] || '',\n newSchemaLevel,\n newIndentLevel,\n data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '',\n )}`\n }\n `)}\n `\n }\n
\n ${data['::type'] && data['::type'].includes('xxx-of')\n ? ''\n : html`
${closeBracket}
`\n }\n `;\n }\n\n // For Primitive types and array of Primitives\n // eslint-disable-next-line no-unused-vars\n const [type, primitiveReadOrWrite, constraint, defaultValue, allowedValues, pattern, schemaDescription, schemaTitle, deprecated] = data.split('~|~');\n if (primitiveReadOrWrite === '🆁' && this.schemaHideReadOnly === 'true') {\n return;\n }\n if (primitiveReadOrWrite === '🆆' && this.schemaHideWriteOnly === 'true') {\n return;\n }\n const dataTypeCss = type.replace(/┃.*/g, '').replace(/[^a-zA-Z0-9+]/g, '').substring(0, 4).toLowerCase();\n const descrExpander = `${constraint || defaultValue || allowedValues || pattern ? `` : ''}`;\n let finalReadWriteText = '';\n let finalReadWriteTip = '';\n if (dataType === 'array') {\n if (readOrWrite === 'readonly') {\n finalReadWriteText = '🆁';\n finalReadWriteTip = 'Read-Only';\n } else if (readOrWrite === 'writeonly') {\n finalReadWriteText = '🆆';\n finalReadWriteTip = 'Write-Only';\n }\n } else if (primitiveReadOrWrite === '🆁') {\n finalReadWriteText = '🆁';\n finalReadWriteTip = 'Read-Only';\n } else if (primitiveReadOrWrite === '🆆') {\n finalReadWriteText = '🆆';\n finalReadWriteTip = 'Write-Only';\n }\n\n return html`\n
\n
\n ${deprecated ? html`` : ''}\n ${keyLabel.endsWith('*')\n ? html`${keyLabel.substring(0, keyLabel.length - 1)}*:`\n : key.startsWith('::OPTION')\n ? html`${keyLabel}${keyDescr}`\n : html`${keyLabel}:`\n }\n \n ${dataType === 'array' ? `[${type}]` : `${type}`}\n ${finalReadWriteText}\n \n
\n
\n ${description || schemaTitle || schemaDescription\n ? html`${html`\n ${unsafeHTML(marked(dataType === 'array'\n ? `${descrExpander} ${description}`\n : schemaTitle\n ? `${descrExpander} ${schemaTitle}: ${schemaDescription}`\n : `${descrExpander} ${schemaDescription}`))}\n `\n }`\n : ''\n } \n ${constraint ? html`
Constraints: ${constraint}
` : ''}\n ${defaultValue ? html`
Default: ${defaultValue}
` : ''}\n ${allowedValues ? html`
${type === 'const' ? 'Value' : 'Allowed'}: ${allowedValues}
` : ''}\n ${pattern ? html`
Pattern: ${pattern}
` : ''}\n
\n
\n `;\n }\n /* eslint-enable indent */\n\n handleAllEvents(e) {\n if (e.target.classList.contains('open-bracket')) {\n this.toggleObjectExpand(e);\n } else if (e.target.classList.contains('schema-multiline-toggle')) {\n this.schemaDescriptionExpanded = (this.schemaDescriptionExpanded === 'true' ? 'false' : 'true');\n } else if (e.target.classList.contains('descr-expand-toggle')) {\n const trEl = e.target.closest('.tr');\n if (trEl) {\n trEl.classList.toggle('expanded-descr');\n trEl.style.maxHeight = trEl.scrollHeight;\n }\n }\n }\n\n toggleObjectExpand(e) {\n const rowEl = e.target.closest('.tr');\n if (rowEl.classList.contains('expanded')) {\n rowEl.classList.replace('expanded', 'collapsed');\n e.target.innerHTML = e.target.classList.contains('array-of-object')\n ? '[{...}]'\n : e.target.classList.contains('array-of-array')\n ? '[[...]]'\n : e.target.classList.contains('array')\n ? '[...]'\n : '{...}';\n } else {\n rowEl.classList.replace('collapsed', 'expanded');\n e.target.innerHTML = e.target.classList.contains('array-of-object')\n ? '[{'\n : e.target.classList.contains('array-of-array')\n ? `[[ ${e.target.dataset.arrayType}`\n : e.target.classList.contains('object')\n ? '{'\n : '[';\n }\n }\n}\nif (!customElements.get('schema-tree')) customElements.define('schema-tree', SchemaTree);\n","import { LitElement, html, css } from 'lit';\n\nexport default class TagInput extends LitElement {\n /* eslint-disable indent */\n render() {\n let tagItemTmpl = '';\n if (Array.isArray(this.value)) {\n tagItemTmpl = html`${this.value\n .filter((v) => typeof v === 'string' && v.trim() !== '')\n .map((v) => html`${v}`)\n }`;\n }\n return html`\n
\n ${tagItemTmpl}\n this.afterPaste(e)}\" @keydown=\"${this.afterKeyDown}\" @blur=\"${this.onBlur}\" placeholder=\"${this.placeholder || ''}\">\n
\n `;\n }\n /* eslint-enable indent */\n\n static get properties() {\n return {\n placeholder: { type: String },\n value: { type: Array, attribute: 'value' },\n };\n }\n\n attributeChangedCallback(name, oldVal, newVal) {\n if (name === 'value') {\n if (newVal && oldVal !== newVal) {\n this.value = newVal.split(',').filter((v) => v.trim() !== '');\n }\n }\n super.attributeChangedCallback(name, oldVal, newVal);\n }\n\n afterPaste(e) {\n const clipboardData = e.clipboardData || window.clipboardData;\n const pastedData = clipboardData.getData('Text');\n const pastedArray = pastedData ? pastedData.split(',').filter((v) => v.trim() !== '') : '';\n if (pastedArray) {\n if (Array.isArray(this.value)) {\n this.value = [...this.value, ...pastedArray];\n } else {\n this.value = pastedArray;\n }\n }\n e.preventDefault();\n }\n\n afterKeyDown(e) {\n if (e.keyCode === 13) {\n e.stopPropagation();\n e.preventDefault();\n if (e.target.value) {\n if (Array.isArray(this.value)) {\n this.value = [...this.value, e.target.value];\n } else {\n this.value = [e.target.value];\n }\n e.target.value = '';\n }\n } else if (e.keyCode === 8) {\n if (e.target.value.length === 0) {\n if (Array.isArray(this.value) && this.value.length > 0) {\n this.value.splice(-1);\n this.value = [...this.value];\n }\n }\n }\n }\n\n onBlur(e) {\n if (e.target.value) {\n if (Array.isArray(this.value)) {\n this.value = [...this.value, e.target.value];\n } else {\n this.value = [e.target.value];\n }\n e.target.value = '';\n }\n }\n\n static get styles() {\n return [css`\n .tags {\n display:flex;\n flex-wrap: wrap;\n outline: none;\n padding:0;\n border-radius:var(--border-radius);\n border:1px solid var(--border-color);\n cursor:text;\n overflow:hidden;\n background:var(--input-bg);\n }\n .tag, .editor {\n padding:3px;\n margin:2px;\n }\n .tag{\n border:1px solid var(--border-color);\n background-color:var(--bg3);\n color:var(--fg3);\n border-radius:var(--border-radius);\n word-break: break-all;\n font-size: var(--font-size-small);\n }\n .tag:hover ~ #cursor {\n display: block;\n }\n .editor {\n flex:1;\n border:1px solid transparent;\n color:var(--fg);\n min-width:60px;\n outline: none;\n line-height: inherit;\n font-family:inherit;\n background:transparent;\n font-size: calc(var(--font-size-small) + 1px);\n }\n .editor:focus-visible {\n outline: 1px solid;\n }\n .editor::placeholder {\n color: var(--placeholder-color);\n opacity:1;\n }\n `];\n }\n}\n// Register the element with the browser\nif (!customElements.get('tag-input')) customElements.define('tag-input', TagInput);\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\n/* eslint-disable indent */\nexport default function checkSymbol(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n \n `;\n}\n","import { LitElement, html, css } from 'lit';\n\nimport CustomStyles from '../styles/custom-styles';\nimport cornerArrowSymbol from './assets/corner-arrow-symbol';\n\nexport default class Breadcrumbs extends LitElement {\n static get properties() {\n return {\n headers: { type: Array },\n };\n }\n\n static get styles() {\n return [\n css`\n .container {\n display: flex;\n align-items: center;\n }\n\n .header {\n font-size: 16px;\n font-weight: 400;\n line-height: 18px;\n color: #A1A8B3;\n text-decoration: none;\n }\n\n .header:hover {\n color: #4A596B;\n }\n\n .header:active {\n color: #0C1522;\n }\n\n .caret {\n margin: 0 2px;\n }\n\n .tooltip {\n position: relative;\n display: inline-block;\n }\n\n .tooltip .tooltiptext {\n visibility: hidden;\n width: max-content;\n max-width: 150px;\n padding: 8px;\n\n border-radius: 4px;\n box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.1);\n\n background-color: #FFFFFF;\n color: #A1A8B3;\n \n position: absolute;\n transform: translateX(-50%);\n top: 135%;\n left: 50%;\n z-index: 1;\n }\n\n .tooltip:hover .tooltiptext {\n visibility: visible;\n left: 50%;\n transform: translateX(-50%);\n }\n\n .tooltiptext::after {\n content: \"\";\n position: absolute;\n bottom: 100%;\n left: 50%;\n margin-left: -5px;\n border-width: 5px;\n border-style: solid;\n border-color: transparent transparent #fff transparent;\n }\n\n @media(max-width: 1024px) {\n .header {\n font-size: 12px;\n line-height: 16px;\n }\n }\n `,\n CustomStyles,\n ];\n }\n\n render() {\n let headers = this.headers.map(({ title, link }) => ({\n title: title.slice(0, 25) + (title.length > 25 ? '...' : ''),\n link,\n hasTooltip: (title.length > 25),\n tooltip: [{ title, link }],\n }));\n\n if (headers.length > 3) {\n const ellipsis = headers.slice(1, -1).reduce((acc, curr) => {\n acc.tooltip.push({ title: curr.tooltip[0].title, link: curr.tooltip[0].link });\n return acc;\n }, { title: '...', link: '', hasTooltip: true, tooltip: [] });\n\n headers = [headers[0], ellipsis, headers[headers.length - 1]];\n }\n\n return html`\n
\n ${headers.map((header, index) => html`\n ${index > 0 ? html`\n \n \n \n ` : ''}\n
\n ${header.title}\n ${header.hasTooltip ? html`\n
\n ${header.tooltip.map((content) => html`\n
\n ${header.tooltip.length > 1 ? cornerArrowSymbol() : ''}\n ${content.title}\n
\n `)}\n
` : ''}\n
\n `)}\n
\n `;\n }\n}\n\nif (!customElements.get('bread-crumbs')) customElements.define('bread-crumbs', Breadcrumbs);\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\n/* eslint-disable indent */\nexport default function cornerArrowSymbol(style) {\nreturn html`\n
\n \n \n \n \n
\n`;\n}\n","/* eslint-disable max-len */\nimport { LitElement, html, css } from 'lit';\nimport checkSymbol from './assets/check-symbol';\nimport closeSymbol from './assets/close-symbol';\n\n// eslint-disable-next-line import/prefer-default-export\nexport class Toast extends LitElement {\n static properties = {\n tone: { type: String },\n tones: { type: {} },\n message: { type: String },\n active: { type: Boolean },\n };\n\n constructor(tone, message) {\n super();\n this.active = true;\n this.message = message ?? '';\n this.tone = tone ?? 'positive';\n this.tones = {\n info: {\n borderColor: css`#7CBBEA`,\n bgColor: css`#DEECF7`,\n icon: checkSymbol,\n },\n positive: {\n borderColor: css`#83D187`,\n bgColor: css`#DFF1E0`,\n icon: checkSymbol,\n },\n warning: {\n borderColor: css`#F5AE70`,\n bgColor: css`#FFEBD7`,\n icon: checkSymbol,\n },\n critical: {\n borderColor: css`#F49494`,\n bgColor: css`#F8E3E3`,\n icon: checkSymbol,\n },\n };\n }\n\n firstUpdated() {\n const onFadeOut = (event) => {\n if (this.renderRoot.querySelectorAll('.toast-active').length > 0 && event.animationName === 'fadeOut') {\n this.onClose();\n }\n };\n this.renderRoot.getElementById('toast').addEventListener('animationend', onFadeOut);\n this.renderRoot.getElementById('toast').addEventListener('webkitAnimationEnd', onFadeOut);\n }\n\n onClose() {\n this.active = false;\n const options = {\n detail: 'closed toast',\n bubbles: true,\n composed: true,\n };\n this.dispatchEvent(new CustomEvent('closed-toast', options));\n }\n\n render() {\n return html`\n \n
\n ${this.tones[this.tone].icon({ width: 24, height: 24 })}\n

${this.message}

\n
\n
\n ${closeSymbol({})}\n
\n
\n `;\n }\n\n static get styles() {\n return [\n css`\n .close-button {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n border-radius: 4px;\n padding: 0px;\n width: 44px;\n height: 36px;\n }\n\n .close-button:hover {\n cursor: pointer;\n background-color: rgba(0, 0, 0, 0.05);\n }\n\n .toast-icon-text {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0px 0px 0px 4px;\n gap: 12px;\n width: auto;\n min-height: 40px;\n }\n\n .text {\n overflow-wrap: break-word;\n font-style: normal;\n font-family:var(--font-regular); \n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n display: flex;\n align-items: center;\n letter-spacing: 0.002em;\n color: black;\n margin: 0;\n }\n\n .toast {\n opacity: 0;\n pointer-events: none;\n display: none;\n }\n\n .toast-active {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding: 16px 16px 16px 20px;\n gap: 12px;\n min-width: 16.125rem;\n width: auto;\n border: 1px solid;\n box-shadow: 0px 12px 16px rgba(0, 0, 0, 0.16);\n border-radius: 4px;\n position: fixed;\n overflow: hidden;\n pointer-events: all;\n bottom: 32px;\n right: 50%;\n transform: translateX(50%);\n z-index: 1001;\n -webkit-animation:\n fadeIn .3s ease,\n slideIn .3s ease,\n fadeOut .3s ease 10s forwards;\n animation:\n fadeIn .3s ease,\n slideIn .3s ease,\n fadeOut .3s ease 10s forwards;\n }\n\n @media only screen and (min-width: 768px) {\n .toast-active {\n right: 96px;\n transform: none;\n }\n }\n \n @keyframes slideIn {\n from { transform: translateY(0, 10px) }\n }\n\n @keyframes fadeIn {\n from { opacity: 0 }\n }\n \n @keyframes fadeOut {\n to {\n opacity: 0;\n pointer-events: none;\n display: none;\n }\n }\n\n @-webkit-keyframes slideIn {\n from { transform: translateY(0, 10px) }\n }\n\n @-webkit-keyframes fadeIn {\n from { opacity: 0 }\n }\n \n @-webkit-keyframes fadeOut {\n to {\n opacity: 0;\n pointer-events: none;\n display: none;\n }\n }\n `,\n ];\n }\n}\n\nif (!customElements.get('toast-component')) customElements.define('toast-component', Toast);\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\n/* eslint-disable indent */\nexport default function closeSymbol(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { LitElement, html, css } from 'lit';\n// eslint-disable-next-line import/extensions\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { joinURLandPath } from '../utils/url';\nimport checkSymbol from './assets/check-symbol';\nimport copySymbol from './assets/copy-symbol';\nimport './toast-component';\n\n/* eslint-disable indent */\n// eslint-disable-next-line import/prefer-default-export\nexport class BaseUrl extends LitElement {\n static properties = {\n id: { type: String },\n url: { type: String },\n path: { type: String },\n computedUrl: { type: String },\n copied: { type: Boolean },\n showButton: { type: Boolean },\n showToast: { type: Boolean },\n };\n\n constructor(id, url, path, computedUrl, variables) {\n super();\n this.id = id;\n this.url = url;\n this.path = path;\n this.computedUrl = computedUrl;\n this.variables = variables;\n this.copied = false;\n this.showButton = false;\n this.showToast = false;\n this.addEventListener('closed-toast', () => { this.showToast = false; });\n }\n\n reset() {\n this.copied = false;\n this.showButton = false;\n }\n\n willUpdate(changedProperties) {\n if (changedProperties.has('id')) {\n this.reset();\n }\n }\n\n onButtonClick() {\n navigator.clipboard.writeText(joinURLandPath(this.computedUrl, this.path));\n this.copied = true;\n this.showToast = true;\n }\n\n onTextClick() {\n navigator.clipboard.writeText(joinURLandPath(this.computedUrl, this.path));\n this.showToast = true;\n }\n\n onMouseOver() {\n this.showButton = true;\n }\n\n onMouseLeave() {\n this.showButton = false;\n this.copied = false;\n }\n\n parseURL() {\n if (!this.variables) return this.url;\n\n let { url } = this;\n const spanVar = '{var}';\n\n for (const [key, value] of Object.entries(this.variables)) {\n const regex = new RegExp(`{${key}}`, 'g');\n url = url.replace(regex, spanVar.replace('{var}', value.value));\n }\n\n return joinURLandPath(url, this.path);\n }\n\n render() {\n return html`\n
\n
\n ${html`${unsafeHTML(this.parseURL())}`}\n \n
\n \n
\n ${\n this.showToast\n ? html``\n : ''\n }\n `;\n }\n\n static get styles() {\n return [\n css`\n .svg-container {\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-items: flex-start;\n padding: 0px 8px 0px 0px;\n gap: 10px;\n width: 57px;\n height: 20px;\n background: linear-gradient(270deg, #FFFFFF 51.22%, rgba(255, 255, 255, 0) 104.88%);\n }\n\n .url {\n flex: 1 0 auto;\n padding: 4px 8px;\n font-family: var(--font-mono);\n font-size: var(--font-size-mono)\n }\n\n .url:hover {\n cursor: pointer;\n }\n\n .variable {\n background-color: rgb(248, 247, 252);\n border: 1px solid rgb(204, 206, 216);\n border-radius: 4px;\n padding: 0px 2px;\n }\n\n .container {\n height: 42px;\n font-size:14px;\n border: 1px solid var(--border-color);\n border-radius: 4px;\n margin: 4px 0px;\n position: relative;\n }\n\n .container slot {\n visibility: hidden;\n }\n\n .container:hover slot {\n visibility: visible;\n }\n\n .container::-webkit-scrollbar {\n display: none;\n }\n\n button {\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n cursor: pointer;\n outline: inherit;\n right: 0;\n display: block;\n position: -webkit-sticky;\n position: sticky;\n }\n\n .copy-container {\n width: inherit;\n height: inherit;\n opacity: 0;\n filter: alpha(opacity = 0);\n position: absolute;\n top:0; bottom:0; left:0; right:0;\n display: block;\n z-index: 2;\n background: transparent;\n }\n\n .content-copy-container {\n width: inherit;\n height: inherit;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-wrap: nowrap;\n font-size: 14px;\n white-space: nowrap;\n overflow-y: hidden;\n overflow-x: auto;\n align-items: center;\n }\n\n .content-copy-container::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n\n .content-copy-container::-webkit-scrollbar-track {\n background:var(--input-bg);\n }\n \n .content-copy-container::-webkit-scrollbar-thumb {\n border-radius: 2px;\n background-color: var(--border-color);\n }\n `,\n ];\n }\n}\n\nif (!customElements.get('base-url')) customElements.define('base-url', BaseUrl);\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport '../components/base-url';\nimport updateCodeExample from '../utils/update-code-example';\n\nexport function setApiServer(serverUrl) {\n const serverObj = this.resolvedSpec?.servers.find((s) => s.url === serverUrl);\n if (!serverObj) {\n return false;\n }\n this.selectedServer = serverObj;\n this.requestUpdate();\n this.dispatchEvent(new CustomEvent('api-server-change', {\n bubbles: true,\n composed: true,\n detail: {\n selectedServer: serverObj,\n },\n }));\n return true;\n}\n\nfunction onApiServerVarChange(e, serverObj) {\n const inputEls = [...e.currentTarget.closest('.server-vars').querySelectorAll('input, select')];\n let tempUrl = serverObj.url;\n inputEls.forEach((v) => {\n serverObj.variables[v.dataset.var].value = v.value;\n const regex = new RegExp(`{${v.dataset.var}}`, 'g');\n tempUrl = tempUrl.replace(regex, v.value.trim());\n });\n serverObj.computedUrl = tempUrl;\n\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n\n this.requestUpdate();\n}\n\n/* eslint-disable indent */\nfunction serverVarsTemplate() {\n // const selectedServerObj = this.resolvedSpec.servers.find((v) => (v.url === this.selectedServer));\n return this.selectedServer && this.selectedServer.variables\n ? html`\n
\n ${Object.entries(this.selectedServer.variables).map((kv) => html`\n
\n
${kv[0]}
\n
\n ${kv[1].enum\n ? html`\n { onApiServerVarChange.call(this, e, this.selectedServer); }}\n >\n ${Object.entries(kv[1].enum).map((e) => (kv[1].default === e[1]\n ? html`\n `\n : html`\n `\n ))}\n `\n : html`\n { onApiServerVarChange.call(this, e, this.selectedServer); }}\n />`}\n
\n
\n ${kv[1].description\n ? html`
${unsafeHTML(marked(kv[1].description))}
`\n : ''\n }\n `)}\n
\n `\n : '';\n}\n\nexport default function serverTemplate() {\n if (!this.resolvedSpec || this.resolvedSpec.specLoadError) { return ''; }\n return html`\n
\n Base URL\n
\n ${this.selectedServer?.computedUrl\n ? html`\n \n
\n ${serverVarsTemplate.call(this)}\n
\n
\n
`\n : ''\n }\n
\n `;\n}\n/* eslint-enable indent */\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function cIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function clojureIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function csharpIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function goIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function javaIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function javascriptIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function kotlinIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function nodeIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function objcIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function ocamlIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function phpIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function pythonIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function rIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function rubyIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function shellIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n \n \n \n \n \n \n \n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function swiftIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","import { html } from 'lit';\nimport HTTPSnippet from 'httpsnippet';\nimport languageIcons from '../components/assets/languages/language-icons';\nimport threeDots from '../components/assets/three-dots';\n\nfunction onClickMoreLanguages() {\n this.showMoreLanguages = !this.showMoreLanguages;\n}\n\nfunction onLeaveMoreLanguages() {\n this.showMoreLanguages = false;\n}\n\nfunction moreLanguagesTemplate(numberOfButtons, languages) {\n if (numberOfButtons >= languages.length) return '';\n\n return html`\n
\n
${threeDots()}
\n
\n ${languages.slice(numberOfButtons).map((language) => html`\n { this.selectedLanguage = language.key; this.requestUpdate(); }}\n >\n ${languageIcons[language.key] ? languageIcons[language.key]({ width: 15, height: 15 }) : ''}\n ${language.title}\n \n `)}\n
\n
\n `;\n}\n\nexport default function languagePickerTemplate() {\n const selectedLanguages = ['node', 'shell', 'python'];\n const languages = HTTPSnippet.availableTargets().filter((language) => selectedLanguages.includes(language.key));\n const numberOfButtons = 3;\n\n return html`\n
\n Language\n
\n
\n ${languages.slice(0, numberOfButtons).map((language) => html`\n { this.selectedLanguage = language.key; this.requestUpdate(); }}\n >\n ${languageIcons[language.key] ? languageIcons[language.key]() : ''}\n ${language.title}\n \n `)}\n
\n ${moreLanguagesTemplate.call(this, numberOfButtons, languages)}\n
\n
`;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function threeDots(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","import { LitElement, html, css } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { guard } from 'lit/directives/guard.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport formatXml from 'xml-but-prettier';\nimport Prism from 'prismjs';\nimport TableStyles from '../styles/table-styles';\nimport FlexStyles from '../styles/flex-styles';\nimport InputStyles from '../styles/input-styles';\nimport FontStyles from '../styles/font-styles';\nimport BorderStyles from '../styles/border-styles';\nimport TabStyles from '../styles/tab-styles';\nimport PrismStyles from '../styles/prism-styles';\nimport PrismLanguagesStyles from '../styles/prism-languages-styles';\nimport CustomStyles from '../styles/custom-styles';\nimport { copyToClipboard, downloadResource, viewResource } from '../utils/common-utils';\nimport { schemaInObjectNotation,\n getTypeInfo,\n generateExample,\n normalizeExamples,\n getSchemaFromParam,\n nestExampleIfPresent,\n anyExampleWithSummaryOrDescription } from '../utils/schema-utils';\nimport './json-tree';\nimport './schema-tree';\nimport './tag-input';\nimport './breadcrumbs';\n\nimport serverTemplate from '../templates/server-template';\nimport securitySchemeTemplate from '../templates/security-scheme-template';\nimport languagePickerTemplate from '../templates/language-picker-template';\nimport updateCodeExample from '../utils/update-code-example';\nimport copySymbol from './assets/copy-symbol';\n\nexport default class ApiRequest extends LitElement {\n constructor() {\n super();\n this.resolvedSpec = {};\n this.responseMessage = '';\n this.resultLoad = false;\n this.responseStatus = 'success';\n this.responseHeaders = '';\n this.responseText = '';\n this.responseUrl = '';\n this.codeExample = '';\n this.activeResponseTab = 'response'; // allowed values: response, headers, curl\n this.selectedRequestBodyType = '';\n this.selectedRequestBodyExample = '';\n this.activeParameterSchemaTabs = {};\n this.showCurlBeforeTry = true;\n this.selectedLanguage = 'shell';\n }\n\n static get properties() {\n return {\n schemaShortSummary: { type: String, attribute: 'schema-short-summary' },\n serverUrl: { type: String, attribute: 'server-url' },\n resolvedSpec: { type: Object },\n selectedServer: { type: Object },\n servers: { type: Array },\n method: { type: String },\n path: { type: String },\n security: { type: Array },\n parameters: { type: Array },\n request_body: { type: Object },\n api_keys: { type: Array },\n parser: { type: Object },\n accept: { type: String },\n callback: { type: String },\n webhook: { type: String },\n responseMessage: { type: String, attribute: false },\n responseText: { type: String, attribute: false },\n responseHeaders: { type: String, attribute: false },\n responseStatus: { type: String, attribute: false },\n responseUrl: { type: String, attribute: false },\n codeExample: { type: String, attribute: false },\n fillRequestFieldsWithExample: { type: String, attribute: 'fill-request-fields-with-example' },\n allowTry: { type: String, attribute: 'allow-try' },\n showCurlBeforeTry: { type: String, attribute: 'show-curl-before-try' },\n renderStyle: { type: String, attribute: 'render-style' },\n schemaStyle: { type: String, attribute: 'schema-style' },\n activeSchemaTab: { type: String, attribute: 'active-schema-tab' },\n activeParameterSchemaTabs: {\n type: Object,\n converter: {\n fromAttribute: (attr) => JSON.parse(attr),\n toAttribute: (prop) => JSON.stringify(prop),\n },\n attribute: 'active-parameter-schema-tabs',\n },\n schemaExpandLevel: { type: Number, attribute: 'schema-expand-level' },\n schemaDescriptionExpanded: { type: String, attribute: 'schema-description-expanded' },\n allowSchemaDescriptionExpandToggle: { type: String, attribute: 'allow-schema-description-expand-toggle' },\n schemaHideReadOnly: { type: String, attribute: 'schema-hide-read-only' },\n schemaHideWriteOnly: { type: String, attribute: 'schema-hide-write-only' },\n fetchCredentials: { type: String, attribute: 'fetch-credentials' },\n\n // properties for internal tracking\n activeResponseTab: { type: String }, // internal tracking of response-tab not exposed as a attribute\n selectedRequestBodyType: { type: String, attribute: 'selected-request-body-type' }, // internal tracking of selected request-body type\n selectedRequestBodyExample: { type: String, attribute: 'selected-request-body-example' }, // internal tracking of selected request-body example\n\n selectedLanguage: { type: String },\n\n // open-api file download\n specUrl: { type: String, attribute: 'spec-url' },\n allowSpecFileDownload: { type: String, attribute: 'allow-spec-file-download' },\n };\n }\n\n static get styles() {\n return [\n TableStyles,\n InputStyles,\n FontStyles,\n FlexStyles,\n BorderStyles,\n TabStyles,\n PrismStyles,\n PrismLanguagesStyles,\n css`\n *, *:before, *:after { box-sizing: border-box; }\n :where(button, input[type=\"checkbox\"], [tabindex=\"0\"]):focus-visible { box-shadow: var(--focus-shadow); }\n :where(input[type=\"text\"], input[type=\"password\"], select, textarea):focus-visible { border-color: var(--primary-color); }\n tag-input:focus-within { outline: 1px solid;}\n .read-mode {\n border-top: 1px solid #E7E9EE;\n margin-top: 24px;\n }\n\n .param-name {\n font-size: 14px;\n font-weight: normal;\n line-height: 20px;\n color: #545454; \n margin-block: 24px 4px;\n font-family: var(--font-regular);\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n .param-name.deprecated { \n color: #DC5A41;\n }\n .param-type{\n line-height: 16px;\n color: #4A4A4A; \n font-family: var(--font-mono);\n font-size: var(--font-size-mono);\n }\n\n .param-type > span {\n margin-left: 8px;\n }\n\n .param-constraint{\n min-width:100px;\n }\n .param-constraint:empty{\n display:none;\n }\n\n .param-description {\n font-size: 13px;\n line-height: 18px;\n color: #4A4A4A;\n }\n\n .top-gap{margin-top:24px;}\n\n .textarea {\n min-height:220px; \n padding:5px;\n resize:vertical;\n direction: ltr;\n }\n .example:first-child {\n margin-top: -9px;\n }\n\n .response-message{\n font-weight:bold;\n text-overflow: ellipsis;\n }\n .response-message.error {\n color:var(--red);\n }\n .response-message.success {\n color:var(--blue);\n }\n\n .file-input-container {\n align-items:flex-end;\n }\n .file-input-container .input-set:first-child .file-input-remove-btn{\n visibility:hidden;\n }\n\n .file-input-remove-btn{\n font-size:16px;\n color:var(--red);\n outline: none;\n border: none;\n background:none;\n cursor:pointer;\n }\n\n .v-tab-btn {\n font-size: var(--smal-font-size);\n height:24px; \n border:none; \n background:none; \n opacity: 0.3;\n cursor: pointer;\n padding: 4px 8px;\n }\n .v-tab-btn.active {\n font-weight: bold;\n background: var(--bg);\n opacity: 1;\n }\n\n @media only screen and (min-width: 768px) {\n .textarea {\n padding:8px;\n }\n }\n\n @media only screen and (max-width: 470px) {\n .hide-in-small-screen {\n display:none;\n }\n }\n `,\n CustomStyles,\n ];\n }\n\n render() {\n return html`\n
\n
\n ${guard([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('path'))}\n ${guard([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('query'))}\n ${this.requestBodyTemplate()}\n ${guard([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('header'))}\n ${guard([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('cookie'))}\n ${this.allowTry === 'false' ? '' : html`${this.apiCallTemplate()}`}\n
\n
\n ${languagePickerTemplate.call(this)}\n ${securitySchemeTemplate.call(this)}\n ${serverTemplate.call(this)}\n ${this.apiResponseTabTemplate()}\n
\n
\n `;\n }\n\n async updated() {\n if (this.showCurlBeforeTry === 'true') {\n updateCodeExample.call(this, this.shadowRoot);\n }\n\n // In focused mode after rendering the request component, update the text-areas(which contains examples) using\n // the original values from hidden textareas\n // This is done coz, user may update the dom by editing the textarea's and once the DOM is updated externally change detection wont happen, therefore update the values manually\n\n // if (this.renderStyle === 'focused') {\n // if (changedProperties.size === 1 && changedProperties.has('activeSchemaTab')) {\n // // dont update example as only tabs is switched\n // } else {\n // this.requestUpdate();\n // }\n // }\n\n if (this.webhook === 'true') {\n this.allowTry = 'false';\n }\n }\n\n async saveExampleState() {\n if (this.renderStyle === 'focused') {\n const reqBodyTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea.request-body-param-user-input')];\n reqBodyTextAreaEls.forEach((el) => {\n el.dataset.user_example = el.value;\n });\n const exampleTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea[data-ptype=\"form-data\"]')];\n exampleTextAreaEls.forEach((el) => {\n el.dataset.user_example = el.value;\n });\n this.requestUpdate();\n }\n }\n\n async updateExamplesFromDataAttr() {\n // In focused mode after rendering the request component, update the text-areas(which contains examples) using\n // the original values from hidden textareas\n // This is done coz, user may update the dom by editing the textarea's and once the DOM is updated externally change detection wont happen, therefore update the values manually\n if (this.renderStyle === 'focused') {\n const reqBodyTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea.request-body-param-user-input')];\n reqBodyTextAreaEls.forEach((el) => {\n el.value = el.dataset.user_example || el.dataset.example;\n });\n const exampleTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea[data-ptype=\"form-data\"]')];\n exampleTextAreaEls.forEach((el) => {\n el.value = el.dataset.user_example || el.dataset.example;\n });\n this.requestUpdate();\n }\n }\n\n /* eslint-disable indent */\n renderExample(example, paramType, paramName) {\n return html`\n ${paramType === 'array' ? '[' : ''}\n {\n const inputEl = e.target.closest('.request-card').querySelector(`[data-pname=\"${paramName}\"]`);\n if (inputEl) {\n inputEl.value = e.target.dataset.exampleType === 'array' ? e.target.dataset.example.split('~|~') : e.target.dataset.example;\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n }\n }}\"\n > ${example.printableValue || example.value} \n ${paramType === 'array' ? '] ' : ''}\n `;\n }\n\n renderShortFormatExamples(examples, paramType, paramName) {\n return html`${examples.map((x, i) => html`\n ${i === 0 ? '' : '┃'}\n ${this.renderExample(x, paramType, paramName)}`)}`;\n }\n\n renderLongFormatExamples(exampleList, paramType, paramName) {\n return html`
    \n ${exampleList.map((v) => html`\n
  • \n ${this.renderExample(v, paramType, paramName)}\n ${v.summary?.length > 0 ? html`(${v.summary})` : ''}\n ${v.description?.length > 0 ? html`

    ${unsafeHTML(marked(v.description))}

    ` : ''}\n
  • \n `)}\n
`;\n }\n\n exampleListTemplate(paramName, paramType, exampleList = []) {\n return html` ${\n exampleList.length > 0\n ? html`Example: \n ${anyExampleWithSummaryOrDescription(exampleList)\n ? this.renderLongFormatExamples(exampleList, paramType, paramName)\n : this.renderShortFormatExamples(exampleList, paramType, paramName)}`\n : ''\n }`;\n }\n\n inputParametersTemplate(paramType) {\n const filteredParams = this.parameters ? this.parameters.filter((param) => param.in === paramType) : [];\n if (filteredParams.length === 0) {\n return '';\n }\n let title = '';\n if (paramType === 'path') {\n title = 'Path Params';\n } else if (paramType === 'query') {\n title = 'Query-String Params';\n } else if (paramType === 'header') {\n title = 'Headers';\n } else if (paramType === 'cookie') {\n title = 'Cookies';\n }\n\n const tableRows = [];\n for (const param of filteredParams) {\n const [declaredParamSchema, serializeStyle, mimeTypeElem] = getSchemaFromParam(param);\n if (!declaredParamSchema) {\n continue;\n }\n const paramSchema = getTypeInfo(declaredParamSchema);\n if (!paramSchema) {\n continue; // eslint-disable-line no-continue\n }\n const schemaAsObj = schemaInObjectNotation(declaredParamSchema, {});\n // let exampleVal = '';\n // let exampleList = [];\n let paramStyle = 'form';\n let paramExplode = true;\n let paramAllowReserved = false;\n if (paramType === 'query') {\n if (param.style && 'form spaceDelimited pipeDelimited'.includes(param.style)) {\n paramStyle = param.style;\n } else if (serializeStyle) {\n paramStyle = serializeStyle;\n }\n if (typeof param.explode === 'boolean') {\n paramExplode = param.explode;\n }\n if (typeof param.allowReserved === 'boolean') {\n paramAllowReserved = param.allowReserved;\n }\n }\n // openapi 3.1.0 spec based examples (which must be Object(string : { value:any, summary?: string, description?: string})\n const example = normalizeExamples(\n (param.examples\n || nestExampleIfPresent(param.example)\n || nestExampleIfPresent(mimeTypeElem?.example)\n || mimeTypeElem?.examples\n || nestExampleIfPresent(paramSchema.examples)\n || nestExampleIfPresent(paramSchema.example)\n ),\n paramSchema.type,\n );\n if (!example.exampleVal && paramSchema.type === 'object') {\n example.exampleVal = generateExample(\n declaredParamSchema,\n serializeStyle || 'json',\n '',\n '',\n this.callback === 'true' || this.webhook === 'true' ? true : false, // eslint-disable-line no-unneeded-ternary\n this.callback === 'true' || this.webhook === 'true' ? false : true, // eslint-disable-line no-unneeded-ternary\n true,\n 'text',\n false,\n )[0].exampleValue;\n }\n if (!this.resolvedSpec.securitySchemes.some((e) => e.name === param.name)) {\n tableRows.push(html`\n
\n ${param.name}\n\n
\n ${paramSchema.type === 'array'\n ? `${paramSchema.arrayType}`\n : `${paramSchema.format ? paramSchema.format : paramSchema.type}`\n }\n ${param.deprecated ? html`deprecated` : ''}\n ${param.required ? html`required` : ''}\n
\n
\n\n ${this.allowTry === 'true'\n ? html`\n ${paramSchema.type === 'array'\n ? html`\n \n `\n : paramSchema.type === 'object'\n ? html`\n
\n
{\n if (e.target.tagName.toLowerCase() === 'button') {\n const newState = { ...this.activeParameterSchemaTabs };\n newState[param.name] = e.target.dataset.tab;\n this.activeParameterSchemaTabs = newState;\n }\n }}\">\n \n \n
\n ${this.activeParameterSchemaTabs[param.name] === 'example'\n ? html`
\n \n
`\n : html`\n
\n \n
`\n }\n
`\n : html`\n {\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n }}\n />`\n }`\n : ''\n }\n ${unsafeHTML(marked(param.description || ''))}\n ${this.exampleListTemplate.call(this, param.name, paramSchema.type, example.exampleList)}\n `);\n }\n }\n\n return html`\n
\n
\n
${title}
\n \n \n
\n
\n
\n
\n ${tableRows}\n
\n
\n
`;\n }\n\n // This method is called before navigation change in focused mode\n async beforeNavigationFocusedMode() {\n // this.saveExampleState();\n }\n\n // This method is called after navigation change in focused mode\n async afterNavigationFocusedMode() {\n this.selectedRequestBodyType = '';\n this.selectedRequestBodyExample = '';\n this.updateExamplesFromDataAttr();\n this.clearResponseData();\n }\n\n // Request-Body Event Handlers\n onSelectExample(e) {\n this.selectedRequestBodyExample = e.target.value;\n const exampleDropdownEl = e.target;\n window.setTimeout((selectEl) => {\n const readOnlyExampleEl = selectEl.closest('.example-panel').querySelector('.request-body-param');\n const userInputExampleTextareaEl = selectEl.closest('.example-panel').querySelector('.request-body-param-user-input');\n userInputExampleTextareaEl.value = readOnlyExampleEl.innerText;\n\n const requestPanelEl = this.getRequestPanel({ target: selectEl });\n updateCodeExample.call(this, requestPanelEl);\n }, 0, exampleDropdownEl);\n }\n\n onMimeTypeChange(e) {\n this.selectedRequestBodyType = e.target.value;\n const mimeDropdownEl = e.target;\n this.selectedRequestBodyExample = '';\n window.setTimeout((selectEl) => {\n const readOnlyExampleEl = selectEl.closest('.request-body-container').querySelector('.request-body-param');\n if (readOnlyExampleEl) {\n const userInputExampleTextareaEl = selectEl.closest('.request-body-container').querySelector('.request-body-param-user-input');\n userInputExampleTextareaEl.value = readOnlyExampleEl.innerText;\n }\n }, 0, mimeDropdownEl);\n }\n\n requestBodyTemplate() {\n if (!this.request_body) {\n return '';\n }\n if (Object.keys(this.request_body).length === 0) {\n return '';\n }\n\n // Variable to store partial HTMLs\n let reqBodyTypeSelectorHtml = '';\n let reqBodyFileInputHtml = '';\n let reqBodyFormHtml = '';\n let reqBodySchemaHtml = '';\n let reqBodyExampleHtml = '';\n\n const requestBodyTypes = [];\n const { content } = this.request_body;\n for (const mimeType in content) {\n requestBodyTypes.push({\n mimeType,\n schema: content[mimeType].schema,\n example: content[mimeType].example,\n examples: content[mimeType].examples,\n });\n if (!this.selectedRequestBodyType) {\n this.selectedRequestBodyType = mimeType;\n }\n }\n // MIME Type selector\n reqBodyTypeSelectorHtml = requestBodyTypes.length === 1\n ? ''\n : html`\n \n `;\n\n // For Loop - Main\n requestBodyTypes.forEach((reqBody) => {\n let schemaAsObj;\n let reqBodyExamples = [];\n\n if (this.selectedRequestBodyType.includes('json') || this.selectedRequestBodyType.includes('xml') || this.selectedRequestBodyType.includes('text') || this.selectedRequestBodyType.includes('jose')) {\n // Generate Example\n if (reqBody.mimeType === this.selectedRequestBodyType) {\n reqBodyExamples = generateExample(\n reqBody.schema,\n reqBody.mimeType,\n reqBody.examples,\n reqBody.example,\n this.callback === 'true' || this.webhook === 'true' ? true : false, // eslint-disable-line no-unneeded-ternary\n this.callback === 'true' || this.webhook === 'true' ? false : true, // eslint-disable-line no-unneeded-ternary\n 'text',\n false,\n );\n if (!this.selectedRequestBodyExample) {\n this.selectedRequestBodyExample = (reqBodyExamples.length > 0 ? reqBodyExamples[0].exampleId : '');\n }\n reqBodyExampleHtml = html`\n ${reqBodyExampleHtml}\n
\n ${reqBodyExamples.length === 1\n ? ''\n : html`\n \n `\n }\n ${reqBodyExamples\n .filter((v) => v.exampleId === this.selectedRequestBodyExample)\n .map((v) => html`\n
\n ${v.exampleSummary && v.exampleSummary.length > 80 ? html`
${v.exampleSummary}
` : ''}\n ${v.exampleDescription ? html`
${unsafeHTML(marked(v.exampleDescription || ''))}
` : ''}\n \n
${(v.exampleFormat === 'text' ? v.exampleValue : JSON.stringify(v.exampleValue, null, 2))}
\n\n \n \n
\n `)}\n\n
\n `;\n }\n } else if (this.selectedRequestBodyType.includes('form-urlencoded') || this.selectedRequestBodyType.includes('form-data')) {\n if (reqBody.mimeType === this.selectedRequestBodyType) {\n const ex = generateExample(\n reqBody.schema,\n reqBody.mimeType,\n reqBody.examples,\n reqBody.example,\n this.callback === 'true' || this.webhook === 'true' ? true : false, // eslint-disable-line no-unneeded-ternary\n this.callback === 'true' || this.webhook === 'true' ? false : true, // eslint-disable-line no-unneeded-ternary\n 'text',\n false,\n );\n if (reqBody.schema) {\n reqBodyFormHtml = this.formDataTemplate(reqBody.schema, reqBody.mimeType, (ex[0] ? ex[0].exampleValue : ''));\n }\n }\n } else if ((/^audio\\/|^image\\/|^video\\/|^font\\/|tar$|zip$|7z$|rtf$|msword$|excel$|\\/pdf$|\\/octet-stream$/.test(this.selectedRequestBodyType))) {\n if (reqBody.mimeType === this.selectedRequestBodyType) {\n reqBodyFileInputHtml = html`\n
\n \n
\n `;\n }\n }\n\n // Generate Schema\n if (reqBody.mimeType.includes('json') || reqBody.mimeType.includes('xml') || reqBody.mimeType.includes('text') || this.selectedRequestBodyType.includes('jose')) {\n schemaAsObj = schemaInObjectNotation(reqBody.schema, {});\n if (this.schemaStyle === 'table') {\n reqBodySchemaHtml = html`\n ${reqBodySchemaHtml}\n \n `;\n } else if (this.schemaStyle === 'tree') {\n reqBodySchemaHtml = html`\n ${reqBodySchemaHtml}\n \n `;\n }\n }\n });\n\n return html`\n
\n
\n REQUEST BODY ${this.request_body.required ? html`*` : ''} \n ${this.selectedRequestBodyType}\n \n ${reqBodyTypeSelectorHtml}\n
\n ${this.request_body.description ? html`
${unsafeHTML(marked(this.request_body.description))}
` : ''}\n \n ${(this.selectedRequestBodyType.includes('json') || this.selectedRequestBodyType.includes('xml') || this.selectedRequestBodyType.includes('text') || this.selectedRequestBodyType.includes('jose'))\n ? html`\n
\n
{ if (e.target.tagName.toLowerCase() === 'button') { this.activeSchemaTab = e.target.dataset.tab; } }}\">\n \n \n
\n
${reqBodyExampleHtml}
\n
${reqBodySchemaHtml}
\n
`\n : html` \n ${reqBodyFileInputHtml}\n ${reqBodyFormHtml}`\n }\n
\n `;\n }\n\n formDataParamAsObjectTemplate(fieldName, fieldSchema, mimeType) {\n // This template is used when form-data param should be send as a object (application/json, application/xml)\n const formdataPartSchema = schemaInObjectNotation(fieldSchema, {});\n const formdataPartExample = generateExample(\n fieldSchema,\n 'json',\n fieldSchema.examples,\n fieldSchema.example,\n this.callback === 'true' || this.webhook === 'true' ? true : false, // eslint-disable-line no-unneeded-ternary\n this.callback === 'true' || this.webhook === 'true' ? false : true, // eslint-disable-line no-unneeded-ternary\n 'text',\n false,\n );\n\n return html`\n
\n
\n
{\n if (e.target.classList.contains('v-tab-btn')) {\n const { tab } = e.target.dataset;\n if (tab) {\n const tabPanelEl = e.target.closest('.tab-panel');\n const selectedTabBtnEl = tabPanelEl.querySelector(`.v-tab-btn[data-tab=\"${tab}\"]`);\n const otherTabBtnEl = [...tabPanelEl.querySelectorAll(`.v-tab-btn:not([data-tab=\"${tab}\"])`)];\n const selectedTabContentEl = tabPanelEl.querySelector(`.tab-content[data-tab=\"${tab}\"]`);\n const otherTabContentEl = [...tabPanelEl.querySelectorAll(`.tab-content:not([data-tab=\"${tab}\"])`)];\n selectedTabBtnEl.classList.add('active');\n selectedTabContentEl.style.display = 'block';\n otherTabBtnEl.forEach((el) => { el.classList.remove('active'); });\n otherTabContentEl.forEach((el) => { el.style.display = 'none'; });\n }\n }\n if (e.target.tagName.toLowerCase() === 'button') { this.activeSchemaTab = e.target.dataset.tab; }\n }}\">\n \n \n
\n
\n ${html`\n
\n \n
`\n }\n ${html`\n
\n \n
`\n }\n
\n `;\n }\n\n formDataTemplate(schema, mimeType, exampleValue = '') {\n const formDataTableRows = [];\n if (schema.properties) {\n for (const fieldName in schema.properties) {\n const fieldSchema = schema.properties[fieldName];\n if (fieldSchema.readOnly) {\n continue;\n }\n const fieldExamples = fieldSchema.examples || fieldSchema.example || '';\n const fieldType = fieldSchema.type;\n const paramSchema = getTypeInfo(fieldSchema);\n const labelColWidth = 'read focused'.includes(this.renderStyle) ? '200px' : '160px';\n const example = normalizeExamples((paramSchema.examples || paramSchema.example), paramSchema.type);\n formDataTableRows.push(html`\n \n \n
\n ${fieldName}${(schema.required?.includes(fieldName) || fieldSchema.required) ? html`*` : ''}\n
\n
${paramSchema.type}
\n \n \n ${fieldType === 'array'\n ? fieldSchema.items?.format === 'binary'\n ? html`\n
this.onAddRemoveFileInput(e, fieldName, mimeType)}\">\n
\n \n \n
\n \n
\n `\n : html`\n \n \n `\n : html`\n ${fieldType === 'object'\n ? this.formDataParamAsObjectTemplate.call(this, fieldName, fieldSchema, mimeType)\n : html`\n ${this.allowTry === 'true'\n ? html` {\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n }}\n />`\n : ''\n }\n `\n }`\n }\n \n ${fieldType === 'object'\n ? ''\n : html`\n \n ${paramSchema.default || paramSchema.constrain || paramSchema.allowedValues || paramSchema.pattern\n ? html`\n
\n ${paramSchema.default ? html`Default: ${paramSchema.default}
` : ''}\n ${paramSchema.pattern ? html`Pattern: ${paramSchema.pattern}
` : ''}\n ${paramSchema.constrain ? html`${paramSchema.constrain}
` : ''}\n ${paramSchema.allowedValues && paramSchema.allowedValues.split('┃').map((v, i) => html`\n ${i > 0 ? '┃' : html`Allowed: `}\n ${html`\n {\n const inputEl = e.target.closest('div').querySelector(`[data-pname=\"${fieldName}\"]`);\n if (inputEl) {\n if (e.target.dataset.type === 'array') {\n inputEl.value = [e.target.dataset.enum];\n } else {\n inputEl.value = e.target.dataset.enum;\n }\n\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n }\n }}\"\n > \n ${v} \n `\n }`)\n }\n
`\n : ''\n }\n `\n }\n \n ${fieldType === 'object'\n ? ''\n : html`\n \n \n \n ${unsafeHTML(marked(fieldSchema.description || ''))}\n ${this.exampleListTemplate.call(this, fieldName, paramSchema.type, example.exampleList)}\n \n \n `\n }`);\n }\n return html`\n \n ${formDataTableRows}\n
\n `;\n }\n\n return html`\n \n ${schema.description ? html`${unsafeHTML(marked(schema.description))}` : ''}\n `;\n }\n\n codeExampleTemplate(display = 'flex') {\n return html`\n
\n \n
${unsafeHTML(Prism.highlight(this.codeExample.trim().replace(/\\\\$/, ''), Prism.languages[this.selectedLanguage], this.selectedLanguage))}
\n
\n `;\n }\n\n apiResponseTabTemplate() {\n let responseFormat = '';\n let responseContent = '';\n if (!this.responseIsBlob) {\n if (this.responseHeaders.includes('application/x-ndjson')) {\n responseFormat = 'json';\n const prismLines = this.responseText.split('\\n').map((q) => Prism.highlight(q, Prism.languages[responseFormat], responseFormat)).join('\\n');\n responseContent = html`${unsafeHTML(prismLines)}`;\n } else if (this.responseHeaders.includes('json')) {\n responseFormat = 'json';\n responseContent = html`${unsafeHTML(Prism.highlight(this.responseText, Prism.languages[responseFormat], responseFormat))}`;\n } else if (this.responseHeaders.includes('html') || this.responseHeaders.includes('xml')) {\n responseFormat = 'html';\n responseContent = html`${unsafeHTML(Prism.highlight(this.responseText, Prism.languages[responseFormat], responseFormat))}`;\n } else {\n responseFormat = 'text';\n responseContent = html`${this.responseText}`;\n }\n }\n return html`\n \n
\n ${this.codeExampleTemplate('flex')}\n
\n ${this.responseMessage\n ? html`\n
\n
\n
${this.responseMessage}
\n
`\n : ''\n }\n ${this.responseIsBlob\n ? html`\n
\n \n ${this.responseBlobType === 'view'\n ? html``\n : ''\n }\n
`\n : html`\n ${this.responseText ? html`\n
\n \n
${responseContent}
\n
`\n : ''\n }`\n }\n
\n
`;\n }\n\n apiCallTemplate() {\n let selectServerDropdownHtml = '';\n if (this.servers && this.servers.length > 0) {\n selectServerDropdownHtml = html`\n \n `;\n }\n const selectedServerHtml = html`\n
\n ${selectServerDropdownHtml}\n ${this.serverUrl\n ? html`\n
\n
API Server
\n ${this.serverUrl} \n
\n `\n : ''\n }\n
\n `;\n\n if (!this.resultLoad) {\n this.updateComplete.then(() => {\n const el = this.renderRoot.host.shadowRoot.children[0];\n updateCodeExample.call(this, el.target ? el.target : el);\n });\n this.resultLoad = true;\n } else {\n const el = this.renderRoot.host.shadowRoot.children[0];\n updateCodeExample.call(this, el.target ? el.target : el);\n }\n\n return html`\n
\n
\n
\n ${selectedServerHtml}\n
\n
\n
Authentication
\n ${this.security?.length > 0\n ? html`\n ${this.api_keys.length > 0\n ? html`
\n ${this.api_keys.length === 1\n ? `${this.api_keys[0]?.typeDisplay} in ${this.api_keys[0].in}`\n : `${this.api_keys.length} API keys applied`\n } \n
`\n : html`
Required (None Applied)`\n }`\n : html` Not Required `\n }\n
\n
\n \n
\n `;\n }\n /* eslint-enable indent */\n\n async onFillRequestData(e) {\n const requestPanelEl = e.target.closest('.request-panel');\n const requestPanelInputEls = [...requestPanelEl.querySelectorAll('input, tag-input, textarea:not(.is-hidden)')];\n requestPanelInputEls.forEach((el) => {\n if (el.dataset.example) {\n if (el.tagName.toUpperCase() === 'TAG-INPUT') {\n el.value = el.dataset.example.split('~|~');\n } else {\n el.value = el.dataset.example;\n }\n }\n });\n }\n\n async onClearRequestData(e) {\n const requestPanelEl = e.target.closest('.request-panel');\n const requestPanelInputEls = [...requestPanelEl.querySelectorAll('input, tag-input, textarea:not(.is-hidden)')];\n requestPanelInputEls.forEach((el) => { el.value = ''; });\n }\n\n async onTryClick(e) {\n const tryBtnEl = e.target ? e.target : e;\n\n const { fetchUrl, fetchOptions, reqHeaders } = updateCodeExample.call(this, tryBtnEl);\n const encodedUrl = `/api/proxy/${encodeURIComponent(fetchUrl)}`;\n\n this.responseUrl = '';\n this.responseHeaders = [];\n this.responseStatus = 'success';\n this.responseIsBlob = false;\n\n this.respContentDisposition = '';\n if (this.responseBlobUrl) {\n URL.revokeObjectURL(this.responseBlobUrl);\n this.responseBlobUrl = '';\n }\n if (this.fetchCredentials) {\n fetchOptions.credentials = this.fetchCredentials;\n }\n const controller = new AbortController();\n const { signal } = controller;\n fetchOptions.headers = reqHeaders;\n const tempRequest = { url: encodedUrl, ...fetchOptions };\n this.dispatchEvent(new CustomEvent('before-try', {\n bubbles: true,\n composed: true,\n detail: {\n request: tempRequest,\n controller,\n },\n }));\n const updatedFetchOptions = {\n method: tempRequest.method,\n headers: tempRequest.headers,\n credentials: tempRequest.credentials,\n body: tempRequest.body,\n };\n const fetchRequest = new Request(tempRequest.url, updatedFetchOptions);\n let fetchResponse;\n let responseClone;\n try {\n let respBlob;\n let respJson;\n let respText;\n tryBtnEl.disabled = true;\n this.responseText = '';\n this.responseMessage = '';\n this.requestUpdate();\n const startTime = performance.now();\n fetchResponse = await fetch(fetchRequest, { signal });\n const endTime = performance.now();\n responseClone = fetchResponse.clone(); // create a response clone to allow reading response body again (response.json, response.text etc)\n tryBtnEl.disabled = false;\n this.responseMessage = html`${fetchResponse.statusText ? `${fetchResponse.statusText}:${fetchResponse.status}` : fetchResponse.status}
Took ${Math.round(endTime - startTime)} milliseconds
`;\n this.responseUrl = fetchResponse.url;\n const respHeadersObj = {};\n fetchResponse.headers.forEach((hdrVal, hdr) => {\n respHeadersObj[hdr] = hdrVal;\n this.responseHeaders = `${this.responseHeaders}${hdr}: ${hdrVal}\\n`;\n });\n const contentType = fetchResponse.headers.get('content-type');\n const respEmpty = (await fetchResponse.clone().text()).length === 0;\n if (respEmpty) {\n this.responseText = '';\n } else if (contentType) {\n if (contentType === 'application/x-ndjson') {\n this.responseText = await fetchResponse.text();\n } else if (contentType.includes('json')) {\n if ((/charset=[^\"']+/).test(contentType)) {\n const encoding = contentType.split('charset=')[1];\n const buffer = await fetchResponse.arrayBuffer();\n try {\n respText = new TextDecoder(encoding).decode(buffer);\n } catch {\n respText = new TextDecoder('utf-8').decode(buffer);\n }\n try {\n respJson = JSON.parse(respText);\n this.responseText = JSON.stringify(respJson, null, 2);\n } catch {\n this.responseText = respText;\n }\n } else {\n respJson = await fetchResponse.json();\n this.responseText = JSON.stringify(respJson, null, 2);\n }\n // eslint-disable-next-line no-useless-escape\n } else if (/^font\\/|tar$|zip$|7z$|rtf$|msword$|excel$|\\/pdf$|\\/octet-stream$|^application\\/vnd\\./.test(contentType)) {\n this.responseIsBlob = true;\n this.responseBlobType = 'download';\n } else if (/^audio|^image|^video/.test(contentType)) {\n this.responseIsBlob = true;\n this.responseBlobType = 'view';\n } else {\n respText = await fetchResponse.text();\n if (contentType.includes('xml')) {\n this.responseText = formatXml(respText, { textNodesOnSameLine: true, indentor: ' ' });\n } else {\n this.responseText = respText;\n }\n }\n if (this.responseIsBlob) {\n const contentDisposition = fetchResponse.headers.get('content-disposition');\n this.respContentDisposition = contentDisposition ? contentDisposition.split('filename=')[1].replace(/\"|'/g, '') : 'filename';\n respBlob = await fetchResponse.blob();\n this.responseBlobUrl = URL.createObjectURL(respBlob);\n }\n } else {\n respText = await fetchResponse.text();\n this.responseText = respText;\n }\n this.dispatchEvent(new CustomEvent('after-try', {\n bubbles: true,\n composed: true,\n detail: {\n request: fetchRequest,\n response: responseClone,\n responseHeaders: respHeadersObj,\n responseBody: respJson || respText || respBlob,\n responseStatus: responseClone.ok,\n },\n }));\n } catch (err) {\n tryBtnEl.disabled = false;\n if (err.name === 'AbortError') {\n this.dispatchEvent(new CustomEvent('request-aborted', {\n bubbles: true,\n composed: true,\n detail: {\n err,\n request: fetchRequest,\n },\n }));\n this.responseMessage = 'Request Aborted';\n this.responseText = 'Request Aborted';\n } else {\n this.dispatchEvent(new CustomEvent('after-try', {\n bubbles: true,\n composed: true,\n detail: {\n err,\n request: fetchRequest,\n },\n }));\n this.responseMessage = `${err.message} (CORS or Network Issue)`;\n }\n }\n this.requestUpdate();\n }\n\n getRequestPanel(e) {\n return e.target.closest('.request-panel');\n }\n\n onAddRemoveFileInput(e, pname, ptype) {\n if (e.target.tagName.toLowerCase() !== 'button') {\n return;\n }\n\n if (e.target.classList.contains('file-input-remove-btn')) {\n // Remove File Input Set\n const el = e.target.closest('.input-set');\n el.remove();\n return;\n }\n const el = e.target.closest('.file-input-container');\n\n // Add File Input Set\n\n // Container\n const newInputContainerEl = document.createElement('div');\n newInputContainerEl.setAttribute('class', 'input-set row');\n\n // File Input\n const newInputEl = document.createElement('input');\n newInputEl.type = 'file';\n newInputEl.style = 'width:200px; margin-top:2px;';\n newInputEl.setAttribute('data-pname', pname);\n newInputEl.setAttribute('data-ptype', ptype.includes('form-urlencode') ? 'form-urlencode' : 'form-data');\n newInputEl.setAttribute('data-array', 'false');\n newInputEl.setAttribute('data-file-array', 'true');\n\n // Remover Button\n const newRemoveBtnEl = document.createElement('button');\n newRemoveBtnEl.setAttribute('class', 'file-input-remove-btn');\n newRemoveBtnEl.innerHTML = '✕';\n\n newInputContainerEl.appendChild(newInputEl);\n newInputContainerEl.appendChild(newRemoveBtnEl);\n el.insertBefore(newInputContainerEl, e.target);\n // el.appendChild(newInputContainerEl);\n }\n\n clearResponseData() {\n this.responseUrl = '';\n this.responseHeaders = '';\n this.responseText = '';\n this.responseStatus = 'success';\n this.responseMessage = '';\n this.responseIsBlob = false;\n this.responseBlobType = '';\n this.respContentDisposition = '';\n if (this.responseBlobUrl) {\n URL.revokeObjectURL(this.responseBlobUrl);\n this.responseBlobUrl = '';\n }\n }\n\n disconnectedCallback() {\n this.codeExample = '';\n // Cleanup ObjectURL for the blob data if this component created one\n if (this.responseBlobUrl) {\n URL.revokeObjectURL(this.responseBlobUrl);\n this.responseBlobUrl = '';\n }\n super.disconnectedCallback();\n }\n}\n\n// Register the element with the browser\nif (!customElements.get('api-request')) customElements.define('api-request', ApiRequest);\n","// Takes a value as input and provides a printable string to replresent null values, spaces, blankstring etc\nexport function getPrintableVal(val) {\n if (val === undefined) {\n return '';\n }\n if (val === null) {\n return 'null';\n }\n if (val === '') {\n return '∅';\n }\n if (typeof val === 'boolean' || typeof val === 'number') {\n return `${val}`;\n }\n if (Array.isArray(val)) {\n return val.map((v) => (v === null ? 'null' : v === '' ? '∅' : v.toString().replace(/^ +| +$/g, (m) => '●'.repeat(m.length)) || '')).join(', ');\n }\n if (typeof val === 'object') {\n const keys = Object.keys(val);\n return `{ ${keys[0]}:${val[keys[0]]}${keys.length > 1 ? ',' : ''} ... }`;\n }\n return val.toString().replace(/^ +| +$/g, (m) => '●'.repeat(m.length)) || '';\n}\n\n/* Generates an schema object containing type and constraint info */\nexport function getTypeInfo(schema) {\n if (!schema) {\n return;\n }\n let dataType = '';\n let constrain = '';\n // let examples;\n\n if (schema.$ref) {\n const n = schema.$ref.lastIndexOf('/');\n const schemaNode = schema.$ref.substring(n + 1);\n dataType = `{recursive: ${schemaNode}} `;\n } else if (schema.type) {\n dataType = Array.isArray(schema.type) ? schema.type.join(schema.length === 2 ? ' or ' : '┃') : schema.type;\n if (schema.format || schema.enum || schema.const) {\n dataType = dataType.replace('string', schema.enum ? 'enum' : schema.const ? 'const' : schema.format);\n }\n if (schema.nullable) {\n dataType += '┃null';\n }\n } else if (schema.const) {\n dataType = 'const';\n } else if (Object.keys(schema).length === 0) {\n dataType = 'any';\n } else {\n dataType = '{missing-type-info}';\n }\n\n const info = {\n type: dataType,\n format: schema.format || '',\n pattern: (schema.pattern && !schema.enum) ? schema.pattern : '',\n readOrWriteOnly: (schema.readOnly ? '🆁' : schema.writeOnly ? '🆆' : ''),\n deprecated: schema.deprecated ? '❌' : '',\n examples: schema.examples || schema.example,\n default: getPrintableVal(schema.default),\n description: schema.description || '',\n constrain: '',\n allowedValues: '',\n arrayType: '',\n html: '',\n };\n\n if (info.type === '{recursive}') {\n info.description = schema.$ref.substring(schema.$ref.lastIndexOf('/') + 1);\n } else if (info.type === '{missing-type-info}' || info.type === 'any') {\n info.description = info.description || '';\n }\n // Set Allowed Values\n info.allowedValues = schema.const\n ? schema.const\n : Array.isArray(schema.enum)\n ? schema.enum.map((v) => (getPrintableVal(v))).join('┃')\n : '';\n\n if (dataType === 'array' && schema.items) {\n const arrayItemType = schema.items?.type;\n const arrayItemDefault = getPrintableVal(schema.items.default);\n\n info.arrayType = `${schema.type} of ${Array.isArray(arrayItemType) ? arrayItemType.join('') : arrayItemType}`;\n info.default = arrayItemDefault;\n info.allowedValues = schema.items.const\n ? schema.const\n : Array.isArray(schema.items?.enum)\n ? schema.items.enum.map((v) => (getPrintableVal(v))).join('┃')\n : '';\n }\n if (dataType.match(/integer|number/g)) {\n if (schema.minimum !== undefined || schema.exclusiveMinimum !== undefined) {\n constrain += schema.minimum !== undefined ? `Min ${schema.minimum}` : `More than ${schema.exclusiveMinimum}`;\n }\n if (schema.maximum !== undefined || schema.exclusiveMaximum !== undefined) {\n constrain += schema.maximum !== undefined ? `${constrain ? '┃' : ''}Max ${schema.maximum}` : `${constrain ? '┃' : ''}Less than ${schema.exclusiveMaximum}`;\n }\n if (schema.multipleOf !== undefined) {\n constrain += `${constrain ? '┃' : ''} multiple of ${schema.multipleOf}`;\n }\n }\n if (dataType.match(/string/g)) {\n if (schema.minLength !== undefined && schema.maxLength !== undefined) {\n constrain += `${constrain ? '┃' : ''}${schema.minLength} to ${schema.maxLength} chars`;\n } else if (schema.minLength !== undefined) {\n constrain += `${constrain ? '┃' : ''}Min ${schema.minLength} chars`;\n } else if (schema.maxLength !== undefined) {\n constrain += `Max ${constrain ? '┃' : ''}${schema.maxLength} chars`;\n }\n }\n info.constrain = constrain;\n info.html = `${info.type}~|~${info.readOrWriteOnly}~|~${info.constrain}~|~${info.default}~|~${info.allowedValues}~|~${info.pattern}~|~${info.description}~|~${schema.title || ''}~|~${info.deprecated ? 'deprecated' : ''}`;\n return info;\n}\n\nexport function nestExampleIfPresent(example) {\n if (typeof example === 'boolean' || typeof example === 'number') {\n return {\n Example: { value: `${example}` },\n };\n }\n if (example === '') {\n return {\n Example: { value: '' },\n };\n }\n return example ? { Example: { value: example } } : example;\n}\n\n/**\n * Normalize example object in the following format (List of object which is used to render example links and fill the input boxes)\n * [{\n * exampleVal : 'value to be rendered on the input control (text-box)',\n * exampleList : [\n * value : '',\n * printableValue: '',\n * summary : '',\n * description : ''\n * ]\n * }]\n * */\nexport function normalizeExamples(examples, dataType = 'string') {\n if (!examples) {\n return {\n exampleVal: '',\n exampleList: [],\n };\n }\n if (examples.constructor === Object) {\n const exampleList = Object.values(examples)\n .filter((v) => (v['x-example-show-value'] !== false))\n .map((v) => ({\n value: (typeof v.value === 'boolean' || typeof v.value === 'number' ? `${v.value}` : (v.value || '')),\n printableValue: getPrintableVal(v.value),\n summary: v.summary || '',\n description: v.description || '',\n }));\n const exampleVal = exampleList.length > 0\n ? exampleList[0].value\n : '';\n return { exampleVal, exampleList };\n }\n\n // This is non-standard way to provide example but will support for now\n if (!Array.isArray(examples)) {\n examples = examples ? [examples] : [];\n }\n\n if (examples.length === 0) {\n return {\n exampleVal: '',\n exampleList: [],\n };\n }\n\n if (dataType === 'array') {\n const [exampleVal] = examples;\n const exampleList = examples.map((v) => ({\n value: v,\n printableValue: getPrintableVal(v),\n }));\n return { exampleVal, exampleList };\n }\n\n const exampleVal = examples[0].toString();\n const exampleList = examples.map((v) => ({\n value: v.toString(),\n printableValue: getPrintableVal(v),\n }));\n return { exampleVal, exampleList };\n}\n\nexport function anyExampleWithSummaryOrDescription(examples) {\n return examples.some((x) => x.summary?.length > 0 || x.description?.length > 0);\n}\n\nexport function getSampleValueByType(schemaObj) {\n const example = schemaObj.examples\n ? schemaObj.examples[0]\n : schemaObj.example === null\n ? null\n : schemaObj.example || undefined;\n if (example === '') { return ''; }\n if (example === null) { return null; }\n if (example === 0) { return 0; }\n if (example === false) { return false; }\n if (example instanceof Date) {\n switch (schemaObj.format.toLowerCase()) {\n case 'date':\n return example.toISOString().split('T')[0];\n case 'time':\n return example.toISOString().split('T')[1];\n default:\n return example.toISOString();\n }\n }\n if (example) { return example; }\n\n if (Object.keys(schemaObj).length === 0) {\n return null;\n }\n if (schemaObj.$ref) {\n // Indicates a Circular ref\n return schemaObj.$ref;\n }\n if (schemaObj.const === false || schemaObj.const === 0 || schemaObj.const === null || schemaObj.const === '') {\n return schemaObj.const;\n }\n if (schemaObj.const) {\n return schemaObj.const;\n }\n const typeValue = Array.isArray(schemaObj.type) ? schemaObj.type[0] : schemaObj.type;\n if (!typeValue) {\n return '?';\n }\n if (typeValue.match(/^integer|^number/g)) {\n const multipleOf = Number.isNaN(Number(schemaObj.multipleOf)) ? undefined : Number(schemaObj.multipleOf);\n const maximum = Number.isNaN(Number(schemaObj.maximum)) ? undefined : Number(schemaObj.maximum);\n const minimumPossibleVal = Number.isNaN(Number(schemaObj.minimum))\n ? Number.isNaN(Number(schemaObj.exclusiveMinimum))\n ? maximum || 0\n : Number(schemaObj.exclusiveMinimum) + (typeValue.startsWith('integer') ? 1 : 0.001)\n : Number(schemaObj.minimum);\n const finalVal = multipleOf\n ? multipleOf >= minimumPossibleVal\n ? multipleOf\n : minimumPossibleVal % multipleOf === 0\n ? minimumPossibleVal\n : Math.ceil(minimumPossibleVal / multipleOf) * multipleOf\n : minimumPossibleVal;\n return finalVal;\n }\n if (typeValue.match(/^boolean/g)) { return false; }\n if (typeValue.match(/^null/g)) { return null; }\n if (typeValue.match(/^string/g)) {\n if (schemaObj.enum) { return schemaObj.enum[0]; }\n if (schemaObj.const) { return schemaObj.const; }\n if (schemaObj.pattern) { return schemaObj.pattern; }\n if (schemaObj.format) {\n const u = `${Date.now().toString(16)}${Math.random().toString(16)}0`.repeat(16);\n switch (schemaObj.format.toLowerCase()) {\n case 'url':\n case 'uri':\n return 'http://example.com';\n case 'date':\n return (new Date(0)).toISOString().split('T')[0];\n case 'time':\n return (new Date(0)).toISOString().split('T')[1];\n case 'date-time':\n return (new Date(0)).toISOString();\n case 'duration':\n return 'P3Y6M4DT12H30M5S'; // P=Period 3-Years 6-Months 4-Days 12-Hours 30-Minutes 5-Seconds\n case 'email':\n case 'idn-email':\n return 'user@example.com';\n case 'hostname':\n case 'idn-hostname':\n return 'www.example.com';\n case 'ipv4':\n return '198.51.100.42';\n case 'ipv6':\n return '2001:0db8:5b96:0000:0000:426f:8e17:642a';\n case 'uuid':\n return [u.substr(0, 8), u.substr(8, 4), `4000-8${u.substr(13, 3)}`, u.substr(16, 12)].join('-');\n default:\n return '';\n }\n } else {\n const minLength = Number.isNaN(schemaObj.minLength) ? undefined : Number(schemaObj.minLength);\n const maxLength = Number.isNaN(schemaObj.maxLength) ? undefined : Number(schemaObj.maxLength);\n const finalLength = minLength || (maxLength > 6 ? 6 : maxLength || undefined);\n return finalLength ? 'A'.repeat(finalLength) : 'string';\n }\n }\n // If type cannot be determined\n return '?';\n}\n\n/*\njson2xml- TestCase\n {\n 'prop1' : 'one',\n 'prop2' : 'two',\n 'prop3' : [ 'a', 'b', 'c' ],\n 'prop4' : {\n 'ob1' : 'val-1',\n 'ob2' : 'val-2'\n }\n }\n \n simple\n \n <0>a\n <1>b\n <2>c\n \n \n val-1\n val-2\n \n \n*/\nexport function json2xml(obj, level = 1) {\n const indent = ' '.repeat(level);\n let xmlText = '';\n if (level === 1 && typeof obj !== 'object') {\n return `\\n${indent}${obj.toString()}`;\n }\n for (const prop in obj) {\n const tagNameOrProp = (obj[prop]['::XML_TAG'] || prop);\n let tagName = '';\n if (Array.isArray(obj[prop])) {\n tagName = tagNameOrProp[0]['::XML_TAG'] || `${prop}`;\n } else {\n tagName = tagNameOrProp;\n }\n if (prop.startsWith('::')) {\n continue;\n }\n if (Array.isArray(obj[prop])) {\n xmlText = `${xmlText}\\n${indent}<${tagName}>${json2xml(obj[prop], level + 1)}\\n${indent}`;\n } else if (typeof obj[prop] === 'object') {\n xmlText = `${xmlText}\\n${indent}<${tagName}>${json2xml(obj[prop], level + 1)}\\n${indent}`;\n } else {\n xmlText = `${xmlText}\\n${indent}<${tagName}>${obj[prop].toString()}`;\n }\n }\n return xmlText;\n}\n\nfunction addSchemaInfoToExample(schema, obj) {\n if (typeof obj !== 'object' || obj === null) {\n return;\n }\n if (schema.title) {\n obj['::TITLE'] = schema.title;\n }\n if (schema.description) {\n obj['::DESCRIPTION'] = schema.description;\n }\n if (schema.xml?.name) {\n obj['::XML_TAG'] = schema.xml?.name;\n }\n if (schema.xml?.wrapped) {\n obj['::XML_WRAP'] = schema.xml?.wrapped.toString();\n }\n}\n\nfunction removeTitlesAndDescriptions(obj) {\n if (typeof obj !== 'object' || obj === null) {\n return;\n }\n delete obj['::TITLE'];\n delete obj['::DESCRIPTION'];\n delete obj['::XML_TAG'];\n delete obj['::XML_WRAP'];\n for (const k in obj) {\n removeTitlesAndDescriptions(obj[k]);\n }\n}\n\nfunction addPropertyExampleToObjectExamples(example, obj, propertyKey) {\n for (const key in obj) {\n obj[key][propertyKey] = example;\n }\n}\n\nfunction mergePropertyExamples(obj, propertyName, propExamples) {\n // Create an example for each variant of the propertyExample, merging them with the current (parent) example\n let i = 0;\n const maxCombinations = 10;\n const mergedObj = {};\n for (const exampleKey in obj) {\n for (const propExampleKey in propExamples) {\n mergedObj[`example-${i}`] = { ...obj[exampleKey] };\n mergedObj[`example-${i}`][propertyName] = propExamples[propExampleKey];\n i++;\n if (i >= maxCombinations) {\n break;\n }\n }\n if (i >= maxCombinations) {\n break;\n }\n }\n return mergedObj;\n}\n\n/* For changing JSON-Schema to a Sample Object, as per the schema (to generate examples based on schema) */\nexport function schemaToSampleObj(schema, config = { }) {\n let obj = {};\n if (!schema) {\n return;\n }\n if (schema.allOf) {\n const objWithAllProps = {};\n\n if (schema.allOf.length === 1 && !schema.allOf[0]?.properties && !schema.allOf[0]?.items) {\n // If allOf has single item and the type is not an object or array, then its a primitive\n if (schema.allOf[0].$ref) {\n return '{ }';\n }\n if (schema.allOf[0].readOnly && config.includeReadOnly) {\n const tempSchema = schema.allOf[0];\n return getSampleValueByType(tempSchema);\n }\n return;\n }\n\n schema.allOf.forEach((v) => {\n if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf) {\n const partialObj = schemaToSampleObj(v, config);\n Object.assign(objWithAllProps, partialObj);\n } else if (v.type === 'array' || v.items) {\n const partialObj = [schemaToSampleObj(v, config)];\n Object.assign(objWithAllProps, partialObj);\n } else if (v.type) {\n const prop = `prop${Object.keys(objWithAllProps).length}`;\n objWithAllProps[prop] = getSampleValueByType(v);\n } else {\n return '';\n }\n });\n\n obj = objWithAllProps;\n } else if (schema.oneOf) {\n // 1. First create example with scheme.properties\n const objWithSchemaProps = {};\n if (schema.properties) {\n for (const propertyName in schema.properties) {\n if (schema.properties[propertyName].properties || schema.properties[propertyName].properties?.items) {\n objWithSchemaProps[propertyName] = schemaToSampleObj(schema.properties[propertyName], config);\n } else {\n objWithSchemaProps[propertyName] = getSampleValueByType(schema.properties[propertyName]);\n }\n }\n }\n\n if (schema.oneOf.length > 0) {\n /*\n oneOf:\n - type: object\n properties:\n option1_PropA:\n type: string\n option1_PropB:\n type: string\n - type: object\n properties:\n option2_PropX:\n type: string\n properties:\n prop1:\n type: string\n prop2:\n type: string\n minLength: 10\n\n The aboove Schem should generate the following 2 examples\n\n Example-1\n {\n prop1: 'string',\n prop2: 'AAAAAAAAAA', <-- min-length 10\n option1_PropA: 'string',\n option1_PropB: 'string'\n }\n\n Example-2\n {\n prop1: 'string',\n prop2: 'AAAAAAAAAA', <-- min-length 10\n option2_PropX: 'string'\n }\n */\n let i = 0;\n // Merge all examples of each oneOf-schema\n for (const key in schema.oneOf) {\n const oneOfSamples = schemaToSampleObj(schema.oneOf[key], config);\n for (const sampleKey in oneOfSamples) {\n // 2. In the final example include a one-of item along with properties\n let finalExample;\n if (Object.keys(objWithSchemaProps).length > 0) {\n if (oneOfSamples[sampleKey] === null || typeof oneOfSamples[sampleKey] !== 'object') {\n // This doesn't really make sense since every oneOf schema _should_ be an object if there are common properties, so we'll skip this\n continue;\n } else {\n finalExample = Object.assign(oneOfSamples[sampleKey], objWithSchemaProps);\n }\n } else {\n finalExample = oneOfSamples[sampleKey];\n }\n obj[`example-${i}`] = finalExample;\n addSchemaInfoToExample(schema.oneOf[key], obj[`example-${i}`]);\n i++;\n }\n }\n }\n } else if (schema.anyOf) {\n // First generate values for regular properties\n let commonObj;\n if (schema.type === 'object' || schema.properties) {\n commonObj = { 'example-0': {} };\n for (const propertyName in schema.properties) {\n if (schema.example) {\n commonObj = schema;\n break;\n }\n if (schema.properties[propertyName].deprecated && !config.includeDeprecated) { continue; }\n if (schema.properties[propertyName].readOnly && !config.includeReadOnly) { continue; }\n if (schema.properties[propertyName].writeOnly && !config.includeWriteOnly) { continue; }\n commonObj = mergePropertyExamples(commonObj, propertyName, schemaToSampleObj(schema.properties[propertyName], config));\n }\n }\n\n // Combine every variant of the regular properties with every variant of the anyOf samples\n let i = 0;\n for (const key in schema.anyOf) {\n const anyOfSamples = schemaToSampleObj(schema.anyOf[key], config);\n for (const sampleKey in anyOfSamples) {\n if (typeof commonObj !== 'undefined') {\n for (const commonKey in commonObj) {\n obj[`example-${i}`] = { ...commonObj[commonKey], ...anyOfSamples[sampleKey] };\n }\n } else {\n obj[`example-${i}`] = anyOfSamples[sampleKey];\n }\n addSchemaInfoToExample(schema.anyOf[key], obj[`example-${i}`]);\n i++;\n }\n }\n } else if (schema.type === 'object' || schema.properties) {\n obj['example-0'] = {};\n addSchemaInfoToExample(schema, obj['example-0']);\n if (schema.example) {\n obj['example-0'] = schema.example;\n } else {\n for (const propertyName in schema.properties) {\n if (schema.properties[propertyName]?.deprecated && !config.includeDeprecated) { continue; }\n if (schema.properties[propertyName]?.readOnly && !config.includeReadOnly) { continue; }\n if (schema.properties[propertyName]?.writeOnly && !config.includeWriteOnly) { continue; }\n if (schema.properties[propertyName]?.type === 'array' || schema.properties[propertyName]?.items) {\n if (schema.properties[propertyName].example) {\n addPropertyExampleToObjectExamples(schema.properties[propertyName].example, obj, propertyName);\n } else if (schema.properties[propertyName]?.items?.example) { // schemas and properties support single example but not multiple examples.\n addPropertyExampleToObjectExamples([schema.properties[propertyName].items.example], obj, propertyName);\n } else {\n const itemSamples = schemaToSampleObj(schema.properties[propertyName].items, config);\n if (config.useXmlTagForProp) {\n const xmlTagName = schema.properties[propertyName].xml?.name || propertyName;\n if (schema.properties[propertyName].xml?.wrapped) {\n const wrappedItemSample = JSON.parse(`{ \"${xmlTagName}\" : { \"${xmlTagName}\" : ${JSON.stringify(itemSamples['example-0'])} } }`);\n obj = mergePropertyExamples(obj, xmlTagName, wrappedItemSample);\n } else {\n obj = mergePropertyExamples(obj, xmlTagName, itemSamples);\n }\n } else {\n const arraySamples = [];\n for (const key in itemSamples) {\n arraySamples[key] = [itemSamples[key]];\n }\n obj = mergePropertyExamples(obj, propertyName, arraySamples);\n }\n }\n continue;\n }\n obj = mergePropertyExamples(obj, propertyName, schemaToSampleObj(schema.properties[propertyName], config));\n }\n }\n } else if (schema.type === 'array' || schema.items) {\n if (schema.items || schema.example) {\n if (schema.example) {\n obj['example-0'] = schema.example;\n } else if (schema.items?.example) { // schemas and properties support single example but not multiple examples.\n obj['example-0'] = [schema.items.example];\n } else {\n const samples = schemaToSampleObj(schema.items, config);\n let i = 0;\n for (const key in samples) {\n obj[`example-${i}`] = [samples[key]];\n addSchemaInfoToExample(schema.items, obj[`example-${i}`]);\n i++;\n }\n }\n } else {\n obj['example-0'] = [];\n }\n } else {\n return { 'example-0': getSampleValueByType(schema) };\n }\n return obj;\n}\n\nfunction generateMarkdownForArrayAndObjectDescription(schema, level = 0) {\n let markdown = ((schema.description || schema.title) && (schema.minItems || schema.maxItems)) ? '' : '';\n if (schema.title) {\n if (schema.description) {\n markdown = `${markdown} ${schema.title}: ${schema.description}
`;\n } else {\n markdown = `${markdown} ${schema.title}
`;\n }\n } else if (schema.description) {\n markdown = `${markdown} ${schema.description}
`;\n }\n if (schema.minItems) {\n markdown = `${markdown} Min Items: ${schema.minItems}`;\n }\n if (schema.maxItems) {\n markdown = `${markdown} Max Items: ${schema.maxItems}`;\n }\n if (level > 0 && schema.items?.description) {\n let itemsMarkdown = '';\n if (schema.items.minProperties) {\n itemsMarkdown = `Min Properties: ${schema.items.minProperties}`;\n }\n if (schema.items.maxProperties) {\n itemsMarkdown = `${itemsMarkdown} Max Properties: ${schema.items.maxProperties}`;\n }\n markdown = `${markdown} ⮕ ${itemsMarkdown} [ ${schema.items.description} ] `;\n }\n return markdown;\n}\n/**\n * For changing OpenAPI-Schema to an Object Notation,\n * This Object would further be an input to UI Components to generate an Object-Tree\n * @param {object} schema - Schema object from OpenAPI spec\n * @param {object} obj - recursivly pass this object to generate object notation\n * @param {number} level - recursion level\n * @param {string} suffix - used for suffixing property names to avoid duplicate props during object composion\n */\nexport function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {\n if (!schema) {\n return;\n }\n if (schema.allOf) {\n const objWithAllProps = {};\n if (schema.allOf.length === 1 && !schema.allOf[0].properties && !schema.allOf[0].items) {\n // If allOf has single item and the type is not an object or array, then its a primitive\n const tempSchema = schema.allOf[0];\n return `${getTypeInfo(tempSchema).html}`;\n }\n // If allOf is an array of multiple elements, then all the keys makes a single object\n schema.allOf.map((v, i) => {\n if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf) {\n const propSuffix = (v.anyOf || v.oneOf) && i > 0 ? i : '';\n const partialObj = schemaInObjectNotation(v, {}, (level + 1), propSuffix);\n Object.assign(objWithAllProps, partialObj);\n } else if (v.type === 'array' || v.items) {\n const partialObj = schemaInObjectNotation(v, {}, (level + 1));\n Object.assign(objWithAllProps, partialObj);\n } else if (v.type) {\n const prop = `prop${Object.keys(objWithAllProps).length}`;\n const typeObj = getTypeInfo(v);\n objWithAllProps[prop] = `${typeObj.html}`;\n } else {\n return '';\n }\n });\n obj = objWithAllProps;\n } else if (schema.anyOf || schema.oneOf) {\n obj['::description'] = schema.description || '';\n // 1. First iterate the regular properties\n if (schema.type === 'object' || schema.properties) {\n obj['::description'] = schema.description || '';\n obj['::type'] = 'object';\n // obj['::deprecated'] = schema.deprecated || false;\n for (const key in schema.properties) {\n if (schema.required && schema.required.includes(key)) {\n obj[`${key}*`] = schemaInObjectNotation(schema.properties[key], {}, (level + 1));\n } else {\n obj[key] = schemaInObjectNotation(schema.properties[key], {}, (level + 1));\n }\n }\n }\n // 2. Then show allof/anyof objects\n const objWithAnyOfProps = {};\n const xxxOf = schema.anyOf ? 'anyOf' : 'oneOf';\n schema[xxxOf].forEach((v, index) => {\n if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf) {\n const partialObj = schemaInObjectNotation(v, {});\n objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`] = partialObj;\n objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`]['::readwrite'] = ''; // xxx-options cannot be read or write only\n objWithAnyOfProps['::type'] = 'xxx-of-option';\n } else if (v.type === 'array' || v.items) {\n // This else-if block never seems to get executed\n const partialObj = schemaInObjectNotation(v, {});\n objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`] = partialObj;\n objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`]['::readwrite'] = ''; // xxx-options cannot be read or write only\n objWithAnyOfProps['::type'] = 'xxx-of-array';\n } else {\n const prop = `::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`;\n objWithAnyOfProps[prop] = `${getTypeInfo(v).html}`;\n objWithAnyOfProps['::type'] = 'xxx-of-option';\n }\n });\n obj[(schema.anyOf ? `::ANY~OF ${suffix}` : `::ONE~OF ${suffix}`)] = objWithAnyOfProps;\n // obj['::type'] = 'object';\n obj['::type'] = 'object';\n } else if (Array.isArray(schema.type)) {\n // When a property has multiple types, then check further if any of the types are array or object, if yes then modify the schema using one-of\n // Clone the schema - as it will be modified to replace multi-data-types with one-of;\n const subSchema = JSON.parse(JSON.stringify(schema));\n const primitiveType = [];\n const complexTypes = [];\n subSchema.type.forEach((v) => {\n if (v.match(/integer|number|string|null|boolean/g)) {\n primitiveType.push(v);\n } else if (v === 'array' && typeof subSchema.items?.type === 'string' && subSchema.items?.type.match(/integer|number|string|null|boolean/g)) {\n // Array with primitive types should also be treated as primitive type\n if (subSchema.items.type === 'string' && subSchema.items.format) {\n primitiveType.push(`[${subSchema.items.format}]`);\n } else {\n primitiveType.push(`[${subSchema.items.type}]`);\n }\n } else {\n complexTypes.push(v);\n }\n });\n let multiPrimitiveTypes;\n if (primitiveType.length > 0) {\n subSchema.type = primitiveType.join(primitiveType.length === 2 ? ' or ' : '┃');\n multiPrimitiveTypes = getTypeInfo(subSchema);\n if (complexTypes.length === 0) {\n return `${multiPrimitiveTypes?.html || ''}`;\n }\n }\n if (complexTypes.length > 0) {\n obj['::type'] = 'object';\n const multiTypeOptions = {\n '::type': 'xxx-of-option',\n };\n\n // Generate ONE-OF options for complexTypes\n complexTypes.forEach((v, i) => {\n if (v === 'null') {\n multiTypeOptions[`::OPTION~${i + 1}`] = 'NULL~|~~|~~|~~|~~|~~|~~|~~|~';\n } else if ('integer, number, string, boolean,'.includes(`${v},`)) {\n subSchema.type = Array.isArray(v) ? v.join('┃') : v;\n const primitiveTypeInfo = getTypeInfo(subSchema);\n multiTypeOptions[`::OPTION~${i + 1}`] = primitiveTypeInfo.html;\n } else if (v === 'object') {\n // If object type iterate all the properties and create an object-type-option\n const objTypeOption = {\n '::title': schema.title || '',\n '::description': schema.description || '',\n '::type': 'object',\n '::deprecated': schema.deprecated || false,\n };\n for (const key in schema.properties) {\n if (schema.required && schema.required.includes(key)) {\n objTypeOption[`${key}*`] = schemaInObjectNotation(schema.properties[key], {}, (level + 1));\n } else {\n objTypeOption[key] = schemaInObjectNotation(schema.properties[key], {}, (level + 1));\n }\n }\n multiTypeOptions[`::OPTION~${i + 1}`] = objTypeOption;\n } else if (v === 'array') {\n multiTypeOptions[`::OPTION~${i + 1}`] = {\n '::title': schema.title || '',\n '::description': schema.description || '',\n '::type': 'array',\n '::props': schemaInObjectNotation(schema.items, {}, (level + 1)),\n };\n }\n });\n multiTypeOptions[`::OPTION~${complexTypes.length + 1}`] = multiPrimitiveTypes?.html || '';\n obj['::ONE~OF'] = multiTypeOptions;\n }\n } else if (schema.type === 'object' || schema.properties) { // If Object\n obj['::title'] = schema.title || '';\n obj['::description'] = generateMarkdownForArrayAndObjectDescription(schema, level);\n obj['::type'] = 'object';\n if ((Array.isArray(schema.type) && schema.type.includes('null')) || schema.nullable) {\n obj['::dataTypeLabel'] = 'object or null';\n }\n obj['::deprecated'] = schema.deprecated || false;\n obj['::readwrite'] = schema.readOnly ? 'readonly' : schema.writeOnly ? 'writeonly' : '';\n for (const key in schema.properties) {\n if (schema.required && schema.required.includes(key)) {\n obj[`${key}*`] = schemaInObjectNotation(schema.properties[key], {}, (level + 1));\n } else {\n obj[key] = schemaInObjectNotation(schema.properties[key], {}, (level + 1));\n }\n }\n for (const key in schema.patternProperties) {\n obj[`[pattern: ${key}]`] = schemaInObjectNotation(schema.patternProperties[key], obj, (level + 1));\n }\n if (schema.additionalProperties) {\n obj['[any-key]'] = schemaInObjectNotation(schema.additionalProperties, {});\n }\n } else if (schema.type === 'array' || schema.items) { // If Array\n obj['::title'] = schema.title || '';\n obj['::description'] = generateMarkdownForArrayAndObjectDescription(schema, level);\n obj['::type'] = 'array';\n if ((Array.isArray(schema.type) && schema.type.includes('null')) || schema.nullable) {\n obj['::dataTypeLabel'] = 'array or null';\n }\n obj['::deprecated'] = schema.deprecated || false;\n obj['::readwrite'] = schema.readOnly ? 'readonly' : schema.writeOnly ? 'writeonly' : '';\n if (schema.items?.items) {\n obj['::array-type'] = schema.items.items.type;\n }\n obj['::props'] = schemaInObjectNotation(schema.items, {}, (level + 1));\n } else {\n const typeObj = getTypeInfo(schema);\n if (typeObj?.html) {\n return `${typeObj.html}`;\n }\n return '';\n }\n return obj;\n}\n\n/* Create Example object */\nexport function generateExample(schema, mimeType, examples = '', example = '', includeReadOnly = true, includeWriteOnly = true, outputType = 'json', includeGeneratedExample = false) {\n const finalExamples = [];\n // First check if examples is provided\n if (examples) {\n for (const eg in examples) {\n let egContent = '';\n let egFormat = 'json';\n if (mimeType?.toLowerCase().includes('json')) {\n if (outputType === 'text') {\n egContent = typeof examples[eg].value === 'string' ? examples[eg].value : JSON.stringify(examples[eg].value, undefined, 2);\n egFormat = 'text';\n } else {\n egContent = examples[eg].value;\n if (typeof examples[eg].value === 'string') {\n try {\n // const fixedJsonString = examples[eg].value.replace((/([\\w]+)(:)/g), '\"$1\"$2').replace((/'/g), '\"');\n const fixedJsonString = examples[eg].value;\n egContent = JSON.parse(fixedJsonString);\n egFormat = 'json';\n } catch (err) {\n egFormat = 'text';\n egContent = examples[eg].value;\n }\n }\n }\n } else {\n egContent = examples[eg].value;\n egFormat = 'text';\n }\n\n finalExamples.push({\n exampleId: eg,\n exampleSummary: examples[eg].summary || eg,\n exampleDescription: examples[eg].description || '',\n exampleType: mimeType,\n exampleValue: egContent,\n exampleFormat: egFormat,\n });\n }\n } else if (example) {\n let egContent = '';\n let egFormat = 'json';\n if (mimeType?.toLowerCase().includes('json')) {\n if (outputType === 'text') {\n egContent = typeof example === 'string' ? example : JSON.stringify(example, undefined, 2);\n egFormat = 'text';\n } else if (typeof example === 'object') {\n egContent = example;\n egFormat = 'json';\n } else if (typeof example === 'string') {\n try {\n egContent = JSON.parse(example);\n egFormat = 'json';\n } catch (err) {\n egFormat = 'text';\n egContent = example;\n }\n }\n } else {\n egContent = example;\n egFormat = 'text';\n }\n finalExamples.push({\n exampleId: 'Example',\n exampleSummary: '',\n exampleDescription: '',\n exampleType: mimeType,\n exampleValue: egContent,\n exampleFormat: egFormat,\n });\n }\n // If schema-level examples are not provided or includeGeneratedExample === true then generate one based on the schema field types\n if (finalExamples.length === 0 || includeGeneratedExample === true) {\n if (schema) {\n if (schema.example) {\n // Note: Deprecated: The 'example' property has been deprecated in 3.1.0 in favor of the JSON Schema 'examples' keyword\n finalExamples.push({\n exampleId: 'Example',\n exampleSummary: '',\n exampleDescription: '',\n exampleType: mimeType,\n exampleValue: schema.example,\n exampleFormat: ((mimeType?.toLowerCase().includes('json') && typeof schema.example === 'object') ? 'json' : 'text'),\n });\n } else if (mimeType?.toLowerCase().includes('json') || mimeType?.toLowerCase().includes('text') || mimeType?.toLowerCase().includes('*/*') || mimeType?.toLowerCase().includes('xml')) {\n let xmlRootStart = '';\n let xmlRootEnd = '';\n let exampleFormat = '';\n let exampleValue = '';\n if (mimeType?.toLowerCase().includes('xml')) {\n xmlRootStart = schema.xml?.name ? `<${schema.xml.name} ${schema.xml.namespace ? `xmlns=\"${schema.xml.namespace}\"` : ''}>` : '';\n xmlRootEnd = schema.xml?.name ? `` : '';\n exampleFormat = 'text';\n } else {\n exampleFormat = outputType;\n }\n const samples = schemaToSampleObj(schema, { includeReadOnly, includeWriteOnly, deprecated: true, useXmlTagForProp: mimeType?.toLowerCase().includes('xml') });\n let i = 0;\n for (const samplesKey in samples) {\n if (!samples[samplesKey]) {\n continue;\n }\n const summary = samples[samplesKey]['::TITLE'] || `Example ${++i}`;\n const description = samples[samplesKey]['::DESCRIPTION'] || '';\n if (mimeType?.toLowerCase().includes('xml')) {\n exampleValue = `\\n${xmlRootStart}${json2xml(samples[samplesKey], 1)}\\n${xmlRootEnd}`;\n } else {\n removeTitlesAndDescriptions(samples[samplesKey]);\n exampleValue = outputType === 'text' ? JSON.stringify(samples[samplesKey], null, 2) : samples[samplesKey];\n }\n\n finalExamples.push({\n exampleId: samplesKey,\n exampleSummary: summary,\n exampleDescription: description,\n exampleType: mimeType,\n exampleFormat,\n exampleValue,\n });\n }\n } else if (mimeType?.toLowerCase().includes('jose')) {\n finalExamples.push({\n exampleId: 'Example',\n exampleSummary: 'Base64 Encoded',\n exampleDescription: '',\n exampleType: mimeType,\n exampleValue: schema.pattern || 'bXJpbg==',\n exampleFormat: 'text',\n });\n } else {\n finalExamples.push({\n exampleId: 'Example',\n exampleSummary: '',\n exampleDescription: '',\n exampleType: mimeType,\n exampleValue: '',\n exampleFormat: 'text',\n });\n }\n } else {\n // No Example or Schema provided (should never reach here)\n finalExamples.push({\n exampleId: 'Example',\n exampleSummary: '',\n exampleDescription: '',\n exampleType: mimeType,\n exampleValue: '',\n exampleFormat: 'text',\n });\n }\n }\n return finalExamples;\n}\n\nfunction getSerializeStyleForContentType(contentType) {\n if (contentType === 'application/json') {\n return 'json';\n }\n if (contentType === 'application/xml') {\n return 'xml';\n }\n return null;\n}\n\nexport function getSchemaFromParam(param) {\n if (param.schema) {\n return [param.schema, null, null];\n }\n if (param.content) {\n // we gonna use the first content-encoding\n for (const contentType of Object.keys(param.content)) {\n if (param.content[contentType].schema) {\n return [param.content[contentType].schema, getSerializeStyleForContentType(contentType), param.content[contentType]];\n }\n }\n }\n return [null, null, null];\n}\n","import { LitElement, html, css } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport FontStyles from '../styles/font-styles';\nimport SchemaStyles from '../styles/schema-styles';\nimport CustomStyles from '../styles/custom-styles';\n\nexport default class SchemaTable extends LitElement {\n static get properties() {\n return {\n schemaExpandLevel: { type: Number, attribute: 'schema-expand-level' },\n schemaDescriptionExpanded: { type: String, attribute: 'schema-description-expanded' },\n allowSchemaDescriptionExpandToggle: { type: String, attribute: 'allow-schema-description-expand-toggle' },\n schemaHideReadOnly: { type: String, attribute: 'schema-hide-read-only' },\n schemaHideWriteOnly: { type: String, attribute: 'schema-hide-write-only' },\n data: { type: Object },\n };\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) { this.schemaExpandLevel = 99999; }\n if (!this.schemaDescriptionExpanded || !'true false'.includes(this.schemaDescriptionExpanded)) { this.schemaDescriptionExpanded = 'false'; }\n if (!this.schemaHideReadOnly || !'true false'.includes(this.schemaHideReadOnly)) { this.schemaHideReadOnly = 'true'; }\n if (!this.schemaHideWriteOnly || !'true false'.includes(this.schemaHideWriteOnly)) { this.schemaHideWriteOnly = 'true'; }\n }\n\n static get styles() {\n return [\n FontStyles,\n SchemaStyles,\n css`\n .table {\n font-size: var(--font-size-small);\n text-align: left;\n line-height: calc(var(--font-size-small) + 6px);\n }\n .param-table{\n border-radius: 4px;\n border:1px solid var(--light-border-color);\n border-bottom: none;\n margin-top: 10px;\n font-size: 14px;\n }\n .param-table .tr {\n border-bottom: 1px solid var(--light-border-color);\n display: grid;\n grid-template-columns: 3fr 2fr 4fr;\n overflow: hidden;\n }\n .param-table .td {\n padding: 4px 0;\n }\n .param-table .key {\n padding: 12px 10px 12px;\n }\n .table .key-descr {\n padding: 12px 10px 12px;\n }\n .table .key-descr p {\n margin: 0px;\n display: inline;\n }\n .key.deprecated .key-label {\n color: var(--red);\n }\n .deprecated-label{\n color: #ef6660;\n padding: 1px 5px;\n font-size: 12px;\n border: 1px solid #ef6660;\n border-radius: 4px;\n }\n .key-label {\n background-color: #f8f7fc;\n border-radius: 4px;\n padding: 0.2em 0.4em;\n font-family: var(--font-mono);\n font-size: 12px;\n }\n .param-table .key-type {\n border-left:1px solid var(--light-border-color);\n border-right:1px solid var(--light-border-color);\n padding: 12px 10px 12px;\n }\n .object-body .key-type {\n white-space: normal;\n color:#4A4A4A;\n font-family: var(--font-mono);\n font-size: 12px;\n }\n .collapsed-all-descr .tr:not(.expanded-descr) {\n max-height: calc(var(--font-size-regular) + var(--font-size-regular) + 10px);\n }\n .collapsed-all-descr .tr:not(.expanded-descr) .td p, .collapsed-all-descr .tr:not(.expanded-descr) .key, .collapsed-all-descr .tr:not(.expanded-descr) .key-type {\n text-overflow: ellipsis;\n display: inline;\n min-width: 0;\n white-space: nowrap;\n overflow: hidden;\n }\n .obj-toggle {\n padding: 0 2px;\n border-radius:2px;\n border: 1px solid transparent;\n display: inline-block;\n margin-left: -16px;\n color:var(--primary-color);\n cursor:pointer;\n font-size: calc(var(--font-size-small) + 4px);\n font-family: var(--font-mono);\n background-clip: border-box;\n }\n .obj-toggle:hover {\n border-color: var(--primary-color);\n }\n .tr.expanded + .object-body {\n display:block;\n }\n .tr.collapsed + .object-body {\n display:none;\n }`,\n CustomStyles,\n ];\n }\n\n /* eslint-disable indent */\n render() {\n return html`\n
this.handleAllEvents(e)}\">\n
\n
${this.data?.['::type'] || ''}
\n ${(this.data && this.allowSchemaDescriptionExpandToggle === 'true')\n ? html`\n
\n
\n ${this.schemaDescriptionExpanded === 'true' ? 'Single line description' : 'Multiline description'}\n
\n `\n : ''\n }\n
\n ${this.data?.['::description']\n ? html` ${unsafeHTML(marked(this.data['::description'] || ''))}`\n : ''\n }\n ${this.data\n ? html`
\n
\n
Field
\n
Type
\n
Description
\n
\n ${this.generateTree(\n this.data['::type'] === 'array' ? this.data['::props'] : this.data,\n this.data['::type'],\n this.data['::array-type'],\n )}\n
\n
`\n : html`

Schema not found

`\n }\n \n `;\n }\n\n generateTree(data, dataType = 'object', arrayType = '', key = '', description = '', schemaLevel = 0, indentLevel = 0, readOrWrite = '') {\n if (this.schemaHideReadOnly === 'true') {\n if (dataType === 'array') {\n if (readOrWrite === 'readonly') {\n return;\n }\n }\n if (data && data['::readwrite'] === 'readonly') {\n return;\n }\n }\n if (this.schemaHideWriteOnly === 'true') {\n if (dataType === 'array') {\n if (readOrWrite === 'writeonly') {\n return;\n }\n }\n if (data && data['::readwrite'] === 'writeonly') {\n return;\n }\n }\n if (!data) {\n return html`
\n
\n ${key.replace('::OPTION~', '')}\n
\n
\n ${\n dataType === 'array'\n ? html` [ ] `\n : dataType === 'object'\n ? html` { } `\n : html` schema undefined `\n }\n
\n
${unsafeHTML(marked(description)) || ''}
\n
`;\n }\n\n const newSchemaLevel = data['::type']?.startsWith('xxx-of') ? schemaLevel : (schemaLevel + 1);\n const newIndentLevel = dataType === 'xxx-of-option' || data['::type'] === 'xxx-of-option' || key.startsWith('::OPTION') ? indentLevel : (indentLevel + 1);\n const leftPadding = 10 * newIndentLevel; // 2 space indentation at each level\n if (Object.keys(data).length === 0) {\n return html`${key}`;\n }\n let keyLabel = '';\n let keyDescr = '';\n let isOneOfLabel = false;\n if (key.startsWith('::ONE~OF') || key.startsWith('::ANY~OF')) {\n keyLabel = key.replace('::', '').replace('~', ' ');\n isOneOfLabel = true;\n } else if (key.startsWith('::OPTION')) {\n const parts = key.split('~');\n keyLabel = parts[1]; // eslint-disable-line prefer-destructuring\n keyDescr = parts[2]; // eslint-disable-line prefer-destructuring\n } else {\n keyLabel = key;\n }\n\n let detailObjType = '';\n if (data['::type'] === 'object') {\n if (dataType === 'array') {\n detailObjType = 'array of object'; // Array of Object\n } else {\n detailObjType = data['::dataTypeLabel'] || data['::type'];\n }\n } else if (data['::type'] === 'array') {\n if (dataType === 'array') {\n // detailObjType = 'array of array'; // Array of array\n detailObjType = `array of array ${arrayType !== 'object' ? `of ${arrayType}` : ''}`; // Array of array\n } else {\n detailObjType = data['::dataTypeLabel'] || data['::type'];\n }\n }\n\n if (typeof data === 'object') {\n return html`\n ${newSchemaLevel >= 0 && key\n ? html`\n
\n
\n ${(keyLabel || keyDescr)\n ? html`\n \n ${schemaLevel < this.schemaExpandLevel ? '-' : '+'}\n `\n : ''\n }\n ${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' || key.startsWith('::OPTION')\n ? html`${keyLabel}${keyDescr}`\n : keyLabel.endsWith('*')\n ? html`${data['::deprecated'] ? '❌' : ''} ${keyLabel.substring(0, keyLabel.length - 1)}*`\n : html`${data['::deprecated'] ? '❌' : ''} ${keyLabel === '::props' ? '' : keyLabel}`\n }\n ${data['::type'] === 'xxx-of' && dataType === 'array' ? html`ARRAY` : ''} \n
\n
\n ${(data['::type'] || '').includes('xxx-of') ? '' : detailObjType}\n ${data['::readwrite'] === 'readonly' ? ' 🆁' : data['::readwrite'] === 'writeonly' ? ' 🆆' : ''}\n
\n
${unsafeHTML(marked(description || ''))}
\n
`\n : html`\n ${data['::type'] === 'array' && dataType === 'array'\n ? html`\n
\n
\n
\n ${arrayType && arrayType !== 'object' ? `${dataType} of ${arrayType}` : dataType}\n
\n
\n
`\n : ''\n }`\n }\n
\n ${Array.isArray(data) && data[0]\n ? html`${this.generateTree(data[0], 'xxx-of-option', '', '::ARRAY~OF', '', newSchemaLevel, newIndentLevel, '')}`\n : html`\n ${Object.keys(data).map((dataKey) => html`\n ${['::title', '::description', '::type', '::props', '::deprecated', '::array-type', '::readwrite', '::dataTypeLabel'].includes(dataKey)\n ? data[dataKey]['::type'] === 'array' || data[dataKey]['::type'] === 'object'\n ? html`${this.generateTree(\n data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey],\n data[dataKey]['::type'],\n data[dataKey]['::array-type'] || '',\n dataKey,\n data[dataKey]['::description'],\n newSchemaLevel,\n newIndentLevel,\n data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '',\n )}`\n : ''\n : html`${this.generateTree(\n data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey],\n data[dataKey]['::type'],\n data[dataKey]['::array-type'] || '',\n dataKey,\n data[dataKey]?.['::description'] || '',\n newSchemaLevel,\n newIndentLevel,\n data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '',\n )}`\n }\n `)}\n `\n }\n
\n `;\n }\n\n // For Primitive Data types\n // eslint-disable-next-line no-unused-vars\n const [type, readOrWriteOnly, constraint, defaultValue, allowedValues, pattern, schemaDescription, schemaTitle, deprecated] = data.split('~|~');\n if (readOrWriteOnly === '🆁' && this.schemaHideReadOnly === 'true') {\n return;\n }\n if (readOrWriteOnly === '🆆' && this.schemaHideWriteOnly === 'true') {\n return;\n }\n const dataTypeCss = type.replace(/┃.*/g, '').replace(/[^a-zA-Z0-9+]/g, '').substring(0, 4).toLowerCase();\n const typeDivider = type.replaceAll('┃', ' | ');\n const descrExpander = `${schemaDescription.length >= 50 || constraint || defaultValue || allowedValues || pattern ? '' : ''}`;\n let dataTypeHtml = '';\n if (dataType === 'array') {\n dataTypeHtml = html` \n
\n [${typeDivider}] ${readOrWrite === 'readonly' ? '🆁' : readOrWrite === 'writeonly' ? '🆆' : ''}\n
`;\n } else {\n dataTypeHtml = html` \n
\n ${typeDivider} ${readOrWriteOnly}\n
`;\n }\n return html`\n
\n
\n ${keyLabel?.endsWith('*')\n ? html`\n ${keyLabel.substring(0, keyLabel.length - 1)}*`\n : key.startsWith('::OPTION')\n ? html`${keyLabel}${keyDescr}`\n : html`${keyLabel ? html` ${keyLabel}` : html`${schemaTitle}`}`\n }\n
\n ${dataTypeHtml}\n
\n ${html`\n ${deprecated ? html`Deprecated` : ''}\n ${unsafeHTML(marked(dataType === 'array'\n ? `${descrExpander} ${description}`\n : schemaTitle\n ? `${descrExpander} ${schemaTitle}: ${schemaDescription}`\n : `${descrExpander} ${schemaDescription}`))}\n `\n }\n ${constraint ? html`
Constraints: ${constraint}
` : ''}\n ${defaultValue ? html`
Default: ${defaultValue}
` : ''}\n ${allowedValues ? html`
${type === 'const' ? 'Value' : 'Allowed'}: ${allowedValues}
` : ''}\n ${pattern ? html`
Pattern: ${pattern}
` : ''}\n
\n
\n `;\n }\n /* eslint-enable indent */\n\n handleAllEvents(e) {\n if (e.target.classList.contains('obj-toggle')) {\n this.toggleObjectExpand(e);\n } else if (e.target.classList.contains('schema-multiline-toggle')) {\n this.schemaDescriptionExpanded = (this.schemaDescriptionExpanded === 'true' ? 'false' : 'true');\n } else if (e.target.classList.contains('descr-expand-toggle')) {\n const trEl = e.target.closest('.tr');\n if (trEl) {\n trEl.classList.toggle('expanded-descr');\n trEl.style.maxHeight = trEl.scrollHeight;\n }\n }\n }\n\n toggleObjectExpand(e) {\n const rowEl = e.target.closest('.tr');\n if (rowEl.classList.contains('expanded')) {\n rowEl.classList.add('collapsed');\n rowEl.classList.remove('expanded');\n e.target.innerText = '+';\n } else {\n rowEl.classList.remove('collapsed');\n rowEl.classList.add('expanded');\n e.target.innerText = '-';\n }\n }\n}\nif (!customElements.get('schema-table')) customElements.define('schema-table', SchemaTable);\n","import { LitElement, html, css } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport { schemaInObjectNotation, generateExample } from '../utils/schema-utils';\nimport FontStyles from '../styles/font-styles';\nimport FlexStyles from '../styles/flex-styles';\nimport TableStyles from '../styles/table-styles';\nimport InputStyles from '../styles/input-styles';\nimport TabStyles from '../styles/tab-styles';\nimport BorderStyles from '../styles/border-styles';\nimport CustomStyles from '../styles/custom-styles';\nimport './json-tree';\nimport './schema-tree';\nimport './schema-table';\n\nexport default class ApiResponse extends LitElement {\n constructor() {\n super();\n this.selectedStatus = '';\n this.headersForEachRespStatus = {};\n this.mimeResponsesForEachStatus = {};\n this.activeSchemaTab = 'schema';\n }\n\n static get properties() {\n return {\n callback: { type: String },\n webhook: { type: String },\n responses: { type: Object },\n parser: { type: Object },\n schemaStyle: { type: String, attribute: 'schema-style' },\n renderStyle: { type: String, attribute: 'render-style' },\n selectedStatus: { type: String, attribute: 'selected-status' },\n selectedMimeType: { type: String, attribute: 'selected-mime-type' },\n activeSchemaTab: { type: String, attribute: 'active-schema-tab' },\n schemaExpandLevel: { type: Number, attribute: 'schema-expand-level' },\n schemaDescriptionExpanded: { type: String, attribute: 'schema-description-expanded' },\n allowSchemaDescriptionExpandToggle: { type: String, attribute: 'allow-schema-description-expand-toggle' },\n schemaHideReadOnly: { type: String, attribute: 'schema-hide-read-only' },\n schemaHideWriteOnly: { type: String, attribute: 'schema-hide-write-only' },\n };\n }\n\n static get styles() {\n return [\n FontStyles,\n FlexStyles,\n TabStyles,\n TableStyles,\n InputStyles,\n BorderStyles,\n css`\n :where(button, input[type=\"checkbox\"], [tabindex=\"0\"]):focus-visible { box-shadow: var(--focus-shadow); }\n :where(input[type=\"text\"], input[type=\"password\"], select, textarea):focus-visible { border-color: var(--primary-color); }\n .response-panel {\n padding: 10px;\n border: 1px solid var(--light-border-color);\n border-radius: 4px;\n }\n .response-panel-header {\n border-bottom: 1px solid var(--light-border-color);\n }\n .resp-head{\n vertical-align: middle;\n padding:16px 0 8px;\n }\n .resp-descr{\n font-size:calc(var(--font-size-small) + 1px);\n color:var(--light-fg);\n text-align:left;\n }\n .resp-box{\n display: flex;\n flex-direction: row;\n flex: 1 1 auto;\n justify-content: space-around;\n align-items: center;\n column-gap: 12px;\n padding: 12px;\n }\n .resp-box:hover {\n cursor: pointer;\n color: var(--vtex-pink);\n font-weight: bold;\n }\n .resp-box.active {\n font-weight: bold;\n color: var(--vtex-pink);\n border-bottom: 2px solid var(--vtex-pink);\n }\n .resp-title {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n flex: 1 1 auto;\n height: 45px;\n text-transform: uppercase;\n }\n .resp-content {\n padding: 24px 40px;\n max-height: calc(100vh - 5rem - 48px);\n overflow: auto;\n background-color: #FFFFFF;\n }\n .resp-content-body {\n overflow: auto;\n scrollbar-width: thin;\n scrollbar-color: white white;\n }\n .resp-content-body:hover {\n scrollbar-color: #CCCED8 white;\n }\n .resp-content-body::-webkit-scrollbar {\n display: block;\n width: 6px;\n height: 6px;\n background-color: white;\n }\n .resp-content-body::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background: white;\n }\n .resp-content-body:hover::-webkit-scrollbar-thumb {\n background: #CCCED8;\n }\n .resp-content-container {\n display: none;\n background-color: rgba(0,0,0,0.1);\n }\n .top-gap{margin-top:16px;}\n .example-panel{\n font-size:var(--font-size-small);\n margin:0;\n }\n .focused-mode,\n .read-mode {\n margin: 32px 0px;\n display: flex;\n flex-direction: column;\n }\n .dot {\n height: 8px;\n width: 8px;\n border-radius: 50%;\n display: inline-block;\n }\n .success {\n background-color: var(--success-color);\n }\n .informational {\n background-color: var(--informational-color);\n }\n .redirection {\n background-color: var(--redirection-color);\n }\n .error {\n background-color: var(--error-color);\n }\n `,\n CustomStyles,\n ];\n }\n\n render() {\n return html`\n
\n ${this.responseTemplate()}\n
\n `;\n }\n\n resetSelection() {\n this.selectedStatus = '';\n this.selectedMimeType = '';\n }\n\n getResponseStatusType(respStatus) {\n const status = respStatus.toString();\n return status.startsWith('1')\n ? 'informational'\n : status.startsWith('2')\n ? 'success'\n : status.startsWith('3')\n ? 'redirection'\n : (status.startsWith('4') || status.startsWith('5'))\n ? 'error'\n : '';\n }\n\n /* eslint-disable indent */\n responseTemplate() {\n if (!this.responses) { return ''; }\n for (const statusCode in this.responses) {\n if (!this.selectedStatus) {\n this.selectedStatus = statusCode;\n }\n const allMimeResp = {};\n for (const mimeResp in this.responses[statusCode]?.content) {\n const mimeRespObj = this.responses[statusCode].content[mimeResp];\n if (!this.selectedMimeType) {\n this.selectedMimeType = mimeResp;\n }\n // Generate Schema\n const schemaTree = schemaInObjectNotation(mimeRespObj.schema, {});\n // Generate Example\n const respExamples = generateExample(\n mimeRespObj.schema,\n mimeResp,\n mimeRespObj.examples,\n mimeRespObj.example,\n this.callback === 'true' || this.webhook === 'true' ? false : true, // eslint-disable-line no-unneeded-ternary\n this.callback === 'true' || this.webhook === 'true' ? true : false, // eslint-disable-line no-unneeded-ternary\n mimeResp.includes('json') ? 'json' : 'text',\n );\n allMimeResp[mimeResp] = {\n description: this.responses[statusCode].description,\n examples: respExamples,\n selectedExample: respExamples[0]?.exampleId || '',\n schemaTree,\n };\n }\n // Headers for each response status\n const tempHeaders = [];\n for (const key in this.responses[statusCode]?.headers) {\n tempHeaders.push({ name: key, ...this.responses[statusCode].headers[key] });\n }\n this.headersForEachRespStatus[statusCode] = tempHeaders;\n this.mimeResponsesForEachStatus[statusCode] = allMimeResp;\n }\n return html`\n ${Object.keys(this.responses).length >= 1\n ? html`
\n ${Object.keys(this.responses).map((respStatus) => html`\n ${respStatus === '$$ref' // Swagger-Client parser creates '$$ref' object if JSON references are used to create responses - this should be ignored\n ? ''\n : html`\n
{\n this.selectedStatus = respStatus;\n if (this.responses[respStatus].content && Object.keys(this.responses[respStatus].content)[0]) {\n this.selectedMimeType = Object.keys(this.responses[respStatus].content)[0]; // eslint-disable-line prefer-destructuring\n } else {\n this.selectedMimeType = undefined;\n }\n }}\"\n >\n
\n
\n ${this.callback === 'true' ? 'Callback Response' : 'Response'}\n
\n
\n
\n
\n \n
\n
\n ${respStatus}\n
\n
\n
\n `\n }`)\n }
`\n : ''\n }\n
\n\n ${Object.keys(this.responses).map((status) => html`\n
\n
\n
\n
\n
\n ${this.callback === 'true' ? 'Callback Response' : 'Response'}\n
\n
\n
\n
\n \n
\n
\n ${status}\n
\n
\n
\n
\n
\n ${unsafeHTML(marked(this.responses[status]?.description || ''))}\n ${(this.headersForEachRespStatus[status] && this.headersForEachRespStatus[status]?.length > 0)\n ? html`${this.responseHeaderListTemplate(this.headersForEachRespStatus[status])}`\n : ''\n }\n
\n ${Object.keys(this.mimeResponsesForEachStatus[status]).length === 0\n ? ''\n : html` \n
\n ${Object.keys(this.mimeResponsesForEachStatus[status]).length === 1\n ? html` ${Object.keys(this.mimeResponsesForEachStatus[status])[0]} `\n : html`${this.mimeTypeDropdownTemplate(Object.keys(this.mimeResponsesForEachStatus[status]))}`\n } \n
{ if (e.target.tagName.toLowerCase() === 'button') { this.activeSchemaTab = e.target.dataset.tab; } }}\" >\n \n \n
\n
\n ${this.activeSchemaTab === 'example'\n ? html`
\n ${this.mimeExampleTemplate(this.mimeResponsesForEachStatus[status][this.selectedMimeType])}\n
`\n : html`
\n ${this.mimeSchemaTemplate(this.mimeResponsesForEachStatus[status][this.selectedMimeType])}\n
`\n }\n
\n `\n }\n
\n
\n
\n `)}\n `;\n }\n\n responseHeaderListTemplate(respHeaders) {\n return html`\n
Response headers
\n \n ${respHeaders.map((v) => html`\n \n \n \n ${v.schema?.type\n ? html` `\n : ''\n }\n \n ${v.description?.type\n ? html``\n : ''\n }\n \n ${v.schema?.example\n ? html`\n `\n : ''\n }\n \n `)}\n
\n ${v.name || ''}\n \n ${v.schema?.type || ''}\n \n
${unsafeHTML(marked(v.description || ''))}
\n
\n ${v.schema?.example || ''}\n
`;\n }\n\n mimeTypeDropdownTemplate(mimeTypes) {\n return html`\n `;\n }\n\n onSelectExample(e) {\n const exampleContainerEl = e.target.closest('.example-panel');\n const exampleEls = [...exampleContainerEl.querySelectorAll('.example')];\n\n exampleEls.forEach((v) => {\n v.style.display = v.dataset.example === e.target.value ? 'block' : 'none';\n });\n }\n\n mimeExampleTemplate(mimeRespDetails) {\n if (!mimeRespDetails) {\n return html`\n
 No example provided 
\n `;\n }\n return html`\n ${mimeRespDetails.examples.length === 1\n ? html`\n ${mimeRespDetails.examples[0].exampleFormat === 'json'\n ? html`\n ${mimeRespDetails.examples[0].exampleSummary && mimeRespDetails.examples[0].exampleSummary.length > 80 ? html`
${mimeRespDetails.examples[0].exampleSummary}
` : ''}\n ${mimeRespDetails.examples[0].exampleDescription ? html`
${unsafeHTML(marked(mimeRespDetails.examples[0].exampleDescription || ''))}
` : ''}\n `\n : html`\n ${mimeRespDetails.examples[0].exampleSummary && mimeRespDetails.examples[0].exampleSummary.length > 80 ? html`
${mimeRespDetails.examples[0].exampleSummary}
` : ''}\n ${mimeRespDetails.examples[0].exampleDescription ? html`
${unsafeHTML(marked(mimeRespDetails.examples[0].exampleDescription || ''))}
` : ''}\n
${mimeRespDetails.examples[0].exampleValue}
\n `\n }`\n : html`\n \n \n ${mimeRespDetails.examples.map((v) => html`\n
\n ${v.exampleSummary && v.exampleSummary.length > 80 ? html`
${v.exampleSummary}
` : ''}\n ${v.exampleDescription ? html`
${unsafeHTML(marked(v.exampleDescription || ''))}
` : ''}\n ${v.exampleFormat === 'json'\n ? html`\n `\n : html`
${v.exampleValue}
`\n }\n
\n `)}\n
\n `\n }\n `;\n }\n\n mimeSchemaTemplate(mimeRespDetails) {\n if (!mimeRespDetails) {\n return html`\n
 Schema not found
\n `;\n }\n return html`\n ${this.schemaStyle === 'table'\n ? html`\n `\n : html`\n `\n }`;\n }\n /* eslint-enable indent */\n}\n\n// Register the element with the browser\nif (!customElements.get('api-response')) customElements.define('api-response', ApiResponse);\n","/* eslint-disable max-len */\nimport { LitElement, html, css } from 'lit';\n// eslint-disable-next-line import/extensions\nimport checkSymbol from './assets/check-symbol';\nimport copySymbol from './assets/copy-symbol';\nimport './toast-component';\n\n/* eslint-disable indent */\n// eslint-disable-next-line import/prefer-default-export\nexport class ContentCopyButton extends LitElement {\n static properties = {\n id: { type: String },\n content: { type: String },\n copied: { type: Boolean },\n showButton: { type: Boolean },\n showToast: { type: Boolean },\n };\n\n constructor(id, content) {\n super();\n this.id = id;\n this.content = content;\n this.copied = false;\n this.showButton = false;\n this.showToast = false;\n this.addEventListener('closed-toast', () => { this.showToast = false; });\n }\n\n reset() {\n this.copied = false;\n this.showButton = false;\n }\n\n willUpdate(changedProperties) {\n if (changedProperties.has('id')) {\n this.reset();\n }\n }\n\n onButtonClick() {\n navigator.clipboard.writeText(this.content);\n this.copied = true;\n }\n\n onTextClick() {\n navigator.clipboard.writeText(this.content);\n this.showToast = true;\n }\n\n onMouseover() {\n this.showButton = true;\n }\n\n onMouseLeave() {\n this.showButton = false;\n this.copied = false;\n }\n\n render() {\n return html`\n
\n ${this.content}\n \n
\n ${\n this.showToast\n ? html``\n : ''\n }\n `;\n }\n\n static get styles() {\n return [\n css`\n .svg-container {\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-items: flex-start;\n padding: 0px 8px 0px 0px;\n gap: 10px;\n width: 57px;\n height: 20px;\n background: linear-gradient(270deg, #FFFFFF 51.22%, rgba(255, 255, 255, 0) 104.88%);\n }\n\n span {\n flex: 1 0 auto;\n padding: 4px 8px;\n }\n\n span:hover {\n cursor: pointer;\n }\n\n button {\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n cursor: pointer;\n outline: inherit;\n right: 0;\n display: block;\n position: -webkit-sticky;\n position: sticky;\n }\n\n .copy-container {\n width: inherit;\n height: inherit;\n opacity: 0;\n filter: alpha(opacity = 0);\n position: absolute;\n top:0; bottom:0; left:0; right:0;\n display: block;\n z-index: 2;\n background: transparent;\n }\n\n .content-copy-container {\n width: inherit;\n height: inherit;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-wrap: nowrap;\n font-size: 14px;\n white-space: nowrap;\n overflow-y: hidden;\n overflow-x: auto;\n align-items: center;\n }\n\n .content-copy-container::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n\n .content-copy-container::-webkit-scrollbar-track {\n background:var(--input-bg);\n }\n \n .content-copy-container::-webkit-scrollbar-thumb {\n border-radius: 2px;\n background-color: var(--border-color);\n }\n `,\n ];\n }\n}\n\nif (!customElements.get('content-copy-button')) customElements.define('content-copy-button', ContentCopyButton);\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport { rapidocApiKey, downloadResource, viewResource } from '../utils/common-utils';\nimport { pathSecurityTemplate } from './security-scheme-template';\nimport codeSamplesTemplate from './code-samples-template';\nimport callbackTemplate from './callback-template';\nimport '../components/api-request';\nimport '../components/api-response';\nimport '../components/content-copy-button';\nimport processPathDescription from '../utils/magic-block-utils';\nimport { joinURLandPath } from '../utils/url';\nimport renderBlockquote from '../utils/renderBlockquote';\n\n/* eslint-disable indent */\nfunction headingRenderer(tagElementId) {\n const renderer = new marked.Renderer();\n renderer.heading = ((text, level, raw, slugger) => `${text}`);\n return renderer;\n}\n\nexport function expandedEndpointBodyTemplate(path, tagName = '') {\n const acceptContentTypes = new Set();\n for (const respStatus in path.responses) {\n for (const acceptContentType in (path.responses[respStatus]?.content)) {\n acceptContentTypes.add(acceptContentType.trim());\n }\n }\n const accept = [...acceptContentTypes].join(', ');\n\n // Filter API Keys that are non-empty and are applicable to the the path\n const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter((v) => (v.finalKeyValue && path.security?.some((ps) => (v.securitySchemeId in ps)))) || [];\n\n // If a RapiDoc API Key is specified on the element and its value is not hyphen(-) then include it for all paths\n const rapiDocApiKey = this.resolvedSpec.securitySchemes.find((v) => (v.securitySchemeId === rapidocApiKey && v.value !== '-'));\n if (rapiDocApiKey) {\n nonEmptyApiKeys.push(rapiDocApiKey);\n }\n\n const docUrl = `https://developers.vtex.com/docs/api-reference/${this.specUrl.split('/')[3]}`;\n marked.Renderer.prototype.blockquote = renderBlockquote;\n\n const codeSampleTabPanel = path.xCodeSamples ? codeSamplesTemplate.call(this, path.xCodeSamples) : '';\n path.description = processPathDescription(path.description);\n return html`\n ${this.renderStyle === 'read' ? html`
` : ''}\n
\n \n ${path.deprecated ? html`
DEPRECATED
` : ''}\n ${html`\n ${path.xBadges && path.xBadges?.length > 0\n ? html`\n
\n ${path.xBadges.map((v) => (\n html`${v.label}`\n ))\n }\n
\n `\n : ''\n }\n
\n ${(this.renderStyle === 'focused' && tagName !== 'General ⦂') ? html`\n

${this.resolvedSpec.info.title} › ${tagName}

\n ` : ''}\n ${(this.specUrl && this.allowSpecFileDownload) ? html`
\n \n \n
` : ''}\n
\n

${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}

\n ${path.isWebhook\n ? html` WEBHOOK `\n : html`\n
\n
\n ${path.method}\n
\n
\n \n
\n
\n `\n }\n `\n }\n ${path.description ? html`
${unsafeHTML(marked(path.description))}
` : ''}\n \n ${codeSampleTabPanel}\n
\n \n\n ${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}\n\n \n
\n
\n `;\n}\n\nexport default function expandedEndpointTemplate() {\n if (!this.resolvedSpec) { return ''; }\n return html`\n ${this.resolvedSpec.tags.map((tag) => html`\n
\n
${tag.name}
\n \n
\n ${unsafeHTML(`\n
\n ${marked(tag.description || '', this.infoDescriptionHeadingsInNavBar === 'true' ? { renderer: headingRenderer(tag.elementId) } : undefined)}\n
`)\n }\n
\n
\n
\n ${tag.paths.map((path) => expandedEndpointBodyTemplate.call(this, path))}\n
\n `)\n }\n`;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport { schemaInObjectNotation } from '../utils/schema-utils';\nimport '../components/json-tree';\nimport '../components/schema-tree';\nimport '../components/schema-table';\n\nfunction schemaBodyTemplate(sComponent) {\n return html`\n
\n
\n
${sComponent.name} Schema
\n ${this.schemaStyle === 'table'\n ? html`\n `\n : html`\n `\n}\n
`;\n}\n\nfunction componentBodyTemplate(sComponent, componentType) {\n if (sComponent.id.indexOf('schemas-') !== -1) {\n return schemaBodyTemplate.call(this, sComponent);\n }\n return html`\n
\n
\n ${html`\n
${sComponent.name} ${componentType}
\n ${sComponent.component\n ? html`\n
\n \n
`\n : ''}\n `}\n
\n `;\n}\n\nexport default function componentsTemplate() {\n if (!this.resolvedSpec) { return ''; }\n return html`\n ${this.resolvedSpec.components.map((component) => html`\n
\n
${component.name}
\n
\n ${unsafeHTML(`
${marked(component.description ? component.description : '')}
`)}\n
\n
\n
\n ${component.subComponents.filter((c) => c.expanded !== false).map((sComponent) => componentBodyTemplate.call(this, sComponent, component.name))}\n
\n `)\n}\n`;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport processPathDescription from '../utils/magic-block-utils';\nimport { downloadResource, viewResource } from '../utils/common-utils';\nimport renderBlockquote from '../utils/renderBlockquote';\n\n/* eslint-disable indent */\nfunction headingRenderer() {\n const renderer = new marked.Renderer();\n renderer.heading = ((text, level, raw, slugger) => `${text}`);\n return renderer;\n}\n\nexport default function overviewTemplate() {\n this.resolvedSpec.info.description = processPathDescription(this.resolvedSpec.info.description);\n marked.Renderer.prototype.blockquote = renderBlockquote;\n\n return html`\n
\n \n ${this.resolvedSpec?.info\n ? html`\n ${this.specUrl && this.allowSpecFileDownload === 'true'\n ? html`\n
\n \n \n
`\n : ''\n }\n
\n ${this.resolvedSpec.info.title}\n ${!this.resolvedSpec.info.version ? '' : html`\n \n ${this.resolvedSpec.info.version}\n `\n }\n
\n
\n ${this.resolvedSpec.info.contact?.email\n ? html`${this.resolvedSpec.info.contact.name || 'Email'}: \n ${this.resolvedSpec.info.contact.email}\n `\n : ''\n }\n ${this.resolvedSpec.info.contact?.url\n ? html`URL: ${this.resolvedSpec.info.contact.url}`\n : ''\n }\n ${this.resolvedSpec.info.license\n ? html`License: \n ${this.resolvedSpec.info.license.url\n ? html`${this.resolvedSpec.info.license.name}`\n : this.resolvedSpec.info.license.name\n } `\n : ''\n }\n ${this.resolvedSpec.info.termsOfService\n ? html`Terms of Service`\n : ''\n }\n
\n \n
\n ${this.resolvedSpec.info.description\n ? html`${\n unsafeHTML(`\n
\n ${marked(this.resolvedSpec.info.description, this.infoDescriptionHeadingsInNavBar === 'true' ? { renderer: headingRenderer() } : undefined)}\n
`)}`\n : ''\n }\n
\n `\n : ''\n }\n
\n `;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\nimport { marked } from 'marked';\nimport { pathIsInSearch } from '../utils/common-utils';\n\nexport function expandCollapseNavBarTag(navLinkEl, action = 'toggle') {\n const tagAndPathEl = navLinkEl?.closest('.nav-bar-tag-and-paths');\n const pathsUnderTagEl = tagAndPathEl?.querySelector('.nav-bar-paths-under-tag');\n if (tagAndPathEl) {\n const isExpanded = tagAndPathEl.classList.contains('expanded');\n if (isExpanded && (action === 'toggle' || action === 'collapse')) {\n pathsUnderTagEl.style.maxHeight = 0;\n tagAndPathEl.classList.replace('expanded', 'collapsed');\n } else if (!isExpanded && (action === 'toggle' || action === 'expand')) {\n tagAndPathEl.classList.replace('collapsed', 'expanded');\n pathsUnderTagEl.style.maxHeight = `${pathsUnderTagEl.scrollHeight}px`;\n }\n }\n}\n\nexport function expandCollapseAll(event, action = 'expand-all') {\n if (!(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13))) {\n return;\n }\n const navEl = event.target.closest('.nav-scroll');\n const elList = [...navEl.querySelectorAll('.nav-bar-tag-and-paths')];\n if (action === 'expand-all') {\n elList.forEach((el) => {\n const navBarPathsUnderTagEl = el.querySelector('.nav-bar-paths-under-tag');\n el.classList.replace('collapsed', 'expanded');\n navBarPathsUnderTagEl.style.maxHeight = `${navBarPathsUnderTagEl?.scrollHeight}px`;\n });\n } else {\n elList.forEach((el) => {\n el.classList.replace('expanded', 'collapsed');\n el.querySelector('.nav-bar-paths-under-tag').style.maxHeight = 0;\n });\n }\n}\n\nexport function navBarClickAndEnterHandler(event) {\n if (!(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13))) {\n return;\n }\n const navEl = event.target;\n event.stopPropagation();\n if (navEl.dataset?.action === 'navigate') {\n this.scrollToEventTarget(event, false);\n } else if (navEl.dataset?.action === 'expand-all' || (navEl.dataset?.action === 'collapse-all')) {\n expandCollapseAll(event, navEl.dataset.action);\n } else if (navEl.dataset?.action === 'expand-collapse-tag') {\n expandCollapseNavBarTag(navEl, 'toggle');\n }\n}\n\n/* eslint-disable indent */\nexport default function navbarTemplate() {\n if (!this.resolvedSpec || this.resolvedSpec.specLoadError) {\n return html`\n \n `;\n }\n return html`\n
\n ${this.resolvedSpec.infoDescriptionHeaders.length > 0 ? html`
` : ''}\n `\n : html``\n }\n `\n }\n \n ${this.allowServerSelection === 'false'\n ? ''\n : html``\n }\n ${(this.allowAuthentication === 'false' || !this.resolvedSpec.securitySchemes)\n ? ''\n : html``\n }\n\n \n\n \n ${this.resolvedSpec.tags\n .filter((tag) => tag.paths.filter((path) => pathIsInSearch(this.matchPaths, path, this.matchType)).length)\n .map((tag) => html`\n `\n }`\n : ''\n }\n \n
\n `)\n }\n\n \n ${this.resolvedSpec.components && this.showComponents === 'true' && this.renderStyle === 'focused'\n ? html`\n \n ${this.resolvedSpec.components.map((component) => (component.subComponents.length\n ? html`\n \n ${component.subComponents.filter((p) => p.expanded !== false).map((p) => html`\n `)\n }`\n : ''))\n }`\n : ''\n }\n `\n }\n\n`;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport { expandedEndpointBodyTemplate } from './expanded-endpoint-template';\nimport '../components/api-request';\nimport '../components/api-response';\nimport componentsTemplate from './components-template';\nimport overviewTemplate from './overview-template';\nimport serverTemplate from './server-template';\nimport securitySchemeTemplate from './security-scheme-template';\nimport { expandCollapseNavBarTag } from './navbar-template';\n\nfunction headingRenderer(tagElementId) {\n const renderer = new marked.Renderer();\n renderer.heading = ((text, level, raw, slugger) => `${text}`);\n return renderer;\n}\n\nfunction wrapFocusedTemplate(templateToWrap) {\n return html`\n
\n ${templateToWrap}\n
`;\n}\n\nfunction defaultContentTemplate() {\n // In focused mode default content is overview or first path\n if (this.showInfo === 'true') {\n return wrapFocusedTemplate(overviewTemplate.call(this));\n }\n const selectedTagObj = this.resolvedSpec.tags[0];\n const selectedPathObj = this.resolvedSpec.tags[0]?.paths[0];\n return (selectedTagObj && selectedPathObj)\n ? wrapFocusedTemplate(expandedEndpointBodyTemplate.call(this, selectedPathObj, selectedTagObj.name))\n : wrapFocusedTemplate('');\n}\n\n/* eslint-disable indent */\nfunction focusedTagBodyTemplate(tag) {\n return html`\n

${tag.name}

\n ${this.onNavTagClick === 'show-description' && tag.description\n ? html`\n
\n ${\n unsafeHTML(`\n
\n ${marked(tag.description || '', this.infoDescriptionHeadingsInNavBar === 'true' ? { renderer: headingRenderer(tag.elementId) } : undefined)}\n
`)\n }\n
`\n : ''\n }\n `;\n}\n\nexport default function focusedEndpointTemplate() {\n if (!this.focusedElementId || !this.resolvedSpec) {\n return;\n }\n const focusElId = this.focusedElementId;\n let selectedPathObj = null;\n let selectedTagObj = null;\n let focusedTemplate;\n let i = 0;\n if (focusElId.startsWith('overview') && this.showInfo === 'true') {\n focusedTemplate = overviewTemplate.call(this);\n } else if (focusElId === 'auth' && this.allowAuthentication === 'true') {\n focusedTemplate = securitySchemeTemplate.call(this);\n } else if (focusElId === 'servers' && this.allowServerSelection === 'true') {\n focusedTemplate = serverTemplate.call(this);\n } else if (focusElId === 'operations-top') {\n focusedTemplate = html`\n
\n \n
`;\n } else if (focusElId.startsWith('cmp--') && this.showComponents === 'true') {\n focusedTemplate = componentsTemplate.call(this);\n } else if (focusElId.startsWith('tag--')) {\n const idToFocus = focusElId.indexOf('--', 4) > 0 ? focusElId.substring(0, focusElId.indexOf('--', 5)) : focusElId;\n selectedTagObj = this.resolvedSpec.tags.find((v) => v.elementId === idToFocus);\n if (selectedTagObj) {\n focusedTemplate = wrapFocusedTemplate.call(this, focusedTagBodyTemplate.call(this, selectedTagObj));\n } else {\n focusedTemplate = defaultContentTemplate.call(this);\n }\n } else {\n for (i = 0; i < this.resolvedSpec.tags.length; i += 1) {\n selectedTagObj = this.resolvedSpec.tags[i];\n selectedPathObj = this.resolvedSpec.tags[i].paths.find((v) => `${v.elementId}` === focusElId);\n if (selectedPathObj) {\n break;\n }\n }\n if (selectedPathObj) {\n // In focused mode we must expand the nav-bar tag element if it is collapsed\n const newNavEl = this.shadowRoot.getElementById(`link-${focusElId}`);\n expandCollapseNavBarTag(newNavEl, 'expand');\n focusedTemplate = wrapFocusedTemplate.call(\n this,\n expandedEndpointBodyTemplate.call(this, selectedPathObj, (selectedTagObj.name || ''), (selectedTagObj.description || '')),\n );\n } else {\n // if focusedElementId is not found then show the default content (overview or first-path)\n focusedTemplate = defaultContentTemplate.call(this);\n }\n }\n return focusedTemplate;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport '../components/api-request';\nimport '../components/api-response';\nimport '../components/content-copy-button';\nimport codeSamplesTemplate from './code-samples-template';\nimport callbackTemplate from './callback-template';\nimport { pathSecurityTemplate } from './security-scheme-template';\nimport { pathIsInSearch, rapidocApiKey } from '../utils/common-utils';\nimport processPathDescription from '../utils/magic-block-utils';\nimport { joinURLandPath } from '../utils/url';\n\nfunction toggleExpand(path) {\n if (path.expanded) {\n path.expanded = false; // collapse\n if (this.updateRoute === 'true') {\n this.replaceHistoryState('');\n }\n } else {\n path.expanded = true; // Expand\n if (this.updateRoute === 'true') {\n const newHash = `${this.routePrefix || '#'}${path.elementId}`;\n if (window.location.hash !== newHash) {\n this.replaceHistoryState(path.elementId);\n }\n }\n }\n this.requestUpdate();\n}\n\nexport function expandCollapseAll(operationsRootEl, action = 'expand-all') {\n const elList = [...operationsRootEl.querySelectorAll('.section-tag')];\n if (action === 'expand-all') {\n elList.map((el) => {\n el.classList.replace('collapsed', 'expanded');\n });\n } else {\n elList.map((el) => {\n el.classList.replace('expanded', 'collapsed');\n });\n }\n}\n\nfunction onExpandCollapseAll(e, action = 'expand-all') {\n expandCollapseAll.call(this, e.target.closest('.operations-root'), action);\n}\n\n/* eslint-disable indent */\nfunction endpointHeadTemplate(path, pathsExpanded = false) {\n return html`\n { toggleExpand.call(this, path, e); }}\" part=\"section-endpoint-head-${path.expanded ? 'expanded' : 'collapsed'}\" class='endpoint-head ${path.method} ${path.deprecated ? 'deprecated' : ''} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>\n
${path.method}
\n
\n ${path.path} \n ${path.isWebhook ? html` Webhook` : ''}\n
\n ${path.deprecated\n ? html`\n \n deprecated \n `\n : ''\n }\n ${this.showSummaryWhenCollapsed\n ? html`\n
\n
${path.summary || path.shortSummary}
`\n : ''\n }\n
\n `;\n}\n\nfunction endpointBodyTemplate(path) {\n const acceptContentTypes = new Set();\n for (const respStatus in path.responses) {\n for (const acceptContentType in (path.responses[respStatus]?.content)) {\n acceptContentTypes.add(acceptContentType.trim());\n }\n }\n const accept = [...acceptContentTypes].join(', ');\n // Filter API Keys that are non-empty and are applicable to the the path\n const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter((v) => (v.finalKeyValue && path.security?.some((ps) => (v.securitySchemeId in ps)))) || [];\n\n // If a RapiDoc API Key is specified on the element and its value is not hyphen(-) then include it for all paths\n const rapiDocApiKey = this.resolvedSpec.securitySchemes.find((v) => (v.securitySchemeId === rapidocApiKey && v.value !== '-'));\n if (rapiDocApiKey) {\n nonEmptyApiKeys.push(rapiDocApiKey);\n }\n\n const codeSampleTabPanel = path.xCodeSamples ? codeSamplesTemplate(path.xCodeSamples) : '';\n path.description = processPathDescription(path.description);\n return html`\n \n
\n
\n ${path.summary\n ? html`
${path.summary}
`\n : path.shortSummary !== path.description\n ? html`
${path.shortSummary}
`\n : ''\n }\n ${path.xBadges && path.xBadges?.length > 0\n ? html`\n
\n ${path.xBadges.map((v) => (\n html`${v.label}`\n ))\n }\n
\n `\n : ''\n }\n
\n
\n ${path.method}\n
\n
\n \n
\n
\n ${path.description ? html`
${unsafeHTML(path.description)}
` : ''}\n \n ${pathSecurityTemplate.call(this, path.security)}\n ${codeSampleTabPanel}\n
\n
\n
\n 0 ? path.servers[0].url : this.selectedServer.computedUrl}\" \n active-schema-tab = \"${this.defaultSchemaTab}\"\n fill-request-fields-with-example = \"${this.fillRequestFieldsWithExample}\"\n allow-try = \"${this.allowTry}\"\n show-curl-before-try = \"${this.showCurlBeforeTry}\"\n accept = \"${accept}\"\n render-style=\"${this.renderStyle}\" \n schema-style = \"${this.schemaStyle}\" \n schema-expand-level = \"${this.schemaExpandLevel}\"\n schema-description-expanded = \"${this.schemaDescriptionExpanded}\"\n allow-schema-description-expand-toggle = \"${this.allowSchemaDescriptionExpandToggle}\"\n schema-hide-read-only = \"${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}\"\n schema-hide-write-only = \"${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}\"\n fetch-credentials = \"${this.fetchCredentials}\"\n exportparts = \"wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,\n file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param, \n anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle\"\n > \n\n ${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}\n
\n\n \n
\n
`;\n}\n\nexport default function endpointTemplate(showExpandCollapse = true, showTags = true, pathsExpanded = false) {\n if (!this.resolvedSpec) { return ''; }\n return html`\n ${showExpandCollapse\n ? html`\n
\n onExpandCollapseAll(e, 'expand-all')}\" style=\"color:var(--primary-color); cursor:pointer;\">\n Expand all\n \n  |  \n onExpandCollapseAll(e, 'collapse-all')}\" style=\"color:var(--primary-color); cursor:pointer;\" >\n Collapse all\n \n   sections\n
`\n : ''\n }\n ${this.resolvedSpec.tags.map((tag) => html`\n ${showTags\n ? html` \n `\n : html`\n \n `\n }\n `)\n }`;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\n\n/* eslint-disable indent */\nexport default function logoTemplate(style) {\nreturn html`\n
\n \n \n \n \n \n \n \n \n
\n`;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\nimport logoTemplate from './logo-template';\n\n/* eslint-disable indent */\nexport default function headerTemplate() {\n return html`\n
\n
\n \n ${logoTemplate('height:36px;width:36px;margin-left:5px')}\n \n \n
${this.headingText}
\n
\n
\n ${(this.allowSpecUrlLoad === 'false')\n ? ''\n : html`\n \n
\n `\n } \n ${(this.allowSpecFileLoad === 'false')\n ? ''\n : html`\n \n \n `\n }\n \n ${(this.allowSearch === 'false' || 'read focused'.includes(this.renderStyle))\n ? ''\n : html` \n \n
\n `\n }\n \n ${(this.allowAdvancedSearch === 'false' || 'read focused'.includes(this.renderStyle))\n ? ''\n : html`\n \n `\n }\n
\n
`;\n }\n/* eslint-enable indent */\n","import { html } from 'lit';\nimport '../components/dialog-box';\n\n/* eslint-disable indent */\nexport default function searchByPropertiesModalTemplate() {\n document.addEventListener('close', () => { this.showAdvancedSearchDialog = false; });\n document.addEventListener('open', this.onOpenSearchDialog);\n\n return html`\n \n \n this.onAdvancedSearch(e, 400)}\"\n >\n
\n
\n this.onAdvancedSearch(e, 0)}\">\n \n
\n
\n this.onAdvancedSearch(e, 0)}\">\n \n
\n
\n this.onAdvancedSearch(e, 0)}\">\n \n
\n
\n this.onAdvancedSearch(e, 0)}\">\n \n
\n
\n this.onAdvancedSearch(e, 0)}\">\n \n
\n
\n
\n \n ${this.advancedSearchMatches?.map((path) => html`\n {\n this.matchPaths = ''; // clear quick filter if applied\n this.showAdvancedSearchDialog = false; // Hide Search Dialog\n this.requestUpdate();\n this.scrollToEventTarget(e, true);\n }\n }\"\n > \n ${path.method} \n ${path.path}\n ${path.summary}\n
\n `)\n }\n \n `;\n}\n/* eslint-enable indent */\n","import { LitElement, html } from 'lit';\nimport DialogBoxStyles from '../styles/dialog-box-styles';\n\nexport default class DialogBox extends LitElement {\n static get properties() {\n return {\n heading: { type: String, attribute: 'heading' },\n show: { type: String, attribute: 'show' },\n };\n }\n\n static get styles() {\n return [DialogBoxStyles];\n }\n\n connectedCallback() {\n super.connectedCallback();\n document.addEventListener('keydown', (e) => {\n if (e.code === 'Escape') {\n this.onClose();\n }\n });\n }\n\n attributeChangedCallback(name, oldVal, newVal) {\n if (oldVal !== newVal) {\n if (name === 'heading') {\n this.heading = newVal;\n }\n if (name === 'show') {\n this.show = newVal;\n if (newVal === 'true') {\n document.dispatchEvent(new CustomEvent('open', {\n bubbles: true,\n composed: true,\n detail: this,\n }));\n }\n }\n }\n super.attributeChangedCallback(name, oldVal, newVal);\n }\n\n /* eslint-disable indent */\n render() {\n return html`\n ${this.show === 'true'\n ? html`\n
\n
\n
\n ${this.heading}\n \n
\n
\n \n
\n
\n
`\n : ''\n }`;\n }\n /* eslint-enable indent */\n\n onClose() {\n document.dispatchEvent(new CustomEvent('close', {\n bubbles: true,\n composed: true,\n }));\n }\n}\n\nif (!customElements.get('dialog-box')) customElements.define('dialog-box', DialogBox);\n","import { html } from 'lit';\nimport ColorUtils from './color-utils';\n/* Generates an schema object containing type and constraint info */\nexport default function setTheme(baseTheme, theme = {}) {\n let newTheme = {};\n\n // Common Theme colors\n const primaryColor = theme.primaryColor ? theme.primaryColor : baseTheme === 'dark' ? '#f76b39' : '#ff591e';\n const primaryColorInvert = ColorUtils.color.invert(primaryColor);\n const primaryColorTrans = ColorUtils.color.opacity(primaryColor, '0.4');\n\n // Dark and Light Theme colors\n if (baseTheme === 'dark') {\n const bg1 = theme.bg1 ? theme.bg1 : '#2a2b2c';\n const fg1 = theme.fg1 ? theme.fg1 : '#bbb';\n\n const bg2 = theme.bg2 ? theme.bg2 : ColorUtils.color.brightness(bg1, 5); // or #383838;\n const bg3 = theme.bg3 ? theme.bg3 : ColorUtils.color.brightness(bg1, 17); // or #444;\n const lightBg = theme.bg3 ? theme.bg3 : ColorUtils.color.brightness(bg1, 35);\n const fg2 = theme.fg2 ? theme.fg2 : ColorUtils.color.brightness(fg1, -15); // or #ababab\n const fg3 = theme.fg3 ? theme.fg3 : ColorUtils.color.brightness(fg1, -20); // or #aaa\n const lightFg = theme.fg3 ? theme.fg3 : '#A1A8B3'; // or #777\n const inlineCodeFg = theme.inlineCodeFg ? theme.inlineCodeFg : '#aaa';\n\n const headerColor = theme.headerColor ? theme.headerColor : ColorUtils.color.brightness(bg1, 10);\n\n const navBgColor = theme.navBgColor ? theme.navBgColor : ColorUtils.color.brightness(bg1, 10);\n const navTextColor = theme.navTextColor ? theme.navTextColor : ColorUtils.color.opacity(ColorUtils.color.invert(navBgColor), '0.50');\n const navHoverBgColor = theme.navHoverBgColor ? theme.navHoverBgColor : ColorUtils.color.brightness(navBgColor, -15);\n const navHoverTextColor = theme.navHoverTextColor ? theme.navHoverTextColor : ColorUtils.color.invert(navBgColor);\n const navAccentColor = theme.navAccentColor ? theme.navAccentColor : ColorUtils.color.brightness(primaryColor, 25);\n const navAccentTextColor = theme.navAccentTextColor ? theme.navAccenttextColor : ColorUtils.color.invert(navAccentColor);\n\n const overlayBg = 'rgba(80, 80, 80, 0.4)';\n\n newTheme = {\n bg1,\n bg2,\n bg3,\n lightBg,\n fg1,\n fg2,\n fg3,\n lightFg,\n inlineCodeFg,\n primaryColor,\n primaryColorTrans,\n primaryColorInvert,\n overlayBg,\n navBgColor,\n navTextColor,\n navHoverBgColor,\n navHoverTextColor,\n navAccentColor,\n navAccentTextColor,\n headerColor,\n headerColorInvert: ColorUtils.color.invert(headerColor),\n headerColorDarker: ColorUtils.color.brightness(headerColor, -20),\n headerColorBorder: ColorUtils.color.brightness(headerColor, 10),\n\n borderColor: theme.borderColor || ColorUtils.color.brightness(bg1, 20), // #555\n lightBorderColor: theme.lightBorderColor || '#e7e9ee', // #444\n codeBorderColor: theme.codeBorderColor || ColorUtils.color.brightness(bg1, 30),\n\n inputBg: theme.inputBg || ColorUtils.color.brightness(bg1, -5), // #2f2f2f\n placeHolder: theme.placeHolder || ColorUtils.color.opacity(fg1, '0.3'),\n hoverColor: theme.hoverColor || ColorUtils.color.brightness(bg1, -10), // #2a2a2a\n\n red: theme.red ? theme.red : '#F06560',\n lightRed: theme.lightRed ? theme.lightRed : ColorUtils.color.brightness(bg1, -10), // #2a2a2a\n\n pink: theme.pink ? theme.pink : '#ffb2b2',\n lightPink: theme.lightPink || ColorUtils.color.brightness(bg1, -10),\n vtexPink: theme.vtexPink ? theme.vtexPink : '#D71D55',\n\n green: theme.green || '#7ec699',\n lightGreen: theme.lightGreen || ColorUtils.color.brightness(bg1, -10), // #2a2a2a\n\n blue: theme.blue || '#71b7ff',\n lightBlue: theme.lightBlue || ColorUtils.color.brightness(bg1, -10), // #2a2a2a\n\n orange: theme.orange ? theme.orange : '#f08d49',\n lightOrange: theme.lightOrange || ColorUtils.color.brightness(bg1, -10), // #2a2a2a\n\n yellow: theme.yellow || '#827717',\n lightYellow: theme.lightYellow || ColorUtils.color.brightness(bg1, -10), // #2a2a2a\n\n purple: theme.purple || '#786FF1',\n brown: theme.brown || '#D4AC0D',\n\n codeBg: theme.codeBg || ColorUtils.color.opacity(ColorUtils.color.brightness(bg1, -15), 0.7),\n codeFg: theme.codeFg || '#aaa',\n codePropertyColor: theme.codePropertyColor || '#f8c555',\n codeKeywordColor: theme.codeKeywordColor || '#cc99cd',\n codeOperatorColor: theme.codeOperatorColor || '#67cdcc',\n };\n } else {\n const bg1 = (theme.bg1 ? theme.bg1 : '#fafbfc');\n const fg1 = (theme.fg1 ? theme.fg1 : '#444444');\n const bg2 = theme.bg2 ? theme.bg2 : ColorUtils.color.brightness(bg1, -5); // or '#fafafa'\n const bg3 = theme.bg3 ? theme.bg3 : ColorUtils.color.brightness(bg1, -15); // or '#f6f6f6'\n const lightBg = theme.bg3 ? theme.bg3 : ColorUtils.color.brightness(bg1, -45);\n const fg2 = theme.fg2 ? theme.fg2 : '#545454';\n const fg3 = theme.fg3 ? theme.fg3 : ColorUtils.color.brightness(fg1, 30); // or #666\n const lightFg = theme.fg3 ? theme.fg3 : '#A1A8B3'; // or #999\n const inlineCodeFg = theme.inlineCodeFg ? theme.inlineCodeFg : 'brown';\n\n const headerColor = theme.headerColor ? theme.headerColor : ColorUtils.color.brightness(bg1, -180);\n\n /*\n const navBgColor = theme.navBgColor ? theme.navBgColor : ColorUtils.color.brightness(bg1, -10);\n const navTextColor = theme.navTextColor ? theme.navTextColor : ColorUtils.color.brightness(fg1, 5);\n const navHoverBgColor = theme.navHoverBgColor ? theme.navHoverBgColor : bg1;\n const navHoverTextColor = theme.navHoverTextColor ? theme.navHoverTextColor : primaryColor;\n const navAccentColor = theme.navAccentColor ? theme.navAccentColor : primaryColor;\n */\n const navBgColor = theme.navBgColor ? theme.navBgColor : ColorUtils.color.brightness(bg1, -200);\n const navTextColor = theme.navTextColor ? theme.navTextColor : ColorUtils.color.opacity(ColorUtils.color.invert(navBgColor), '0.65');\n const navHoverBgColor = theme.navHoverBgColor ? theme.navHoverBgColor : ColorUtils.color.brightness(navBgColor, -15);\n const navHoverTextColor = theme.navHoverTextColor ? theme.navHoverTextColor : ColorUtils.color.invert(navBgColor);\n const navAccentColor = theme.navAccentColor ? theme.navAccentColor : ColorUtils.color.brightness(primaryColor, 25);\n const navAccentTextColor = theme.navAccentTextColor ? theme.navAccenttextColor : ColorUtils.color.invert(navAccentColor);\n const overlayBg = 'rgba(0, 0, 0, 0.4)';\n\n newTheme = {\n bg1,\n bg2,\n bg3,\n lightBg,\n fg1,\n fg2,\n fg3,\n lightFg,\n inlineCodeFg,\n primaryColor,\n primaryColorTrans,\n primaryColorInvert,\n overlayBg,\n navBgColor,\n navTextColor,\n navHoverBgColor,\n navHoverTextColor,\n navAccentColor,\n navAccentTextColor,\n headerColor,\n headerColorInvert: ColorUtils.color.invert(headerColor),\n headerColorDarker: ColorUtils.color.brightness(headerColor, -20),\n headerColorBorder: ColorUtils.color.brightness(headerColor, 10),\n\n borderColor: theme.borderColor || '#B9B9B9',\n lightBorderColor: theme.lightBorderColor || '#e7e9ee',\n codeBorderColor: theme.codeBorderColor || 'transparent',\n\n inputBg: theme.inputBg || 'rgba(255, 255, 255, 0.0001)',\n placeHolder: theme.placeHolder || ColorUtils.color.brightness(lightFg, 20), // #dedede\n hoverColor: theme.hoverColor || ColorUtils.color.brightness(bg1, -5), // # f1f1f1\n\n rebelPink: '#e31c58',\n\n red: theme.red || '#F06560',\n lightRed: theme.lightRed || '#fff0f0',\n\n pink: theme.pink ? theme.pink : '#990055',\n lightPink: theme.lightPink ? theme.lightPink : '#ffb2b2',\n vtexPink: theme.vtexPink ? theme.vtexPink : '#D71D55',\n\n green: theme.green || '#690',\n lightGreen: theme.lightGreen || '#fbfff0',\n\n blue: theme.blue || '#47AFE8',\n lightBlue: theme.lightBlue || '#eff8fd',\n\n orange: theme.orange || '#FF9900',\n lightOrange: theme.lightOrange || '#fff5e6',\n\n yellow: theme.yellow || '#827717',\n lightYellow: theme.lightYellow || '#fff5cc',\n\n purple: theme.purple || '#786FF1',\n brown: theme.brown || '#D4AC0D',\n\n fgPositive: '#38853C',\n bgPositive: '#DFF1E0',\n borderPositive: '#83D187',\n\n fgPatch: '#6C6314',\n bgPatch: '#e9e7da',\n borderPatch: '#afa871',\n\n fgWarning: '#D56A00',\n bgWarning: '#FFEBD7',\n borderWarning: '#F5AE70',\n\n fgInfo: '#2978B5',\n bgInfo: '#DEECF7',\n borderInfo: '#7CBBEA',\n\n fgCritical: '#CC3D3D',\n bgCritical: '#F8E3E3',\n borderCritical: '#F49494',\n\n codeBg: theme.codeBg || ColorUtils.color.opacity(ColorUtils.color.brightness(bg1, -15), 0.7),\n codeFg: theme.codeFg || '#666',\n codePropertyColor: theme.codePropertyColor || '#905',\n codeKeywordColor: theme.codeKeywordColor || '#07a',\n codeOperatorColor: theme.codeOperatorColor || '#9a6e3a',\n };\n }\n return html`\n `;\n}\n","import { html } from 'lit';\n\n// Templates\nimport expandedEndpointTemplate from './expanded-endpoint-template';\nimport focusedEndpointTemplate from './focused-endpoint-template';\nimport overviewTemplate from './overview-template';\nimport endpointTemplate from './endpoint-template';\nimport { recoverPersistedApiKeys } from './security-scheme-template';\nimport headerTemplate from './header-template';\nimport navbarTemplate from './navbar-template';\nimport advancedSearchTemplate from './advance-search-template';\nimport SetTheme from '../utils/theme';\nimport { isValidHexColor } from '../utils/color-utils';\n\nexport default function mainBodyTemplate(isMini = false, showExpandCollapse = true, showTags = true, pathsExpanded = false) {\n if (!this.resolvedSpec) {\n return '';\n }\n if (this.persistAuth === 'true') {\n recoverPersistedApiKeys.call(this);\n }\n const newTheme = {\n bg1: isValidHexColor(this.bgColor) ? this.bgColor : '',\n fg1: isValidHexColor(this.textColor) ? this.textColor : '',\n headerColor: isValidHexColor(this.headerColor) ? this.headerColor : '',\n primaryColor: isValidHexColor(this.primaryColor) ? this.primaryColor : '',\n navBgColor: isValidHexColor(this.navBgColor) ? this.navBgColor : '',\n navTextColor: isValidHexColor(this.navTextColor) ? this.navTextColor : '',\n navHoverBgColor: isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',\n navHoverTextColor: isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : '',\n navAccentColor: isValidHexColor(this.navAccentColor) ? this.navAccentColor : '',\n navAccentTextColor: isValidHexColor(this.navAccentTextColor) ? this.navAccentTextColor : '',\n };\n /* eslint-disable indent */\n if (this.resolvedSpec.specLoadError) {\n if (isMini) {\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n
${this.resolvedSpec.info.description}
\n `;\n }\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n \n ${headerTemplate.call(this)}\n
\n \n
\n

${this.resolvedSpec.info.title}

\n
${this.resolvedSpec.info.description}
\n
\n
\n `;\n }\n if (this.resolvedSpec.isSpecLoading) {\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n
\n \n
\n
\n
\n
\n `;\n }\n\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n\n \n ${this.showHeader === 'false' ? '' : headerTemplate.call(this)}\n\n \n ${this.allowAdvancedSearch === 'false' ? '' : advancedSearchTemplate.call(this)}\n\n
\n \n ${((this.renderStyle === 'read' || this.renderStyle === 'focused')\n && this.showSideNav === 'true'\n && this.resolvedSpec\n ) ? navbarTemplate.call(this) : ''\n }\n\n \n
\n \n
\n ${this.loading === true\n ? html`
`\n : html`\n ${this.loadFailed === true\n ? html`
Unable to load the Spec
`\n : html`\n
\n ${this.renderStyle === 'focused'\n ? html`${focusedEndpointTemplate.call(this)}`\n : html`\n ${this.showInfo === 'true' ? overviewTemplate.call(this) : ''}\n
\n \n
\n ${this.renderStyle === 'read'\n ? expandedEndpointTemplate.call(this)\n : endpointTemplate.call(this, showExpandCollapse, showTags, pathsExpanded)\n }\n `\n }\n
\n `\n }`\n }\n
\n \n
\n
\n `;\n}\n/* eslint-enable indent */\n","import { css, LitElement, unsafeCSS } from 'lit';\nimport { marked } from 'marked';\nimport Prism from 'prismjs';\nimport 'prismjs/components/prism-css';\nimport 'prismjs/components/prism-yaml';\nimport 'prismjs/components/prism-go';\nimport 'prismjs/components/prism-java';\nimport 'prismjs/components/prism-json';\nimport 'prismjs/components/prism-bash';\nimport 'prismjs/components/prism-python';\nimport 'prismjs/components/prism-http';\nimport 'prismjs/components/prism-csharp';\n\n// Styles\nimport FontStyles from './styles/font-styles';\nimport InputStyles from './styles/input-styles';\nimport FlexStyles from './styles/flex-styles';\nimport TableStyles from './styles/table-styles';\nimport EndpointStyles from './styles/endpoint-styles';\nimport PrismStyles from './styles/prism-styles';\nimport TabStyles from './styles/tab-styles';\nimport NavStyles from './styles/nav-styles';\nimport InfoStyles from './styles/info-styles';\nimport CustomStyles from './styles/custom-styles';\n// import { expandCollapseNavBarTag } from '@/templates/navbar-template';\nimport { advancedSearch, pathIsInSearch, componentIsInSearch, rapidocApiKey, sleep } from './utils/common-utils';\nimport ProcessSpec from './utils/spec-parser';\nimport mainBodyTemplate from './templates/main-body-template';\nimport { applyApiKey, onClearAllApiKeys } from './templates/security-scheme-template';\nimport { setApiServer } from './templates/server-template';\n\nexport default class RapiDoc extends LitElement {\n constructor() {\n super();\n /* const intersectionObserverOptions = {\n root: this.getRootNode().host,\n rootMargin: '-50px 0px -50px 0px', // when the element is visible 100px from bottom\n threshold: 0,\n };\n this.showSummaryWhenCollapsed = true;\n // Will activate intersection observer only after spec load and hash analyze\n // to scroll to the proper element without being reverted by observer behavior\n this.intersectionObserver = new IntersectionObserver((entries) => { this.onIntersect(entries); }, intersectionObserverOptions);\n */\n this.isIntersectionObserverActive = false;\n }\n\n static get properties() {\n return {\n // Heading\n headingText: { type: String, attribute: 'heading-text' },\n gotoPath: { type: String, attribute: 'goto-path' },\n\n // Spec\n updateRoute: { type: String, attribute: 'update-route' },\n routePrefix: { type: String, attribute: 'route-prefix' },\n specUrl: { type: String, attribute: 'spec-url' },\n spec: { type: String, attribute: 'spec' },\n sortTags: { type: String, attribute: 'sort-tags' },\n generateMissingTags: { type: String, attribute: 'generate-missing-tags' },\n sortEndpointsBy: { type: String, attribute: 'sort-endpoints-by' },\n specFile: { type: String, attribute: false },\n\n // UI Layouts\n layout: { type: String },\n renderStyle: { type: String, attribute: 'render-style' },\n defaultSchemaTab: { type: String, attribute: 'default-schema-tab' },\n responseAreaHeight: { type: String, attribute: 'response-area-height' },\n fillRequestFieldsWithExample: { type: String, attribute: 'fill-request-fields-with-example' },\n persistAuth: { type: String, attribute: 'persist-auth' },\n onNavTagClick: { type: String, attribute: 'on-nav-tag-click' },\n\n // Schema Styles\n schemaStyle: { type: String, attribute: 'schema-style' },\n schemaExpandLevel: { type: Number, attribute: 'schema-expand-level' },\n schemaDescriptionExpanded: { type: String, attribute: 'schema-description-expanded' },\n schemaHideReadOnly: { type: String, attribute: 'schema-hide-read-only' },\n schemaHideWriteOnly: { type: String, attribute: 'schema-hide-write-only' },\n\n // API Server\n apiKeyName: { type: String, attribute: 'api-key-name' },\n apiKeyLocation: { type: String, attribute: 'api-key-location' },\n apiKeyValue: { type: String, attribute: 'api-key-value' },\n defaultApiServerUrl: { type: String, attribute: 'default-api-server' },\n serverUrl: { type: String, attribute: 'server-url' },\n oauthReceiver: { type: String, attribute: 'oauth-receiver' },\n\n // Hide/Show Sections & Enable Disable actions\n showHeader: { type: String, attribute: 'show-header' },\n showSideNav: { type: String, attribute: 'show-side-nav' },\n showInfo: { type: String, attribute: 'show-info' },\n allowAuthentication: { type: String, attribute: 'allow-authentication' },\n allowTry: { type: String, attribute: 'allow-try' },\n showCurlBeforeTry: { type: String, attribute: 'show-curl-before-try' },\n allowSpecUrlLoad: { type: String, attribute: 'allow-spec-url-load' },\n allowSpecFileLoad: { type: String, attribute: 'allow-spec-file-load' },\n allowSpecFileDownload: { type: String, attribute: 'allow-spec-file-download' },\n allowSearch: { type: String, attribute: 'allow-search' },\n allowAdvancedSearch: { type: String, attribute: 'allow-advanced-search' },\n allowServerSelection: { type: String, attribute: 'allow-server-selection' },\n allowSchemaDescriptionExpandToggle: { type: String, attribute: 'allow-schema-description-expand-toggle' },\n showComponents: { type: String, attribute: 'show-components' },\n pageDirection: { type: String, attribute: 'page-direction' },\n\n // Main Colors and Font\n theme: { type: String },\n bgColor: { type: String, attribute: 'bg-color' },\n textColor: { type: String, attribute: 'text-color' },\n headerColor: { type: String, attribute: 'header-color' },\n primaryColor: { type: String, attribute: 'primary-color' },\n fontSize: { type: String, attribute: 'font-size' },\n regularFont: { type: String, attribute: 'regular-font' },\n monoFont: { type: String, attribute: 'mono-font' },\n mediumFont: { type: String, attribute: 'medium-font' },\n loadFonts: { type: String, attribute: 'load-fonts' },\n cssFile: { type: String, attribute: 'css-file' },\n cssClasses: { type: String, attribute: 'css-classes' },\n\n // Nav Bar Colors\n navBgColor: { type: String, attribute: 'nav-bg-color' },\n navTextColor: { type: String, attribute: 'nav-text-color' },\n navHoverBgColor: { type: String, attribute: 'nav-hover-bg-color' },\n navHoverTextColor: { type: String, attribute: 'nav-hover-text-color' },\n navAccentColor: { type: String, attribute: 'nav-accent-color' },\n navAccentTextColor: { type: String, attribute: 'nav-accent-text-color' },\n navActiveItemMarker: { type: String, attribute: 'nav-active-item-marker' },\n navItemSpacing: { type: String, attribute: 'nav-item-spacing' },\n showMethodInNavBar: { type: String, attribute: 'show-method-in-nav-bar' },\n usePathInNavBar: { type: String, attribute: 'use-path-in-nav-bar' },\n infoDescriptionHeadingsInNavBar: { type: String, attribute: 'info-description-headings-in-navbar' },\n\n // Fetch Options\n fetchCredentials: { type: String, attribute: 'fetch-credentials' },\n\n // Filters\n matchPaths: { type: String, attribute: 'match-paths' },\n matchType: { type: String, attribute: 'match-type' },\n\n // Internal Properties\n loading: { type: Boolean }, // indicates spec is being loaded\n focusedElementId: { type: String }, // updating the focusedElementId will automatically render appropriate section in focused mode\n showAdvancedSearchDialog: { type: Boolean },\n advancedSearchMatches: { type: Object },\n };\n }\n\n static get styles() {\n return [\n FontStyles,\n InputStyles,\n FlexStyles,\n TableStyles,\n EndpointStyles,\n PrismStyles,\n TabStyles,\n NavStyles,\n InfoStyles,\n css`\n :host {\n display:flex;\n flex-direction: column;\n min-width:360px;\n width:100%;\n height:100%;\n margin:0;\n padding:0;\n overflow: hidden;\n letter-spacing:normal;\n color:var(--fg);\n background-color:var(--bg);\n font-family:var(--font-regular);\n }\n :where(button, input[type=\"checkbox\"], [tabindex=\"0\"]):focus-visible { box-shadow: var(--focus-shadow); }\n :where(input[type=\"text\"], input[type=\"password\"], select, textarea):focus-visible { border-color: var(--primary-color); }\n .body {\n display:flex;\n height:100%;\n width:100%;\n overflow:hidden;\n max-width: 2087px;\n }\n .main-content { \n margin:0;\n padding: 0; \n display:block;\n flex:1;\n height:100%;\n overflow-y: auto;\n overflow-x: hidden;\n scrollbar-width: thin;\n scrollbar-color: var(--border-color) transparent;\n }\n\n .main-content-inner--view-mode {\n padding: 0 8px;\n }\n .main-content::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n .main-content::-webkit-scrollbar-track {\n background:transparent;\n }\n .main-content::-webkit-scrollbar-thumb {\n background-color: var(--border-color);\n }\n .section-gap.section-tag {\n border-bottom:1px solid var(--border-color);\n }\n .section-tag-header {\n position:relative;\n cursor: n-resize;\n padding: 12px 0;\n }\n .collapsed .section-tag-header:hover{\n cursor: s-resize;\n }\n\n .section-tag-header:hover{\n background-image: linear-gradient(to right, rgba(0,0,0,0), var(--border-color), rgba(0,0,0,0));\n }\n\n .section-tag-header:hover::after {\n position:absolute;\n margin-left:-24px;\n font-size:20px;\n top: calc(50% - 14px);\n color:var(--primary-color);\n content: '⬆'; \n }\n\n .collapsed .section-tag-header::after {\n position:absolute;\n margin-left:-24px;\n font-size:20px;\n top: calc(50% - 14px);\n color: var(--border-color);\n content: '⬇'; \n }\n .collapsed .section-tag-header:hover::after {\n color:var(--primary-color);\n }\n\n .collapsed .section-tag-body {\n display:none;\n }\n\n .logo {\n height:36px;\n width:36px;\n margin-left:5px; \n }\n .only-large-screen-flex,\n .only-large-screen{\n display:none;\n }\n .tag.title {\n text-transform: uppercase;\n }\n .main-header {\n background-color:var(--header-bg);\n color:var(--header-fg);\n width:100%;\n }\n .header-title {\n font-size:calc(var(--font-size-regular) + 8px); \n padding:0 8px;\n }\n input.header-input{\n background:var(--header-color-darker);\n color:var(--header-fg);\n border:1px solid var(--header-color-border);\n flex:1; \n padding-right:24px;\n border-radius:3px;\n }\n input.header-input::placeholder {\n opacity:0.4;\n }\n .loader {\n margin: 16px auto 16px auto; \n border: 4px solid var(--bg3);\n border-radius: 50%;\n border-top: 4px solid var(--primary-color);\n width: 36px;\n height: 36px;\n animation: spin 2s linear infinite;\n }\n .expanded-endpoint-body { \n position: relative;\n padding: 6px 0px; \n }\n .expanded-endpoint-body .tag-description {\n background: var(--code-bg);\n border-radius: var(--border-radius);\n transition: max-height .2s ease-out;\n }\n .expanded-endpoint-body .tag-icon {\n transition: transform .2s ease-out;\n }\n .expanded-endpoint-body .tag-icon.expanded {\n transform: rotate(180deg);\n }\n .divider { \n border-top: 2px solid var(--border-color);\n margin: 24px 0;\n width:100%;\n }\n\n .tooltip {\n cursor:pointer;\n border: 1px solid var(--border-color);\n border-left-width: 4px;\n margin-left:2px;\n }\n .tooltip a {\n color: var(--fg2);\n text-decoration: none;\n }\n .tooltip-text {\n color: var(--fg2);\n max-width: 400px;\n position: absolute;\n z-index:1;\n background-color: var(--bg2);\n visibility: hidden;\n\n overflow-wrap: break-word;\n }\n .tooltip:hover {\n color: var(--primary-color);\n border-color: var(--primary-color);\n }\n .tooltip:hover a:hover {\n color: var(--primary-color);\n }\n\n .tooltip:hover .tooltip-text {\n visibility: visible;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n\n .nav-method { font-weight: bold; margin-right: 4px; font-size: calc(var(--font-size-small) - 2px); white-space: nowrap; }\n .nav-method.false { display: none; }\n\n .nav-method.as-colored-text.get { color:var(--get-color); }\n .nav-method.as-colored-text.put { color:var(--put-color); }\n .nav-method.as-colored-text.post { color:var(--post-color); }\n .nav-method.as-colored-text.delete { color:var(--delete-color); }\n .nav-method.as-colored-text.head, .nav-method.as-colored-text.patch, .nav-method.as-colored-text.options { color:var(--nav-head-color); }\n \n .nav-method.as-colored-block {\n padding: 1px 4px;\n min-width: 30px;\n border-radius: 4px 0 0 4px;\n color: #000;\n }\n .colored-block .nav-method.as-colored-block {\n outline: 1px solid;\n }\n\n .nav-method.as-colored-block.get { background-color: var(--blue); }\n .nav-method.as-colored-block.put { background-color: var(--orange); }\n .nav-method.as-colored-block.post { background-color: var(--green); }\n .nav-method.as-colored-block.delete { background-color: var(--red); }\n .nav-method.as-colored-block.head, .nav-method.as-colored-block.patch , .nav-method.as-colored-block.options { \n background-color: var(--yellow); \n }\n\n @media only screen and (min-width: 768px) {\n .nav-bar {\n width: 260px;\n display:flex;\n }\n .only-large-screen{\n display:block;\n }\n .only-large-screen-flex{\n display:flex;\n }\n .section-gap { \n padding: 0 0 0 24px; \n }\n .section-gap--focused-mode {\n padding: 24px 8px; \n }\n .section-gap--read-mode { \n padding: 24px 8px; \n }\n .endpoint-body {\n position: relative;\n padding:36px 0 48px 0;\n }\n }\n\n @media (min-width: 2560px) {\n .body {\n padding-left: 316px;\n padding-right: 221px;\n }\n }\n\n @media only screen and (min-width: 1024px) {\n .nav-bar {\n width: ${unsafeCSS(this.fontSize === 'default' ? '300px' : this.fontSize === 'large' ? '315px' : '330px')};\n display:flex;\n }\n .section-gap--focused-mode { \n padding: 12px 80px 12px 80px; \n }\n .section-gap--read-mode { \n padding: 24px 80px 12px 80px; \n }\n }`,\n CustomStyles,\n ];\n }\n\n // Startup\n connectedCallback() {\n super.connectedCallback();\n const parent = this.parentElement;\n if (parent) {\n /* if (parent.offsetWidth === 0 && parent.style.width === '') {\n parent.style.width = '100vw';\n }\n if (parent.offsetHeight === 0 && parent.style.height === '') {\n parent.style.height = '100vh';\n } */\n if (parent.tagName === 'BODY') {\n if (!parent.style.marginTop) { parent.style.marginTop = '0'; }\n if (!parent.style.marginRight) { parent.style.marginRight = '0'; }\n if (!parent.style.marginBottom) { parent.style.marginBottom = '0'; }\n if (!parent.style.marginLeft) { parent.style.marginLeft = '0'; }\n }\n }\n\n if (this.loadFonts !== 'false') {\n const fontDescriptor = {\n family: 'Open Sans',\n style: 'normal',\n weight: '300',\n unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD',\n };\n const fontWeight300 = new FontFace(\n 'Open Sans',\n \"url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UN_r8OUuhpKKSTjw.woff2) format('woff2')\",\n fontDescriptor,\n );\n fontDescriptor.weight = '600';\n const fontWeight600 = new FontFace(\n 'Open Sans',\n \"url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UNirkOUuhpKKSTjw.woff2) format('woff2')\",\n fontDescriptor,\n );\n fontWeight300.load().then((font) => { document.fonts.add(font); });\n fontWeight600.load().then((font) => { document.fonts.add(font); });\n }\n\n if (!this.layout || !'row, column,'.includes(`${this.layout},`)) { this.layout = 'row'; }\n if (!this.renderStyle || !'read, view, focused,'.includes(`${this.renderStyle},`)) { this.renderStyle = 'focused'; }\n if (!this.schemaStyle || !'tree, table,'.includes(`${this.schemaStyle},`)) { this.schemaStyle = 'tree'; }\n if (!this.theme || !'light, dark,'.includes(`${this.theme},`)) {\n this.theme = (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) ? 'light' : 'dark';\n }\n if (!this.defaultSchemaTab || !'example, schema, model,'.includes(`${this.defaultSchemaTab},`)) {\n this.defaultSchemaTab = 'example';\n } else if (this.defaultSchemaTab === 'model') {\n this.defaultSchemaTab = 'schema';\n }\n if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) { this.schemaExpandLevel = 99999; }\n if (!this.schemaDescriptionExpanded || !'true, false,'.includes(`${this.schemaDescriptionExpanded},`)) { this.schemaDescriptionExpanded = 'false'; }\n\n if (!this.schemaHideReadOnly || !'default, never,'.includes(`${this.schemaHideReadOnly},`)) { this.schemaHideReadOnly = 'default'; }\n if (!this.schemaHideWriteOnly || !'default, never,'.includes(`${this.schemaHideWriteOnly},`)) { this.schemaHideWriteOnly = 'default'; }\n\n if (!this.fillRequestFieldsWithExample || !'true, false,'.includes(`${this.fillRequestFieldsWithExample},`)) { this.fillRequestFieldsWithExample = 'true'; }\n if (!this.persistAuth || !'true, false,'.includes(`${this.persistAuth},`)) { this.persistAuth = 'false'; }\n if (!this.responseAreaHeight) {\n this.responseAreaHeight = '400px';\n }\n\n if (!this.allowSearch || !'true, false,'.includes(`${this.allowSearch},`)) { this.allowSearch = 'true'; }\n if (!this.allowAdvancedSearch || !'true, false,'.includes(`${this.allowAdvancedSearch},`)) { this.allowAdvancedSearch = 'true'; }\n\n if (!this.allowTry || !'true, false,'.includes(`${this.allowTry},`)) { this.allowTry = 'true'; }\n if (!this.apiKeyValue) { this.apiKeyValue = '-'; }\n if (!this.apiKeyLocation) { this.apiKeyLocation = 'header'; }\n if (!this.apiKeyName) { this.apiKeyName = ''; }\n\n if (!this.oauthReceiver) { this.oauthReceiver = 'oauth-receiver.html'; }\n if (!this.updateRoute || !'true, false,'.includes(`${this.updateRoute},`)) { this.updateRoute = 'true'; }\n if (!this.routePrefix) { this.routePrefix = '#'; }\n if (!this.sortTags || !'true, false,'.includes(`${this.sortTags},`)) { this.sortTags = 'false'; }\n if (!this.generateMissingTags || !'true, false,'.includes(`${this.generateMissingTags},`)) { this.generateMissingTags = 'false'; }\n if (!this.sortEndpointsBy || !'method, path, summary, none,'.includes(`${this.sortEndpointsBy},`)) { this.sortEndpointsBy = 'path'; }\n\n if (!this.onNavTagClick || !'expand-collapse, show-description,'.includes(`${this.onNavTagClick},`)) { this.onNavTagClick = 'expand-collapse'; }\n if (!this.navItemSpacing || !'compact, relaxed, default,'.includes(`${this.navItemSpacing},`)) { this.navItemSpacing = 'default'; }\n if (!this.showMethodInNavBar || !'false, as-plain-text, as-colored-text, as-colored-block,'.includes(`${this.showMethodInNavBar},`)) { this.showMethodInNavBar = 'false'; }\n if (!this.usePathInNavBar || !'true, false,'.includes(`${this.usePathInNavBar},`)) { this.usePathInNavBar = 'false'; }\n if (!this.navActiveItemMarker || !'left-bar, colored-block'.includes(`${this.navActiveItemMarker},`)) { this.navActiveItemMarker = 'left-bar'; }\n\n if (!this.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) { this.fontSize = 'default'; }\n if (!this.showInfo || !'true, false,'.includes(`${this.showInfo},`)) { this.showInfo = 'true'; }\n if (!this.allowServerSelection || !'true, false,'.includes(`${this.allowServerSelection},`)) { this.allowServerSelection = 'true'; }\n if (!this.allowAuthentication || !'true, false,'.includes(`${this.allowAuthentication},`)) { this.allowAuthentication = 'true'; }\n if (!this.allowSchemaDescriptionExpandToggle || !'true, false,'.includes(`${this.allowSchemaDescriptionExpandToggle},`)) { this.allowSchemaDescriptionExpandToggle = 'true'; }\n\n if (!this.showSideNav || !'true false'.includes(this.showSideNav)) { this.showSideNav = 'true'; }\n if (!this.showComponents || !'true false'.includes(this.showComponents)) { this.showComponents = 'false'; }\n if (!this.infoDescriptionHeadingsInNavBar || !'true, false,'.includes(`${this.infoDescriptionHeadingsInNavBar},`)) { this.infoDescriptionHeadingsInNavBar = 'false'; }\n if (!this.fetchCredentials || !'omit, same-origin, include,'.includes(`${this.fetchCredentials},`)) { this.fetchCredentials = ''; }\n if (!this.matchType || !'includes regex'.includes(this.matchType)) { this.matchType = 'includes'; }\n\n if (!this.showAdvancedSearchDialog) { this.showAdvancedSearchDialog = false; }\n\n if (!this.cssFile) { this.cssFile = null; }\n if (!this.cssClasses) { this.cssClasses = ''; }\n\n Prism.languages.node = Prism.languages.javascript;\n\n marked.setOptions({\n highlight: (code, lang) => {\n if (lang === 'curl') lang = 'bash';\n if (Prism.languages[lang]) {\n return Prism.highlight(code, Prism.languages[lang], lang);\n }\n return code;\n },\n });\n\n window.addEventListener('hashchange', () => {\n this.scrollToPath(this.getElementIDFromURL());\n }, true);\n }\n\n // Cleanup\n disconnectedCallback() {\n /* if (this.intersectionObserver) {\n this.intersectionObserver.disconnect();\n } */\n super.disconnectedCallback();\n }\n\n infoDescriptionHeadingRenderer() {\n const renderer = new marked.Renderer();\n renderer.heading = ((text, level, raw, slugger) => `${text}`);\n return renderer;\n }\n\n render() {\n // return render(mainBodyTemplate(this), this.shadowRoot, { eventContext: this });\n /* const cssLinkEl = document.querySelector(`link[href*=\"${this.cssFile}\"]`);\n // adding custom style for RapiDoc\n if (cssLinkEl) {\n this.shadowRoot.appendChild(cssLinkEl.cloneNode());\n } */\n return mainBodyTemplate.call(this);\n }\n\n /* observeExpandedContent() {\n // Main Container\n const observeOverviewEls = this.shadowRoot.querySelectorAll('.observe-me');\n observeOverviewEls.forEach((targetEl) => {\n this.intersectionObserver.observe(targetEl);\n });\n } */\n\n attributeChangedCallback(name, oldVal, newVal) {\n if (name === 'spec-url') {\n if (oldVal !== newVal) {\n // put it at the end of event-loop to load all the attributes\n window.setTimeout(async () => {\n await this.loadSpec(newVal);\n // If goto-path is provided and no location-hash is present then try to scroll there\n if (this.gotoPath && !window.location.hash) {\n this.scrollToPath(this.gotoPath);\n }\n }, 0);\n }\n }\n if (name === 'render-style') {\n if (newVal === 'read') {\n window.setTimeout(() => {\n this.observeExpandedContent();\n }, 100);\n } else {\n // this.intersectionObserver.disconnect();\n }\n }\n if (name === 'api-key-name' || name === 'api-key-location' || name === 'api-key-value') {\n let updateSelectedApiKey = false;\n let apiKeyName = '';\n let apiKeyLocation = '';\n let apiKeyValue = '';\n\n if (name === 'api-key-name') {\n if (this.getAttribute('api-key-location') && this.getAttribute('api-key-value')) {\n apiKeyName = newVal;\n apiKeyLocation = this.getAttribute('api-key-location');\n apiKeyValue = this.getAttribute('api-key-value');\n updateSelectedApiKey = true;\n }\n } else if (name === 'api-key-location') {\n if (this.getAttribute('api-key-name') && this.getAttribute('api-key-value')) {\n apiKeyLocation = newVal;\n apiKeyName = this.getAttribute('api-key-name');\n apiKeyValue = this.getAttribute('api-key-value');\n updateSelectedApiKey = true;\n }\n } else if (name === 'api-key-value') {\n if (this.getAttribute('api-key-name') && this.getAttribute('api-key-location')) {\n apiKeyValue = newVal;\n apiKeyLocation = this.getAttribute('api-key-location');\n apiKeyName = this.getAttribute('api-key-name');\n updateSelectedApiKey = true;\n }\n }\n\n if (updateSelectedApiKey) {\n if (this.resolvedSpec) {\n const rapiDocApiKey = this.resolvedSpec.securitySchemes.find((v) => v.securitySchemeId === rapidocApiKey);\n if (!rapiDocApiKey) {\n this.resolvedSpec.securitySchemes.push({\n securitySchemeId: rapidocApiKey,\n description: 'api-key provided in rapidoc element attributes',\n type: 'apiKey',\n name: apiKeyName,\n in: apiKeyLocation,\n value: apiKeyValue,\n finalKeyValue: apiKeyValue,\n });\n } else {\n rapiDocApiKey.name = apiKeyName;\n rapiDocApiKey.in = apiKeyLocation;\n rapiDocApiKey.value = apiKeyValue;\n rapiDocApiKey.finalKeyValue = apiKeyValue;\n }\n this.requestUpdate();\n }\n }\n }\n super.attributeChangedCallback(name, oldVal, newVal);\n }\n\n onSpecUrlChange() {\n this.setAttribute('spec-url', this.shadowRoot.getElementById('spec-url').value);\n }\n\n onSpecFileChange(e) {\n this.setAttribute('spec-file', this.shadowRoot.getElementById('spec-file').value);\n const specFile = e.target.files[0];\n const reader = new FileReader();\n reader.onload = () => {\n try {\n const specObj = JSON.parse(reader.result);\n this.loadSpec(specObj);\n this.shadowRoot.getElementById('spec-url').value = '';\n } catch (err) {\n console.error('RapiDoc: Unable to read or parse json'); // eslint-disable-line no-console\n }\n };\n // Read the Text file\n reader.readAsText(specFile);\n }\n\n onFileLoadClick() {\n this.shadowRoot.getElementById('spec-file').click();\n }\n\n onSearchChange(e) {\n this.matchPaths = e.target.value;\n this.resolvedSpec.tags.forEach((tag) => tag.paths.filter((v) => {\n if (this.matchPaths) {\n // v.expanded = false;\n if (pathIsInSearch(this.matchPaths, v, this.matchType)) {\n tag.expanded = true;\n }\n }\n }));\n this.resolvedSpec.components.forEach((component) => component.subComponents.filter((v) => {\n v.expanded = false;\n if (!this.matchPaths || componentIsInSearch(this.matchPaths, v)) {\n v.expanded = true;\n }\n }));\n this.requestUpdate();\n }\n\n onClearSearch() {\n const searchEl = this.shadowRoot.getElementById('nav-bar-search');\n searchEl.value = '';\n this.matchPaths = '';\n this.resolvedSpec.components.forEach((component) => component.subComponents.filter((v) => {\n v.expanded = true;\n }));\n }\n\n onShowSearchModalClicked() {\n this.showAdvancedSearchDialog = true;\n }\n\n // Event Handler on Dialog-Box is opened\n async onOpenSearchDialog(e) {\n // Set focus to text input\n const inputEl = e.detail.querySelector('input');\n await sleep(0);\n if (inputEl) {\n inputEl.focus();\n }\n }\n\n // Public Method\n async loadSpec(specUrl) {\n if (!specUrl) {\n return;\n }\n this.matchPaths = '';\n try {\n this.resolvedSpec = {\n specLoadError: false,\n isSpecLoading: true,\n tags: [],\n };\n this.loading = true;\n this.loadFailed = false;\n const processedSpec = await ProcessSpec.call(\n this,\n specUrl,\n this.spec,\n this.generateMissingTags === 'true',\n this.sortTags === 'true',\n this.getAttribute('sort-endpoints-by'),\n this.getAttribute('api-key-name'),\n this.getAttribute('api-key-location'),\n this.getAttribute('api-key-value'),\n this.getAttribute('server-url'),\n );\n this.loading = false;\n this.afterSpecParsedAndValidated(processedSpec);\n } catch (err) {\n this.loading = false;\n this.loadFailed = true;\n this.resolvedSpec = null;\n console.error(`RapiDoc: Unable to resolve the API spec.. ${err.message}`); // eslint-disable-line no-console\n }\n }\n\n async afterSpecParsedAndValidated(spec) {\n this.resolvedSpec = spec;\n this.selectedServer = undefined;\n if (this.defaultApiServerUrl) {\n if (this.defaultApiServerUrl === this.serverUrl) {\n this.selectedServer = {\n url: this.serverUrl,\n computedUrl: this.serverUrl,\n };\n } else if (this.resolvedSpec.servers) {\n this.selectedServer = this.resolvedSpec.servers.find((v) => (v.url === this.defaultApiServerUrl));\n }\n }\n if (!this.selectedServer) {\n if (this.resolvedSpec.servers) {\n this.selectedServer = this.resolvedSpec.servers[0]; // eslint-disable-line prefer-destructuring\n }\n }\n this.requestUpdate();\n // eslint-disable-next-line no-await-in-loop\n while (!await this.updateComplete);\n const specLoadedEvent = new CustomEvent('spec-loaded', { detail: spec });\n this.dispatchEvent(specLoadedEvent);\n\n // Initiate IntersectionObserver and put it at the end of event loop, to allow loading all the child elements (must for larger specs)\n // this.intersectionObserver.disconnect();\n if (this.renderStyle === 'read') {\n await sleep(100);\n this.observeExpandedContent(); // This will auto-highlight the selected nav-item in read-mode\n }\n\n this.isIntersectionObserverActive = true;\n\n // On first time Spec load, try to navigate to location hash if provided\n const elementId = this.getElementIDFromURL();\n\n if (elementId) {\n if (this.renderStyle === 'view') {\n this.expandAndGotoOperation(elementId, true, true);\n } else {\n this.scrollToPath(elementId);\n }\n } else if (this.renderStyle === 'focused') {\n // If goto-path is provided and no location-hash is present then try to scroll to default element\n if (!this.gotoPath) {\n const defaultElementId = this.showInfo ? 'overview' : this.resolvedSpec.tags[0]?.paths[0];\n this.scrollToPath(defaultElementId);\n }\n }\n }\n\n /**\n * Return the URL from where is served the RapiDoc component, removing any hash and route prefix\n */\n getComponentBaseURL() {\n const { href } = window.location;\n\n // Remove end of string # or /\n const cleanRouterPrefix = this.routePrefix.replace(/(#|\\/)$/, '');\n\n if (!cleanRouterPrefix) {\n return href.split('#')[0];\n }\n\n const indexOfRoutePrefix = href.lastIndexOf(cleanRouterPrefix);\n\n if (indexOfRoutePrefix === -1) {\n return href;\n }\n\n return href.slice(0, indexOfRoutePrefix);\n }\n\n /**\n * From the URL return the ID of the element whether it is in the hash or if used a router prefix without a hash\n */\n getElementIDFromURL() {\n const baseURL = this.getComponentBaseURL();\n const elementId = window.location.href.replace(baseURL + this.routePrefix, '');\n return elementId;\n }\n\n replaceHistoryState(hashId) {\n const baseURL = this.getComponentBaseURL();\n window.history.replaceState(null, null, `${baseURL}${this.routePrefix || '#'}${hashId}`);\n }\n\n expandAndGotoOperation(elementId, scrollToElement = true) {\n if (!this.resolvedSpec) {\n return;\n }\n // Expand full operation and tag\n let isExpandingNeeded = true;\n const tmpElementId = elementId.indexOf('#') === -1 ? elementId : elementId.substring(1);\n if (tmpElementId.startsWith('overview') || tmpElementId === 'servers' || tmpElementId === 'auth') {\n isExpandingNeeded = false;\n } else {\n for (let i = 0; i < this.resolvedSpec.tags?.length; i++) {\n const tag = this.resolvedSpec.tags[i];\n const path = tag.paths?.find((p) => p.elementId === elementId);\n if (path) {\n if (path.expanded && tag.expanded) {\n isExpandingNeeded = false;\n } else {\n path.expanded = true;\n tag.expanded = true;\n }\n }\n }\n }\n if (scrollToElement) {\n // requestUpdate() and delay required, else we cant find element\n if (isExpandingNeeded) {\n this.requestUpdate();\n }\n window.setTimeout(() => {\n const gotoEl = this.shadowRoot.getElementById(tmpElementId);\n if (gotoEl) {\n gotoEl.scrollIntoView({ behavior: 'auto', block: 'start' });\n if (this.updateRoute === 'true') {\n this.replaceHistoryState(tmpElementId);\n }\n }\n }, isExpandingNeeded ? 150 : 0);\n }\n }\n\n isValidTopId(id) {\n return (id.startsWith('overview') || id === 'servers' || id === 'auth');\n }\n\n isValidPathId(id) {\n if (id === 'overview' && this.showInfo) {\n return true;\n }\n if (id === 'servers' && this.allowServerSelection) {\n return true;\n }\n if (id === 'auth' && this.allowAuthentication) {\n return true;\n }\n if (id.startsWith('tag--')) {\n return this.resolvedSpec?.tags?.find((tag) => tag.elementId === id);\n }\n return this.resolvedSpec?.tags?.find((tag) => tag.paths.find((path) => path.elementId === id));\n }\n\n onIntersect(entries) {\n if (this.isIntersectionObserverActive === false) {\n return;\n }\n\n entries.forEach((entry) => {\n if (entry.isIntersecting && entry.intersectionRatio > 0) {\n const oldNavEl = this.shadowRoot.querySelector('.nav-bar-tag.active, .nav-bar-path.active, .nav-bar-info.active, .nav-bar-h1.active, .nav-bar-h2.active, .operations.active');\n const newNavEl = this.shadowRoot.getElementById(`link-${entry.target.id}`);\n\n // Add active class in the new element\n if (newNavEl) {\n if (this.updateRoute === 'true') {\n this.replaceHistoryState(entry.target.id);\n }\n // newNavEl.scrollIntoView({ behavior: 'auto', block: 'center' });\n newNavEl.classList.add('active');\n newNavEl.part.add('section-navbar-active-item');\n }\n\n // Remove active class from previous element\n // if it is different from the new one (edge case on loading in read render style)\n if (oldNavEl && oldNavEl !== newNavEl) {\n oldNavEl.classList.remove('active');\n oldNavEl.part.remove('section-navbar-active-item');\n }\n }\n });\n }\n\n // Called by anchor tags created using markdown\n handleHref(e) {\n if (e.target.tagName.toLowerCase() === 'a') {\n if (e.target.getAttribute('href').startsWith('#')) {\n const gotoEl = this.shadowRoot.getElementById(e.target.getAttribute('href').replace('#', ''));\n if (gotoEl) {\n gotoEl.scrollIntoView({ behavior: 'auto', block: 'start' });\n }\n }\n }\n }\n\n /**\n * Called by\n * - onClick of Navigation Bar\n * - onClick of Advanced Search items\n *\n * Functionality:\n * 1. First deactivate IntersectionObserver\n * 2. Scroll to the element\n * 3. Activate IntersectionObserver (after little delay)\n *\n */\n async scrollToEventTarget(event, scrollNavItemToView = true) {\n if (!(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13))) {\n return;\n }\n const navEl = event.target;\n if (!navEl.dataset.contentId) {\n return;\n }\n this.isIntersectionObserverActive = false;\n if (this.renderStyle === 'focused') {\n const requestEl = this.shadowRoot.querySelector('api-request');\n if (requestEl) {\n requestEl.beforeNavigationFocusedMode();\n }\n }\n this.scrollToPath(navEl.dataset.contentId, true, scrollNavItemToView);\n setTimeout(() => {\n this.isIntersectionObserverActive = true;\n }, 300);\n }\n\n // Public Method (scrolls to a given path and highlights the left-nav selection)\n async scrollToPath(elementId, expandPath = true, scrollNavItemToView = true) {\n if (this.renderStyle === 'focused') {\n // for focused mode update this.focusedElementId to update the rendering, else it wont find the needed html elements\n // focusedElementId will get validated in the template\n this.focusedElementId = elementId;\n await sleep(0);\n }\n if (this.renderStyle === 'view') {\n this.expandAndGotoOperation(elementId, expandPath, true);\n } else {\n let isValidElementId = false;\n const contentEl = this.shadowRoot.getElementById(elementId);\n if (contentEl) {\n isValidElementId = true;\n contentEl.scrollIntoView({ behavior: 'auto', block: 'start' });\n } else {\n isValidElementId = false;\n }\n if (isValidElementId) {\n // for focused style it is important to reset request-body-selection and response selection which maintains the state for in case of multiple req-body or multiple response mime-type\n if (this.renderStyle === 'focused') {\n const requestEl = this.shadowRoot.querySelector('api-request');\n if (requestEl) {\n requestEl.afterNavigationFocusedMode();\n }\n const responseEl = this.shadowRoot.querySelector('api-response');\n if (responseEl) {\n responseEl.resetSelection();\n }\n }\n\n // Update Location Hash\n if (this.updateRoute === 'true') {\n this.replaceHistoryState(elementId);\n }\n\n // Update NavBar View and Styles\n const newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);\n\n if (newNavEl) {\n if (scrollNavItemToView) {\n newNavEl.scrollIntoView({ behavior: 'auto', block: 'center' });\n }\n await sleep(0);\n const oldNavEl = this.shadowRoot.querySelector('.nav-bar-tag.active, .nav-bar-path.active, .nav-bar-info.active, .nav-bar-h1.active, .nav-bar-h2.active, .operations.active');\n if (oldNavEl) {\n oldNavEl.classList.remove('active');\n oldNavEl.part.remove('active');\n oldNavEl.part.remove('section-navbar-active-item');\n }\n newNavEl.classList.add('active'); // must add the class after scrolling\n newNavEl.part.add('section-navbar-active-item');\n // this.requestUpdate();\n }\n }\n }\n }\n\n // Public Method - to update security-scheme of type http\n setHttpUserNameAndPassword(securitySchemeId, username, password) {\n return applyApiKey.call(this, securitySchemeId, username, password);\n }\n\n // Public Method - to update security-scheme of type apiKey or OAuth\n setApiKey(securitySchemeId, apiKeyValue) {\n return applyApiKey.call(this, securitySchemeId, '', '', apiKeyValue);\n }\n\n // Public Method\n removeAllSecurityKeys() {\n return onClearAllApiKeys.call(this);\n }\n\n // Public Method\n setApiServer(apiServerUrl) {\n // return apiServerUrl;\n return setApiServer.call(this, apiServerUrl);\n }\n\n // Event handler for Advanced Search text-inputs and checkboxes\n onAdvancedSearch(ev, delay) {\n const eventTargetEl = ev.target;\n clearTimeout(this.timeoutId);\n this.timeoutId = setTimeout(() => {\n let searchInputEl;\n if (eventTargetEl.type === 'text') {\n searchInputEl = eventTargetEl;\n } else {\n searchInputEl = eventTargetEl.closest('.advanced-search-options').querySelector('input[type=text]');\n }\n const searchOptions = [...eventTargetEl.closest('.advanced-search-options').querySelectorAll('input:checked')].map((v) => v.id);\n this.advancedSearchMatches = advancedSearch(searchInputEl.value, this.resolvedSpec.tags, searchOptions);\n }, delay);\n }\n}\nif (!customElements.get('rapi-doc')) customElements.define('rapi-doc', RapiDoc);\n","import { css, LitElement } from 'lit';\nimport { marked } from 'marked';\nimport Prism from 'prismjs';\nimport 'prismjs/components/prism-css';\nimport 'prismjs/components/prism-yaml';\nimport 'prismjs/components/prism-go';\nimport 'prismjs/components/prism-java';\nimport 'prismjs/components/prism-json';\nimport 'prismjs/components/prism-bash';\nimport 'prismjs/components/prism-python';\nimport 'prismjs/components/prism-http';\nimport 'prismjs/components/prism-csharp';\n\n// Styles\nimport FontStyles from '~/styles/font-styles';\nimport InputStyles from '~/styles/input-styles';\nimport FlexStyles from '~/styles/flex-styles';\nimport TableStyles from '~/styles/table-styles';\nimport PrismStyles from '~/styles/prism-styles';\nimport TabStyles from '~/styles/tab-styles';\nimport NavStyles from '~/styles/nav-styles';\nimport InfoStyles from '~/styles/info-styles';\n\nimport EndpointStyles from '~/styles/endpoint-styles';\nimport { rapidocApiKey } from '~/utils/common-utils';\nimport ProcessSpec from '~/utils/spec-parser';\nimport mainBodyTemplate from '~/templates/main-body-template';\nimport { applyApiKey, onClearAllApiKeys } from '~/templates/security-scheme-template';\nimport { setApiServer } from '~/templates/server-template';\n\nexport default class RapiDocMini extends LitElement {\n constructor() {\n super();\n this.isMini = true;\n this.updateRoute = 'false';\n this.renderStyle = 'view';\n this.showHeader = 'false';\n this.allowAdvancedSearch = 'false';\n }\n\n static get properties() {\n return {\n // Spec\n specUrl: { type: String, attribute: 'spec-url' },\n sortEndpointsBy: { type: String, attribute: 'sort-endpoints-by' },\n\n // UI Layouts\n layout: { type: String },\n pathsExpanded: { type: String, attribute: 'paths-expanded' },\n defaultSchemaTab: { type: String, attribute: 'default-schema-tab' },\n responseAreaHeight: { type: String, attribute: 'response-area-height' },\n showSummaryWhenCollapsed: { type: String, attribute: 'show-summary-when-collapsed' },\n fillRequestFieldsWithExample: { type: String, attribute: 'fill-request-fields-with-example' },\n persistAuth: { type: String, attribute: 'persist-auth' },\n\n // Schema Styles\n schemaStyle: { type: String, attribute: 'schema-style' },\n schemaExpandLevel: { type: Number, attribute: 'schema-expand-level' },\n schemaDescriptionExpanded: { type: String, attribute: 'schema-description-expanded' },\n\n // API Server\n apiKeyName: { type: String, attribute: 'api-key-name' },\n apiKeyLocation: { type: String, attribute: 'api-key-location' },\n apiKeyValue: { type: String, attribute: 'api-key-value' },\n defaultApiServerUrl: { type: String, attribute: 'default-api-server' },\n serverUrl: { type: String, attribute: 'server-url' },\n oauthReceiver: { type: String, attribute: 'oauth-receiver' },\n\n allowTry: { type: String, attribute: 'allow-try' },\n\n // Main Colors and Font\n theme: { type: String },\n bgColor: { type: String, attribute: 'bg-color' },\n textColor: { type: String, attribute: 'text-color' },\n primaryColor: { type: String, attribute: 'primary-color' },\n fontSize: { type: String, attribute: 'font-size' },\n regularFont: { type: String, attribute: 'regular-font' },\n monoFont: { type: String, attribute: 'mono-font' },\n mediumFont: { type: String, attribute: 'medium-font' },\n loadFonts: { type: String, attribute: 'load-fonts' },\n\n // Fetch Options\n fetchCredentials: { type: String, attribute: 'fetch-credentials' },\n\n // Filters\n matchPaths: { type: String, attribute: 'match-paths' },\n matchType: { type: String, attribute: 'match-type' },\n\n // Internal Properties\n loading: { type: Boolean }, // indicates spec is being loaded\n };\n }\n\n static get styles() {\n return [\n FontStyles,\n InputStyles,\n FlexStyles,\n TableStyles,\n EndpointStyles,\n PrismStyles,\n TabStyles,\n NavStyles,\n InfoStyles,\n css`\n :host {\n display:flex;\n flex-direction: column;\n min-width:360px;\n width:100%;\n height:100%;\n margin:0;\n padding:0;\n overflow: hidden;\n letter-spacing:normal;\n color:var(--fg);\n background-color:var(--bg);\n font-family:var(--font-regular);\n }\n\n @media only screen and (min-width: 768px) {\n .only-large-screen{\n display:block;\n }\n .only-large-screen-flex{\n display:flex;\n }\n }`,\n ];\n }\n\n // Startup\n connectedCallback() {\n super.connectedCallback();\n\n if (this.loadFonts !== 'false') {\n const fontDescriptor = {\n family: 'Open Sans',\n style: 'normal',\n weight: '300',\n unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD',\n };\n const fontWeight300 = new FontFace(\n 'Open Sans',\n \"url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UN_r8OUuhpKKSTjw.woff2) format('woff2')\",\n fontDescriptor,\n );\n fontDescriptor.weight = '600';\n const fontWeight600 = new FontFace(\n 'Open Sans',\n \"url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UNirkOUuhpKKSTjw.woff2) format('woff2')\",\n fontDescriptor,\n );\n fontWeight300.load().then((font) => { document.fonts.add(font); });\n fontWeight600.load().then((font) => { document.fonts.add(font); });\n }\n\n if (!this.showSummaryWhenCollapsed || !'true, false,'.includes(`${this.showSummaryWhenCollapsed},`)) { this.showSummaryWhenCollapsed = 'true'; }\n if (!this.layout || !'row, column,'.includes(`${this.layout},`)) { this.layout = 'row'; }\n if (!this.schemaStyle || !'tree, table,'.includes(`${this.schemaStyle},`)) { this.schemaStyle = 'tree'; }\n if (!this.theme || !'light, dark,'.includes(`${this.theme},`)) {\n this.theme = (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) ? 'light' : 'dark';\n }\n if (!this.defaultSchemaTab || !'example, schema, model,'.includes(`${this.defaultSchemaTab},`)) {\n this.defaultSchemaTab = 'example';\n } else if (this.defaultSchemaTab === 'model') {\n this.defaultSchemaTab = 'schema';\n }\n this.pathsExpanded = this.pathsExpanded === 'true';\n if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) { this.schemaExpandLevel = 99999; }\n if (!this.schemaDescriptionExpanded || !'true, false,'.includes(`${this.schemaDescriptionExpanded},`)) { this.schemaDescriptionExpanded = 'false'; }\n if (!this.fillRequestFieldsWithExample || !'true, false,'.includes(`${this.fillRequestFieldsWithExample},`)) { this.fillRequestFieldsWithExample = 'true'; }\n if (!this.persistAuth || !'true, false,'.includes(`${this.persistAuth},`)) { this.persistAuth = 'false'; }\n if (!this.responseAreaHeight) { this.responseAreaHeight = '300px'; }\n\n if (!this.allowTry || !'true, false,'.includes(`${this.allowTry},`)) { this.allowTry = 'true'; }\n if (!this.apiKeyValue) { this.apiKeyValue = '-'; }\n if (!this.apiKeyLocation) { this.apiKeyLocation = 'header'; }\n if (!this.apiKeyName) { this.apiKeyName = ''; }\n\n if (!this.oauthReceiver) { this.oauthReceiver = 'oauth-receiver.html'; }\n if (!this.sortTags || !'true, false,'.includes(`${this.sortTags},`)) { this.sortTags = 'false'; }\n if (!this.sortEndpointsBy || !'method, path, summary,'.includes(`${this.sortEndpointsBy},`)) { this.sortEndpointsBy = 'path'; }\n if (!this.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) { this.fontSize = 'default'; }\n if (!this.matchType || !'includes regex'.includes(this.matchType)) { this.matchType = 'includes'; }\n\n if (!this.allowSchemaDescriptionExpandToggle || !'true, false,'.includes(`${this.allowSchemaDescriptionExpandToggle},`)) { this.allowSchemaDescriptionExpandToggle = 'true'; }\n if (!this.fetchCredentials || !'omit, same-origin, include,'.includes(`${this.fetchCredentials},`)) { this.fetchCredentials = ''; }\n\n marked.setOptions({\n highlight: (code, lang) => {\n if (lang === 'curl') lang = 'bash';\n if (Prism.languages[lang]) {\n return Prism.highlight(code, Prism.languages[lang], lang);\n }\n return code;\n },\n });\n }\n\n render() {\n return mainBodyTemplate.call(this, true, false, false, this.pathsExpanded);\n }\n\n attributeChangedCallback(name, oldVal, newVal) {\n if (name === 'spec-url') {\n if (oldVal !== newVal) {\n // put it at the end of event-loop to load all the attributes\n window.setTimeout(async () => {\n await this.loadSpec(newVal);\n }, 0);\n }\n }\n if (name === 'api-key-name' || name === 'api-key-location' || name === 'api-key-value') {\n let updateSelectedApiKey = false;\n let apiKeyName = '';\n let apiKeyLocation = '';\n let apiKeyValue = '';\n\n if (name === 'api-key-name') {\n if (this.getAttribute('api-key-location') && this.getAttribute('api-key-value')) {\n apiKeyName = newVal;\n apiKeyLocation = this.getAttribute('api-key-location');\n apiKeyValue = this.getAttribute('api-key-value');\n updateSelectedApiKey = true;\n }\n } else if (name === 'api-key-location') {\n if (this.getAttribute('api-key-name') && this.getAttribute('api-key-value')) {\n apiKeyLocation = newVal;\n apiKeyName = this.getAttribute('api-key-name');\n apiKeyValue = this.getAttribute('api-key-value');\n updateSelectedApiKey = true;\n }\n } else if (name === 'api-key-value') {\n if (this.getAttribute('api-key-name') && this.getAttribute('api-key-location')) {\n apiKeyValue = newVal;\n apiKeyLocation = this.getAttribute('api-key-location');\n apiKeyName = this.getAttribute('api-key-name');\n updateSelectedApiKey = true;\n }\n }\n\n if (updateSelectedApiKey) {\n if (this.resolvedSpec) {\n const rapiDocApiKey = this.resolvedSpec.securitySchemes.find((v) => v.securitySchemeId === rapidocApiKey);\n if (!rapiDocApiKey) {\n this.resolvedSpec.securitySchemes.push({\n apiKeyId: rapidocApiKey,\n description: 'api-key provided in rapidoc element attributes',\n type: 'apiKey',\n name: apiKeyName,\n in: apiKeyLocation,\n value: apiKeyValue,\n finalKeyValue: apiKeyValue,\n });\n } else {\n rapiDocApiKey.name = apiKeyName;\n rapiDocApiKey.in = apiKeyLocation;\n rapiDocApiKey.value = apiKeyValue;\n rapiDocApiKey.finalKeyValue = apiKeyValue;\n }\n this.requestUpdate();\n }\n }\n }\n super.attributeChangedCallback(name, oldVal, newVal);\n }\n\n onSpecUrlChange() {\n this.setAttribute('spec-url', this.shadowRoot.getElementById('spec-url').value);\n }\n\n // Public Method\n async loadSpec(specUrl) {\n if (!specUrl) {\n return;\n }\n try {\n this.resolvedSpec = {\n specLoadError: false,\n isSpecLoading: true,\n tags: [],\n };\n this.loading = true;\n this.loadFailed = false;\n this.requestUpdate();\n const spec = await ProcessSpec.call(\n this,\n specUrl,\n this.generateMissingTags === 'true',\n this.sortTags === 'true',\n this.getAttribute('sort-endpoints-by'),\n this.getAttribute('api-key-name'),\n this.getAttribute('api-key-location'),\n this.getAttribute('api-key-value'),\n this.getAttribute('server-url'),\n );\n this.loading = false;\n this.afterSpecParsedAndValidated(spec);\n } catch (err) {\n this.loading = false;\n this.loadFailed = true;\n this.resolvedSpec = null;\n console.error(`RapiDoc: Unable to resolve the API spec.. ${err.message}`); // eslint-disable-line no-console\n }\n }\n\n // Public Method - to update security-scheme of type http\n setHttpUserNameAndPassword(securitySchemeId, username, password) {\n return applyApiKey.call(this, securitySchemeId, username, password);\n }\n\n // Public Method - to update security-scheme of type apiKey or OAuth\n setApiKey(securitySchemeId, apiKeyValue) {\n return applyApiKey.call(this, securitySchemeId, '', '', apiKeyValue);\n }\n\n // Public Method\n removeAllSecurityKeys() {\n return onClearAllApiKeys.call(this);\n }\n\n // Public Method\n setApiServer(apiServerUrl) {\n // return apiServerUrl;\n return setApiServer.call(this, apiServerUrl);\n }\n\n async afterSpecParsedAndValidated(spec) {\n this.resolvedSpec = spec;\n this.selectedServer = undefined;\n if (this.defaultApiServerUrl) {\n if (this.defaultApiServerUrl === this.serverUrl) {\n this.selectedServer = {\n url: this.serverUrl,\n computedUrl: this.serverUrl,\n };\n } else if (this.resolvedSpec.servers) {\n this.selectedServer = this.resolvedSpec.servers.find((v) => (v.url === this.defaultApiServerUrl));\n }\n }\n if (!this.selectedServer) {\n if (this.resolvedSpec.servers) {\n this.selectedServer = this.resolvedSpec.servers[0]; // eslint-disable-line prefer-destructuring\n }\n }\n this.requestUpdate();\n // eslint-disable-next-line no-await-in-loop\n while (!await this.updateComplete);\n const specLoadedEvent = new CustomEvent('spec-loaded', { detail: spec });\n this.dispatchEvent(specLoadedEvent);\n }\n\n // Called by anchor tags created using markdown\n handleHref(e) {\n if (e.target.tagName.toLowerCase() === 'a') {\n if (e.target.getAttribute('href').startsWith('#')) {\n const gotoEl = this.shadowRoot.getElementById(e.target.getAttribute('href').replace('#', ''));\n if (gotoEl) {\n gotoEl.scrollIntoView({ behavior: 'auto', block: 'start' });\n }\n }\n }\n }\n}\nif (!customElements.get('rapi-doc-mini')) customElements.define('rapi-doc-mini', RapiDocMini);\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\n\n// Templates\nimport overviewTemplate from '~/templates/overview-template';\nimport headerTemplate from '~/templates/header-template';\nimport { schemaInObjectNotation, generateExample } from '~/utils/schema-utils';\nimport '~/components/json-tree';\nimport '~/components/schema-tree';\nimport SetTheme from '~/utils/theme';\nimport { isValidHexColor } from '~/utils/color-utils';\n\n/* eslint-disable indent */\n// Json Schema Nav Template\nfunction jsonSchemaNavTemplate() {\n return html`\n \n `;\n}\n\n// Json Schema Body Template\nfunction jsonSchemaBodyTemplate() {\n return html`\n ${this.showInfo === 'true' ? overviewTemplate.call(this) : ''}\n
\n ${this.resolvedSpec.schemaAndExamples.map((jSchemaBody) => {\n const examplesObj = generateExample(jSchemaBody.schema, 'json', jSchemaBody.examples, jSchemaBody.example, true, false, 'json', true);\n jSchemaBody.selectedExample = examplesObj[0]?.exampleId;\n return html`\n
\n
\n
${jSchemaBody.name}
\n ${unsafeHTML(marked(jSchemaBody.description || ''))}\n
\n
\n
\n \n
\n
\n ${examplesObj.length > 1\n ? html``\n : html`
${examplesObj[0].exampleSummary}
`\n }\n ${examplesObj.map((v) => html`\n `)\n }\n
\n
\n
`;\n })\n }\n
\n `;\n}\n/* eslint-enable indent */\n\n// Json Schema Root Template\nexport default function jsonSchemaViewerTemplate(isMini = false) {\n// export default function jsonSchemaViewerTemplate(isMini = false, showExpandCollapse = true, showTags = true, pathsExpanded = false) {\n if (!this.resolvedSpec) {\n return '';\n }\n const newTheme = {\n bg1: isValidHexColor(this.bgColor) ? this.bgColor : '',\n fg1: isValidHexColor(this.textColor) ? this.textColor : '',\n headerColor: isValidHexColor(this.headerColor) ? this.headerColor : '',\n primaryColor: isValidHexColor(this.primaryColor) ? this.primaryColor : '',\n navBgColor: isValidHexColor(this.navBgColor) ? this.navBgColor : '',\n navTextColor: isValidHexColor(this.navTextColor) ? this.navTextColor : '',\n navHoverBgColor: isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',\n navHoverTextColor: isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : '',\n navAccentColor: isValidHexColor(this.navAccentColor) ? this.navAccentColor : '',\n navAccenttextColor: isValidHexColor(this.navAccentTextColor) ? this.navAccentTextColor : '',\n };\n /* eslint-disable indent */\n if (this.resolvedSpec.specLoadError) {\n if (isMini) {\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n
${this.resolvedSpec.info.description}
\n `;\n }\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n \n ${headerTemplate.call(this)}\n

Header

\n
\n \n
\n

${this.resolvedSpec.info.title}

\n
${this.resolvedSpec.info.description}
\n
\n
\n `;\n }\n if (this.resolvedSpec.isSpecLoading) {\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n
\n \n
\n
\n
\n
\n `;\n }\n\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n\n \n ${this.showHeader === 'false' ? '' : headerTemplate.call(this)}\n \n
\n\n \n ${jsonSchemaNavTemplate.call(this)}\n\n \n
\n \n
\n ${this.loading === true\n ? html`
`\n : html`\n ${this.loadFailed === true\n ? html`
Unable to load the Spec
`\n : html`\n
{ this.handleHref(e); }}\">\n ${jsonSchemaBodyTemplate.call(this)}\n
\n `\n }`\n }\n
\n \n
\n
\n `;\n}\n/* eslint-enable indent */\n","import { css, LitElement } from 'lit';\nimport { marked } from 'marked';\nimport Prism from 'prismjs';\nimport 'prismjs/components/prism-css';\nimport 'prismjs/components/prism-yaml';\nimport 'prismjs/components/prism-go';\nimport 'prismjs/components/prism-java';\nimport 'prismjs/components/prism-json';\nimport 'prismjs/components/prism-bash';\nimport 'prismjs/components/prism-python';\nimport 'prismjs/components/prism-http';\nimport 'prismjs/components/prism-csharp';\n\n// Styles\nimport FontStyles from '~/styles/font-styles';\nimport InputStyles from '~/styles/input-styles';\nimport FlexStyles from '~/styles/flex-styles';\nimport TableStyles from '~/styles/table-styles';\nimport PrismStyles from '~/styles/prism-styles';\nimport TabStyles from '~/styles/tab-styles';\nimport NavStyles from '~/styles/nav-styles';\nimport InfoStyles from '~/styles/info-styles';\n\nimport EndpointStyles from '~/styles/endpoint-styles';\nimport ProcessSpec from '~/utils/spec-parser';\nimport jsonSchemaViewerTemplate from '~/templates/json-schema-viewer-template';\n\nexport default class JsonSchemaViewer extends LitElement {\n constructor() {\n super();\n this.isMini = false;\n this.updateRoute = 'false';\n this.renderStyle = 'focused';\n this.showHeader = 'true';\n this.allowAdvancedSearch = 'false';\n this.selectedExampleForEachSchema = {};\n }\n\n static get properties() {\n return {\n // Spec\n specUrl: { type: String, attribute: 'spec-url' },\n\n // Schema Styles\n schemaStyle: { type: String, attribute: 'schema-style' },\n schemaExpandLevel: { type: Number, attribute: 'schema-expand-level' },\n schemaDescriptionExpanded: { type: String, attribute: 'schema-description-expanded' },\n allowSchemaDescriptionExpandToggle: { type: String, attribute: 'allow-schema-description-expand-toggle' },\n\n // Hide/show Sections\n showHeader: { type: String, attribute: 'show-header' },\n showSideNav: { type: String, attribute: 'show-side-nav' },\n showInfo: { type: String, attribute: 'show-info' },\n\n // Allow or restrict features\n allowSpecUrlLoad: { type: String, attribute: 'allow-spec-url-load' },\n allowSpecFileLoad: { type: String, attribute: 'allow-spec-file-load' },\n allowSpecFileDownload: { type: String, attribute: 'allow-spec-file-download' },\n allowSearch: { type: String, attribute: 'allow-search' },\n\n // Main Colors and Font\n theme: { type: String },\n bgColor: { type: String, attribute: 'bg-color' },\n textColor: { type: String, attribute: 'text-color' },\n primaryColor: { type: String, attribute: 'primary-color' },\n fontSize: { type: String, attribute: 'font-size' },\n regularFont: { type: String, attribute: 'regular-font' },\n monoFont: { type: String, attribute: 'mono-font' },\n loadFonts: { type: String, attribute: 'load-fonts' },\n\n // Internal Properties\n loading: { type: Boolean }, // indicates spec is being loaded\n };\n }\n\n static get styles() {\n return [\n FontStyles,\n InputStyles,\n FlexStyles,\n TableStyles,\n EndpointStyles,\n PrismStyles,\n TabStyles,\n NavStyles,\n InfoStyles,\n css`\n :host {\n display:flex;\n flex-direction: column;\n min-width:360px;\n width:100%;\n height:100%;\n margin:0;\n padding:0;\n overflow: hidden;\n letter-spacing:normal;\n color:var(--fg);\n background-color:var(--bg);\n font-family:var(--font-regular);\n }\n .body {\n display:flex;\n height:100%;\n width:100%;\n overflow:hidden;\n }\n .nav-bar {\n width: 230px;\n display:flex;\n }\n\n .main-content { \n margin:0;\n padding: 16px; \n display:block;\n flex:1;\n height:100%;\n overflow-y: auto;\n overflow-x: hidden;\n scrollbar-width: thin;\n scrollbar-color: var(--border-color) transparent;\n }\n .main-content-inner--view-mode {\n padding: 0 8px;\n }\n .main-content::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n .main-content::-webkit-scrollbar-track {\n background:transparent;\n }\n .main-content::-webkit-scrollbar-thumb {\n background-color: var(--border-color);\n }\n .main-header {\n background-color:var(--header-bg);\n color:var(--header-fg);\n width:100%;\n }\n .header-title {\n font-size:calc(var(--font-size-regular) + 8px); \n padding:0 8px;\n }\n input.header-input{\n background:var(--header-color-darker);\n color:var(--header-fg);\n border:1px solid var(--header-color-border);\n flex:1; \n padding-right:24px;\n border-radius:3px;\n }\n input.header-input::placeholder {\n opacity:0.4;\n }\n .loader {\n margin: 16px auto 16px auto; \n border: 4px solid var(--bg3);\n border-radius: 50%;\n border-top: 4px solid var(--primary-color);\n width: 36px;\n height: 36px;\n animation: spin 2s linear infinite;\n }\n @media only screen and (min-width: 768px) {\n .only-large-screen{\n display:block;\n }\n .only-large-screen-flex{\n display:flex;\n }\n }`,\n ];\n }\n\n // Startup\n connectedCallback() {\n super.connectedCallback();\n const parent = this.parentElement;\n if (parent) {\n if (parent.offsetWidth === 0 && parent.style.width === '') {\n parent.style.width = '100vw';\n }\n if (parent.offsetHeight === 0 && parent.style.height === '') {\n parent.style.height = '100vh';\n }\n if (parent.tagName === 'BODY') {\n if (!parent.style.marginTop) { parent.style.marginTop = '0'; }\n if (!parent.style.marginRight) { parent.style.marginRight = '0'; }\n if (!parent.style.marginBottom) { parent.style.marginBottom = '0'; }\n if (!parent.style.marginLeft) { parent.style.marginLeft = '0'; }\n }\n }\n\n if (this.loadFonts !== 'false') {\n const fontDescriptor = {\n family: 'Open Sans',\n style: 'normal',\n weight: '300',\n unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD',\n };\n const fontWeight300 = new FontFace(\n 'Open Sans',\n \"url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UN_r8OUuhpKKSTjw.woff2) format('woff2')\",\n fontDescriptor,\n );\n fontDescriptor.weight = '600';\n const fontWeight600 = new FontFace(\n 'Open Sans',\n \"url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UNirkOUuhpKKSTjw.woff2) format('woff2')\",\n fontDescriptor,\n );\n fontWeight300.load().then((font) => { document.fonts.add(font); });\n fontWeight600.load().then((font) => { document.fonts.add(font); });\n }\n\n this.renderStyle = 'focused';\n this.pathsExpanded = this.pathsExpanded === 'true';\n\n if (!this.showInfo || !'true, false,'.includes(`${this.showInfo},`)) { this.showInfo = 'true'; }\n if (!this.showSideNav || !'true false'.includes(this.showSideNav)) { this.showSideNav = 'true'; }\n if (!this.showHeader || !'true, false,'.includes(`${this.showHeader},`)) { this.showHeader = 'true'; }\n\n if (!this.schemaStyle || !'tree, table,'.includes(`${this.schemaStyle},`)) { this.schemaStyle = 'tree'; }\n if (!this.theme || !'light, dark,'.includes(`${this.theme},`)) {\n this.theme = (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) ? 'light' : 'dark';\n }\n if (!this.allowSearch || !'true, false,'.includes(`${this.allowSearch},`)) { this.allowSearch = 'true'; }\n if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) { this.schemaExpandLevel = 99999; }\n if (!this.schemaDescriptionExpanded || !'true, false,'.includes(`${this.schemaDescriptionExpanded},`)) { this.schemaDescriptionExpanded = 'false'; }\n if (!this.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) { this.fontSize = 'default'; }\n if (!this.matchType || !'includes regex'.includes(this.matchType)) { this.matchType = 'includes'; }\n if (!this.allowSchemaDescriptionExpandToggle || !'true, false,'.includes(`${this.allowSchemaDescriptionExpandToggle},`)) { this.allowSchemaDescriptionExpandToggle = 'true'; }\n\n marked.setOptions({\n highlight: (code, lang) => {\n if (lang === 'curl') lang = 'bash';\n if (Prism.languages[lang]) {\n return Prism.highlight(code, Prism.languages[lang], lang);\n }\n return code;\n },\n });\n }\n\n render() {\n return jsonSchemaViewerTemplate.call(this, true, false, false, this.pathsExpanded);\n }\n\n attributeChangedCallback(name, oldVal, newVal) {\n if (name === 'spec-url') {\n if (oldVal !== newVal) {\n // put it at the end of event-loop to load all the attributes\n window.setTimeout(async () => {\n await this.loadSpec(newVal);\n }, 0);\n }\n }\n super.attributeChangedCallback(name, oldVal, newVal);\n }\n\n onSpecUrlChange() {\n this.setAttribute('spec-url', this.shadowRoot.getElementById('spec-url').value);\n }\n\n onSearchChange(e) {\n // Todo: Filter Search\n this.matchPaths = e.target.value;\n }\n\n // Public Method\n async loadSpec(specUrl) {\n if (!specUrl) {\n return;\n }\n try {\n this.resolvedSpec = {\n specLoadError: false,\n isSpecLoading: true,\n tags: [],\n };\n this.loading = true;\n this.loadFailed = false;\n this.requestUpdate();\n const spec = await ProcessSpec.call(\n this,\n specUrl,\n this.generateMissingTags === 'true',\n this.sortTags === 'true',\n this.getAttribute('sort-endpoints-by'),\n );\n this.loading = false;\n this.afterSpecParsedAndValidated(spec);\n } catch (err) {\n this.loading = false;\n this.loadFailed = true;\n this.resolvedSpec = null;\n console.error(`RapiDoc: Unable to resolve the API spec.. ${err.message}`); // eslint-disable-line no-console\n }\n }\n\n async afterSpecParsedAndValidated(spec) {\n this.resolvedSpec = spec;\n const specLoadedEvent = new CustomEvent('spec-loaded', { detail: spec });\n this.dispatchEvent(specLoadedEvent);\n }\n\n // Called by anchor tags created using markdown\n handleHref(e) {\n if (e.target.tagName.toLowerCase() === 'a') {\n if (e.target.getAttribute('href').startsWith('#')) {\n const gotoEl = this.shadowRoot.getElementById(e.target.getAttribute('href').replace('#', ''));\n if (gotoEl) {\n gotoEl.scrollIntoView({ behavior: 'auto', block: 'start' });\n }\n }\n }\n }\n\n // Example Dropdown @change Handler\n onSelectExample(e) {\n const exampleContainerEl = e.target.closest('.json-schema-example-panel');\n const exampleEls = [...exampleContainerEl.querySelectorAll('.example')];\n exampleEls.forEach((v) => {\n v.style.display = v.dataset.example === e.target.value ? 'flex' : 'none';\n });\n }\n\n async scrollToEventTarget(event) {\n const navEl = event.currentTarget;\n if (!navEl.dataset.contentId) {\n return;\n }\n const contentEl = this.shadowRoot.getElementById(navEl.dataset.contentId);\n if (contentEl) {\n contentEl.scrollIntoView({ behavior: 'auto', block: 'start' });\n }\n }\n}\nif (!customElements.get('json-schema-viewer')) customElements.define('json-schema-viewer', JsonSchemaViewer);\n"],"names":[],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"rapidoc-min.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;ACKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC0RA;AACA;AACA;AAIA;AAIA;AAIA;AAEA;;;AAIA;;AAEA;AACA;AACA;AACA;;;;;AAKA;AAGA;;AAGA;AACA;AACA;;AAIA;;AAGA;AACA;;;;AAIA;AAGA;AACA;;;AAIA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AAGA;;AAGA;AACA;;;AAKA;;AAKA;AA+BA;;;AAGA;;AAGA;AACA;AACA;AACA;;AAGA;AACA;;AAIA;;AAGA;;;;AAKA;AACA;AACA;AACA;AAGA;AAGA;;;;;;;AAQA;;;AAGA;;AAEA;;;;;;AASA;AACA;;AAEA;;;AAMA;;;AAGA;;AAEA;;AAIA;;AAGA;;AAEA;;AAIA;AAGA;;;;;;AA1FA;;;AA0IA;AACA;AAEA;;;AAGA;;;AAMA;;AAEA;;;;;AAOA;;AAEA;AAKA;;AAGA;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;;;AAMA;;;AAvFA;;;;;AC/eA;;;ACAA;;AAYA;;AAEA;AACA;AACA;AACA;AACA;;AAIA;;AC3BA;;AAEA;AACA;;;AAGA;;;AAGA;;AAEA;;AAEA;;;;AAIA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;AAQA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;;;;;;AAOA;;;;;;;;;;;;;;;;;;;;;ACrEA;;;;;;;;;;;;;;;;;AAmBA;;;;;;;;;;;;;;;;;;;;;;;;AA0BA;;;;;;;;;;;;;;;;;;;;;;;;AAgDA;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACTA;AAQA;;AAEA;;AAEA;;AAGA;AAYA;;AAEA;;AAEA;AACA;;;AAIA;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC0PA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA7RA;AAQA;;AAEA;AACA;;;AAIA;AACA;;AAIA;AACA;AAEA;;AASA;AA0BA;AACA;AASA;AAyDA;AACA;AACA;AAMA;AACA;AACA;AAGA;;AAEA;;AAEA;AACA;AAGA;AACA;AAwBA;;;AAIA;AASA;AA4BA;AACA;AACA;AACA;AAMA;AACA;AACA;;;;AAIA;AAEA;AAKA;AAIA;AACA;AACA;AACA;;;AAIA;;AChUA;AACA;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiHA;AC3HA;;;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC0EA;;AAwBA;AACA;;;;;;;;;;AAUA;;AAEA;AACA;;AAEA;;AAEA;AC3HA;;;;;;AD2HA;AACA;;AC9HA;ADiIA;;;;AAKA;AEzEA;AACA;;AAEA;AACA;;AAEA;ACnEA;AAIA;;;;AAKA;;;AD+DA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwHA;;AEjHA;AACA;AACA;;AAEA;;;;;;AAUA;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiHA;;AC3KA;;AAEA;;AAEA;;AAGA;AACA;;AAEA;;;AAIA;AACA;AACA;;AAGA;AACA;;AAGA;;;;;;AAOA;AACA;AACA;;;;AAIA;;;AAMA;AAOA;;;AAGA;AAEA;;AAEA;;;AAGA;;AAKA;ACtGA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;AAIA;ACJA;;;;;;;;;;;;;AAcA;ACdA;;;AAIA;ACMA;AACA;ACXA;;;AAIA;ADQA;AACA;;;AAGA;AACA;;AAEA;AACA;;;;;AAMA;AAQA;;;;AAIA;;AAEA;AACA;AACA;;AAEA;AACA;;;;AAIA;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AE8KA;AAOA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;;AAIA;AA0DA;;;;AAIA;AACA;AACA;AACA;AACA;AAQA;AACA;AAEA;AAIA;AACA;AAKA;;AAEA;AACA;AACA;;AAEA;AAEA;AC9JA;ADkPA;AACA;;;AAGA;AAIA;AACA;;;;AAIA;AAEA;;;AAIA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAIA;AAOA;AACA;;AAEA;;;;AAKA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;;;;;;AAOA;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AAIA;AAIA;AACA;AAGA;;;AAKA;;AAEA;;;;;;;AAgBA;;;AAIA;AA0EA;AACA;AACA;AACA;;;AAOA;AAqBA;;AAEA;AAGA;AACA;AACA;;;;AAKA;AAGA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA;;;;;;AAWA;;AAoBA;;AAOA;AAIA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAIA;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAKA;AAIA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AAEA;AACA;;AAIA;;;AAmBA;AAiBA;AACA;;;AAGA;AACA;;;;;;AAMA;AACA;AACA;AACA;;;;AAKA;AACA;;AAEA;AACA;AACA;AACA;;;;AAMA;AAgBA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AAGA;;;;;;AAMA;AACA;;;;;;;;AAQA;;;AAIA;AACA;AACA;;;AAGA;;;AAGA;AAEA;AAGA;AAEA;;AAEA;;;AAGA;AACA;AACA;;AAEA;AAIA;;;AAOA;;AAIA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA;;AAIA;;;AAMA;;;;AAMA;AACA;;;AAKA;;AAGA;;AAGA;;AAIA;;;;AAIA;AACA;;;AAGA;AAEA;AAIA;AACA;AACA;;AAGA;AAsBA;;AAEA;;AAEA;;AAGA;AACA;AACA;AAGA;AAEA;AACA;;;AAGA;AAIA;AAEA;;AAEA;AACA;AACA;;AAMA;AAMA;AACA;;AAIA;;AAEA;AACA;;;AAIA;;AAEA;;AAMA;;;;AAeA;;;;AAIA;AAEA;AAEA;AAIA;;;AAOA;AAGA;;;AAGA;;AAEA;AAGA;;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEnhCA;AAQA;;AAEA;AACA;;;AAIA;;AAEA;;AAIA;AAIA;;;;;;AAOA;;AAMA;;AAKA;AAyBA;AACA;;;AAGA;;AAQA;AAIA;AAsCA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAGA;AAMA;;AAEA;AACA;AACA;;AAEA;AACA;AAEA;;;;AAKA;;;AAGA;;AAKA;AAGA;AACA;AAwBA;;;AASA;AAaA;AACA;AAGA;AACA;AACA;AAGA;AACA;AACA;AACA;AAEA;;AAMA;;AAEA;AACA;AACA;;AAOA;AACA;AACA;AACA;;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnNA;AAOA;AACA;;AAGA;AA6DA;AAEA;AACA;AAGA;AACA;;;;AAWA;;;;;AAKA;;;AAGA;;;;AAIA;;;AAOA;AACA;;;;AAIA;AACA;;;;;AAKA;;;AAGA;;;;;;AAMA;AACA;;AAKA;;AAIA;AAIA;AACA;AACA;;;AAGA;AAEA;AACA;AAEA;;;;;;;AASA;AAEA;;;AAMA;;;AAGA;;;AAGA;AAEA;AACA;;AAIA;AAEA;AACA;;AAIA;;AAGA;AACA;;AAIA;AAEA;AAIA;AACA;AAEA;AAkBA;AAEA;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;AAEA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAGA;AACA;;AAEA;;;;;AAzCA;AACA;AAiDA;AASA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAvBA;AACA;AA0BA;AChZA;AACA;AACA;;AAEA;;;;AAQA;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA;ACpHA;AACA;AACA;AACA;AACA;AACA;;AAGA;;AAKA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAIA;AACA;;;AAGA;;;;AAKA;AAEA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;;;AAGA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAOA;AAKA;AACA;AACA;AACA;;AAEA;;;;AAQA;;;AAfA;;AC3IA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAEA;;AAEA;;AAGA;AACA;AACA;AACA;;AAEA;;;AAKA;;AAQA;AACA;AACA;AACA;;AAGA;AACA;;;AAKA;AAKA;AACA;AACA;;AAEA;;;;AAIA;;;AAVA;ACxCA;;AAEA;AAEA;;AAGA;AACA;AACA;;AAIA;AACA;;AAEA;AAFA;;;AAOA;AAEA;AACA;AAGA;AAIA;AAEA;AAMA;;;;AAOA;;AASA;;AAKA;;;;AChBA;AACA;;AAEA;AAGA;AACA;;;;;;;AASA;;;;;AAKA;AAEA;;AAEA;;AAKA;AAGA;;;;;;AAQA;AACA;AAGA;AAEA;AAEA;AACA;;AAIA;;AAEA;AACA;;AAEA;;AAEA;;;AAIA;AACA;AAEA;;AA1BA;;AAgCA;AAIA;;AAKA;;AAEA;;;;;;;;;;AAWA;;;;;;AAQA;AAGA;AACA;;AAIA;;AAEA;AACA;AACA;AACA;;;AAGA;;;;AAKA;AAEA;;AAIA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AAIA;;AAEA;;AAOA;;;AAGA;AACA;;;AAGA;AACA;AACA;;AAGA;AACA;;;;;AAQA;;;AAIA;;;;;AAMA;;;;AAKA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAUA;;ACzPA;AAEA;AAiBA;AACA;;AAGA;AAMA;AAIA;;;AAsBA;ACzBA;AACA;AACA;AACA;AACA;;AAEA;;;AAIA;AAGA;;AAGA;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EA;;AAEA;AAMA;;AAGA;;AAKA;;AAIA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;;;;AAIA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAOA;AAKA;;AAGA;;;;AAIA;;;;AAIA;AAGA;AACA;AAEA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AAMA;AACA;AACA;;;AAIA;;AAGA;AAMA;AACA;AACA;;;;AAnDA;;;;AC5OA;AAEA;;;;;;;;;;;;;ACOA;;;AAGA;;;;;;;AASA;AACA;;;;;AAMA;;;;;AAOA;AACA;;;AAGA;;;AAIA;AAGA;;;;AAKA;AAGA;;;;;ADtDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AECA;;;AAOA;;;;;;;;;AASA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;;;AAMA;;;AAGA;AACA;;AAEA;;AASA;AACA;AACA;;;;AAMA;ACvBA;;;;AAKA;AACA;;;;;;AAMA;;;;;;;AC6JA;AACA;AACA;AACA;;AAEA;;AAMA;AACA;AACA;AACA;;;AAGA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAGA;ACvSA;AACA;AAGA;AACA;;AAEA;;;;AAIA;AACA;;;AAKA;AAEA;;;AAGA;;;;AAOA;AACA;;;AAGA;;;AAGA;;AAEA;;AAEA;;;;;AASA;AACA;AAGA;AAGA;AACA;AAGA;;;;AAIA;;;;;;;;AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACoSA;;;;;;;;;AASA;;;;;;;;;;;;;;;;;;;;;;;AChSA;;;;;;;;;ACxGA;;;;;;AAMA;AACA;AACA;;AAIA;;;;AAMA;AAKA;;AAEA;AAIA;;AAEA;AACA;;;;;AAKA;AACA;AACA;AACA;;;;;;AAMA;AAEA;AACA;AACA;;AAGA;AAGA;;AAEA;AACA;;AAEA;;;;AAKA;;AAKA;AAyBA;AACA;AAGA;AACA;;AAEA;;;;;AAKA;AACA;;;AAKA;AAEA;;;AAGA;;;;AAOA;AACA;;;AAGA;;AAEA;;;AAGA;;;;;AAKA;AACA;AAGA;AAGA;AACA;;;;;;;AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACTA","sources":["webpack://rapidoc/./src/styles/input-styles.js","webpack://rapidoc/./src/styles/flex-styles.js","webpack://rapidoc/./src/styles/table-styles.js","webpack://rapidoc/./src/styles/endpoint-styles.js","webpack://rapidoc/./src/styles/prism-styles.js","webpack://rapidoc/./src/styles/tab-styles.js","webpack://rapidoc/./src/styles/nav-styles.js","webpack://rapidoc/./src/styles/info-styles.js","webpack://rapidoc/./src/styles/custom-styles.js","webpack://rapidoc/./src/templates/security-scheme-template.js","webpack://rapidoc/./src/components/assets/copy-symbol.js","webpack://rapidoc/./src/templates/code-samples-template.js","webpack://rapidoc/./src/templates/callback-template.js","webpack://rapidoc/./src/styles/prism-languages-styles.js","webpack://rapidoc/./src/components/json-tree.js","webpack://rapidoc/./src/components/schema-tree.js","webpack://rapidoc/./src/components/tag-input.js","webpack://rapidoc/./src/components/assets/check-symbol.js","webpack://rapidoc/./src/components/breadcrumbs.js","webpack://rapidoc/./src/components/assets/corner-arrow-symbol.js","webpack://rapidoc/./src/components/toast-component.js","webpack://rapidoc/./src/components/assets/close-symbol.js","webpack://rapidoc/./src/components/base-url.js","webpack://rapidoc/./src/templates/server-template.js","webpack://rapidoc/./src/components/assets/languages/c-icon.js","webpack://rapidoc/./src/components/assets/languages/clojure-icon.js","webpack://rapidoc/./src/components/assets/languages/csharp-icon.js","webpack://rapidoc/./src/components/assets/languages/go-icon.js","webpack://rapidoc/./src/components/assets/languages/java-icon.js","webpack://rapidoc/./src/components/assets/languages/javascript-icon.js","webpack://rapidoc/./src/components/assets/languages/kotlin-icon.js","webpack://rapidoc/./src/components/assets/languages/node-icon.js","webpack://rapidoc/./src/components/assets/languages/objc-icon.js","webpack://rapidoc/./src/components/assets/languages/ocaml-icon.js","webpack://rapidoc/./src/components/assets/languages/php-icon.js","webpack://rapidoc/./src/components/assets/languages/python-icon.js","webpack://rapidoc/./src/components/assets/languages/r-icon.js","webpack://rapidoc/./src/components/assets/languages/ruby-icon.js","webpack://rapidoc/./src/components/assets/languages/shell-icon.js","webpack://rapidoc/./src/components/assets/languages/swift-icon.js","webpack://rapidoc/./src/templates/language-picker-template.js","webpack://rapidoc/./src/components/assets/three-dots.js","webpack://rapidoc/./src/components/api-request.js","webpack://rapidoc/./src/utils/schema-utils.js","webpack://rapidoc/./src/components/schema-table.js","webpack://rapidoc/./src/components/api-response.js","webpack://rapidoc/./src/components/content-copy-button.js","webpack://rapidoc/./src/templates/expanded-endpoint-template.js","webpack://rapidoc/./src/templates/components-template.js","webpack://rapidoc/./src/templates/overview-template.js","webpack://rapidoc/./src/templates/navbar-template.js","webpack://rapidoc/./src/templates/focused-endpoint-template.js","webpack://rapidoc/./src/templates/endpoint-template.js","webpack://rapidoc/./src/templates/logo-template.js","webpack://rapidoc/./src/templates/header-template.js","webpack://rapidoc/./src/templates/advance-search-template.js","webpack://rapidoc/./src/components/dialog-box.js","webpack://rapidoc/./src/utils/theme.js","webpack://rapidoc/./src/templates/main-body-template.js","webpack://rapidoc/./src/rapidoc.js","webpack://rapidoc/./src/rapidoc-mini.js","webpack://rapidoc/./src/templates/json-schema-viewer-template.js","webpack://rapidoc/./src/json-schema-viewer.js"],"sourcesContent":["import { css } from 'lit';\n\n/* eslint-disable max-len */\nexport default css`\n/* Button */\n.m-btn {\n display: flex;\n flex-direction: column;\n align-items: center;\n border-radius: var(--border-radius);\n font-weight: 400;\n padding: 7px 12px 6px;\n outline: none;\n border: none;\n text-align: center;\n white-space: nowrap;\n transition: background-color 0.2s;\n user-select: none;\n cursor: pointer;\n font-family: var(--font-medium);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n.m-btn-primary {\n background-color: var(--primary-color);\n color: var(--primary-color-invert);\n}\n.m-btn-primary:hover {\n background-color: #000711;\n}\n.m-btn-secondary{\n background: #e7e9ee;\n color: #142032;\n}\n.m-btn-secondary:hover {\n background: #ccced8;\n}\n.m-btn-tertiary {\n background: #ffffff;\n color: #142032;\n}\n.m-btn-tertiary:hover {\n color: #000711;\n}\n.m-btn.thin-border { border-width: 1px; }\n.m-btn.large { padding:8px 14px; }\n.m-btn.small { padding:5px 12px; }\n.m-btn.tiny { padding:5px 6px; }\n.m-btn.circle { border-radius: 50%; }\n.m-btn.nav:hover { \n background-color: var(--nav-accent-color);\n}\n.m-btn:disabled{ \n background-color: var(--bg3);\n color: var(--fg3);\n border-color: var(--fg3);\n cursor: not-allowed;\n opacity: 0.4;\n}\n.toolbar-btn{\n cursor: pointer;\n padding: 4px;\n margin:0 2px;\n font-size: var(--font-size-small);\n min-width: 50px;\n color: var(--primary-color-invert);\n border-radius: 2px;\n border: none;\n background-color: var(--primary-color);\n}\n.copy-code {\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n cursor: pointer;\n outline: inherit;\n display: block;\n}\n.copy-button{\n opacity: 0.3;\n}\n.check-button, .copy-button:hover{\n opacity: 1;\n}\n\ninput, textarea, select, pre {\n color: #000000;\n outline: none;\n background-color: var(--input-bg);\n border: 1px solid #B9B9B9;\n border-radius: var(--border-radius);\n}\nbutton {\n font-family: var(--font-regular);\n}\n\n/* Form Inputs */\npre,\nselect,\ntextarea,\ninput[type=\"file\"],\ninput[type=\"text\"],\ninput[type=\"password\"] {\n font-family:var(--font-mono); \n font-size: var(--font-size-mono);\n transition: border .2s;\n padding: 6px 8px;\n line-height: 140%;\n}\n\nselect {\n font-family: var(--font-regular);\n padding: 8px;\n background-image: url(\"data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%3E%3Cpath%20d%3D%22M10.3%203.3L6%207.6%201.7%203.3A1%201%200%2000.3%204.7l5%205a1%201%200%20001.4%200l5-5a1%201%200%2010-1.4-1.4z%22%20fill%3D%22%23777777%22%2F%3E%3C%2Fsvg%3E\"); \n background-position: calc(100% - 14px) center;\n background-repeat: no-repeat; \n background-size: 10px;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n cursor: pointer;\n}\n\nselect:hover {\n border-color: var(--primary-color);\n}\n\ninput[type=\"text\"]:hover {\n border-color: var(--fg2);\n}\n\ntextarea::placeholder,\ninput[type=\"text\"]::placeholder,\ninput[type=\"password\"]::placeholder {\n color: var(--placeholder-color);\n opacity:1;\n}\n\nselect:focus,\ntextarea:focus,\ninput[type=\"text\"]:focus,\ninput[type=\"password\"]:focus,\ntextarea:active,\ninput[type=\"text\"]:active,\ninput[type=\"password\"]:active {\n border-color: none;\n}\n\ninput[type=\"file\"]{\n font-family: var(--font-regular);\n padding:2px;\n cursor:pointer;\n border: 1px solid var(--primary-color);\n min-height: calc(var(--font-size-small) + 18px);\n}\n\ninput[type=\"file\"]::-webkit-file-upload-button {\n font-family: var(--font-regular);\n font-size: var(--font-size-small);\n outline: none;\n cursor:pointer;\n padding: 3px 8px;\n border: 1px solid var(--primary-color);\n background-color: var(--primary-color);\n color: var(--primary-color-invert);\n border-radius: var(--border-radius);;\n -webkit-appearance: none;\n}\n\npre,\ntextarea {\n scrollbar-width: thin;\n scrollbar-color: var(--border-color) var(--input-bg);\n}\n\npre::-webkit-scrollbar,\ntextarea::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\n\npre::-webkit-scrollbar-track,\ntextarea::-webkit-scrollbar-track {\n background:var(--input-bg);\n}\n \npre::-webkit-scrollbar-thumb,\ntextarea::-webkit-scrollbar-thumb {\n border-radius: 2px;\n background-color: var(--border-color);\n}\n\n.link {\n font-size:var(--font-size-small);\n text-decoration: underline;\n color:var(--rebel-pink);\n font-family:var(--font-mono);\n margin-bottom:2px;\n}\n\n/* Toggle Body */\ninput[type=\"checkbox\"] {\n appearance: none;\n display: inline-block;\n background-color: var(--light-bg);\n border: 1px solid var(--light-bg);\n border-radius: 9px;\n cursor: pointer;\n height: 18px;\n position: relative;\n transition: border .25s .15s, box-shadow .25s .3s, padding .25s;\n min-width: 36px;\n width: 36px;\n vertical-align: top;\n}\n/* Toggle Thumb */\ninput[type=\"checkbox\"]:after {\n position: absolute;\n background-color: var(--bg);\n border: 1px solid var(--light-bg);\n border-radius: 8px;\n content: '';\n top: 0px;\n left: 0px;\n right: 16px;\n display: block;\n height: 16px;\n transition: border .25s .15s, left .25s .1s, right .15s .175s;\n}\n\n/* Toggle Body - Checked */\ninput[type=\"checkbox\"]:checked {\n background-color: var(--green);\n border-color: var(--green);\n}\n/* Toggle Thumb - Checked*/\ninput[type=\"checkbox\"]:checked:after {\n border: 1px solid var(--green);\n left: 16px;\n right: 1px;\n transition: border .25s, left .15s .25s, right .25s .175s;\n}`;\n","import { css } from 'lit';\n\nexport default css`\n .flex,\n .row,\n .col,\n .row-api {\n display: flex;\n }\n .row-api {\n flex: 1fr 1fr;\n align-items: center;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-evenly;\n }\n .row {\n align-items: center;\n }\n .col {\n align-items: stretch;\n flex-direction: column;\n }\n .row-api-left {\n min-width: 288px;\n max-width: 720px;\n flex: 2 1 0%;\n justify-content: flex-end;\n padding-right: 32px;\n }\n .row-api-right {\n min-width: 288px;\n max-width: 702px;\n flex: 1;\n justify-content: flex-start;\n border-left: 1px solid #E7E9EE;\n }\n .row-api-right-box{\n text-align:left; \n direction:ltr; \n margin-block: 32px 16px; \n padding-left: 32px;\n }\n .clear-btn{\n margin-left: 32px\n }\n\n @media (max-width: 1280px) {\n .row-api {\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n }\n .row-api-right-box{\n padding-left: 0px;\n }\n .clear-btn{\n margin-left: 0px\n }\n\n .row-api-left,\n .row-api-right {\n max-width: unset;\n width: 100%;\n border: none;\n padding: 10px;\n }\n }\n`;\n","import { css } from 'lit';\n\nexport default css`\n.m-table {\n border-spacing: 0; \n border-collapse: separate;\n border: 1px solid var(--light-border-color);\n border-radius: var(--border-radius);\n margin: 0;\n max-width: 100%;\n direction: ltr;\n}\n.m-table tr:first-child td,\n.m-table tr:first-child th {\n border-top: 0 none;\n}\n.m-table td, \n.m-table th {\n font-size: var(--font-size-small);\n line-height: calc(var(--font-size-small) + 4px);\n padding: 4px 5px 4px;\n vertical-align: top;\n}\n\n.m-table.padded-12 td, \n.m-table.padded-12 th {\n padding: 12px;\n}\n\n.m-table td:not([align]), \n.m-table th:not([align]) {\n text-align: left;\n}\n\n.m-table th {\n color: var(--fg2);\n font-size: var(--font-size-small);\n line-height: calc(var(--font-size-small) + 18px);\n font-weight: 600;\n letter-spacing: normal;\n background-color: var(--bg2);\n vertical-align: bottom;\n border-bottom: 1px solid var(--light-border-color);\n}\n\n.m-table > tbody > tr > td,\n.m-table > tr > td {\n border-top: 1px solid var(--light-border-color);\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.table-title {\n font-size: 16px;\n font-weight: 400;\n line-height: 18px;\n}\n`;\n","import { css } from 'lit';\n\nexport default css`\n.only-large-screen { display:none; }\n.endpoint-head .path{\n display: flex;\n font-family:var(--font-mono);\n font-size: var(--font-size-small);\n align-items: center;\n overflow-wrap: break-word;\n word-break: break-all;\n}\n\n.endpoint-head .descr {\n font-size: var(--font-size-small);\n color:var(--light-fg);\n font-weight:400;\n align-items: center;\n overflow-wrap: break-word;\n word-break: break-all;\n display:none;\n}\n\n.m-endpoint.expanded{margin-bottom:16px; }\n.m-endpoint > .endpoint-head{\n border-width:1px 1px 1px 5px;\n border-style:solid;\n border-color:transparent;\n border-top-color:var(--light-border-color);\n display:flex;\n padding:6px 16px;\n align-items: center;\n cursor: pointer;\n}\n.m-endpoint > .endpoint-head.put:hover,\n.m-endpoint > .endpoint-head.put.expanded{\n color:var(--put-color); \n background-color:var(--put-bg-color);\n border-color:var(--put-border-color);\n}\n.m-endpoint > .endpoint-head.post:hover,\n.m-endpoint > .endpoint-head.post.expanded {\n color:var(--post-color);\n background-color:var(--post-bg-color);\n border-color:var(--post-border-color);\n}\n.m-endpoint > .endpoint-head.get:hover,\n.m-endpoint > .endpoint-head.get.expanded {\n color:var(--get-color); \n background-color:var(--get-bg-color);\n border-color:var(--get-border-color);\n}\n.m-endpoint > .endpoint-head.patch:hover,\n.m-endpoint > .endpoint-head.patch.expanded {\n color:var(--patch-color); \n background-color:var(--patch-bg-color);\n border-color:var(--patch-border-color);\n}\n.m-endpoint > .endpoint-head.delete:hover,\n.m-endpoint > .endpoint-head.delete.expanded {\n color:var(--delete-color); \n background-color:var(--delete-bg-color);\n border-color:var(--delete-border-color);\n}\n\n.m-endpoint > .endpoint-head.head:hover,\n.m-endpoint > .endpoint-head.head.expanded,\n.m-endpoint > .endpoint-head.patch:hover,\n.m-endpoint > .endpoint-head.patch.expanded,\n.m-endpoint > .endpoint-head.options:hover,\n.m-endpoint > .endpoint-head.options.expanded {\n border-color:var(--yellow); \n background-color:var(--light-yellow); \n}\n\n.m-endpoint > .endpoint-head.deprecated:hover,\n.m-endpoint > .endpoint-head.deprecated.expanded {\n border-color:var(--border-color); \n filter:opacity(0.6);\n}\n\n.m-endpoint .endpoint-body {\n flex-wrap:wrap;\n padding:16px 0px 0 0px;\n}\n.m-endpoint .endpoint-body.delete{ border-color:var(--delete-border-color); }\n.m-endpoint .endpoint-body.put{ border-color:var(--put-border-color); }\n.m-endpoint .endpoint-body.post{ border-color:var(--post-border-color); }\n.m-endpoint .endpoint-body.get{ border-color:var(--get-border-color); }\n.m-endpoint .endpoint-body.head,\n.m-endpoint .endpoint-body.patch,\n.m-endpoint .endpoint-body.options { \n border-color:var(--yellow); \n}\n\n.m-endpoint .endpoint-body.deprecated{ \n border-color:var(--border-color);\n filter:opacity(0.6);\n}\n\n.endpoint-head .deprecated{\n color: var(--light-fg);\n filter:opacity(0.6);\n}\n\n.summary{\n padding: 24px 16px;\n}\n.summary .title{\n font-size: 28px;\n margin-bottom: 24px;\n word-break: break-all;\n}\n\n.path-description p {\n font-size: 18px;\n line-height: 24px;\n margin: 0;\n}\n\n.endpoint-head .method{\n padding:2px 5px;\n vertical-align: middle;\n font-size:var(--font-size-small);\n height: calc(var(--font-size-small) + 16px);\n line-height: calc(var(--font-size-small) + 8px);\n width: 60px;\n border-radius: 2px;\n display:inline-block;\n text-align: center;\n font-weight: bold;\n text-transform:uppercase;\n margin-right:5px;\n}\n.endpoint-head .method.delete{ border: 2px solid var(--delete-border-color);}\n.endpoint-head .method.put{ border: 2px solid var(--put-border-color); }\n.endpoint-head .method.post{ border: 2px solid var(--post-border-color); }\n.endpoint-head .method.get{ border: 2px solid var(--get-border-color); }\n.endpoint-head .method.get.deprecated{ border: 2px solid var(--border-color); }\n.endpoint-head .method.head,\n.endpoint-head .method.patch,\n.endpoint-head .method.options { \n border: 2px solid var(--yellow); \n}\n\n.req-resp-container {\n display: flex;\n align-items: stretch;\n flex-wrap: wrap;\n flex-direction: column;\n border-top:1px solid var(--light-border-color);\n}\n\n.view-mode-request,\napi-response.view-mode {\n flex:1; \n min-height:100px;\n padding: 0 16px 24px 16px;\n overflow:hidden;\n}\n.view-mode-request {\n border-width: 0;\n border-style:dashed;\n}\n\n.head .view-mode-request,\n.patch .view-mode-request,\n.options .view-mode-request { \n border-color:var(--yellow); \n}\n.put .view-mode-request { \n border-color:var(--put-color); \n}\n.post .view-mode-request { \n border-color:var(--post-color); \n}\n.get .view-mode-request { \n border-color:var(--get-color); \n}\n.delete .view-mode-request { \n border-color:var(--delete-color); \n}\n\nblockquote {\n padding: 20px;\n}\n\nblockquote h3 {\n margin: 0;\n padding: 0;\n}\n\nblockquote.warning {\n border-left: 3px solid #f0ad4e;\n background-color: #fcf8f2;\n}\n\nblockquote.warning h3 {\n color: #f0ad4e;\n}\n\nblockquote.danger {\n border-left: 3px solid #d9534f;\n background-color: #fdf7f7;\n}\n\nblockquote.danger h3 {\n color: #d9534f;\n}\n\nblockquote.info {\n border-left: 3px solid #5bc0de;\n background-color: #e3edf2;\n}\n\nblockquote.info h3 {\n color: #5bc0de;\n}\n\nblockquote.success {\n border-left: 3px solid #50af51;\n background-color: #f3f8f3;\n}\n\nblockquote.success h3 {\n color: #50af51;\n}\n\npre {\n overflow: scroll;\n max-height: 1000px;\n margin-top: 15px!important;\n margin-bottom: 15px!important;\n}\n\ntable {\n border-spacing: 0px;\n border-collapse: collapse;\n}\n\ntable th {\n border: 1px solid #dfe2e5;\n padding: 6px 13px;\n}\n\ntable td {\n border: 1px solid #dfe2e5;\n padding: 6px 13px;\n}\n\n@media only screen and (min-width: 1024px) {\n .only-large-screen { display:block; }\n .endpoint-head .path{\n font-size: var(--font-size-regular);\n }\n .endpoint-head .descr{\n display: flex;\n }\n .endpoint-head .m-markdown-small,\n .descr .m-markdown-small{\n display:block;\n }\n .req-resp-container{\n flex-direction: var(--layout, row);\n flex-wrap: nowrap;\n }\n api-response.view-mode {\n padding:16px;\n }\n .view-mode-request.row-layout {\n border-width:0 1px 0 0;\n padding:16px;\n }\n .summary{\n padding:24px 16px;\n }\n}\n`;\n","import { css } from 'lit';\n\nexport default css`\ncode[class*=\"language-\"],\npre[class*=\"language-\"] {\n text-align: left;\n white-space: pre;\n word-spacing: normal;\n word-break: normal;\n word-wrap: normal;\n line-height: 1.5;\n tab-size: 2;\n\n -webkit-hyphens: none;\n -moz-hyphens: none;\n -ms-hyphens: none;\n hyphens: none;\n}\n\n/* Code blocks */\npre[class*=\"language-\"] {\n padding: 1em;\n margin: .5em 0;\n overflow: auto;\n}\n\n/* Inline code */\n:not(pre) > code[class*=\"language-\"] {\n white-space: normal;\n}\n\n.token.comment,\n.token.block-comment,\n.token.prolog,\n.token.doctype,\n.token.cdata {\n color: var(--light-fg)\n}\n\n.token.punctuation {\n color: var(--fg);\n}\n\n.token.tag,\n.token.attr-name,\n.token.namespace,\n.token.deleted {\n color:var(--pink);\n}\n\n.token.function-name {\n color: var(--rebel-pink);\n}\n\n.token.boolean,\n.token.number{\n color: var(--red);\n}\n\n.token.function {\n color: #2953B2;\n}\n\n.token.property,\n.token.class-name,\n.token.constant,\n.token.symbol {\n color: var(--code-property-color);\n}\n\n.token.selector,\n.token.important,\n.token.atrule,\n.token.keyword,\n.token.builtin {\n color: var(--code-keyword-color);\n}\n\n.token.string,\n.token.char,\n.token.attr-value,\n.token.regex,\n.token.variable { \n color: var(--green);\n}\n\n.token.operator,\n.token.entity,\n.token.url {\n color: var(--code-operator-color);\n}\n\n.token.important,\n.token.bold {\n font-weight: bold;\n}\n.token.italic {\n font-style: italic;\n}\n\n.token.entity {\n cursor: help;\n}\n\n.token.inserted {\n color: green;\n}\n`;\n","import { css } from 'lit';\n\nexport default css`\n.tab-panel {\n border: none;\n}\n.tab-buttons {\n height:30px;\n padding: 4px 4px 0 4px;\n border-bottom: 1px solid var(--light-border-color) ;\n align-items: stretch;\n overflow-y: hidden;\n overflow-x: auto;\n scrollbar-width: thin;\n}\n.tab-buttons::-webkit-scrollbar {\n height: 1px;\n background-color: var(--border-color);\n}\n.tab-btn {\n border: none;\n border-bottom: 1px solid transparent; \n color: var(--light-fg);\n background-color: transparent;\n white-space: nowrap;\n cursor:pointer;\n outline:none;\n font-family:var(--font-regular); \n width:100%;\n font-weight: bold;\n font-size: 16px;\n}\n.tab-btn.active {\n border-bottom: 1px solid #D71D55; \n font-weight:bold;\n color:#D71D55;\n}\n\n.tab-btn:hover {\n color:#c81e51;\n}\n.tab-content {\n margin:16px 0 0 0;\n position:relative;\n min-height: 50px;\n}\n`;\n","import { css } from 'lit';\n\nexport default css`\n.nav-bar-info:focus-visible,\n.nav-bar-tag:focus-visible,\n.nav-bar-path:focus-visible {\n outline: 1px solid;\n box-shadow: none;\n outline-offset: -4px;\n}\n.nav-bar-expand-all:focus-visible,\n.nav-bar-collapse-all:focus-visible,\n.nav-bar-tag-icon:focus-visible {\n outline: 1px solid;\n box-shadow: none;\n outline-offset: 2px;\n}\n.nav-bar {\n width:0;\n height:100%;\n overflow: hidden;\n color:var(--nav-text-color);\n background-color: var(--nav-bg-color);\n background-blend-mode: multiply;\n line-height: calc(var(--font-size-small) + 4px);\n display:none;\n position:relative;\n flex-direction:column;\n flex-wrap:nowrap;\n word-break:break-word;\n}\n::slotted([slot=nav-logo]){\n padding:16px 16px 0 16px;\n}\n.nav-scroll {\n overflow-x: hidden;\n overflow-y: auto;\n overflow-y: overlay;\n scrollbar-width: thin;\n scrollbar-color: var(--nav-hover-bg-color) transparent;\n}\n\n.nav-bar-tag {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-direction: row;\n}\n.nav-bar.read .nav-bar-tag-icon {\n display:none;\n}\n.nav-bar-paths-under-tag {\n overflow:hidden;\n transition: max-height .2s ease-out, visibility .3s;\n}\n.collapsed .nav-bar-paths-under-tag {\n visibility: hidden;\n}\n\n.nav-bar-expand-all {\n transform: rotate(90deg); \n cursor:pointer; \n margin-right:10px;\n}\n.nav-bar-collapse-all {\n transform: rotate(270deg); \n cursor:pointer;\n}\n.nav-bar-expand-all:hover, .nav-bar-collapse-all:hover {\n color: var(--primary-color);\n}\n\n.nav-bar-tag-icon {\n color: var(--nav-text-color);\n font-size: 20px; \n}\n.nav-bar-tag-icon:hover {\n color:var(--nav-hover-text-color);\n}\n.nav-bar.focused .nav-bar-tag-and-paths.collapsed .nav-bar-tag-icon::after {\n content: '⌵';\n width:16px;\n height:16px;\n text-align: center;\n display: inline-block;\n transform: rotate(-90deg);\n transition: transform 0.2s ease-out 0s;\n}\n.nav-bar.focused .nav-bar-tag-and-paths.expanded .nav-bar-tag-icon::after {\n content: '⌵';\n width:16px;\n height:16px;\n text-align: center;\n display: inline-block;\n transition: transform 0.2s ease-out 0s;\n}\n.nav-scroll::-webkit-scrollbar {\n width: var(--scroll-bar-width, 8px);\n}\n.nav-scroll::-webkit-scrollbar-track {\n background:transparent;\n}\n.nav-scroll::-webkit-scrollbar-thumb {\n background-color: var(--nav-hover-bg-color);\n}\n\n.nav-bar-tag {\n font-size: var(--font-size-regular);\n color: var(--nav-accent-color);\n border-left:4px solid transparent;\n font-weight:bold;\n padding: 15px 15px 15px 10px;\n text-transform: capitalize;\n}\n\n.nav-bar-components,\n.nav-bar-h1,\n.nav-bar-h2,\n.nav-bar-info,\n.nav-bar-tag,\n.nav-bar-path {\n display:flex;\n cursor: pointer;\n width: 100%;\n border: none;\n border-radius:4px; \n color: var(--nav-text-color);\n background: transparent;\n border-left:4px solid transparent;\n}\n\n.nav-bar-h1,\n.nav-bar-h2,\n.nav-bar-path {\n font-size: calc(var(--font-size-small) + 1px);\n padding: var(--nav-item-padding);\n}\n.nav-bar-path.small-font {\n font-size: var(--font-size-small);\n}\n\n.nav-bar-info {\n font-size: var(--font-size-regular);\n padding: 16px 10px;\n font-weight:bold;\n}\n.nav-bar-section {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n font-size: var(--font-size-small);\n color: var(--nav-text-color);\n padding: var(--nav-item-padding);\n font-weight:bold;\n}\n.nav-bar-section.operations {\n cursor:pointer;\n}\n.nav-bar-section.operations:hover {\n color:var(--nav-hover-text-color);\n background-color:var(--nav-hover-bg-color);\n}\n\n.nav-bar-section:first-child {\n display: none;\n}\n.nav-bar-h2 {margin-left:12px;}\n\n.nav-bar-h1.left-bar.active,\n.nav-bar-h2.left-bar.active,\n.nav-bar-info.left-bar.active,\n.nav-bar-tag.left-bar.active,\n.nav-bar-path.left-bar.active,\n.nav-bar-section.left-bar.operations.active {\n border-left:4px solid var(--nav-accent-color);\n color:var(--nav-hover-text-color);\n}\n\n.nav-bar-h1.colored-block.active,\n.nav-bar-h2.colored-block.active,\n.nav-bar-info.colored-block.active,\n.nav-bar-tag.colored-block.active,\n.nav-bar-path.colored-block.active,\n.nav-bar-section.colored-block.operations.active {\n background-color: var(--nav-accent-color);\n color: var(--nav-accent-text-color);\n border-radius: 0;\n}\n\n.nav-bar-h1:hover,\n.nav-bar-h2:hover,\n.nav-bar-info:hover,\n.nav-bar-tag:hover,\n.nav-bar-path:hover {\n color:var(--nav-hover-text-color);\n background-color:var(--nav-hover-bg-color);\n}\n`;\n","import { css } from 'lit';\n\nexport default css`\n#api-info {\n font-size: calc(var(--font-size-regular) - 1px);\n margin-top: 8px;\n}\n\n#api-info span:before {\n content: \"|\";\n display: inline-block;\n opacity: 0.5;\n width: 15px;\n text-align: center;\n}\n#api-info span:first-child:before {\n content: \"\";\n width: 0px;\n}\n`;\n","import { css } from 'lit';\n\n/*\nThis file is reserved for any custom css that developers want to add to\ncustomize their theme. Simply add your css to this file and yarn build.\n*/\n\nexport default css`\n.code-container {\n padding-inline: 32px;\n padding-top: 16px;\n}\n.code-container > code {\n font-size: 14px;\n line-height: 20px;\n}\n\n.request-card {\n border: 1px solid #CCCED8;\n border-radius: 4px;\n padding-block: 24px;\n margin-top: 24px;\n}\n\n.request-title-container {\n margin-left: 16px;\n}\n\n.request-title {\n margin-bottom: 8px;\n font-size: 18px;\n font-weight: 400;\n line-height: 18px;\n color: #4A4A4A;\n}\n\n.label-operation-container {\n text-align: left;\n direction: ltr;\n padding: 8px 0;\n color: var(--fg3);\n display: flex;\n width: 100%;\n overflow: hidden;\n}\n\n.label-operation-path-container {\n display: inline-flex;\n flex-direction: row;\n flex-grow: 1;\n justify-content: space-between;\n align-items: stretch;\n width: auto;\n height: 28px;\n left: 0;\n top: 0;\n border: 1px solid var(--border-color);\n border-radius: 0px 4px 4px 0px;\n margin: 4px 0px;\n flex-wrap: nowrap;\n overflow-x: auto;\n position: relative;\n scrollbar-color: transparent transparent;\n}\n\n.label-operation-path-container::-webkit-scrollbar {\n display: none;\n}\n\n.label-operation-path-item {\n flex: 0 0 auto;\n}\n\n.label-operation-method-container {\n display: inline-flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n padding: 4px 8px;\n width: auto;\n height: 28px;\n left: 0;\n top: 0;\n border-width: 1px 0px 1px 1px;\n border-style: solid;\n border-radius: 4px 0px 0px 4px;\n margin: 4px 0px;\n text-transform: uppercase;\n}\n\n.right-box-title {\n color: #4A4A4A;\n font-size: 18px;\n line-height: 20px;\n font-weight: 400;\n}\n\n.right-box-container {\n margin-top: 16px;\n}\n\n.right-box-label {\n color: var(--fg2);\n margin-bottom: 4px;\n font-size: 14px;\n font-weight: 400;\n}\n\n.right-box-input {\n width: 100%;\n height: 44px;\n}\n\n.server-template {\n position: relative;\n}\n\n.server-template-vars {\n position: absolute;\n top: calc(100% + 2px);\n \n background-color: var(--bg);\n\n border: 1px solid rgb(204, 206, 216);\n border-radius: 4px;\n box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.1);\n \n z-index: 1;\n\n max-height: 300px;\n max-width: 100%;\n}\n\n.server-vars {\n padding: 10px 10px 0px 10px;\n overflow-x: hidden;\n overflow-y: auto;\n}\n\n.language-picker {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n\n padding: 16px 0px;\n gap: 5px;\n}\n\n.language-picker-buttons {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 5px;\n}\n\n.square-language-button {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 4px;\n gap: 5px;\n\n width: max-content;\n min-width: 50px;\n height: 50px;\n\n flex: none;\n order: 1;\n flex-grow: 0;\n\n background-color: rgba(0, 0, 0, 0);\n border: 1px solid rgba(0, 0, 0, 0);\n border-radius: 4px;\n\n color: var(--fg2);\n font-style: normal;\n font-weight: 400;\n font-size: 12px;\n line-height: 16px;\n\n cursor: pointer;\n}\n\n.square-language-button:hover {\n border: 1px solid rgb(59, 59, 59);\n}\n\n.square-language-button:active {\n border-color: rgb(59, 59, 59);\n box-shadow: rgb(255 255 255) 0px 0px 0px 1px, rgb(185 185 185) 0px 0px 0px 3px;\n}\n\n.rectangle-language-button {\n display: flex;\n gap: 5px;\n\n width: 100%;\n text-align: left;\n\n background-color: rgba(0, 0, 0, 0);\n border: 1px solid rgba(0, 0, 0, 0);\n border-radius: 0px;\n padding: 6px 6px;\n\n color: var(--fg2);\n cursor: pointer;\n}\n\n.rectangle-language-button:hover {\n background-color: rgb(248, 247, 252);\n}\n\n.rectangle-language-button:active {\n background-color: rgb(204, 206, 216);\n}\n\n.selected-language {\n border: 1px solid rgb(204, 206, 216);\n}\n\n.language-show-more {\n height: 30px;\n width: 30px;\n padding: 4px;\n\n border: 1px solid rgba(0, 0, 0, 0);\n border-radius: 4px;\n\n cursor: pointer;\n}\n\n.language-show-more:hover {\n border: 1px solid rgb(59, 59, 59);\n}\n\n.data-example{\n background: #FFF3F6;\n border: 1px solid #FFE0EF;\n border-radius: 4px;\n font-family: var(--font-mono);\n font-size: var(--font-size-small);\n width: max-content;\n padding: 0.2em 0.4em;\n}\n\n.data-example:hover{\n border: 1px solid #ffb5cb;\n}\n\n.language-show-more:active {\n border-color: rgb(59, 59, 59);\n box-shadow: rgb(255 255 255) 0px 0px 0px 1px, rgb(185 185 185) 0px 0px 0px 3px;\n}\n\n.more-languages-dropdown {\n position: absolute;\n top: 105%;\n right: 0%;\n min-width: 140px;\n\n background-color: var(--bg);\n\n border: 1px solid rgb(204, 206, 216);\n border-radius: 4px;\n box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.1);\n \n z-index: 1;\n\n transition: visibility 0.3s linear,opacity 0.3s linear;\n}\n`;\n","/* eslint-disable arrow-body-style */\nimport { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport updateCodeExample from '../utils/update-code-example';\n\nconst codeVerifier = '731DB1C3F7EA533B85E29492D26AA-1234567890-1234567890';\nconst codeChallenge = '4FatVDBJKPAo4JgLLaaQFMUcQPn5CrPRvLlaob9PTYc'; // Base64 encoded SHA-256\n\nconst localStorageKey = 'rapidoc';\n\nexport function applyApiKey(securitySchemeId, username = '', password = '', providedApikeyVal = '') {\n const securityObj = this.resolvedSpec.securitySchemes?.find((v) => (v.securitySchemeId === securitySchemeId));\n if (!securityObj) {\n return false;\n }\n let finalApiKeyValue = '';\n if (securityObj.scheme?.toLowerCase() === 'basic') {\n if (username) {\n finalApiKeyValue = `Basic ${Buffer.from(`${username}:${password}`, 'utf8').toString('base64')}`;\n }\n } else if (providedApikeyVal) {\n securityObj.value = providedApikeyVal;\n finalApiKeyValue = `${securityObj.scheme?.toLowerCase() === 'bearer' ? 'Bearer ' : ''}${providedApikeyVal}`;\n }\n if (finalApiKeyValue) {\n securityObj.finalKeyValue = finalApiKeyValue;\n this.requestUpdate();\n return true;\n }\n return false;\n}\n\nexport function onClearAllApiKeys() {\n this.resolvedSpec.securitySchemes?.forEach((v) => {\n v.user = '';\n v.password = '';\n v.value = '';\n v.finalKeyValue = '';\n });\n this.requestUpdate();\n}\n\nfunction getPersistedApiKeys() {\n return JSON.parse(localStorage.getItem(localStorageKey)) || {};\n}\n\nfunction setPersistedApiKeys(obj) {\n localStorage.setItem(localStorageKey, JSON.stringify(obj));\n}\n\nexport function recoverPersistedApiKeys() {\n const rapidocLs = getPersistedApiKeys.call(this);\n Object.values(rapidocLs).forEach((p) => {\n applyApiKey.call(this, p.securitySchemeId, p.username, p.password, p.value);\n });\n}\n\nfunction onApiKeyChange(securitySchemeId) {\n let apiKeyValue = '';\n const securityObj = this.resolvedSpec.securitySchemes.find((v) => (v.securitySchemeId === securitySchemeId));\n if (securityObj) {\n const trEl = this.shadowRoot.getElementById(`security-scheme-${securitySchemeId}`);\n if (trEl) {\n if (securityObj.type && securityObj.scheme && securityObj.type === 'http' && securityObj.scheme.toLowerCase() === 'basic') {\n const userVal = trEl.querySelector('.api-key-user').value.trim();\n const passwordVal = trEl.querySelector('.api-key-password').value.trim();\n applyApiKey.call(this, securitySchemeId, userVal, passwordVal);\n } else {\n apiKeyValue = trEl.querySelector('.api-key-input').value.trim();\n applyApiKey.call(this, securitySchemeId, '', '', apiKeyValue);\n }\n if (this.persistAuth === 'true') {\n const rapidocLs = getPersistedApiKeys.call(this);\n rapidocLs[securitySchemeId] = securityObj;\n setPersistedApiKeys.call(this, rapidocLs);\n }\n }\n }\n}\n\n// Updates the OAuth Access Token (API key), so it reflects in UI and gets used in TRY calls\nfunction updateOAuthKey(securitySchemeId, accessToken, tokenType = 'Bearer') {\n const securityObj = this.resolvedSpec.securitySchemes.find((v) => (v.securitySchemeId === securitySchemeId));\n securityObj.finalKeyValue = `${(tokenType.toLowerCase() === 'bearer' ? 'Bearer' : (tokenType.toLowerCase() === 'mac' ? 'MAC' : tokenType))} ${accessToken}`;\n this.requestUpdate();\n}\n\n/* eslint-disable no-console */\n// Gets Access-Token in exchange of Authorization Code\nasync function fetchAccessToken(tokenUrl, clientId, clientSecret, redirectUrl, grantType, authCode, securitySchemeId, authFlowDivEl, sendClientSecretIn = 'header', scopes = null, username = null, password = null) {\n const respDisplayEl = authFlowDivEl ? authFlowDivEl.querySelector('.oauth-resp-display') : undefined;\n const urlFormParams = new URLSearchParams();\n const headers = new Headers();\n urlFormParams.append('grant_type', grantType);\n if (grantType === 'authorization_code') {\n urlFormParams.append('client_id', clientId);\n urlFormParams.append('client_secret', clientSecret);\n }\n if (grantType !== 'client_credentials' && grantType !== 'password') {\n urlFormParams.append('redirect_uri', redirectUrl);\n }\n if (authCode) {\n urlFormParams.append('code', authCode);\n urlFormParams.append('code_verifier', codeVerifier); // for PKCE\n }\n if (sendClientSecretIn === 'header') {\n headers.set('Authorization', `Basic ${Buffer.from(`${clientId}:${clientSecret}`, 'utf8').toString('base64')}`);\n } else if (grantType !== 'authorization_code') {\n urlFormParams.append('client_id', clientId);\n urlFormParams.append('client_secret', clientSecret);\n }\n if (grantType === 'password') {\n urlFormParams.append('username', username);\n urlFormParams.append('password', password);\n }\n if (scopes) {\n urlFormParams.append('scope', scopes);\n }\n\n try {\n const resp = await fetch(tokenUrl, { method: 'POST', headers, body: urlFormParams });\n const tokenResp = await resp.json();\n if (resp.ok) {\n if (tokenResp.token_type && tokenResp.access_token) {\n updateOAuthKey.call(this, securitySchemeId, tokenResp.access_token, tokenResp.token_type);\n if (respDisplayEl) {\n respDisplayEl.innerHTML = 'Access Token Received';\n }\n return true;\n }\n } else {\n if (respDisplayEl) {\n respDisplayEl.innerHTML = `${tokenResp.error_description || tokenResp.error_description || 'Unable to get access token'}`;\n }\n return false;\n }\n } catch (err) {\n if (respDisplayEl) {\n respDisplayEl.innerHTML = 'Failed to get access token';\n }\n return false;\n }\n}\n\n// Gets invoked when it receives the Authorization Code from the other window via message-event\nasync function onWindowMessageEvent(msgEvent, winObj, tokenUrl, clientId, clientSecret, redirectUrl, grantType, sendClientSecretIn, securitySchemeId, authFlowDivEl) {\n sessionStorage.removeItem('winMessageEventActive');\n winObj.close();\n if (msgEvent.data.fake) {\n return;\n }\n if (!msgEvent.data) {\n console.warn('RapiDoc: Received no data with authorization message');\n }\n if (msgEvent.data.error) {\n console.warn('RapiDoc: Error while receiving data');\n }\n if (msgEvent.data) {\n if (msgEvent.data.responseType === 'code') {\n // Authorization Code flow\n fetchAccessToken.call(this, tokenUrl, clientId, clientSecret, redirectUrl, grantType, msgEvent.data.code, securitySchemeId, authFlowDivEl, sendClientSecretIn);\n } else if (msgEvent.data.responseType === 'token') {\n // Implicit flow\n updateOAuthKey.call(this, securitySchemeId, msgEvent.data.access_token, msgEvent.data.token_type);\n }\n }\n}\n\n// code_challenge generator for PKCE flow\n// TODO: Implement dynamic generation of code-challenge based on code-verifier\n/*\nasync function generateCodeChallenge() {\n const encoder = new TextEncoder();\n const data = encoder.encode(codeVerifier);\n const sha256Hash = await window.crypto.subtle.digest('SHA-256', data); // returns Unit8Array\n // const utf8Decoder = new TextDecoder();\n // const b64EncodedSha256 = btoa(utf8Decoder.decode(sha256Hash));\n const b64EncodedSha256 = base64encode(sha256Hash);\n return b64EncodedSha256;\n}\n*/\n\nasync function onInvokeOAuthFlow(securitySchemeId, flowType, authUrl, tokenUrl, e) {\n const authFlowDivEl = e.target.closest('.oauth-flow');\n const clientId = authFlowDivEl.querySelector('.oauth-client-id') ? authFlowDivEl.querySelector('.oauth-client-id').value.trim() : '';\n const clientSecret = authFlowDivEl.querySelector('.oauth-client-secret') ? authFlowDivEl.querySelector('.oauth-client-secret').value.trim() : '';\n const username = authFlowDivEl.querySelector('.api-key-user') ? authFlowDivEl.querySelector('.api-key-user').value.trim() : '';\n const password = authFlowDivEl.querySelector('.api-key-password') ? authFlowDivEl.querySelector('.api-key-password').value.trim() : '';\n const sendClientSecretIn = authFlowDivEl.querySelector('.oauth-send-client-secret-in') ? authFlowDivEl.querySelector('.oauth-send-client-secret-in').value.trim() : 'header';\n const checkedScopeEls = [...authFlowDivEl.querySelectorAll('.scope-checkbox:checked')];\n const pkceCheckboxEl = authFlowDivEl.querySelector(`#${securitySchemeId}-pkce`);\n const state = (`${Math.random().toString(36).slice(2, 9)}random${Math.random().toString(36).slice(2, 9)}`);\n const nonce = (`${Math.random().toString(36).slice(2, 9)}random${Math.random().toString(36).slice(2, 9)}`);\n // const codeChallenge = await generateCodeChallenge(codeVerifier);\n const redirectUrlObj = new URL(`${window.location.origin}${window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'))}/${this.oauthReceiver}`);\n let grantType = '';\n let responseType = '';\n let newWindow;\n\n // clear previous error messages\n const errEls = [...authFlowDivEl.parentNode.querySelectorAll('.oauth-resp-display')];\n errEls.forEach((v) => { v.innerHTML = ''; });\n\n if (flowType === 'authorizationCode' || flowType === 'implicit') {\n const authUrlObj = new URL(authUrl);\n if (flowType === 'authorizationCode') {\n grantType = 'authorization_code';\n responseType = 'code';\n } else if (flowType === 'implicit') {\n responseType = 'token';\n }\n const authCodeParams = new URLSearchParams(authUrlObj.search);\n const selectedScopes = checkedScopeEls.map((v) => v.value).join(' ');\n if (selectedScopes) {\n authCodeParams.set('scope', selectedScopes);\n }\n authCodeParams.set('client_id', clientId);\n authCodeParams.set('redirect_uri', redirectUrlObj.toString());\n authCodeParams.set('response_type', responseType);\n authCodeParams.set('state', state);\n authCodeParams.set('nonce', nonce);\n if (pkceCheckboxEl && pkceCheckboxEl.checked) {\n authCodeParams.set('code_challenge', codeChallenge);\n authCodeParams.set('code_challenge_method', 'S256');\n }\n authCodeParams.set('show_dialog', true);\n authUrlObj.search = authCodeParams.toString();\n // If any older message-event-listener is active then fire a fake message to remove it (these are single time listeners)\n if (sessionStorage.getItem('winMessageEventActive') === 'true') {\n window.postMessage({ fake: true }, this);\n }\n setTimeout(() => {\n newWindow = window.open(authUrlObj.toString());\n if (!newWindow) {\n console.error(`RapiDoc: Unable to open ${authUrlObj.toString()} in a new window`);\n } else {\n sessionStorage.setItem('winMessageEventActive', 'true');\n window.addEventListener(\n 'message',\n (msgEvent) => onWindowMessageEvent.call(this, msgEvent, newWindow, tokenUrl, clientId, clientSecret, redirectUrlObj.toString(), grantType, sendClientSecretIn, securitySchemeId, authFlowDivEl),\n { once: true },\n );\n }\n }, 10);\n } else if (flowType === 'clientCredentials') {\n grantType = 'client_credentials';\n const selectedScopes = checkedScopeEls.map((v) => v.value).join(' ');\n fetchAccessToken.call(this, tokenUrl, clientId, clientSecret, redirectUrlObj.toString(), grantType, '', securitySchemeId, authFlowDivEl, sendClientSecretIn, selectedScopes);\n } else if (flowType === 'password') {\n grantType = 'password';\n const selectedScopes = checkedScopeEls.map((v) => v.value).join(' ');\n fetchAccessToken.call(this, tokenUrl, clientId, clientSecret, redirectUrlObj.toString(), grantType, '', securitySchemeId, authFlowDivEl, sendClientSecretIn, selectedScopes, username, password);\n }\n}\n/* eslint-enable no-console */\n\n/* eslint-disable indent */\n\nfunction oAuthFlowTemplate(flowName, clientId, clientSecret, securitySchemeId, authFlow, defaultScopes = [], receiveTokenIn = 'header') {\n let { authorizationUrl, tokenUrl, refreshUrl } = authFlow;\n const pkceOnly = authFlow['x-pkce-only'] || false;\n const isUrlAbsolute = (url) => (url.indexOf('://') > 0 || url.indexOf('//') === 0);\n // Calculcate base URL\n const url = new URL(this.selectedServer.computedUrl);\n const baseUrl = url.origin;\n\n if (refreshUrl && !isUrlAbsolute(refreshUrl)) {\n refreshUrl = `${baseUrl}/${refreshUrl.replace(/^\\//, '')}`;\n }\n if (tokenUrl && !isUrlAbsolute(tokenUrl)) {\n tokenUrl = `${baseUrl}/${tokenUrl.replace(/^\\//, '')}`;\n }\n if (authorizationUrl && !isUrlAbsolute(authorizationUrl)) {\n authorizationUrl = `${baseUrl}/${authorizationUrl.replace(/^\\//, '')}`;\n }\n let flowNameDisplay;\n if (flowName === 'authorizationCode') {\n flowNameDisplay = 'Authorization Code Flow';\n } else if (flowName === 'clientCredentials') {\n flowNameDisplay = 'Client Credentials Flow';\n } else if (flowName === 'implicit') {\n flowNameDisplay = 'Implicit Flow';\n } else if (flowName === 'password') {\n flowNameDisplay = 'Password Flow';\n } else {\n flowNameDisplay = flowName;\n }\n return html`\n
\n
${flowNameDisplay}
\n ${authorizationUrl\n ? html`
Auth URL ${authorizationUrl}
`\n : ''\n }\n ${tokenUrl\n ? html`
Token URL ${tokenUrl}
`\n : ''\n }\n ${refreshUrl\n ? html`
Refresh URL ${refreshUrl}
`\n : ''\n }\n ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'implicit' || flowName === 'password'\n ? html`\n ${authFlow.scopes\n ? html`\n Scopes \n
\n ${Object.entries(authFlow.scopes).map((scopeAndDescr, index) => html`\n
\n \n \n
\n `)}\n
\n `\n : ''\n }\n ${flowName === 'password'\n ? html`\n
\n \n \n
`\n : ''\n }\n
\n ${flowName === 'authorizationCode'\n ? html`\n
\n \n \n
\n `\n : ''\n }\n \n ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'password'\n ? html`\n \n `\n : ''\n }\n ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'implicit' || flowName === 'password'\n ? html`\n `\n : ''\n }\n
\n
\n `\n : ''\n }\n
\n `;\n}\n\nfunction removeApiKey(securitySchemeId) {\n const securityObj = this.resolvedSpec.securitySchemes?.find((v) => (v.securitySchemeId === securitySchemeId));\n securityObj.user = '';\n securityObj.password = '';\n securityObj.value = '';\n securityObj.finalKeyValue = '';\n if (this.persistAuth === 'true') {\n const rapidocLs = getPersistedApiKeys.call(this);\n delete rapidocLs[securityObj.securitySchemeId];\n setPersistedApiKeys.call(this, rapidocLs);\n }\n this.requestUpdate();\n}\n\nfunction handleApiKeyChange(e, securitySchemeId, apiKey) {\n if (apiKey === '') removeApiKey.call(this, securitySchemeId);\n else onApiKeyChange.call(this, securitySchemeId);\n\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n}\n\nexport default function securitySchemeTemplate() {\n if (!this.resolvedSpec) { return ''; }\n const providedApiKeys = this.resolvedSpec.securitySchemes?.filter((v) => (v.finalKeyValue));\n if (!providedApiKeys) {\n return;\n }\n return html`\n
\n
Header Auth
\n\n ${this.resolvedSpec.securitySchemes && this.resolvedSpec.securitySchemes.length > 0\n ? html`\n
\n ${this.resolvedSpec.securitySchemes.map((v) => html`\n
\n
${v.name}
\n ${v.description\n ? html`\n
\n ${unsafeHTML(marked(v.description || ''))}\n
`\n : ''\n }\n\n ${(v.type.toLowerCase() === 'apikey') || (v.type.toLowerCase() === 'http' && v.scheme.toLowerCase() === 'bearer')\n ? html`\n
\n ${v.in !== 'cookie'\n ? html`\n { handleApiKeyChange.call(this, e, v.securitySchemeId, e.target.value); }}\"\n >`\n : html` cookies cannot be set from here`\n }\n
`\n : ''\n }\n ${v.type.toLowerCase() === 'http' && v.scheme.toLowerCase() === 'basic'\n ? html`\n
\n Send Authorization in header containing the word Basic followed by a space and a base64 encoded string of username:password.\n
\n
\n {\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n }}\n >\n {\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n }}\n >\n \n
`\n : ''\n }\n
\n ${v.type.toLowerCase() === 'oauth2'\n ? html`\n
\n ${Object.keys(v.flows).map((f) => oAuthFlowTemplate.call(this, f, v['x-client-id'], v['x-client-secret'], v.securitySchemeId, v.flows[f], v['x-default-scopes'], v['x-receive-token-in']))}\n
\n `\n : ''\n }\n `)}\n
`\n : ''\n }\n \n \n \n
\n`;\n}\n\nexport function pathSecurityTemplate(pathSecurity) {\n if (this.resolvedSpec.securitySchemes && pathSecurity) {\n const orSecurityKeys1 = [];\n if (Array.isArray(pathSecurity)) {\n if (pathSecurity.length === 0) {\n return '';\n }\n } else {\n return '';\n }\n pathSecurity.forEach((pSecurity) => {\n const andSecurityKeys1 = [];\n const andKeyTypes = [];\n if (Object.keys(pSecurity).length === 0) {\n orSecurityKeys1.push({\n securityTypes: 'None',\n securityDefs: [],\n });\n } else {\n Object.keys(pSecurity).forEach((pathSecurityKey) => {\n let pathScopes = '';\n const s = this.resolvedSpec.securitySchemes.find((ss) => ss.securitySchemeId === pathSecurityKey);\n if (pSecurity[pathSecurityKey] && Array.isArray(pSecurity[pathSecurityKey])) {\n pathScopes = pSecurity[pathSecurityKey].join(', ');\n }\n if (s) {\n andKeyTypes.push(s.typeDisplay);\n andSecurityKeys1.push({ ...s, ...({ scopes: pathScopes }) });\n }\n });\n orSecurityKeys1.push({\n securityTypes: andKeyTypes.length > 1 ? `${andKeyTypes[0]} + ${andKeyTypes.length - 1} more` : andKeyTypes[0],\n securityDefs: andSecurityKeys1,\n });\n }\n });\n return html`
\n
\n \n ${orSecurityKeys1.map((orSecurityItem1, i) => html`\n ${orSecurityItem1.securityTypes\n ? html`\n ${i !== 0 ? html`
OR
` : ''}\n
\n
\n ${this.updateRoute === 'true' && this.allowAuthentication === 'true'\n ? html` ${orSecurityItem1.securityTypes} `\n : html`${orSecurityItem1.securityTypes}`\n }\n
\n
\n ${orSecurityItem1.securityDefs.length > 1 ? html`
Requires all of the following
` : ''}\n
\n ${orSecurityItem1.securityDefs.map((andSecurityItem, j) => {\n const scopeHtml = html`${andSecurityItem.scopes !== ''\n ? html`\n
\n Required scopes:\n
\n
\n ${andSecurityItem.scopes.split(',').map((scope, cnt) => html`${cnt === 0 ? '' : '┃'}${scope}`)}\n
\n
`\n : ''\n }`;\n\n return html`\n ${andSecurityItem.type === 'oauth2'\n ? html`\n
\n ${orSecurityItem1.securityDefs.length > 1\n ? html`${j + 1}.  `\n : 'Needs'\n }\n OAuth Token ${andSecurityItem.securitySchemeId} in Authorization header\n ${scopeHtml}\n
`\n : andSecurityItem.type === 'http'\n ? html`\n
\n ${orSecurityItem1.securityDefs.length > 1 ? html`${j + 1}.  ` : html`Requires`}\n ${andSecurityItem.scheme === 'basic' ? 'Base 64 encoded username:password' : 'Bearer Token'} in Authorization header\n ${scopeHtml}\n
`\n : html`\n
\n ${orSecurityItem1.securityDefs.length > 1 ? html`${j + 1}.  ` : html`Requires`}\n Token in ${andSecurityItem.name} ${andSecurityItem.in}\n ${scopeHtml}\n
`\n }`;\n })}\n
\n
\n
\n `\n : ''\n }\n `)\n }\n
\n `;\n }\n return '';\n}\n\n/* eslint-enable indent */\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\n/* eslint-disable indent */\nexport default function copySymbol() {\nreturn html`\n \n \n \n \n`;\n}\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport Prism from 'prismjs';\nimport { copyToClipboard } from '../utils/common-utils';\nimport copySymbol from '../components/assets/copy-symbol';\n\n/* eslint-disable indent */\nexport default function codeSamplesTemplate(xCodeSamples) {\n return html`\n
CODE SAMPLES
\n
{\n if (!e.target.classList.contains('tab-btn')) { return; }\n const clickedTab = e.target.dataset.tab;\n\n const tabButtons = [...e.currentTarget.querySelectorAll('.tab-btn')];\n const tabContents = [...e.currentTarget.querySelectorAll('.tab-content')];\n tabButtons.forEach((tabBtnEl) => tabBtnEl.classList[tabBtnEl.dataset.tab === clickedTab ? 'add' : 'remove']('active'));\n tabContents.forEach((tabBodyEl) => { tabBodyEl.style.display = (tabBodyEl.dataset.tab === clickedTab ? 'block' : 'none'); });\n }\n }\">\n
\n ${xCodeSamples.map((v, i) => html``)}\n
\n ${xCodeSamples.map((v, i) => html`\n
\n \n
${Prism.languages[v.lang?.toLowerCase()] ? unsafeHTML(Prism.highlight(v.source, Prism.languages[v.lang?.toLowerCase()], v.lang?.toLowerCase())) : v.source}
\n
`)\n }\n
\n `;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\n\n/* eslint-disable indent */\nexport default function callbackTemplate(callbacks) {\n return html`\n
CALLBACKS
\n ${Object.entries(callbacks).map((kv) => html`\n
\n ${kv[0]}\n ${Object.entries(kv[1]).map((pathObj) => html`\n
\n
\n ${Object.entries(pathObj[1]).map((method) => html`\n
\n
\n
\n \n ${method[0]} \n
\n ${pathObj[0]} \n
\n
\n \n\n \n
\n
\n `)}\n
\n
\n `)}\n
\n `)}\n `;\n}\n/* eslint-enable indent */\n","import { css } from 'lit';\n\nconst ShellStyle = css`\n.shell-token.shell-function {\n color: #2953B2;\n}\n\n.shell-token.shell-method {\n color: #4A4A4A;\n}\n\n.shell-token.shell-punctuation {\n color: #4A4A4A;\n}\n\n.shell-token.shell-string {\n color: var(--green);\n}\n\n`;\n\nconst JavascriptStyle = css`\n.node-token.node-builtin {\n color: #4A4A4A;\n}\n\n.node-token.node-keyword {\n color: #2953B2;\n}\n\n.node-token.node-punctuation {\n color: #4A4A4A;\n}\n\n.node-token.node-operator {\n color: #4A4A4A;\n}\n\n.node-token.node-string {\n color: var(--green);\n}\n\n.node-token.node-property {\n color: var(--green);\n}\n`;\n\nconst RubyStyle = css``;\n\nconst PhpStyle = css``;\n\nconst JsonStyle = css`\n.json-token.json-boolean {\n color: #2953B2;\n}\n\n.json-token.json-keyword {\n color: #2953B2;\n}\n\n.json-token.json-punctuation {\n color: #4A4A4A;\n}\n\n.json-token.json-comment {\n color: #4A4A4A;\n}\n\n.json-token.json-string {\n color: var(--green);\n}\n\n.json-token.json-property {\n color: var(--green);\n}\n`;\n\nconst PythonStyle = css`\n.python-token.python-builtin {\n color: #4A4A4A;\n}\n\n.python-token.python-keyword {\n color: #2953B2;\n}\n\n.python-token.python-punctuation {\n color: #4A4A4A;\n}\n\n.python-token.python-string {\n color: var(--green);\n}\n`;\n\nexport default [\n ShellStyle,\n JavascriptStyle,\n RubyStyle,\n PhpStyle,\n PythonStyle,\n JsonStyle,\n];\n","import { LitElement, html, css } from 'lit';\nimport { copyToClipboard } from '../utils/common-utils';\nimport FontStyles from '../styles/font-styles';\nimport BorderStyles from '../styles/border-styles';\nimport InputStyles from '../styles/input-styles';\nimport CustomStyles from '../styles/custom-styles';\nimport copySymbol from './assets/copy-symbol';\n\nexport default class JsonTree extends LitElement {\n static get properties() {\n return {\n data: { type: Object },\n renderStyle: { type: String, attribute: 'render-style' },\n };\n }\n\n static get styles() {\n return [\n FontStyles,\n BorderStyles,\n InputStyles,\n css`\n :host{\n display:flex;\n }\n :where(button, input[type=\"checkbox\"], [tabindex=\"0\"]):focus-visible { box-shadow: var(--focus-shadow); }\n :where(input[type=\"text\"], input[type=\"password\"], select, textarea):focus-visible { border-color: var(--primary-color); }\n .json-tree {\n position: relative;\n font-family: var(--font-mono);\n font-size: var(--font-size-small);\n display:inline-block;\n overflow:hidden;\n word-break: break-all;\n flex:1;\n line-height: calc(var(--font-size-small) + 6px);\n min-height: 40px;\n direction: ltr; \n text-align: left;\n }\n\n .open-bracket {\n display:inline-block;\n padding: 0 20px 0 0;\n cursor:pointer;\n border: 1px solid transparent;\n border-radius:3px;\n }\n .close-bracket {\n border: 1px solid transparent;\n border-radius:3px;\n display:inline-block;\n }\n .open-bracket:hover {\n color:var(--primary-color);\n background-color:var(--hover-color);\n border: 1px solid var(--border-color);\n }\n .open-bracket.expanded:hover ~ .inside-bracket {\n border-left: 1px solid var(--fg3);\n }\n .open-bracket.expanded:hover ~ .close-bracket {\n color:var(--primary-color);\n }\n .inside-bracket {\n padding-left:12px;\n overflow: hidden;\n border-left:1px dotted var(--border-color);\n }\n .open-bracket.collapsed + .inside-bracket,\n .open-bracket.collapsed + .inside-bracket + .close-bracket {\n display:none;\n }\n\n .string{color:var(--green);}\n .number{color:var(--blue);}\n .null{color:var(--red);}\n .boolean{color:var(--purple);}\n .object{color:var(--fg)}\n .toolbar {\n position: absolute;\n top:5px;\n right:6px;\n display:flex;\n padding:2px;\n align-items: center;\n }`,\n CustomStyles,\n ];\n }\n\n /* eslint-disable indent */\n render() {\n return html`\n
\n
\n \n
\n ${this.generateTree(this.data, true)}\n
\n `;\n }\n\n generateTree(data, isLast = false) {\n if (data === null) {\n return html`
null
`;\n }\n if (typeof data === 'object' && (data instanceof Date === false)) {\n const detailType = Array.isArray(data) ? 'array' : 'pure_object';\n if (Object.keys(data).length === 0) {\n return html`${(Array.isArray(data) ? '[ ],' : '{ },')}`;\n }\n return html`\n
${detailType === 'array' ? '[' : '{'}
\n
\n ${Object.keys(data).map((key, i, a) => html`\n
\n ${detailType === 'pure_object' ? html`\"${key}\":` : ''}\n ${this.generateTree(data[key], i === (a.length - 1))}\n
`)\n }\n
\n
${detailType === 'array' ? ']' : '}'}${isLast ? '' : ','}
\n `;\n }\n return (typeof data === 'string' || data instanceof Date)\n ? html`\"${data}\"${isLast ? '' : ','}`\n : html`${data}${isLast ? '' : ','}`;\n }\n /* eslint-enable indent */\n\n toggleExpand(e) {\n const openBracketEl = e.target;\n if (e.target.classList.contains('open-bracket')) {\n if (openBracketEl.classList.contains('expanded')) {\n openBracketEl.classList.replace('expanded', 'collapsed');\n e.target.innerHTML = e.target.classList.contains('array') ? '[...]' : '{...}';\n } else {\n openBracketEl.classList.replace('collapsed', 'expanded');\n e.target.innerHTML = e.target.classList.contains('array') ? '[' : '{';\n }\n }\n }\n}\n// Register the element with the browser\nif (!customElements.get('json-tree')) customElements.define('json-tree', JsonTree);\n","import { LitElement, html, css } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport FontStyles from '../styles/font-styles';\nimport SchemaStyles from '../styles/schema-styles';\nimport BorderStyles from '../styles/border-styles';\nimport CustomStyles from '../styles/custom-styles';\n\nexport default class SchemaTree extends LitElement {\n static get properties() {\n return {\n data: { type: Object },\n schemaExpandLevel: { type: Number, attribute: 'schema-expand-level' },\n schemaDescriptionExpanded: { type: String, attribute: 'schema-description-expanded' },\n allowSchemaDescriptionExpandToggle: { type: String, attribute: 'allow-schema-description-expand-toggle' },\n schemaHideReadOnly: { type: String, attribute: 'schema-hide-read-only' },\n schemaHideWriteOnly: { type: String, attribute: 'schema-hide-write-only' },\n };\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) { this.schemaExpandLevel = 99999; }\n if (!this.schemaDescriptionExpanded || !'true false'.includes(this.schemaDescriptionExpanded)) { this.schemaDescriptionExpanded = 'false'; }\n if (!this.schemaHideReadOnly || !'true false'.includes(this.schemaHideReadOnly)) { this.schemaHideReadOnly = 'true'; }\n if (!this.schemaHideWriteOnly || !'true false'.includes(this.schemaHideWriteOnly)) { this.schemaHideWriteOnly = 'true'; }\n }\n\n static get styles() {\n return [\n FontStyles,\n SchemaStyles,\n BorderStyles,\n css`\n .tree {\n font-size:var(--font-size-small);\n text-align: left;\n direction: ltr;\n line-height:calc(var(--font-size-small) + 6px);\n }\n .tree .tr:hover{\n background-color:var(--hover-color);\n }\n .collapsed-all-descr .tr:not(.expanded-descr) {\n overflow: hidden;\n max-height:calc(var(--font-size-small) + 8px);\n }\n .tree .key {\n max-width: 300px;\n }\n .key.deprecated .key-label {\n color: var(--red);\n }\n .tr.expanded:hover > .td.key > .open-bracket {\n color: var(--primary-color);\n }\n .tr.expanded:hover + .inside-bracket {\n border-left: 1px solid var(--fg3);\n }\n .tr.expanded:hover + .inside-bracket + .close-bracket {\n color: var(--primary-color);\n }\n .inside-bracket.xxx-of-option {\n border-left: 1px solid transparent;\n }\n .open-bracket{\n display:inline-block;\n padding: 0 20px 0 0;\n cursor:pointer;\n border: 1px solid transparent;\n border-radius:3px;\n }\n .open-bracket:hover {\n color:var(--primary-color);\n background-color:var(--hover-color);\n border: 1px solid var(--border-color);\n }\n .close-bracket{\n display:inline-block;\n font-family: var(--font-mono);\n }\n .tr.collapsed + .inside-bracket,\n .tr.collapsed + .inside-bracket + .close-bracket{\n overflow: hidden;\n display:none;\n }\n .inside-bracket.object,\n .inside-bracket.array {\n border-left: 1px dotted var(--border-color);\n }`,\n CustomStyles,\n ];\n }\n\n /* eslint-disable indent */\n render() {\n return html`\n
this.handleAllEvents(e)}\">\n
\n
${this.data?.['::type'] || ''}
\n ${this.allowSchemaDescriptionExpandToggle === 'true'\n ? html`\n
\n
\n ${this.schemaDescriptionExpanded === 'true' ? 'Single line description' : 'Multiline description'}\n
`\n : ''\n }\n
\n ${unsafeHTML(marked(this.data?.['::description'] || ''))}\n ${this.data\n ? html`\n ${this.generateTree(\n this.data['::type'] === 'array' ? this.data['::props'] : this.data,\n this.data['::type'],\n this.data['::array-type'] || '',\n )}`\n : html` Schema not found `\n }\n
\n `;\n }\n\n generateTree(data, dataType = 'object', arrayType = '', key = '', description = '', schemaLevel = 0, indentLevel = 0, readOrWrite = '') {\n if (this.schemaHideReadOnly === 'true') {\n if (dataType === 'array') {\n if (readOrWrite === 'readonly') {\n return;\n }\n }\n if (data?.['::readwrite'] === 'readonly') {\n return;\n }\n }\n if (this.schemaHideWriteOnly === 'true') {\n if (dataType === 'array') {\n if (readOrWrite === 'writeonly') {\n return;\n }\n }\n if (data?.['::readwrite'] === 'writeonly') {\n return;\n }\n }\n\n if (!data) {\n return html`
\n ${key.replace('::OPTION~', '')}\n ${\n dataType === 'array'\n ? html` [ ] `\n : dataType === 'object'\n ? html` { } `\n : html` schema undefined `\n }\n
`;\n }\n if (Object.keys(data).length === 0) {\n return html`${key}:{ }`;\n }\n let keyLabel = '';\n let keyDescr = '';\n if (key.startsWith('::ONE~OF') || key.startsWith('::ANY~OF')) {\n keyLabel = key.replace('::', '').replace('~', ' ');\n } else if (key.startsWith('::OPTION')) {\n const parts = key.split('~');\n [, keyLabel, keyDescr] = parts;\n } else {\n keyLabel = key;\n }\n\n const leftPadding = 12;\n const minFieldColWidth = 400 - (indentLevel * leftPadding);\n let openBracket = '';\n let closeBracket = '';\n const newSchemaLevel = data['::type']?.startsWith('xxx-of') ? schemaLevel : (schemaLevel + 1);\n // const newIndentLevel = dataType === 'xxx-of-option' || data['::type'] === 'xxx-of-option' ? indentLevel : (indentLevel + 1);\n const newIndentLevel = dataType === 'xxx-of-option' || data['::type'] === 'xxx-of-option' || key.startsWith('::OPTION') ? indentLevel : (indentLevel + 1);\n if (data['::type'] === 'object') {\n if (dataType === 'array') {\n if (schemaLevel < this.schemaExpandLevel) {\n openBracket = html`[{`;\n } else {\n openBracket = html`[{...}]`;\n }\n closeBracket = '}]';\n } else {\n if (schemaLevel < this.schemaExpandLevel) {\n openBracket = html`{`;\n } else {\n openBracket = html`{...}`;\n }\n closeBracket = '}';\n }\n } else if (data['::type'] === 'array') {\n if (dataType === 'array') {\n const arrType = arrayType !== 'object' ? arrayType : '';\n if (schemaLevel < this.schemaExpandLevel) {\n openBracket = html`[[ ${arrType} `;\n } else {\n openBracket = html`[[...]]`;\n }\n closeBracket = ']]';\n } else {\n if (schemaLevel < this.schemaExpandLevel) {\n openBracket = html`[`;\n } else {\n openBracket = html`[...]`;\n }\n closeBracket = ']';\n }\n }\n if (typeof data === 'object') {\n return html`\n
\n
\n ${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' || key.startsWith('::OPTION')\n ? html` ${keyLabel}${keyDescr}`\n : keyLabel === '::props' || keyLabel === '::ARRAY~OF'\n ? ''\n : schemaLevel > 0\n ? html`\n ${data['::deprecated'] ? '✗' : ''}\n ${keyLabel.replace(/\\*$/, '')}${keyLabel.endsWith('*') ? html`*` : ''}${readOrWrite === 'readonly' ? html` 🆁` : readOrWrite === 'writeonly' ? html` 🆆` : readOrWrite}:\n `\n : ''\n }\n ${openBracket}\n
\n
${unsafeHTML(marked(description || ''))}
\n
\n
\n ${Array.isArray(data) && data[0]\n ? html`${this.generateTree(data[0], 'xxx-of-option', '', '::ARRAY~OF', '', newSchemaLevel, newIndentLevel, data[0]['::readwrite'])}`\n : html`\n ${Object.keys(data).map((dataKey) => html`\n ${['::title', '::description', '::type', '::props', '::deprecated', '::array-type', '::readwrite', '::dataTypeLabel'].includes(dataKey)\n ? data[dataKey]['::type'] === 'array' || data[dataKey]['::type'] === 'object'\n ? html`${this.generateTree(\n data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey],\n data[dataKey]['::type'],\n data[dataKey]['::array-type'] || '',\n dataKey,\n data[dataKey]['::description'],\n newSchemaLevel,\n newIndentLevel,\n data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '',\n )}`\n : ''\n : html`${this.generateTree(\n data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey],\n data[dataKey]['::type'],\n data[dataKey]['::array-type'] || '',\n dataKey,\n data[dataKey]?.['::description'] || '',\n newSchemaLevel,\n newIndentLevel,\n data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '',\n )}`\n }\n `)}\n `\n }\n
\n ${data['::type'] && data['::type'].includes('xxx-of')\n ? ''\n : html`
${closeBracket}
`\n }\n `;\n }\n\n // For Primitive types and array of Primitives\n // eslint-disable-next-line no-unused-vars\n const [type, primitiveReadOrWrite, constraint, defaultValue, allowedValues, pattern, schemaDescription, schemaTitle, deprecated] = data.split('~|~');\n if (primitiveReadOrWrite === '🆁' && this.schemaHideReadOnly === 'true') {\n return;\n }\n if (primitiveReadOrWrite === '🆆' && this.schemaHideWriteOnly === 'true') {\n return;\n }\n const dataTypeCss = type.replace(/┃.*/g, '').replace(/[^a-zA-Z0-9+]/g, '').substring(0, 4).toLowerCase();\n const descrExpander = `${constraint || defaultValue || allowedValues || pattern ? `` : ''}`;\n let finalReadWriteText = '';\n let finalReadWriteTip = '';\n if (dataType === 'array') {\n if (readOrWrite === 'readonly') {\n finalReadWriteText = '🆁';\n finalReadWriteTip = 'Read-Only';\n } else if (readOrWrite === 'writeonly') {\n finalReadWriteText = '🆆';\n finalReadWriteTip = 'Write-Only';\n }\n } else if (primitiveReadOrWrite === '🆁') {\n finalReadWriteText = '🆁';\n finalReadWriteTip = 'Read-Only';\n } else if (primitiveReadOrWrite === '🆆') {\n finalReadWriteText = '🆆';\n finalReadWriteTip = 'Write-Only';\n }\n\n return html`\n
\n
\n ${deprecated ? html`` : ''}\n ${keyLabel.endsWith('*')\n ? html`${keyLabel.substring(0, keyLabel.length - 1)}*:`\n : key.startsWith('::OPTION')\n ? html`${keyLabel}${keyDescr}`\n : html`${keyLabel}:`\n }\n \n ${dataType === 'array' ? `[${type}]` : `${type}`}\n ${finalReadWriteText}\n \n
\n
\n ${description || schemaTitle || schemaDescription\n ? html`${html`\n ${unsafeHTML(marked(dataType === 'array'\n ? `${descrExpander} ${description}`\n : schemaTitle\n ? `${descrExpander} ${schemaTitle}: ${schemaDescription}`\n : `${descrExpander} ${schemaDescription}`))}\n `\n }`\n : ''\n } \n ${constraint ? html`
Constraints: ${constraint}
` : ''}\n ${defaultValue ? html`
Default: ${defaultValue}
` : ''}\n ${allowedValues ? html`
${type === 'const' ? 'Value' : 'Allowed'}: ${allowedValues}
` : ''}\n ${pattern ? html`
Pattern: ${pattern}
` : ''}\n
\n
\n `;\n }\n /* eslint-enable indent */\n\n handleAllEvents(e) {\n if (e.target.classList.contains('open-bracket')) {\n this.toggleObjectExpand(e);\n } else if (e.target.classList.contains('schema-multiline-toggle')) {\n this.schemaDescriptionExpanded = (this.schemaDescriptionExpanded === 'true' ? 'false' : 'true');\n } else if (e.target.classList.contains('descr-expand-toggle')) {\n const trEl = e.target.closest('.tr');\n if (trEl) {\n trEl.classList.toggle('expanded-descr');\n trEl.style.maxHeight = trEl.scrollHeight;\n }\n }\n }\n\n toggleObjectExpand(e) {\n const rowEl = e.target.closest('.tr');\n if (rowEl.classList.contains('expanded')) {\n rowEl.classList.replace('expanded', 'collapsed');\n e.target.innerHTML = e.target.classList.contains('array-of-object')\n ? '[{...}]'\n : e.target.classList.contains('array-of-array')\n ? '[[...]]'\n : e.target.classList.contains('array')\n ? '[...]'\n : '{...}';\n } else {\n rowEl.classList.replace('collapsed', 'expanded');\n e.target.innerHTML = e.target.classList.contains('array-of-object')\n ? '[{'\n : e.target.classList.contains('array-of-array')\n ? `[[ ${e.target.dataset.arrayType}`\n : e.target.classList.contains('object')\n ? '{'\n : '[';\n }\n }\n}\nif (!customElements.get('schema-tree')) customElements.define('schema-tree', SchemaTree);\n","import { LitElement, html, css } from 'lit';\n\nexport default class TagInput extends LitElement {\n /* eslint-disable indent */\n render() {\n let tagItemTmpl = '';\n if (Array.isArray(this.value)) {\n tagItemTmpl = html`${this.value\n .filter((v) => typeof v === 'string' && v.trim() !== '')\n .map((v) => html`${v}`)\n }`;\n }\n return html`\n
\n ${tagItemTmpl}\n this.afterPaste(e)}\" @keydown=\"${this.afterKeyDown}\" @blur=\"${this.onBlur}\" placeholder=\"${this.placeholder || ''}\">\n
\n `;\n }\n /* eslint-enable indent */\n\n static get properties() {\n return {\n placeholder: { type: String },\n value: { type: Array, attribute: 'value' },\n };\n }\n\n attributeChangedCallback(name, oldVal, newVal) {\n if (name === 'value') {\n if (newVal && oldVal !== newVal) {\n this.value = newVal.split(',').filter((v) => v.trim() !== '');\n }\n }\n super.attributeChangedCallback(name, oldVal, newVal);\n }\n\n afterPaste(e) {\n const clipboardData = e.clipboardData || window.clipboardData;\n const pastedData = clipboardData.getData('Text');\n const pastedArray = pastedData ? pastedData.split(',').filter((v) => v.trim() !== '') : '';\n if (pastedArray) {\n if (Array.isArray(this.value)) {\n this.value = [...this.value, ...pastedArray];\n } else {\n this.value = pastedArray;\n }\n }\n e.preventDefault();\n }\n\n afterKeyDown(e) {\n if (e.keyCode === 13) {\n e.stopPropagation();\n e.preventDefault();\n if (e.target.value) {\n if (Array.isArray(this.value)) {\n this.value = [...this.value, e.target.value];\n } else {\n this.value = [e.target.value];\n }\n e.target.value = '';\n }\n } else if (e.keyCode === 8) {\n if (e.target.value.length === 0) {\n if (Array.isArray(this.value) && this.value.length > 0) {\n this.value.splice(-1);\n this.value = [...this.value];\n }\n }\n }\n }\n\n onBlur(e) {\n if (e.target.value) {\n if (Array.isArray(this.value)) {\n this.value = [...this.value, e.target.value];\n } else {\n this.value = [e.target.value];\n }\n e.target.value = '';\n }\n }\n\n static get styles() {\n return [css`\n .tags {\n display:flex;\n flex-wrap: wrap;\n outline: none;\n padding:0;\n border-radius:var(--border-radius);\n border:1px solid var(--border-color);\n cursor:text;\n overflow:hidden;\n background:var(--input-bg);\n }\n .tag, .editor {\n padding:3px;\n margin:2px;\n }\n .tag{\n border:1px solid var(--border-color);\n background-color:var(--bg3);\n color:var(--fg3);\n border-radius:var(--border-radius);\n word-break: break-all;\n font-size: var(--font-size-small);\n }\n .tag:hover ~ #cursor {\n display: block;\n }\n .editor {\n flex:1;\n border:1px solid transparent;\n color:var(--fg);\n min-width:60px;\n outline: none;\n line-height: inherit;\n font-family:inherit;\n background:transparent;\n font-size: calc(var(--font-size-small) + 1px);\n }\n .editor:focus-visible {\n outline: 1px solid;\n }\n .editor::placeholder {\n color: var(--placeholder-color);\n opacity:1;\n }\n `];\n }\n}\n// Register the element with the browser\nif (!customElements.get('tag-input')) customElements.define('tag-input', TagInput);\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\n/* eslint-disable indent */\nexport default function checkSymbol(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n \n `;\n}\n","import { LitElement, html, css } from 'lit';\n\nimport CustomStyles from '../styles/custom-styles';\nimport cornerArrowSymbol from './assets/corner-arrow-symbol';\n\nexport default class Breadcrumbs extends LitElement {\n static get properties() {\n return {\n headers: { type: Array },\n };\n }\n\n static get styles() {\n return [\n css`\n .container {\n display: flex;\n align-items: center;\n }\n\n .header {\n font-size: 16px;\n font-weight: 400;\n line-height: 18px;\n color: #A1A8B3;\n text-decoration: none;\n }\n\n .header:hover {\n color: #4A596B;\n }\n\n .header:active {\n color: #0C1522;\n }\n\n .caret {\n margin: 0 2px;\n }\n\n .tooltip {\n position: relative;\n display: inline-block;\n }\n\n .tooltip .tooltiptext {\n visibility: hidden;\n width: max-content;\n max-width: 150px;\n padding: 8px;\n\n border-radius: 4px;\n box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.1);\n\n background-color: #FFFFFF;\n color: #A1A8B3;\n \n position: absolute;\n transform: translateX(-50%);\n top: 135%;\n left: 50%;\n z-index: 1;\n }\n\n .tooltip:hover .tooltiptext {\n visibility: visible;\n left: 50%;\n transform: translateX(-50%);\n }\n\n .tooltiptext::after {\n content: \"\";\n position: absolute;\n bottom: 100%;\n left: 50%;\n margin-left: -5px;\n border-width: 5px;\n border-style: solid;\n border-color: transparent transparent #fff transparent;\n }\n\n @media(max-width: 1024px) {\n .header {\n font-size: 12px;\n line-height: 16px;\n }\n }\n `,\n CustomStyles,\n ];\n }\n\n render() {\n let headers = this.headers.map(({ title, link }) => ({\n title: title.slice(0, 25) + (title.length > 25 ? '...' : ''),\n link,\n hasTooltip: (title.length > 25),\n tooltip: [{ title, link }],\n }));\n\n if (headers.length > 3) {\n const ellipsis = headers.slice(1, -1).reduce((acc, curr) => {\n acc.tooltip.push({ title: curr.tooltip[0].title, link: curr.tooltip[0].link });\n return acc;\n }, { title: '...', link: '', hasTooltip: true, tooltip: [] });\n\n headers = [headers[0], ellipsis, headers[headers.length - 1]];\n }\n\n return html`\n
\n ${headers.map((header, index) => html`\n ${index > 0 ? html`\n \n \n \n ` : ''}\n
\n ${header.title}\n ${header.hasTooltip ? html`\n
\n ${header.tooltip.map((content) => html`\n
\n ${header.tooltip.length > 1 ? cornerArrowSymbol() : ''}\n ${content.title}\n
\n `)}\n
` : ''}\n
\n `)}\n
\n `;\n }\n}\n\nif (!customElements.get('bread-crumbs')) customElements.define('bread-crumbs', Breadcrumbs);\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\n/* eslint-disable indent */\nexport default function cornerArrowSymbol(style) {\nreturn html`\n
\n \n \n \n \n
\n`;\n}\n","/* eslint-disable max-len */\nimport { LitElement, html, css } from 'lit';\nimport checkSymbol from './assets/check-symbol';\nimport closeSymbol from './assets/close-symbol';\n\n// eslint-disable-next-line import/prefer-default-export\nexport class Toast extends LitElement {\n static properties = {\n tone: { type: String },\n tones: { type: {} },\n message: { type: String },\n active: { type: Boolean },\n };\n\n constructor(tone, message) {\n super();\n this.active = true;\n this.message = message ?? '';\n this.tone = tone ?? 'positive';\n this.tones = {\n info: {\n borderColor: css`#7CBBEA`,\n bgColor: css`#DEECF7`,\n icon: checkSymbol,\n },\n positive: {\n borderColor: css`#83D187`,\n bgColor: css`#DFF1E0`,\n icon: checkSymbol,\n },\n warning: {\n borderColor: css`#F5AE70`,\n bgColor: css`#FFEBD7`,\n icon: checkSymbol,\n },\n critical: {\n borderColor: css`#F49494`,\n bgColor: css`#F8E3E3`,\n icon: checkSymbol,\n },\n };\n }\n\n firstUpdated() {\n const onFadeOut = (event) => {\n if (this.renderRoot.querySelectorAll('.toast-active').length > 0 && event.animationName === 'fadeOut') {\n this.onClose();\n }\n };\n this.renderRoot.getElementById('toast').addEventListener('animationend', onFadeOut);\n this.renderRoot.getElementById('toast').addEventListener('webkitAnimationEnd', onFadeOut);\n }\n\n onClose() {\n this.active = false;\n const options = {\n detail: 'closed toast',\n bubbles: true,\n composed: true,\n };\n this.dispatchEvent(new CustomEvent('closed-toast', options));\n }\n\n render() {\n return html`\n \n
\n ${this.tones[this.tone].icon({ width: 24, height: 24 })}\n

${this.message}

\n
\n
\n ${closeSymbol({})}\n
\n
\n `;\n }\n\n static get styles() {\n return [\n css`\n .close-button {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n border-radius: 4px;\n padding: 0px;\n width: 44px;\n height: 36px;\n }\n\n .close-button:hover {\n cursor: pointer;\n background-color: rgba(0, 0, 0, 0.05);\n }\n\n .toast-icon-text {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0px 0px 0px 4px;\n gap: 12px;\n width: auto;\n min-height: 40px;\n }\n\n .text {\n overflow-wrap: break-word;\n font-style: normal;\n font-family:var(--font-regular); \n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n display: flex;\n align-items: center;\n letter-spacing: 0.002em;\n color: black;\n margin: 0;\n }\n\n .toast {\n opacity: 0;\n pointer-events: none;\n display: none;\n }\n\n .toast-active {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding: 16px 16px 16px 20px;\n gap: 12px;\n min-width: 16.125rem;\n width: auto;\n border: 1px solid;\n box-shadow: 0px 12px 16px rgba(0, 0, 0, 0.16);\n border-radius: 4px;\n position: fixed;\n overflow: hidden;\n pointer-events: all;\n bottom: 32px;\n right: 50%;\n transform: translateX(50%);\n z-index: 1001;\n -webkit-animation:\n fadeIn .3s ease,\n slideIn .3s ease,\n fadeOut .3s ease 10s forwards;\n animation:\n fadeIn .3s ease,\n slideIn .3s ease,\n fadeOut .3s ease 10s forwards;\n }\n\n @media only screen and (min-width: 768px) {\n .toast-active {\n right: 96px;\n transform: none;\n }\n }\n \n @keyframes slideIn {\n from { transform: translateY(0, 10px) }\n }\n\n @keyframes fadeIn {\n from { opacity: 0 }\n }\n \n @keyframes fadeOut {\n to {\n opacity: 0;\n pointer-events: none;\n display: none;\n }\n }\n\n @-webkit-keyframes slideIn {\n from { transform: translateY(0, 10px) }\n }\n\n @-webkit-keyframes fadeIn {\n from { opacity: 0 }\n }\n \n @-webkit-keyframes fadeOut {\n to {\n opacity: 0;\n pointer-events: none;\n display: none;\n }\n }\n `,\n ];\n }\n}\n\nif (!customElements.get('toast-component')) customElements.define('toast-component', Toast);\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\n/* eslint-disable indent */\nexport default function closeSymbol(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { LitElement, html, css } from 'lit';\n// eslint-disable-next-line import/extensions\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { joinURLandPath } from '../utils/url';\nimport checkSymbol from './assets/check-symbol';\nimport copySymbol from './assets/copy-symbol';\nimport './toast-component';\n\n/* eslint-disable indent */\n// eslint-disable-next-line import/prefer-default-export\nexport class BaseUrl extends LitElement {\n static properties = {\n id: { type: String },\n url: { type: String },\n path: { type: String },\n computedUrl: { type: String },\n copied: { type: Boolean },\n showButton: { type: Boolean },\n showToast: { type: Boolean },\n };\n\n constructor(id, url, path, computedUrl, variables) {\n super();\n this.id = id;\n this.url = url;\n this.path = path;\n this.computedUrl = computedUrl;\n this.variables = variables;\n this.copied = false;\n this.showButton = false;\n this.showToast = false;\n this.addEventListener('closed-toast', () => { this.showToast = false; });\n }\n\n reset() {\n this.copied = false;\n this.showButton = false;\n }\n\n willUpdate(changedProperties) {\n if (changedProperties.has('id')) {\n this.reset();\n }\n }\n\n onButtonClick() {\n navigator.clipboard.writeText(joinURLandPath(this.computedUrl, this.path));\n this.copied = true;\n this.showToast = true;\n }\n\n onTextClick() {\n navigator.clipboard.writeText(joinURLandPath(this.computedUrl, this.path));\n this.showToast = true;\n }\n\n onMouseOver() {\n this.showButton = true;\n }\n\n onMouseLeave() {\n this.showButton = false;\n this.copied = false;\n }\n\n parseURL() {\n if (!this.variables) return this.url;\n\n let { url } = this;\n const spanVar = '{var}';\n\n for (const [key, value] of Object.entries(this.variables)) {\n const regex = new RegExp(`{${key}}`, 'g');\n url = url.replace(regex, spanVar.replace('{var}', value.value));\n }\n\n return joinURLandPath(url, this.path);\n }\n\n render() {\n return html`\n
\n
\n ${html`${unsafeHTML(this.parseURL())}`}\n \n
\n \n
\n ${\n this.showToast\n ? html``\n : ''\n }\n `;\n }\n\n static get styles() {\n return [\n css`\n .svg-container {\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-items: flex-start;\n padding: 0px 8px 0px 0px;\n gap: 10px;\n width: 57px;\n height: 20px;\n background: linear-gradient(270deg, #FFFFFF 51.22%, rgba(255, 255, 255, 0) 104.88%);\n }\n\n .url {\n flex: 1 0 auto;\n padding: 4px 8px;\n font-family: var(--font-mono);\n font-size: var(--font-size-mono)\n }\n\n .url:hover {\n cursor: pointer;\n }\n\n .variable {\n background-color: rgb(248, 247, 252);\n border: 1px solid rgb(204, 206, 216);\n border-radius: 4px;\n padding: 0px 2px;\n }\n\n .container {\n height: 42px;\n font-size:14px;\n border: 1px solid var(--border-color);\n border-radius: 4px;\n margin: 4px 0px;\n position: relative;\n }\n\n .container slot {\n visibility: hidden;\n }\n\n .container:hover slot {\n visibility: visible;\n }\n\n .container::-webkit-scrollbar {\n display: none;\n }\n\n button {\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n cursor: pointer;\n outline: inherit;\n right: 0;\n display: block;\n position: -webkit-sticky;\n position: sticky;\n }\n\n .copy-container {\n width: inherit;\n height: inherit;\n opacity: 0;\n filter: alpha(opacity = 0);\n position: absolute;\n top:0; bottom:0; left:0; right:0;\n display: block;\n z-index: 2;\n background: transparent;\n }\n\n .content-copy-container {\n width: inherit;\n height: inherit;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-wrap: nowrap;\n font-size: 14px;\n white-space: nowrap;\n overflow-y: hidden;\n overflow-x: auto;\n align-items: center;\n }\n\n .content-copy-container::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n\n .content-copy-container::-webkit-scrollbar-track {\n background:var(--input-bg);\n }\n \n .content-copy-container::-webkit-scrollbar-thumb {\n border-radius: 2px;\n background-color: var(--border-color);\n }\n `,\n ];\n }\n}\n\nif (!customElements.get('base-url')) customElements.define('base-url', BaseUrl);\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport '../components/base-url';\nimport updateCodeExample from '../utils/update-code-example';\n\nexport function setApiServer(serverUrl) {\n const serverObj = this.resolvedSpec?.servers.find((s) => s.url === serverUrl);\n if (!serverObj) {\n return false;\n }\n this.selectedServer = serverObj;\n this.requestUpdate();\n this.dispatchEvent(new CustomEvent('api-server-change', {\n bubbles: true,\n composed: true,\n detail: {\n selectedServer: serverObj,\n },\n }));\n return true;\n}\n\nfunction onApiServerVarChange(e, serverObj) {\n const inputEls = [...e.currentTarget.closest('.server-vars').querySelectorAll('input, select')];\n let tempUrl = serverObj.url;\n inputEls.forEach((v) => {\n serverObj.variables[v.dataset.var].value = v.value;\n const regex = new RegExp(`{${v.dataset.var}}`, 'g');\n tempUrl = tempUrl.replace(regex, v.value.trim());\n });\n serverObj.computedUrl = tempUrl;\n\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n\n this.requestUpdate();\n}\n\n/* eslint-disable indent */\nfunction serverVarsTemplate() {\n // const selectedServerObj = this.resolvedSpec.servers.find((v) => (v.url === this.selectedServer));\n return this.selectedServer && this.selectedServer.variables\n ? html`\n
\n ${Object.entries(this.selectedServer.variables).map((kv) => html`\n
\n
${kv[0]}
\n
\n ${kv[1].enum\n ? html`\n { onApiServerVarChange.call(this, e, this.selectedServer); }}\n >\n ${Object.entries(kv[1].enum).map((e) => (kv[1].default === e[1]\n ? html`\n `\n : html`\n `\n ))}\n `\n : html`\n { onApiServerVarChange.call(this, e, this.selectedServer); }}\n />`}\n
\n
\n ${kv[1].description\n ? html`
${unsafeHTML(marked(kv[1].description))}
`\n : ''\n }\n `)}\n
\n `\n : '';\n}\n\nexport default function serverTemplate() {\n if (!this.resolvedSpec || this.resolvedSpec.specLoadError) { return ''; }\n return html`\n
\n Base URL\n
\n ${this.selectedServer?.computedUrl\n ? html`\n \n
\n ${serverVarsTemplate.call(this)}\n
\n
\n
`\n : ''\n }\n
\n `;\n}\n/* eslint-enable indent */\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function cIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function clojureIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function csharpIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function goIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function javaIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function javascriptIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function kotlinIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function nodeIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function objcIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function ocamlIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function phpIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function pythonIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function rIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function rubyIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function shellIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n \n \n \n \n \n \n \n \n \n \n `;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function swiftIcon(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","import { html } from 'lit';\nimport HTTPSnippet from 'httpsnippet';\nimport languageIcons from '../components/assets/languages/language-icons';\nimport threeDots from '../components/assets/three-dots';\n\nfunction onClickMoreLanguages() {\n this.showMoreLanguages = !this.showMoreLanguages;\n}\n\nfunction onLeaveMoreLanguages() {\n this.showMoreLanguages = false;\n}\n\nfunction moreLanguagesTemplate(numberOfButtons, languages) {\n if (numberOfButtons >= languages.length) return '';\n\n return html`\n
\n
${threeDots()}
\n
\n ${languages.slice(numberOfButtons).map((language) => html`\n { this.selectedLanguage = language.key; this.requestUpdate(); }}\n >\n ${languageIcons[language.key] ? languageIcons[language.key]({ width: 15, height: 15 }) : ''}\n ${language.title}\n \n `)}\n
\n
\n `;\n}\n\nexport default function languagePickerTemplate() {\n const selectedLanguages = ['node', 'shell', 'python'];\n const languages = HTTPSnippet.availableTargets().filter((language) => selectedLanguages.includes(language.key));\n const numberOfButtons = 3;\n\n return html`\n
\n Language\n
\n
\n ${languages.slice(0, numberOfButtons).map((language) => html`\n { this.selectedLanguage = language.key; this.requestUpdate(); }}\n >\n ${languageIcons[language.key] ? languageIcons[language.key]() : ''}\n ${language.title}\n \n `)}\n
\n ${moreLanguagesTemplate.call(this, numberOfButtons, languages)}\n
\n
`;\n}\n","/* eslint-disable max-len */\nimport { html } from 'lit';\n\nexport default function threeDots(dimensions) {\n const width = dimensions?.width ?? 20;\n const height = dimensions?.height ?? 20;\n return html`\n \n \n \n `;\n}\n","import { LitElement, html, css } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { guard } from 'lit/directives/guard.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport formatXml from 'xml-but-prettier';\nimport Prism from 'prismjs';\nimport TableStyles from '../styles/table-styles';\nimport FlexStyles from '../styles/flex-styles';\nimport InputStyles from '../styles/input-styles';\nimport FontStyles from '../styles/font-styles';\nimport BorderStyles from '../styles/border-styles';\nimport TabStyles from '../styles/tab-styles';\nimport PrismStyles from '../styles/prism-styles';\nimport PrismLanguagesStyles from '../styles/prism-languages-styles';\nimport CustomStyles from '../styles/custom-styles';\nimport { copyToClipboard, downloadResource, viewResource } from '../utils/common-utils';\nimport { schemaInObjectNotation,\n getTypeInfo,\n generateExample,\n normalizeExamples,\n getSchemaFromParam,\n nestExampleIfPresent,\n anyExampleWithSummaryOrDescription } from '../utils/schema-utils';\nimport './json-tree';\nimport './schema-tree';\nimport './tag-input';\nimport './breadcrumbs';\n\nimport serverTemplate from '../templates/server-template';\nimport securitySchemeTemplate from '../templates/security-scheme-template';\nimport languagePickerTemplate from '../templates/language-picker-template';\nimport updateCodeExample from '../utils/update-code-example';\nimport copySymbol from './assets/copy-symbol';\n\nexport default class ApiRequest extends LitElement {\n constructor() {\n super();\n this.resolvedSpec = {};\n this.responseMessage = '';\n this.resultLoad = false;\n this.responseStatus = 'success';\n this.responseHeaders = '';\n this.responseText = '';\n this.responseUrl = '';\n this.codeExample = '';\n this.activeResponseTab = 'response'; // allowed values: response, headers, curl\n this.selectedRequestBodyType = '';\n this.selectedRequestBodyExample = '';\n this.activeParameterSchemaTabs = {};\n this.showCurlBeforeTry = true;\n this.selectedLanguage = 'shell';\n }\n\n static get properties() {\n return {\n schemaShortSummary: { type: String, attribute: 'schema-short-summary' },\n serverUrl: { type: String, attribute: 'server-url' },\n resolvedSpec: { type: Object },\n selectedServer: { type: Object },\n servers: { type: Array },\n method: { type: String },\n path: { type: String },\n security: { type: Array },\n parameters: { type: Array },\n request_body: { type: Object },\n api_keys: { type: Array },\n parser: { type: Object },\n accept: { type: String },\n callback: { type: String },\n webhook: { type: String },\n responseMessage: { type: String, attribute: false },\n responseText: { type: String, attribute: false },\n responseHeaders: { type: String, attribute: false },\n responseStatus: { type: String, attribute: false },\n responseUrl: { type: String, attribute: false },\n codeExample: { type: String, attribute: false },\n fillRequestFieldsWithExample: { type: String, attribute: 'fill-request-fields-with-example' },\n allowTry: { type: String, attribute: 'allow-try' },\n showCurlBeforeTry: { type: String, attribute: 'show-curl-before-try' },\n renderStyle: { type: String, attribute: 'render-style' },\n schemaStyle: { type: String, attribute: 'schema-style' },\n activeSchemaTab: { type: String, attribute: 'active-schema-tab' },\n activeParameterSchemaTabs: {\n type: Object,\n converter: {\n fromAttribute: (attr) => JSON.parse(attr),\n toAttribute: (prop) => JSON.stringify(prop),\n },\n attribute: 'active-parameter-schema-tabs',\n },\n schemaExpandLevel: { type: Number, attribute: 'schema-expand-level' },\n schemaDescriptionExpanded: { type: String, attribute: 'schema-description-expanded' },\n allowSchemaDescriptionExpandToggle: { type: String, attribute: 'allow-schema-description-expand-toggle' },\n schemaHideReadOnly: { type: String, attribute: 'schema-hide-read-only' },\n schemaHideWriteOnly: { type: String, attribute: 'schema-hide-write-only' },\n fetchCredentials: { type: String, attribute: 'fetch-credentials' },\n\n // properties for internal tracking\n activeResponseTab: { type: String }, // internal tracking of response-tab not exposed as a attribute\n selectedRequestBodyType: { type: String, attribute: 'selected-request-body-type' }, // internal tracking of selected request-body type\n selectedRequestBodyExample: { type: String, attribute: 'selected-request-body-example' }, // internal tracking of selected request-body example\n\n selectedLanguage: { type: String },\n\n // open-api file download\n specUrl: { type: String, attribute: 'spec-url' },\n allowSpecFileDownload: { type: String, attribute: 'allow-spec-file-download' },\n };\n }\n\n static get styles() {\n return [\n TableStyles,\n InputStyles,\n FontStyles,\n FlexStyles,\n BorderStyles,\n TabStyles,\n PrismStyles,\n PrismLanguagesStyles,\n css`\n *, *:before, *:after { box-sizing: border-box; }\n :where(button, input[type=\"checkbox\"], [tabindex=\"0\"]):focus-visible { box-shadow: var(--focus-shadow); }\n :where(input[type=\"text\"], input[type=\"password\"], select, textarea):focus-visible { border-color: var(--primary-color); }\n tag-input:focus-within { outline: 1px solid;}\n .read-mode {\n border-top: 1px solid #E7E9EE;\n margin-top: 24px;\n }\n\n .param-name {\n font-size: 14px;\n font-weight: normal;\n line-height: 20px;\n color: #545454; \n margin-block: 24px 4px;\n font-family: var(--font-regular);\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n .param-name.deprecated { \n color: #DC5A41;\n }\n .param-type{\n line-height: 16px;\n color: #4A4A4A; \n font-family: var(--font-mono);\n font-size: var(--font-size-mono);\n }\n\n .param-type > span {\n margin-left: 8px;\n }\n\n .param-constraint{\n min-width:100px;\n }\n .param-constraint:empty{\n display:none;\n }\n\n .param-description {\n font-size: 13px;\n line-height: 18px;\n color: #4A4A4A;\n }\n\n .top-gap{margin-top:24px;}\n\n .textarea {\n min-height:220px; \n padding:5px;\n resize:vertical;\n direction: ltr;\n }\n .example:first-child {\n margin-top: -9px;\n }\n\n .response-message{\n font-weight:bold;\n text-overflow: ellipsis;\n }\n .response-message.error {\n color:var(--red);\n }\n .response-message.success {\n color:var(--blue);\n }\n\n .file-input-container {\n align-items:flex-end;\n }\n .file-input-container .input-set:first-child .file-input-remove-btn{\n visibility:hidden;\n }\n\n .file-input-remove-btn{\n font-size:16px;\n color:var(--red);\n outline: none;\n border: none;\n background:none;\n cursor:pointer;\n }\n\n .v-tab-btn {\n font-size: var(--smal-font-size);\n height:24px; \n border:none; \n background:none; \n opacity: 0.3;\n cursor: pointer;\n padding: 4px 8px;\n }\n .v-tab-btn.active {\n font-weight: bold;\n background: var(--bg);\n opacity: 1;\n }\n\n @media only screen and (min-width: 768px) {\n .textarea {\n padding:8px;\n }\n }\n\n @media only screen and (max-width: 470px) {\n .hide-in-small-screen {\n display:none;\n }\n }\n `,\n CustomStyles,\n ];\n }\n\n render() {\n return html`\n
\n
\n ${guard([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('path'))}\n ${guard([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('query'))}\n ${this.requestBodyTemplate()}\n ${guard([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('header'))}\n ${guard([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('cookie'))}\n ${this.allowTry === 'false' ? '' : html`${this.apiCallTemplate()}`}\n
\n
\n ${languagePickerTemplate.call(this)}\n ${securitySchemeTemplate.call(this)}\n ${serverTemplate.call(this)}\n ${this.apiResponseTabTemplate()}\n
\n
\n `;\n }\n\n async updated() {\n if (this.showCurlBeforeTry === 'true') {\n updateCodeExample.call(this, this.shadowRoot);\n }\n\n // In focused mode after rendering the request component, update the text-areas(which contains examples) using\n // the original values from hidden textareas\n // This is done coz, user may update the dom by editing the textarea's and once the DOM is updated externally change detection wont happen, therefore update the values manually\n\n // if (this.renderStyle === 'focused') {\n // if (changedProperties.size === 1 && changedProperties.has('activeSchemaTab')) {\n // // dont update example as only tabs is switched\n // } else {\n // this.requestUpdate();\n // }\n // }\n\n if (this.webhook === 'true') {\n this.allowTry = 'false';\n }\n }\n\n async saveExampleState() {\n if (this.renderStyle === 'focused') {\n const reqBodyTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea.request-body-param-user-input')];\n reqBodyTextAreaEls.forEach((el) => {\n el.dataset.user_example = el.value;\n });\n const exampleTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea[data-ptype=\"form-data\"]')];\n exampleTextAreaEls.forEach((el) => {\n el.dataset.user_example = el.value;\n });\n this.requestUpdate();\n }\n }\n\n async updateExamplesFromDataAttr() {\n // In focused mode after rendering the request component, update the text-areas(which contains examples) using\n // the original values from hidden textareas\n // This is done coz, user may update the dom by editing the textarea's and once the DOM is updated externally change detection wont happen, therefore update the values manually\n if (this.renderStyle === 'focused') {\n const reqBodyTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea.request-body-param-user-input')];\n reqBodyTextAreaEls.forEach((el) => {\n el.value = el.dataset.user_example || el.dataset.example;\n });\n const exampleTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea[data-ptype=\"form-data\"]')];\n exampleTextAreaEls.forEach((el) => {\n el.value = el.dataset.user_example || el.dataset.example;\n });\n this.requestUpdate();\n }\n }\n\n /* eslint-disable indent */\n renderExample(example, paramType, paramName) {\n return html`\n ${paramType === 'array' ? '[' : ''}\n {\n const inputEl = e.target.closest('.request-card').querySelector(`[data-pname=\"${paramName}\"]`);\n if (inputEl) {\n inputEl.value = e.target.dataset.exampleType === 'array' ? e.target.dataset.example.split('~|~') : e.target.dataset.example;\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n }\n }}\"\n > ${example.printableValue || example.value} \n ${paramType === 'array' ? '] ' : ''}\n `;\n }\n\n renderShortFormatExamples(examples, paramType, paramName) {\n return html`${examples.map((x, i) => html`\n ${i === 0 ? '' : '┃'}\n ${this.renderExample(x, paramType, paramName)}`)}`;\n }\n\n renderLongFormatExamples(exampleList, paramType, paramName) {\n return html`
    \n ${exampleList.map((v) => html`\n
  • \n ${this.renderExample(v, paramType, paramName)}\n ${v.summary?.length > 0 ? html`(${v.summary})` : ''}\n ${v.description?.length > 0 ? html`

    ${unsafeHTML(marked(v.description))}

    ` : ''}\n
  • \n `)}\n
`;\n }\n\n exampleListTemplate(paramName, paramType, exampleList = []) {\n return html` ${\n exampleList.length > 0\n ? html`Example: \n ${anyExampleWithSummaryOrDescription(exampleList)\n ? this.renderLongFormatExamples(exampleList, paramType, paramName)\n : this.renderShortFormatExamples(exampleList, paramType, paramName)}`\n : ''\n }`;\n }\n\n inputParametersTemplate(paramType) {\n const filteredParams = this.parameters ? this.parameters.filter((param) => param.in === paramType) : [];\n if (filteredParams.length === 0) {\n return '';\n }\n let title = '';\n if (paramType === 'path') {\n title = 'Path Params';\n } else if (paramType === 'query') {\n title = 'Query-String Params';\n } else if (paramType === 'header') {\n title = 'Headers';\n } else if (paramType === 'cookie') {\n title = 'Cookies';\n }\n\n const tableRows = [];\n for (const param of filteredParams) {\n const [declaredParamSchema, serializeStyle, mimeTypeElem] = getSchemaFromParam(param);\n if (!declaredParamSchema) {\n continue;\n }\n const paramSchema = getTypeInfo(declaredParamSchema);\n if (!paramSchema) {\n continue; // eslint-disable-line no-continue\n }\n const schemaAsObj = schemaInObjectNotation(declaredParamSchema, {});\n // let exampleVal = '';\n // let exampleList = [];\n let paramStyle = 'form';\n let paramExplode = true;\n let paramAllowReserved = false;\n if (paramType === 'query') {\n if (param.style && 'form spaceDelimited pipeDelimited'.includes(param.style)) {\n paramStyle = param.style;\n } else if (serializeStyle) {\n paramStyle = serializeStyle;\n }\n if (typeof param.explode === 'boolean') {\n paramExplode = param.explode;\n }\n if (typeof param.allowReserved === 'boolean') {\n paramAllowReserved = param.allowReserved;\n }\n }\n // openapi 3.1.0 spec based examples (which must be Object(string : { value:any, summary?: string, description?: string})\n const example = normalizeExamples(\n (param.examples\n || nestExampleIfPresent(param.example)\n || nestExampleIfPresent(mimeTypeElem?.example)\n || mimeTypeElem?.examples\n || nestExampleIfPresent(paramSchema.examples)\n || nestExampleIfPresent(paramSchema.example)\n ),\n paramSchema.type,\n );\n if (!example.exampleVal && paramSchema.type === 'object') {\n example.exampleVal = generateExample(\n declaredParamSchema,\n serializeStyle || 'json',\n '',\n '',\n this.callback === 'true' || this.webhook === 'true' ? true : false, // eslint-disable-line no-unneeded-ternary\n this.callback === 'true' || this.webhook === 'true' ? false : true, // eslint-disable-line no-unneeded-ternary\n true,\n 'text',\n false,\n )[0].exampleValue;\n }\n if (!this.resolvedSpec.securitySchemes.some((e) => e.name === param.name)) {\n tableRows.push(html`\n
\n ${param.name}\n\n
\n ${paramSchema.type === 'array'\n ? `${paramSchema.arrayType}`\n : `${paramSchema.format ? paramSchema.format : paramSchema.type}`\n }\n ${param.deprecated ? html`deprecated` : ''}\n ${param.required ? html`required` : ''}\n
\n
\n\n ${this.allowTry === 'true'\n ? html`\n ${paramSchema.type === 'array'\n ? html`\n \n `\n : paramSchema.type === 'object'\n ? html`\n
\n
{\n if (e.target.tagName.toLowerCase() === 'button') {\n const newState = { ...this.activeParameterSchemaTabs };\n newState[param.name] = e.target.dataset.tab;\n this.activeParameterSchemaTabs = newState;\n }\n }}\">\n \n \n
\n ${this.activeParameterSchemaTabs[param.name] === 'example'\n ? html`
\n \n
`\n : html`\n
\n \n
`\n }\n
`\n : html`\n {\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n }}\n />`\n }`\n : ''\n }\n ${unsafeHTML(marked(param.description || ''))}\n ${this.exampleListTemplate.call(this, param.name, paramSchema.type, example.exampleList)}\n `);\n }\n }\n\n return html`\n
\n
\n
${title}
\n \n \n
\n
\n
\n
\n ${tableRows}\n
\n
\n
`;\n }\n\n // This method is called before navigation change in focused mode\n async beforeNavigationFocusedMode() {\n // this.saveExampleState();\n }\n\n // This method is called after navigation change in focused mode\n async afterNavigationFocusedMode() {\n this.selectedRequestBodyType = '';\n this.selectedRequestBodyExample = '';\n this.updateExamplesFromDataAttr();\n this.clearResponseData();\n }\n\n // Request-Body Event Handlers\n onSelectExample(e) {\n this.selectedRequestBodyExample = e.target.value;\n const exampleDropdownEl = e.target;\n window.setTimeout((selectEl) => {\n const readOnlyExampleEl = selectEl.closest('.example-panel').querySelector('.request-body-param');\n const userInputExampleTextareaEl = selectEl.closest('.example-panel').querySelector('.request-body-param-user-input');\n userInputExampleTextareaEl.value = readOnlyExampleEl.innerText;\n\n const requestPanelEl = this.getRequestPanel({ target: selectEl });\n updateCodeExample.call(this, requestPanelEl);\n }, 0, exampleDropdownEl);\n }\n\n onMimeTypeChange(e) {\n this.selectedRequestBodyType = e.target.value;\n const mimeDropdownEl = e.target;\n this.selectedRequestBodyExample = '';\n window.setTimeout((selectEl) => {\n const readOnlyExampleEl = selectEl.closest('.request-body-container').querySelector('.request-body-param');\n if (readOnlyExampleEl) {\n const userInputExampleTextareaEl = selectEl.closest('.request-body-container').querySelector('.request-body-param-user-input');\n userInputExampleTextareaEl.value = readOnlyExampleEl.innerText;\n }\n }, 0, mimeDropdownEl);\n }\n\n requestBodyTemplate() {\n if (!this.request_body) {\n return '';\n }\n if (Object.keys(this.request_body).length === 0) {\n return '';\n }\n\n // Variable to store partial HTMLs\n let reqBodyTypeSelectorHtml = '';\n let reqBodyFileInputHtml = '';\n let reqBodyFormHtml = '';\n let reqBodySchemaHtml = '';\n let reqBodyExampleHtml = '';\n\n const requestBodyTypes = [];\n const { content } = this.request_body;\n for (const mimeType in content) {\n requestBodyTypes.push({\n mimeType,\n schema: content[mimeType].schema,\n example: content[mimeType].example,\n examples: content[mimeType].examples,\n });\n if (!this.selectedRequestBodyType) {\n this.selectedRequestBodyType = mimeType;\n }\n }\n // MIME Type selector\n reqBodyTypeSelectorHtml = requestBodyTypes.length === 1\n ? ''\n : html`\n \n `;\n\n // For Loop - Main\n requestBodyTypes.forEach((reqBody) => {\n let schemaAsObj;\n let reqBodyExamples = [];\n\n if (this.selectedRequestBodyType.includes('json') || this.selectedRequestBodyType.includes('xml') || this.selectedRequestBodyType.includes('text') || this.selectedRequestBodyType.includes('jose')) {\n // Generate Example\n if (reqBody.mimeType === this.selectedRequestBodyType) {\n reqBodyExamples = generateExample(\n reqBody.schema,\n reqBody.mimeType,\n reqBody.examples,\n reqBody.example,\n this.callback === 'true' || this.webhook === 'true' ? true : false, // eslint-disable-line no-unneeded-ternary\n this.callback === 'true' || this.webhook === 'true' ? false : true, // eslint-disable-line no-unneeded-ternary\n 'text',\n false,\n );\n if (!this.selectedRequestBodyExample) {\n this.selectedRequestBodyExample = (reqBodyExamples.length > 0 ? reqBodyExamples[0].exampleId : '');\n }\n reqBodyExampleHtml = html`\n ${reqBodyExampleHtml}\n
\n ${reqBodyExamples.length === 1\n ? ''\n : html`\n \n `\n }\n ${reqBodyExamples\n .filter((v) => v.exampleId === this.selectedRequestBodyExample)\n .map((v) => html`\n
\n ${v.exampleSummary && v.exampleSummary.length > 80 ? html`
${v.exampleSummary}
` : ''}\n ${v.exampleDescription ? html`
${unsafeHTML(marked(v.exampleDescription || ''))}
` : ''}\n \n
${(v.exampleFormat === 'text' ? v.exampleValue : JSON.stringify(v.exampleValue, null, 2))}
\n\n \n \n
\n `)}\n\n
\n `;\n }\n } else if (this.selectedRequestBodyType.includes('form-urlencoded') || this.selectedRequestBodyType.includes('form-data')) {\n if (reqBody.mimeType === this.selectedRequestBodyType) {\n const ex = generateExample(\n reqBody.schema,\n reqBody.mimeType,\n reqBody.examples,\n reqBody.example,\n this.callback === 'true' || this.webhook === 'true' ? true : false, // eslint-disable-line no-unneeded-ternary\n this.callback === 'true' || this.webhook === 'true' ? false : true, // eslint-disable-line no-unneeded-ternary\n 'text',\n false,\n );\n if (reqBody.schema) {\n reqBodyFormHtml = this.formDataTemplate(reqBody.schema, reqBody.mimeType, (ex[0] ? ex[0].exampleValue : ''));\n }\n }\n } else if ((/^audio\\/|^image\\/|^video\\/|^font\\/|tar$|zip$|7z$|rtf$|msword$|excel$|\\/pdf$|\\/octet-stream$/.test(this.selectedRequestBodyType))) {\n if (reqBody.mimeType === this.selectedRequestBodyType) {\n reqBodyFileInputHtml = html`\n
\n \n
\n `;\n }\n }\n\n // Generate Schema\n if (reqBody.mimeType.includes('json') || reqBody.mimeType.includes('xml') || reqBody.mimeType.includes('text') || this.selectedRequestBodyType.includes('jose')) {\n schemaAsObj = schemaInObjectNotation(reqBody.schema, {});\n if (this.schemaStyle === 'table') {\n reqBodySchemaHtml = html`\n ${reqBodySchemaHtml}\n \n `;\n } else if (this.schemaStyle === 'tree') {\n reqBodySchemaHtml = html`\n ${reqBodySchemaHtml}\n \n `;\n }\n }\n });\n\n return html`\n
\n
\n REQUEST BODY ${this.request_body.required ? html`*` : ''} \n ${this.selectedRequestBodyType}\n \n ${reqBodyTypeSelectorHtml}\n
\n ${this.request_body.description ? html`
${unsafeHTML(marked(this.request_body.description))}
` : ''}\n \n ${(this.selectedRequestBodyType.includes('json') || this.selectedRequestBodyType.includes('xml') || this.selectedRequestBodyType.includes('text') || this.selectedRequestBodyType.includes('jose'))\n ? html`\n
\n
{ if (e.target.tagName.toLowerCase() === 'button') { this.activeSchemaTab = e.target.dataset.tab; } }}\">\n \n \n
\n
${reqBodyExampleHtml}
\n
${reqBodySchemaHtml}
\n
`\n : html` \n ${reqBodyFileInputHtml}\n ${reqBodyFormHtml}`\n }\n
\n `;\n }\n\n formDataParamAsObjectTemplate(fieldName, fieldSchema, mimeType) {\n // This template is used when form-data param should be send as a object (application/json, application/xml)\n const formdataPartSchema = schemaInObjectNotation(fieldSchema, {});\n const formdataPartExample = generateExample(\n fieldSchema,\n 'json',\n fieldSchema.examples,\n fieldSchema.example,\n this.callback === 'true' || this.webhook === 'true' ? true : false, // eslint-disable-line no-unneeded-ternary\n this.callback === 'true' || this.webhook === 'true' ? false : true, // eslint-disable-line no-unneeded-ternary\n 'text',\n false,\n );\n\n return html`\n
\n
\n
{\n if (e.target.classList.contains('v-tab-btn')) {\n const { tab } = e.target.dataset;\n if (tab) {\n const tabPanelEl = e.target.closest('.tab-panel');\n const selectedTabBtnEl = tabPanelEl.querySelector(`.v-tab-btn[data-tab=\"${tab}\"]`);\n const otherTabBtnEl = [...tabPanelEl.querySelectorAll(`.v-tab-btn:not([data-tab=\"${tab}\"])`)];\n const selectedTabContentEl = tabPanelEl.querySelector(`.tab-content[data-tab=\"${tab}\"]`);\n const otherTabContentEl = [...tabPanelEl.querySelectorAll(`.tab-content:not([data-tab=\"${tab}\"])`)];\n selectedTabBtnEl.classList.add('active');\n selectedTabContentEl.style.display = 'block';\n otherTabBtnEl.forEach((el) => { el.classList.remove('active'); });\n otherTabContentEl.forEach((el) => { el.style.display = 'none'; });\n }\n }\n if (e.target.tagName.toLowerCase() === 'button') { this.activeSchemaTab = e.target.dataset.tab; }\n }}\">\n \n \n
\n
\n ${html`\n
\n \n
`\n }\n ${html`\n
\n \n
`\n }\n
\n `;\n }\n\n formDataTemplate(schema, mimeType, exampleValue = '') {\n const formDataTableRows = [];\n if (schema.properties) {\n for (const fieldName in schema.properties) {\n const fieldSchema = schema.properties[fieldName];\n if (fieldSchema.readOnly) {\n continue;\n }\n const fieldExamples = fieldSchema.examples || fieldSchema.example || '';\n const fieldType = fieldSchema.type;\n const paramSchema = getTypeInfo(fieldSchema);\n const labelColWidth = 'read focused'.includes(this.renderStyle) ? '200px' : '160px';\n const example = normalizeExamples((paramSchema.examples || paramSchema.example), paramSchema.type);\n formDataTableRows.push(html`\n \n \n
\n ${fieldName}${(schema.required?.includes(fieldName) || fieldSchema.required) ? html`*` : ''}\n
\n
${paramSchema.type}
\n \n \n ${fieldType === 'array'\n ? fieldSchema.items?.format === 'binary'\n ? html`\n
this.onAddRemoveFileInput(e, fieldName, mimeType)}\">\n
\n \n \n
\n \n
\n `\n : html`\n \n \n `\n : html`\n ${fieldType === 'object'\n ? this.formDataParamAsObjectTemplate.call(this, fieldName, fieldSchema, mimeType)\n : html`\n ${this.allowTry === 'true'\n ? html` {\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n }}\n />`\n : ''\n }\n `\n }`\n }\n \n ${fieldType === 'object'\n ? ''\n : html`\n \n ${paramSchema.default || paramSchema.constrain || paramSchema.allowedValues || paramSchema.pattern\n ? html`\n
\n ${paramSchema.default ? html`Default: ${paramSchema.default}
` : ''}\n ${paramSchema.pattern ? html`Pattern: ${paramSchema.pattern}
` : ''}\n ${paramSchema.constrain ? html`${paramSchema.constrain}
` : ''}\n ${paramSchema.allowedValues && paramSchema.allowedValues.split('┃').map((v, i) => html`\n ${i > 0 ? '┃' : html`Allowed: `}\n ${html`\n {\n const inputEl = e.target.closest('div').querySelector(`[data-pname=\"${fieldName}\"]`);\n if (inputEl) {\n if (e.target.dataset.type === 'array') {\n inputEl.value = [e.target.dataset.enum];\n } else {\n inputEl.value = e.target.dataset.enum;\n }\n\n const requestPanelEl = this.getRequestPanel(e);\n updateCodeExample.call(this, requestPanelEl);\n }\n }}\"\n > \n ${v} \n `\n }`)\n }\n
`\n : ''\n }\n `\n }\n \n ${fieldType === 'object'\n ? ''\n : html`\n \n \n \n ${unsafeHTML(marked(fieldSchema.description || ''))}\n ${this.exampleListTemplate.call(this, fieldName, paramSchema.type, example.exampleList)}\n \n \n `\n }`);\n }\n return html`\n \n ${formDataTableRows}\n
\n `;\n }\n\n return html`\n \n ${schema.description ? html`${unsafeHTML(marked(schema.description))}` : ''}\n `;\n }\n\n codeExampleTemplate(display = 'flex') {\n return html`\n
\n \n
${unsafeHTML(Prism.highlight(this.codeExample.trim().replace(/\\\\$/, ''), Prism.languages[this.selectedLanguage], this.selectedLanguage))}
\n
\n `;\n }\n\n apiResponseTabTemplate() {\n let responseFormat = '';\n let responseContent = '';\n if (!this.responseIsBlob) {\n if (this.responseHeaders.includes('application/x-ndjson')) {\n responseFormat = 'json';\n const prismLines = this.responseText.split('\\n').map((q) => Prism.highlight(q, Prism.languages[responseFormat], responseFormat)).join('\\n');\n responseContent = html`${unsafeHTML(prismLines)}`;\n } else if (this.responseHeaders.includes('json')) {\n responseFormat = 'json';\n responseContent = html`${unsafeHTML(Prism.highlight(this.responseText, Prism.languages[responseFormat], responseFormat))}`;\n } else if (this.responseHeaders.includes('html') || this.responseHeaders.includes('xml')) {\n responseFormat = 'html';\n responseContent = html`${unsafeHTML(Prism.highlight(this.responseText, Prism.languages[responseFormat], responseFormat))}`;\n } else {\n responseFormat = 'text';\n responseContent = html`${this.responseText}`;\n }\n }\n return html`\n \n
\n ${this.codeExampleTemplate('flex')}\n
\n ${this.responseMessage\n ? html`\n
\n
\n
${this.responseMessage}
\n
`\n : ''\n }\n ${this.responseIsBlob\n ? html`\n
\n \n ${this.responseBlobType === 'view'\n ? html``\n : ''\n }\n
`\n : html`\n ${this.responseText ? html`\n
\n \n
${responseContent}
\n
`\n : ''\n }`\n }\n
\n
`;\n }\n\n apiCallTemplate() {\n let selectServerDropdownHtml = '';\n if (this.servers && this.servers.length > 0) {\n selectServerDropdownHtml = html`\n \n `;\n }\n const selectedServerHtml = html`\n
\n ${selectServerDropdownHtml}\n ${this.serverUrl\n ? html`\n
\n
API Server
\n ${this.serverUrl} \n
\n `\n : ''\n }\n
\n `;\n\n if (!this.resultLoad) {\n this.updateComplete.then(() => {\n const el = this.renderRoot.host.shadowRoot.children[0];\n updateCodeExample.call(this, el.target ? el.target : el);\n });\n this.resultLoad = true;\n } else {\n const el = this.renderRoot.host.shadowRoot.children[0];\n updateCodeExample.call(this, el.target ? el.target : el);\n }\n\n return html`\n
\n
\n
\n ${selectedServerHtml}\n
\n
\n
Authentication
\n ${this.security?.length > 0\n ? html`\n ${this.api_keys.length > 0\n ? html`
\n ${this.api_keys.length === 1\n ? `${this.api_keys[0]?.typeDisplay} in ${this.api_keys[0].in}`\n : `${this.api_keys.length} API keys applied`\n } \n
`\n : html`
Required (None Applied)`\n }`\n : html` Not Required `\n }\n
\n
\n \n
\n `;\n }\n /* eslint-enable indent */\n\n async onFillRequestData(e) {\n const requestPanelEl = e.target.closest('.request-panel');\n const requestPanelInputEls = [...requestPanelEl.querySelectorAll('input, tag-input, textarea:not(.is-hidden)')];\n requestPanelInputEls.forEach((el) => {\n if (el.dataset.example) {\n if (el.tagName.toUpperCase() === 'TAG-INPUT') {\n el.value = el.dataset.example.split('~|~');\n } else {\n el.value = el.dataset.example;\n }\n }\n });\n }\n\n async onClearRequestData(e) {\n const requestPanelEl = e.target.closest('.request-panel');\n const requestPanelInputEls = [...requestPanelEl.querySelectorAll('input, tag-input, textarea:not(.is-hidden)')];\n requestPanelInputEls.forEach((el) => { el.value = ''; });\n }\n\n async onTryClick(e) {\n const tryBtnEl = e.target ? e.target : e;\n\n const { fetchUrl, fetchOptions, reqHeaders } = updateCodeExample.call(this, tryBtnEl);\n const encodedUrl = `/api/proxy/${encodeURIComponent(fetchUrl)}`;\n\n this.responseUrl = '';\n this.responseHeaders = [];\n this.responseStatus = 'success';\n this.responseIsBlob = false;\n\n this.respContentDisposition = '';\n if (this.responseBlobUrl) {\n URL.revokeObjectURL(this.responseBlobUrl);\n this.responseBlobUrl = '';\n }\n if (this.fetchCredentials) {\n fetchOptions.credentials = this.fetchCredentials;\n }\n const controller = new AbortController();\n const { signal } = controller;\n fetchOptions.headers = reqHeaders;\n const tempRequest = { url: encodedUrl, ...fetchOptions };\n this.dispatchEvent(new CustomEvent('before-try', {\n bubbles: true,\n composed: true,\n detail: {\n request: tempRequest,\n controller,\n },\n }));\n const updatedFetchOptions = {\n method: tempRequest.method,\n headers: tempRequest.headers,\n credentials: tempRequest.credentials,\n body: tempRequest.body,\n };\n const fetchRequest = new Request(tempRequest.url, updatedFetchOptions);\n let fetchResponse;\n let responseClone;\n try {\n let respBlob;\n let respJson;\n let respText;\n tryBtnEl.disabled = true;\n this.responseText = '';\n this.responseMessage = '';\n this.requestUpdate();\n const startTime = performance.now();\n fetchResponse = await fetch(fetchRequest, { signal });\n const endTime = performance.now();\n responseClone = fetchResponse.clone(); // create a response clone to allow reading response body again (response.json, response.text etc)\n tryBtnEl.disabled = false;\n this.responseMessage = html`${fetchResponse.statusText ? `${fetchResponse.statusText}:${fetchResponse.status}` : fetchResponse.status}
Took ${Math.round(endTime - startTime)} milliseconds
`;\n this.responseUrl = fetchResponse.url;\n const respHeadersObj = {};\n fetchResponse.headers.forEach((hdrVal, hdr) => {\n respHeadersObj[hdr] = hdrVal;\n this.responseHeaders = `${this.responseHeaders}${hdr}: ${hdrVal}\\n`;\n });\n const contentType = fetchResponse.headers.get('content-type');\n const respEmpty = (await fetchResponse.clone().text()).length === 0;\n if (respEmpty) {\n this.responseText = '';\n } else if (contentType) {\n if (contentType === 'application/x-ndjson') {\n this.responseText = await fetchResponse.text();\n } else if (contentType.includes('json')) {\n if ((/charset=[^\"']+/).test(contentType)) {\n const encoding = contentType.split('charset=')[1];\n const buffer = await fetchResponse.arrayBuffer();\n try {\n respText = new TextDecoder(encoding).decode(buffer);\n } catch {\n respText = new TextDecoder('utf-8').decode(buffer);\n }\n try {\n respJson = JSON.parse(respText);\n this.responseText = JSON.stringify(respJson, null, 2);\n } catch {\n this.responseText = respText;\n }\n } else {\n respJson = await fetchResponse.json();\n this.responseText = JSON.stringify(respJson, null, 2);\n }\n // eslint-disable-next-line no-useless-escape\n } else if (/^font\\/|tar$|zip$|7z$|rtf$|msword$|excel$|\\/pdf$|\\/octet-stream$|^application\\/vnd\\./.test(contentType)) {\n this.responseIsBlob = true;\n this.responseBlobType = 'download';\n } else if (/^audio|^image|^video/.test(contentType)) {\n this.responseIsBlob = true;\n this.responseBlobType = 'view';\n } else {\n respText = await fetchResponse.text();\n if (contentType.includes('xml')) {\n this.responseText = formatXml(respText, { textNodesOnSameLine: true, indentor: ' ' });\n } else {\n this.responseText = respText;\n }\n }\n if (this.responseIsBlob) {\n const contentDisposition = fetchResponse.headers.get('content-disposition');\n this.respContentDisposition = contentDisposition ? contentDisposition.split('filename=')[1].replace(/\"|'/g, '') : 'filename';\n respBlob = await fetchResponse.blob();\n this.responseBlobUrl = URL.createObjectURL(respBlob);\n }\n } else {\n respText = await fetchResponse.text();\n this.responseText = respText;\n }\n this.dispatchEvent(new CustomEvent('after-try', {\n bubbles: true,\n composed: true,\n detail: {\n request: fetchRequest,\n response: responseClone,\n responseHeaders: respHeadersObj,\n responseBody: respJson || respText || respBlob,\n responseStatus: responseClone.ok,\n },\n }));\n } catch (err) {\n tryBtnEl.disabled = false;\n if (err.name === 'AbortError') {\n this.dispatchEvent(new CustomEvent('request-aborted', {\n bubbles: true,\n composed: true,\n detail: {\n err,\n request: fetchRequest,\n },\n }));\n this.responseMessage = 'Request Aborted';\n this.responseText = 'Request Aborted';\n } else {\n this.dispatchEvent(new CustomEvent('after-try', {\n bubbles: true,\n composed: true,\n detail: {\n err,\n request: fetchRequest,\n },\n }));\n this.responseMessage = `${err.message} (CORS or Network Issue)`;\n }\n }\n this.requestUpdate();\n }\n\n getRequestPanel(e) {\n return e.target.closest('.request-panel');\n }\n\n onAddRemoveFileInput(e, pname, ptype) {\n if (e.target.tagName.toLowerCase() !== 'button') {\n return;\n }\n\n if (e.target.classList.contains('file-input-remove-btn')) {\n // Remove File Input Set\n const el = e.target.closest('.input-set');\n el.remove();\n return;\n }\n const el = e.target.closest('.file-input-container');\n\n // Add File Input Set\n\n // Container\n const newInputContainerEl = document.createElement('div');\n newInputContainerEl.setAttribute('class', 'input-set row');\n\n // File Input\n const newInputEl = document.createElement('input');\n newInputEl.type = 'file';\n newInputEl.style = 'width:200px; margin-top:2px;';\n newInputEl.setAttribute('data-pname', pname);\n newInputEl.setAttribute('data-ptype', ptype.includes('form-urlencode') ? 'form-urlencode' : 'form-data');\n newInputEl.setAttribute('data-array', 'false');\n newInputEl.setAttribute('data-file-array', 'true');\n\n // Remover Button\n const newRemoveBtnEl = document.createElement('button');\n newRemoveBtnEl.setAttribute('class', 'file-input-remove-btn');\n newRemoveBtnEl.innerHTML = '✕';\n\n newInputContainerEl.appendChild(newInputEl);\n newInputContainerEl.appendChild(newRemoveBtnEl);\n el.insertBefore(newInputContainerEl, e.target);\n // el.appendChild(newInputContainerEl);\n }\n\n clearResponseData() {\n this.responseUrl = '';\n this.responseHeaders = '';\n this.responseText = '';\n this.responseStatus = 'success';\n this.responseMessage = '';\n this.responseIsBlob = false;\n this.responseBlobType = '';\n this.respContentDisposition = '';\n if (this.responseBlobUrl) {\n URL.revokeObjectURL(this.responseBlobUrl);\n this.responseBlobUrl = '';\n }\n }\n\n disconnectedCallback() {\n this.codeExample = '';\n // Cleanup ObjectURL for the blob data if this component created one\n if (this.responseBlobUrl) {\n URL.revokeObjectURL(this.responseBlobUrl);\n this.responseBlobUrl = '';\n }\n super.disconnectedCallback();\n }\n}\n\n// Register the element with the browser\nif (!customElements.get('api-request')) customElements.define('api-request', ApiRequest);\n","// Takes a value as input and provides a printable string to replresent null values, spaces, blankstring etc\nexport function getPrintableVal(val) {\n if (val === undefined) {\n return '';\n }\n if (val === null) {\n return 'null';\n }\n if (val === '') {\n return '∅';\n }\n if (typeof val === 'boolean' || typeof val === 'number') {\n return `${val}`;\n }\n if (Array.isArray(val)) {\n return val.map((v) => (v === null ? 'null' : v === '' ? '∅' : v.toString().replace(/^ +| +$/g, (m) => '●'.repeat(m.length)) || '')).join(', ');\n }\n if (typeof val === 'object') {\n const keys = Object.keys(val);\n return `{ ${keys[0]}:${val[keys[0]]}${keys.length > 1 ? ',' : ''} ... }`;\n }\n return val.toString().replace(/^ +| +$/g, (m) => '●'.repeat(m.length)) || '';\n}\n\n/* Generates an schema object containing type and constraint info */\nexport function getTypeInfo(schema) {\n if (!schema) {\n return;\n }\n let dataType = '';\n let constrain = '';\n // let examples;\n\n if (schema.$ref) {\n const n = schema.$ref.lastIndexOf('/');\n const schemaNode = schema.$ref.substring(n + 1);\n dataType = `{recursive: ${schemaNode}} `;\n } else if (schema.type) {\n dataType = Array.isArray(schema.type) ? schema.type.join(schema.length === 2 ? ' or ' : '┃') : schema.type;\n if (schema.format || schema.enum || schema.const) {\n dataType = dataType.replace('string', schema.enum ? 'enum' : schema.const ? 'const' : schema.format);\n }\n if (schema.nullable) {\n dataType += '┃null';\n }\n } else if (schema.const) {\n dataType = 'const';\n } else if (Object.keys(schema).length === 0) {\n dataType = 'any';\n } else {\n dataType = '{missing-type-info}';\n }\n\n const info = {\n type: dataType,\n format: schema.format || '',\n pattern: (schema.pattern && !schema.enum) ? schema.pattern : '',\n readOrWriteOnly: (schema.readOnly ? '🆁' : schema.writeOnly ? '🆆' : ''),\n deprecated: schema.deprecated ? '❌' : '',\n examples: schema.examples || schema.example,\n default: getPrintableVal(schema.default),\n description: schema.description || '',\n constrain: '',\n allowedValues: '',\n arrayType: '',\n html: '',\n };\n\n if (info.type === '{recursive}') {\n info.description = schema.$ref.substring(schema.$ref.lastIndexOf('/') + 1);\n } else if (info.type === '{missing-type-info}' || info.type === 'any') {\n info.description = info.description || '';\n }\n // Set Allowed Values\n info.allowedValues = schema.const\n ? schema.const\n : Array.isArray(schema.enum)\n ? schema.enum.map((v) => (getPrintableVal(v))).join('┃')\n : '';\n\n if (dataType === 'array' && schema.items) {\n const arrayItemType = schema.items?.type;\n const arrayItemDefault = getPrintableVal(schema.items.default);\n\n info.arrayType = `${schema.type} of ${Array.isArray(arrayItemType) ? arrayItemType.join('') : arrayItemType}`;\n info.default = arrayItemDefault;\n info.allowedValues = schema.items.const\n ? schema.const\n : Array.isArray(schema.items?.enum)\n ? schema.items.enum.map((v) => (getPrintableVal(v))).join('┃')\n : '';\n }\n if (dataType.match(/integer|number/g)) {\n if (schema.minimum !== undefined || schema.exclusiveMinimum !== undefined) {\n constrain += schema.minimum !== undefined ? `Min ${schema.minimum}` : `More than ${schema.exclusiveMinimum}`;\n }\n if (schema.maximum !== undefined || schema.exclusiveMaximum !== undefined) {\n constrain += schema.maximum !== undefined ? `${constrain ? '┃' : ''}Max ${schema.maximum}` : `${constrain ? '┃' : ''}Less than ${schema.exclusiveMaximum}`;\n }\n if (schema.multipleOf !== undefined) {\n constrain += `${constrain ? '┃' : ''} multiple of ${schema.multipleOf}`;\n }\n }\n if (dataType.match(/string/g)) {\n if (schema.minLength !== undefined && schema.maxLength !== undefined) {\n constrain += `${constrain ? '┃' : ''}${schema.minLength} to ${schema.maxLength} chars`;\n } else if (schema.minLength !== undefined) {\n constrain += `${constrain ? '┃' : ''}Min ${schema.minLength} chars`;\n } else if (schema.maxLength !== undefined) {\n constrain += `Max ${constrain ? '┃' : ''}${schema.maxLength} chars`;\n }\n }\n info.constrain = constrain;\n info.html = `${info.type}~|~${info.readOrWriteOnly}~|~${info.constrain}~|~${info.default}~|~${info.allowedValues}~|~${info.pattern}~|~${info.description}~|~${schema.title || ''}~|~${info.deprecated ? 'deprecated' : ''}`;\n return info;\n}\n\nexport function nestExampleIfPresent(example) {\n if (typeof example === 'boolean' || typeof example === 'number') {\n return {\n Example: { value: `${example}` },\n };\n }\n if (example === '') {\n return {\n Example: { value: '' },\n };\n }\n return example ? { Example: { value: example } } : example;\n}\n\n/**\n * Normalize example object in the following format (List of object which is used to render example links and fill the input boxes)\n * [{\n * exampleVal : 'value to be rendered on the input control (text-box)',\n * exampleList : [\n * value : '',\n * printableValue: '',\n * summary : '',\n * description : ''\n * ]\n * }]\n * */\nexport function normalizeExamples(examples, dataType = 'string') {\n if (!examples) {\n return {\n exampleVal: '',\n exampleList: [],\n };\n }\n if (examples.constructor === Object) {\n const exampleList = Object.values(examples)\n .filter((v) => (v['x-example-show-value'] !== false))\n .map((v) => ({\n value: (typeof v.value === 'boolean' || typeof v.value === 'number' ? `${v.value}` : (v.value || '')),\n printableValue: getPrintableVal(v.value),\n summary: v.summary || '',\n description: v.description || '',\n }));\n const exampleVal = exampleList.length > 0\n ? exampleList[0].value\n : '';\n return { exampleVal, exampleList };\n }\n\n // This is non-standard way to provide example but will support for now\n if (!Array.isArray(examples)) {\n examples = examples ? [examples] : [];\n }\n\n if (examples.length === 0) {\n return {\n exampleVal: '',\n exampleList: [],\n };\n }\n\n if (dataType === 'array') {\n const [exampleVal] = examples;\n const exampleList = examples.map((v) => ({\n value: v,\n printableValue: getPrintableVal(v),\n }));\n return { exampleVal, exampleList };\n }\n\n const exampleVal = examples[0].toString();\n const exampleList = examples.map((v) => ({\n value: v.toString(),\n printableValue: getPrintableVal(v),\n }));\n return { exampleVal, exampleList };\n}\n\nexport function anyExampleWithSummaryOrDescription(examples) {\n return examples.some((x) => x.summary?.length > 0 || x.description?.length > 0);\n}\n\nexport function getSampleValueByType(schemaObj) {\n const example = schemaObj.examples\n ? schemaObj.examples[0]\n : schemaObj.example === null\n ? null\n : schemaObj.example || undefined;\n if (example === '') { return ''; }\n if (example === null) { return null; }\n if (example === 0) { return 0; }\n if (example === false) { return false; }\n if (example instanceof Date) {\n switch (schemaObj.format.toLowerCase()) {\n case 'date':\n return example.toISOString().split('T')[0];\n case 'time':\n return example.toISOString().split('T')[1];\n default:\n return example.toISOString();\n }\n }\n if (example) { return example; }\n\n if (Object.keys(schemaObj).length === 0) {\n return null;\n }\n if (schemaObj.$ref) {\n // Indicates a Circular ref\n return schemaObj.$ref;\n }\n if (schemaObj.const === false || schemaObj.const === 0 || schemaObj.const === null || schemaObj.const === '') {\n return schemaObj.const;\n }\n if (schemaObj.const) {\n return schemaObj.const;\n }\n const typeValue = Array.isArray(schemaObj.type) ? schemaObj.type[0] : schemaObj.type;\n if (!typeValue) {\n return '?';\n }\n if (typeValue.match(/^integer|^number/g)) {\n const multipleOf = Number.isNaN(Number(schemaObj.multipleOf)) ? undefined : Number(schemaObj.multipleOf);\n const maximum = Number.isNaN(Number(schemaObj.maximum)) ? undefined : Number(schemaObj.maximum);\n const minimumPossibleVal = Number.isNaN(Number(schemaObj.minimum))\n ? Number.isNaN(Number(schemaObj.exclusiveMinimum))\n ? maximum || 0\n : Number(schemaObj.exclusiveMinimum) + (typeValue.startsWith('integer') ? 1 : 0.001)\n : Number(schemaObj.minimum);\n const finalVal = multipleOf\n ? multipleOf >= minimumPossibleVal\n ? multipleOf\n : minimumPossibleVal % multipleOf === 0\n ? minimumPossibleVal\n : Math.ceil(minimumPossibleVal / multipleOf) * multipleOf\n : minimumPossibleVal;\n return finalVal;\n }\n if (typeValue.match(/^boolean/g)) { return false; }\n if (typeValue.match(/^null/g)) { return null; }\n if (typeValue.match(/^string/g)) {\n if (schemaObj.enum) { return schemaObj.enum[0]; }\n if (schemaObj.const) { return schemaObj.const; }\n if (schemaObj.pattern) { return schemaObj.pattern; }\n if (schemaObj.format) {\n const u = `${Date.now().toString(16)}${Math.random().toString(16)}0`.repeat(16);\n switch (schemaObj.format.toLowerCase()) {\n case 'url':\n case 'uri':\n return 'http://example.com';\n case 'date':\n return (new Date(0)).toISOString().split('T')[0];\n case 'time':\n return (new Date(0)).toISOString().split('T')[1];\n case 'date-time':\n return (new Date(0)).toISOString();\n case 'duration':\n return 'P3Y6M4DT12H30M5S'; // P=Period 3-Years 6-Months 4-Days 12-Hours 30-Minutes 5-Seconds\n case 'email':\n case 'idn-email':\n return 'user@example.com';\n case 'hostname':\n case 'idn-hostname':\n return 'www.example.com';\n case 'ipv4':\n return '198.51.100.42';\n case 'ipv6':\n return '2001:0db8:5b96:0000:0000:426f:8e17:642a';\n case 'uuid':\n return [u.substr(0, 8), u.substr(8, 4), `4000-8${u.substr(13, 3)}`, u.substr(16, 12)].join('-');\n default:\n return '';\n }\n } else {\n const minLength = Number.isNaN(schemaObj.minLength) ? undefined : Number(schemaObj.minLength);\n const maxLength = Number.isNaN(schemaObj.maxLength) ? undefined : Number(schemaObj.maxLength);\n const finalLength = minLength || (maxLength > 6 ? 6 : maxLength || undefined);\n return finalLength ? 'A'.repeat(finalLength) : 'string';\n }\n }\n // If type cannot be determined\n return '?';\n}\n\n/*\njson2xml- TestCase\n {\n 'prop1' : 'one',\n 'prop2' : 'two',\n 'prop3' : [ 'a', 'b', 'c' ],\n 'prop4' : {\n 'ob1' : 'val-1',\n 'ob2' : 'val-2'\n }\n }\n \n simple\n \n <0>a\n <1>b\n <2>c\n \n \n val-1\n val-2\n \n \n*/\nexport function json2xml(obj, level = 1) {\n const indent = ' '.repeat(level);\n let xmlText = '';\n if (level === 1 && typeof obj !== 'object') {\n return `\\n${indent}${obj.toString()}`;\n }\n for (const prop in obj) {\n const tagNameOrProp = (obj[prop]['::XML_TAG'] || prop);\n let tagName = '';\n if (Array.isArray(obj[prop])) {\n tagName = tagNameOrProp[0]['::XML_TAG'] || `${prop}`;\n } else {\n tagName = tagNameOrProp;\n }\n if (prop.startsWith('::')) {\n continue;\n }\n if (Array.isArray(obj[prop])) {\n xmlText = `${xmlText}\\n${indent}<${tagName}>${json2xml(obj[prop], level + 1)}\\n${indent}`;\n } else if (typeof obj[prop] === 'object') {\n xmlText = `${xmlText}\\n${indent}<${tagName}>${json2xml(obj[prop], level + 1)}\\n${indent}`;\n } else {\n xmlText = `${xmlText}\\n${indent}<${tagName}>${obj[prop].toString()}`;\n }\n }\n return xmlText;\n}\n\nfunction addSchemaInfoToExample(schema, obj) {\n if (typeof obj !== 'object' || obj === null) {\n return;\n }\n if (schema.title) {\n obj['::TITLE'] = schema.title;\n }\n if (schema.description) {\n obj['::DESCRIPTION'] = schema.description;\n }\n if (schema.xml?.name) {\n obj['::XML_TAG'] = schema.xml?.name;\n }\n if (schema.xml?.wrapped) {\n obj['::XML_WRAP'] = schema.xml?.wrapped.toString();\n }\n}\n\nfunction removeTitlesAndDescriptions(obj) {\n if (typeof obj !== 'object' || obj === null) {\n return;\n }\n delete obj['::TITLE'];\n delete obj['::DESCRIPTION'];\n delete obj['::XML_TAG'];\n delete obj['::XML_WRAP'];\n for (const k in obj) {\n removeTitlesAndDescriptions(obj[k]);\n }\n}\n\nfunction addPropertyExampleToObjectExamples(example, obj, propertyKey) {\n for (const key in obj) {\n obj[key][propertyKey] = example;\n }\n}\n\nfunction mergePropertyExamples(obj, propertyName, propExamples) {\n // Create an example for each variant of the propertyExample, merging them with the current (parent) example\n let i = 0;\n const maxCombinations = 10;\n const mergedObj = {};\n for (const exampleKey in obj) {\n for (const propExampleKey in propExamples) {\n mergedObj[`example-${i}`] = { ...obj[exampleKey] };\n mergedObj[`example-${i}`][propertyName] = propExamples[propExampleKey];\n i++;\n if (i >= maxCombinations) {\n break;\n }\n }\n if (i >= maxCombinations) {\n break;\n }\n }\n return mergedObj;\n}\n\n/* For changing JSON-Schema to a Sample Object, as per the schema (to generate examples based on schema) */\nexport function schemaToSampleObj(schema, config = { }) {\n let obj = {};\n if (!schema) {\n return;\n }\n if (schema.allOf) {\n const objWithAllProps = {};\n\n if (schema.allOf.length === 1 && !schema.allOf[0]?.properties && !schema.allOf[0]?.items) {\n // If allOf has single item and the type is not an object or array, then its a primitive\n if (schema.allOf[0].$ref) {\n return '{ }';\n }\n if (schema.allOf[0].readOnly && config.includeReadOnly) {\n const tempSchema = schema.allOf[0];\n return getSampleValueByType(tempSchema);\n }\n return;\n }\n\n schema.allOf.forEach((v) => {\n if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf) {\n const partialObj = schemaToSampleObj(v, config);\n Object.assign(objWithAllProps, partialObj);\n } else if (v.type === 'array' || v.items) {\n const partialObj = [schemaToSampleObj(v, config)];\n Object.assign(objWithAllProps, partialObj);\n } else if (v.type) {\n const prop = `prop${Object.keys(objWithAllProps).length}`;\n objWithAllProps[prop] = getSampleValueByType(v);\n } else {\n return '';\n }\n });\n\n obj = objWithAllProps;\n } else if (schema.oneOf) {\n // 1. First create example with scheme.properties\n const objWithSchemaProps = {};\n if (schema.properties) {\n for (const propertyName in schema.properties) {\n if (schema.properties[propertyName].properties || schema.properties[propertyName].properties?.items) {\n objWithSchemaProps[propertyName] = schemaToSampleObj(schema.properties[propertyName], config);\n } else {\n objWithSchemaProps[propertyName] = getSampleValueByType(schema.properties[propertyName]);\n }\n }\n }\n\n if (schema.oneOf.length > 0) {\n /*\n oneOf:\n - type: object\n properties:\n option1_PropA:\n type: string\n option1_PropB:\n type: string\n - type: object\n properties:\n option2_PropX:\n type: string\n properties:\n prop1:\n type: string\n prop2:\n type: string\n minLength: 10\n\n The aboove Schem should generate the following 2 examples\n\n Example-1\n {\n prop1: 'string',\n prop2: 'AAAAAAAAAA', <-- min-length 10\n option1_PropA: 'string',\n option1_PropB: 'string'\n }\n\n Example-2\n {\n prop1: 'string',\n prop2: 'AAAAAAAAAA', <-- min-length 10\n option2_PropX: 'string'\n }\n */\n let i = 0;\n // Merge all examples of each oneOf-schema\n for (const key in schema.oneOf) {\n const oneOfSamples = schemaToSampleObj(schema.oneOf[key], config);\n for (const sampleKey in oneOfSamples) {\n // 2. In the final example include a one-of item along with properties\n let finalExample;\n if (Object.keys(objWithSchemaProps).length > 0) {\n if (oneOfSamples[sampleKey] === null || typeof oneOfSamples[sampleKey] !== 'object') {\n // This doesn't really make sense since every oneOf schema _should_ be an object if there are common properties, so we'll skip this\n continue;\n } else {\n finalExample = Object.assign(oneOfSamples[sampleKey], objWithSchemaProps);\n }\n } else {\n finalExample = oneOfSamples[sampleKey];\n }\n obj[`example-${i}`] = finalExample;\n addSchemaInfoToExample(schema.oneOf[key], obj[`example-${i}`]);\n i++;\n }\n }\n }\n } else if (schema.anyOf) {\n // First generate values for regular properties\n let commonObj;\n if (schema.type === 'object' || schema.properties) {\n commonObj = { 'example-0': {} };\n for (const propertyName in schema.properties) {\n if (schema.example) {\n commonObj = schema;\n break;\n }\n if (schema.properties[propertyName].deprecated && !config.includeDeprecated) { continue; }\n if (schema.properties[propertyName].readOnly && !config.includeReadOnly) { continue; }\n if (schema.properties[propertyName].writeOnly && !config.includeWriteOnly) { continue; }\n commonObj = mergePropertyExamples(commonObj, propertyName, schemaToSampleObj(schema.properties[propertyName], config));\n }\n }\n\n // Combine every variant of the regular properties with every variant of the anyOf samples\n let i = 0;\n for (const key in schema.anyOf) {\n const anyOfSamples = schemaToSampleObj(schema.anyOf[key], config);\n for (const sampleKey in anyOfSamples) {\n if (typeof commonObj !== 'undefined') {\n for (const commonKey in commonObj) {\n obj[`example-${i}`] = { ...commonObj[commonKey], ...anyOfSamples[sampleKey] };\n }\n } else {\n obj[`example-${i}`] = anyOfSamples[sampleKey];\n }\n addSchemaInfoToExample(schema.anyOf[key], obj[`example-${i}`]);\n i++;\n }\n }\n } else if (schema.type === 'object' || schema.properties) {\n obj['example-0'] = {};\n addSchemaInfoToExample(schema, obj['example-0']);\n if (schema.example) {\n obj['example-0'] = schema.example;\n } else {\n for (const propertyName in schema.properties) {\n if (schema.properties[propertyName]?.deprecated && !config.includeDeprecated) { continue; }\n if (schema.properties[propertyName]?.readOnly && !config.includeReadOnly) { continue; }\n if (schema.properties[propertyName]?.writeOnly && !config.includeWriteOnly) { continue; }\n if (schema.properties[propertyName]?.type === 'array' || schema.properties[propertyName]?.items) {\n if (schema.properties[propertyName].example) {\n addPropertyExampleToObjectExamples(schema.properties[propertyName].example, obj, propertyName);\n } else if (schema.properties[propertyName]?.items?.example) { // schemas and properties support single example but not multiple examples.\n addPropertyExampleToObjectExamples([schema.properties[propertyName].items.example], obj, propertyName);\n } else {\n const itemSamples = schemaToSampleObj(schema.properties[propertyName].items, config);\n if (config.useXmlTagForProp) {\n const xmlTagName = schema.properties[propertyName].xml?.name || propertyName;\n if (schema.properties[propertyName].xml?.wrapped) {\n const wrappedItemSample = JSON.parse(`{ \"${xmlTagName}\" : { \"${xmlTagName}\" : ${JSON.stringify(itemSamples['example-0'])} } }`);\n obj = mergePropertyExamples(obj, xmlTagName, wrappedItemSample);\n } else {\n obj = mergePropertyExamples(obj, xmlTagName, itemSamples);\n }\n } else {\n const arraySamples = [];\n for (const key in itemSamples) {\n arraySamples[key] = [itemSamples[key]];\n }\n obj = mergePropertyExamples(obj, propertyName, arraySamples);\n }\n }\n continue;\n }\n obj = mergePropertyExamples(obj, propertyName, schemaToSampleObj(schema.properties[propertyName], config));\n }\n }\n } else if (schema.type === 'array' || schema.items) {\n if (schema.items || schema.example) {\n if (schema.example) {\n obj['example-0'] = schema.example;\n } else if (schema.items?.example) { // schemas and properties support single example but not multiple examples.\n obj['example-0'] = [schema.items.example];\n } else {\n const samples = schemaToSampleObj(schema.items, config);\n let i = 0;\n for (const key in samples) {\n obj[`example-${i}`] = [samples[key]];\n addSchemaInfoToExample(schema.items, obj[`example-${i}`]);\n i++;\n }\n }\n } else {\n obj['example-0'] = [];\n }\n } else {\n return { 'example-0': getSampleValueByType(schema) };\n }\n return obj;\n}\n\nfunction generateMarkdownForArrayAndObjectDescription(schema, level = 0) {\n let markdown = ((schema.description || schema.title) && (schema.minItems || schema.maxItems)) ? '' : '';\n if (schema.title) {\n if (schema.description) {\n markdown = `${markdown} ${schema.title}: ${schema.description}
`;\n } else {\n markdown = `${markdown} ${schema.title}
`;\n }\n } else if (schema.description) {\n markdown = `${markdown} ${schema.description}
`;\n }\n if (schema.minItems) {\n markdown = `${markdown} Min Items: ${schema.minItems}`;\n }\n if (schema.maxItems) {\n markdown = `${markdown} Max Items: ${schema.maxItems}`;\n }\n if (level > 0 && schema.items?.description) {\n let itemsMarkdown = '';\n if (schema.items.minProperties) {\n itemsMarkdown = `Min Properties: ${schema.items.minProperties}`;\n }\n if (schema.items.maxProperties) {\n itemsMarkdown = `${itemsMarkdown} Max Properties: ${schema.items.maxProperties}`;\n }\n markdown = `${markdown} ⮕ ${itemsMarkdown} [ ${schema.items.description} ] `;\n }\n return markdown;\n}\n/**\n * For changing OpenAPI-Schema to an Object Notation,\n * This Object would further be an input to UI Components to generate an Object-Tree\n * @param {object} schema - Schema object from OpenAPI spec\n * @param {object} obj - recursivly pass this object to generate object notation\n * @param {number} level - recursion level\n * @param {string} suffix - used for suffixing property names to avoid duplicate props during object composion\n */\nexport function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {\n if (!schema) {\n return;\n }\n if (schema.allOf) {\n const objWithAllProps = {};\n if (schema.allOf.length === 1 && !schema.allOf[0].properties && !schema.allOf[0].items) {\n // If allOf has single item and the type is not an object or array, then its a primitive\n const tempSchema = schema.allOf[0];\n return `${getTypeInfo(tempSchema).html}`;\n }\n // If allOf is an array of multiple elements, then all the keys makes a single object\n schema.allOf.map((v, i) => {\n if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf) {\n const propSuffix = (v.anyOf || v.oneOf) && i > 0 ? i : '';\n const partialObj = schemaInObjectNotation(v, {}, (level + 1), propSuffix);\n Object.assign(objWithAllProps, partialObj);\n } else if (v.type === 'array' || v.items) {\n const partialObj = schemaInObjectNotation(v, {}, (level + 1));\n Object.assign(objWithAllProps, partialObj);\n } else if (v.type) {\n const prop = `prop${Object.keys(objWithAllProps).length}`;\n const typeObj = getTypeInfo(v);\n objWithAllProps[prop] = `${typeObj.html}`;\n } else {\n return '';\n }\n });\n obj = objWithAllProps;\n } else if (schema.anyOf || schema.oneOf) {\n obj['::description'] = schema.description || '';\n // 1. First iterate the regular properties\n if (schema.type === 'object' || schema.properties) {\n obj['::description'] = schema.description || '';\n obj['::type'] = 'object';\n // obj['::deprecated'] = schema.deprecated || false;\n for (const key in schema.properties) {\n if (schema.required && schema.required.includes(key)) {\n obj[`${key}*`] = schemaInObjectNotation(schema.properties[key], {}, (level + 1));\n } else {\n obj[key] = schemaInObjectNotation(schema.properties[key], {}, (level + 1));\n }\n }\n }\n // 2. Then show allof/anyof objects\n const objWithAnyOfProps = {};\n const xxxOf = schema.anyOf ? 'anyOf' : 'oneOf';\n schema[xxxOf].forEach((v, index) => {\n if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf) {\n const partialObj = schemaInObjectNotation(v, {});\n objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`] = partialObj;\n objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`]['::readwrite'] = ''; // xxx-options cannot be read or write only\n objWithAnyOfProps['::type'] = 'xxx-of-option';\n } else if (v.type === 'array' || v.items) {\n // This else-if block never seems to get executed\n const partialObj = schemaInObjectNotation(v, {});\n objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`] = partialObj;\n objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`]['::readwrite'] = ''; // xxx-options cannot be read or write only\n objWithAnyOfProps['::type'] = 'xxx-of-array';\n } else {\n const prop = `::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`;\n objWithAnyOfProps[prop] = `${getTypeInfo(v).html}`;\n objWithAnyOfProps['::type'] = 'xxx-of-option';\n }\n });\n obj[(schema.anyOf ? `::ANY~OF ${suffix}` : `::ONE~OF ${suffix}`)] = objWithAnyOfProps;\n // obj['::type'] = 'object';\n obj['::type'] = 'object';\n } else if (Array.isArray(schema.type)) {\n // When a property has multiple types, then check further if any of the types are array or object, if yes then modify the schema using one-of\n // Clone the schema - as it will be modified to replace multi-data-types with one-of;\n const subSchema = JSON.parse(JSON.stringify(schema));\n const primitiveType = [];\n const complexTypes = [];\n subSchema.type.forEach((v) => {\n if (v.match(/integer|number|string|null|boolean/g)) {\n primitiveType.push(v);\n } else if (v === 'array' && typeof subSchema.items?.type === 'string' && subSchema.items?.type.match(/integer|number|string|null|boolean/g)) {\n // Array with primitive types should also be treated as primitive type\n if (subSchema.items.type === 'string' && subSchema.items.format) {\n primitiveType.push(`[${subSchema.items.format}]`);\n } else {\n primitiveType.push(`[${subSchema.items.type}]`);\n }\n } else {\n complexTypes.push(v);\n }\n });\n let multiPrimitiveTypes;\n if (primitiveType.length > 0) {\n subSchema.type = primitiveType.join(primitiveType.length === 2 ? ' or ' : '┃');\n multiPrimitiveTypes = getTypeInfo(subSchema);\n if (complexTypes.length === 0) {\n return `${multiPrimitiveTypes?.html || ''}`;\n }\n }\n if (complexTypes.length > 0) {\n obj['::type'] = 'object';\n const multiTypeOptions = {\n '::type': 'xxx-of-option',\n };\n\n // Generate ONE-OF options for complexTypes\n complexTypes.forEach((v, i) => {\n if (v === 'null') {\n multiTypeOptions[`::OPTION~${i + 1}`] = 'NULL~|~~|~~|~~|~~|~~|~~|~~|~';\n } else if ('integer, number, string, boolean,'.includes(`${v},`)) {\n subSchema.type = Array.isArray(v) ? v.join('┃') : v;\n const primitiveTypeInfo = getTypeInfo(subSchema);\n multiTypeOptions[`::OPTION~${i + 1}`] = primitiveTypeInfo.html;\n } else if (v === 'object') {\n // If object type iterate all the properties and create an object-type-option\n const objTypeOption = {\n '::title': schema.title || '',\n '::description': schema.description || '',\n '::type': 'object',\n '::deprecated': schema.deprecated || false,\n };\n for (const key in schema.properties) {\n if (schema.required && schema.required.includes(key)) {\n objTypeOption[`${key}*`] = schemaInObjectNotation(schema.properties[key], {}, (level + 1));\n } else {\n objTypeOption[key] = schemaInObjectNotation(schema.properties[key], {}, (level + 1));\n }\n }\n multiTypeOptions[`::OPTION~${i + 1}`] = objTypeOption;\n } else if (v === 'array') {\n multiTypeOptions[`::OPTION~${i + 1}`] = {\n '::title': schema.title || '',\n '::description': schema.description || '',\n '::type': 'array',\n '::props': schemaInObjectNotation(schema.items, {}, (level + 1)),\n };\n }\n });\n multiTypeOptions[`::OPTION~${complexTypes.length + 1}`] = multiPrimitiveTypes?.html || '';\n obj['::ONE~OF'] = multiTypeOptions;\n }\n } else if (schema.type === 'object' || schema.properties) { // If Object\n obj['::title'] = schema.title || '';\n obj['::description'] = generateMarkdownForArrayAndObjectDescription(schema, level);\n obj['::type'] = 'object';\n if ((Array.isArray(schema.type) && schema.type.includes('null')) || schema.nullable) {\n obj['::dataTypeLabel'] = 'object or null';\n }\n obj['::deprecated'] = schema.deprecated || false;\n obj['::readwrite'] = schema.readOnly ? 'readonly' : schema.writeOnly ? 'writeonly' : '';\n for (const key in schema.properties) {\n if (schema.required && schema.required.includes(key)) {\n obj[`${key}*`] = schemaInObjectNotation(schema.properties[key], {}, (level + 1));\n } else {\n obj[key] = schemaInObjectNotation(schema.properties[key], {}, (level + 1));\n }\n }\n for (const key in schema.patternProperties) {\n obj[`[pattern: ${key}]`] = schemaInObjectNotation(schema.patternProperties[key], obj, (level + 1));\n }\n if (schema.additionalProperties) {\n obj['[any-key]'] = schemaInObjectNotation(schema.additionalProperties, {});\n }\n } else if (schema.type === 'array' || schema.items) { // If Array\n obj['::title'] = schema.title || '';\n obj['::description'] = generateMarkdownForArrayAndObjectDescription(schema, level);\n obj['::type'] = 'array';\n if ((Array.isArray(schema.type) && schema.type.includes('null')) || schema.nullable) {\n obj['::dataTypeLabel'] = 'array or null';\n }\n obj['::deprecated'] = schema.deprecated || false;\n obj['::readwrite'] = schema.readOnly ? 'readonly' : schema.writeOnly ? 'writeonly' : '';\n if (schema.items?.items) {\n obj['::array-type'] = schema.items.items.type;\n }\n obj['::props'] = schemaInObjectNotation(schema.items, {}, (level + 1));\n } else {\n const typeObj = getTypeInfo(schema);\n if (typeObj?.html) {\n return `${typeObj.html}`;\n }\n return '';\n }\n return obj;\n}\n\n/* Create Example object */\nexport function generateExample(schema, mimeType, examples = '', example = '', includeReadOnly = true, includeWriteOnly = true, outputType = 'json', includeGeneratedExample = false) {\n const finalExamples = [];\n // First check if examples is provided\n if (examples) {\n for (const eg in examples) {\n let egContent = '';\n let egFormat = 'json';\n if (mimeType?.toLowerCase().includes('json')) {\n if (outputType === 'text') {\n egContent = typeof examples[eg].value === 'string' ? examples[eg].value : JSON.stringify(examples[eg].value, undefined, 2);\n egFormat = 'text';\n } else {\n egContent = examples[eg].value;\n if (typeof examples[eg].value === 'string') {\n try {\n // const fixedJsonString = examples[eg].value.replace((/([\\w]+)(:)/g), '\"$1\"$2').replace((/'/g), '\"');\n const fixedJsonString = examples[eg].value;\n egContent = JSON.parse(fixedJsonString);\n egFormat = 'json';\n } catch (err) {\n egFormat = 'text';\n egContent = examples[eg].value;\n }\n }\n }\n } else {\n egContent = examples[eg].value;\n egFormat = 'text';\n }\n\n finalExamples.push({\n exampleId: eg,\n exampleSummary: examples[eg].summary || eg,\n exampleDescription: examples[eg].description || '',\n exampleType: mimeType,\n exampleValue: egContent,\n exampleFormat: egFormat,\n });\n }\n } else if (example) {\n let egContent = '';\n let egFormat = 'json';\n if (mimeType?.toLowerCase().includes('json')) {\n if (outputType === 'text') {\n egContent = typeof example === 'string' ? example : JSON.stringify(example, undefined, 2);\n egFormat = 'text';\n } else if (typeof example === 'object') {\n egContent = example;\n egFormat = 'json';\n } else if (typeof example === 'string') {\n try {\n egContent = JSON.parse(example);\n egFormat = 'json';\n } catch (err) {\n egFormat = 'text';\n egContent = example;\n }\n }\n } else {\n egContent = example;\n egFormat = 'text';\n }\n finalExamples.push({\n exampleId: 'Example',\n exampleSummary: '',\n exampleDescription: '',\n exampleType: mimeType,\n exampleValue: egContent,\n exampleFormat: egFormat,\n });\n }\n // If schema-level examples are not provided or includeGeneratedExample === true then generate one based on the schema field types\n if (finalExamples.length === 0 || includeGeneratedExample === true) {\n if (schema) {\n if (schema.example) {\n // Note: Deprecated: The 'example' property has been deprecated in 3.1.0 in favor of the JSON Schema 'examples' keyword\n finalExamples.push({\n exampleId: 'Example',\n exampleSummary: '',\n exampleDescription: '',\n exampleType: mimeType,\n exampleValue: schema.example,\n exampleFormat: ((mimeType?.toLowerCase().includes('json') && typeof schema.example === 'object') ? 'json' : 'text'),\n });\n } else if (mimeType?.toLowerCase().includes('json') || mimeType?.toLowerCase().includes('text') || mimeType?.toLowerCase().includes('*/*') || mimeType?.toLowerCase().includes('xml')) {\n let xmlRootStart = '';\n let xmlRootEnd = '';\n let exampleFormat = '';\n let exampleValue = '';\n if (mimeType?.toLowerCase().includes('xml')) {\n xmlRootStart = schema.xml?.name ? `<${schema.xml.name} ${schema.xml.namespace ? `xmlns=\"${schema.xml.namespace}\"` : ''}>` : '';\n xmlRootEnd = schema.xml?.name ? `` : '';\n exampleFormat = 'text';\n } else {\n exampleFormat = outputType;\n }\n const samples = schemaToSampleObj(schema, { includeReadOnly, includeWriteOnly, deprecated: true, useXmlTagForProp: mimeType?.toLowerCase().includes('xml') });\n let i = 0;\n for (const samplesKey in samples) {\n if (!samples[samplesKey]) {\n continue;\n }\n const summary = samples[samplesKey]['::TITLE'] || `Example ${++i}`;\n const description = samples[samplesKey]['::DESCRIPTION'] || '';\n if (mimeType?.toLowerCase().includes('xml')) {\n exampleValue = `\\n${xmlRootStart}${json2xml(samples[samplesKey], 1)}\\n${xmlRootEnd}`;\n } else {\n removeTitlesAndDescriptions(samples[samplesKey]);\n exampleValue = outputType === 'text' ? JSON.stringify(samples[samplesKey], null, 2) : samples[samplesKey];\n }\n\n finalExamples.push({\n exampleId: samplesKey,\n exampleSummary: summary,\n exampleDescription: description,\n exampleType: mimeType,\n exampleFormat,\n exampleValue,\n });\n }\n } else if (mimeType?.toLowerCase().includes('jose')) {\n finalExamples.push({\n exampleId: 'Example',\n exampleSummary: 'Base64 Encoded',\n exampleDescription: '',\n exampleType: mimeType,\n exampleValue: schema.pattern || 'bXJpbg==',\n exampleFormat: 'text',\n });\n } else {\n finalExamples.push({\n exampleId: 'Example',\n exampleSummary: '',\n exampleDescription: '',\n exampleType: mimeType,\n exampleValue: '',\n exampleFormat: 'text',\n });\n }\n } else {\n // No Example or Schema provided (should never reach here)\n finalExamples.push({\n exampleId: 'Example',\n exampleSummary: '',\n exampleDescription: '',\n exampleType: mimeType,\n exampleValue: '',\n exampleFormat: 'text',\n });\n }\n }\n return finalExamples;\n}\n\nfunction getSerializeStyleForContentType(contentType) {\n if (contentType === 'application/json') {\n return 'json';\n }\n if (contentType === 'application/xml') {\n return 'xml';\n }\n return null;\n}\n\nexport function getSchemaFromParam(param) {\n if (param.schema) {\n return [param.schema, null, null];\n }\n if (param.content) {\n // we gonna use the first content-encoding\n for (const contentType of Object.keys(param.content)) {\n if (param.content[contentType].schema) {\n return [param.content[contentType].schema, getSerializeStyleForContentType(contentType), param.content[contentType]];\n }\n }\n }\n return [null, null, null];\n}\n","import { LitElement, html, css } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport FontStyles from '../styles/font-styles';\nimport SchemaStyles from '../styles/schema-styles';\nimport CustomStyles from '../styles/custom-styles';\n\nexport default class SchemaTable extends LitElement {\n static get properties() {\n return {\n schemaExpandLevel: { type: Number, attribute: 'schema-expand-level' },\n schemaDescriptionExpanded: { type: String, attribute: 'schema-description-expanded' },\n allowSchemaDescriptionExpandToggle: { type: String, attribute: 'allow-schema-description-expand-toggle' },\n schemaHideReadOnly: { type: String, attribute: 'schema-hide-read-only' },\n schemaHideWriteOnly: { type: String, attribute: 'schema-hide-write-only' },\n data: { type: Object },\n };\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) { this.schemaExpandLevel = 99999; }\n if (!this.schemaDescriptionExpanded || !'true false'.includes(this.schemaDescriptionExpanded)) { this.schemaDescriptionExpanded = 'false'; }\n if (!this.schemaHideReadOnly || !'true false'.includes(this.schemaHideReadOnly)) { this.schemaHideReadOnly = 'true'; }\n if (!this.schemaHideWriteOnly || !'true false'.includes(this.schemaHideWriteOnly)) { this.schemaHideWriteOnly = 'true'; }\n }\n\n static get styles() {\n return [\n FontStyles,\n SchemaStyles,\n css`\n .table {\n font-size: var(--font-size-small);\n text-align: left;\n line-height: calc(var(--font-size-small) + 6px);\n }\n .param-table{\n border-radius: 4px;\n border:1px solid var(--light-border-color);\n border-bottom: none;\n margin-top: 10px;\n font-size: 14px;\n }\n .param-table .tr {\n border-bottom: 1px solid var(--light-border-color);\n display: grid;\n grid-template-columns: 3fr 2fr 4fr;\n overflow: hidden;\n }\n .param-table .td {\n padding: 4px 0;\n }\n .param-table .key {\n padding: 12px 10px 12px;\n }\n .table .key-descr {\n padding: 12px 10px 12px;\n }\n .table .key-descr p {\n margin: 0px;\n display: inline;\n }\n .key.deprecated .key-label {\n color: var(--red);\n }\n .deprecated-label{\n color: #ef6660;\n padding: 1px 5px;\n font-size: 12px;\n border: 1px solid #ef6660;\n border-radius: 4px;\n }\n .key-label {\n background-color: #f8f7fc;\n border-radius: 4px;\n padding: 0.2em 0.4em;\n font-family: var(--font-mono);\n font-size: 12px;\n }\n .param-table .key-type {\n border-left:1px solid var(--light-border-color);\n border-right:1px solid var(--light-border-color);\n padding: 12px 10px 12px;\n }\n .object-body .key-type {\n white-space: normal;\n color:#4A4A4A;\n font-family: var(--font-mono);\n font-size: 12px;\n }\n .collapsed-all-descr .tr:not(.expanded-descr) {\n max-height: calc(var(--font-size-regular) + var(--font-size-regular) + 10px);\n }\n .collapsed-all-descr .tr:not(.expanded-descr) .td p, .collapsed-all-descr .tr:not(.expanded-descr) .key, .collapsed-all-descr .tr:not(.expanded-descr) .key-type {\n text-overflow: ellipsis;\n display: inline;\n min-width: 0;\n white-space: nowrap;\n overflow: hidden;\n }\n .obj-toggle {\n padding: 0 2px;\n border-radius:2px;\n border: 1px solid transparent;\n display: inline-block;\n margin-left: -16px;\n color:var(--primary-color);\n cursor:pointer;\n font-size: calc(var(--font-size-small) + 4px);\n font-family: var(--font-mono);\n background-clip: border-box;\n }\n .obj-toggle:hover {\n border-color: var(--primary-color);\n }\n .tr.expanded + .object-body {\n display:block;\n }\n .tr.collapsed + .object-body {\n display:none;\n }`,\n CustomStyles,\n ];\n }\n\n /* eslint-disable indent */\n render() {\n return html`\n
this.handleAllEvents(e)}\">\n
\n
${this.data?.['::type'] || ''}
\n ${(this.data && this.allowSchemaDescriptionExpandToggle === 'true')\n ? html`\n
\n
\n ${this.schemaDescriptionExpanded === 'true' ? 'Single line description' : 'Multiline description'}\n
\n `\n : ''\n }\n
\n ${this.data?.['::description']\n ? html` ${unsafeHTML(marked(this.data['::description'] || ''))}`\n : ''\n }\n ${this.data\n ? html`
\n
\n
Field
\n
Type
\n
Description
\n
\n ${this.generateTree(\n this.data['::type'] === 'array' ? this.data['::props'] : this.data,\n this.data['::type'],\n this.data['::array-type'],\n )}\n
\n
`\n : html`

Schema not found

`\n }\n \n `;\n }\n\n generateTree(data, dataType = 'object', arrayType = '', key = '', description = '', schemaLevel = 0, indentLevel = 0, readOrWrite = '') {\n if (this.schemaHideReadOnly === 'true') {\n if (dataType === 'array') {\n if (readOrWrite === 'readonly') {\n return;\n }\n }\n if (data && data['::readwrite'] === 'readonly') {\n return;\n }\n }\n if (this.schemaHideWriteOnly === 'true') {\n if (dataType === 'array') {\n if (readOrWrite === 'writeonly') {\n return;\n }\n }\n if (data && data['::readwrite'] === 'writeonly') {\n return;\n }\n }\n if (!data) {\n return html`
\n
\n ${key.replace('::OPTION~', '')}\n
\n
\n ${\n dataType === 'array'\n ? html` [ ] `\n : dataType === 'object'\n ? html` { } `\n : html` schema undefined `\n }\n
\n
${unsafeHTML(marked(description)) || ''}
\n
`;\n }\n\n const newSchemaLevel = data['::type']?.startsWith('xxx-of') ? schemaLevel : (schemaLevel + 1);\n const newIndentLevel = dataType === 'xxx-of-option' || data['::type'] === 'xxx-of-option' || key.startsWith('::OPTION') ? indentLevel : (indentLevel + 1);\n const leftPadding = 10 * newIndentLevel; // 2 space indentation at each level\n if (Object.keys(data).length === 0) {\n return html`${key}`;\n }\n let keyLabel = '';\n let keyDescr = '';\n let isOneOfLabel = false;\n if (key.startsWith('::ONE~OF') || key.startsWith('::ANY~OF')) {\n keyLabel = key.replace('::', '').replace('~', ' ');\n isOneOfLabel = true;\n } else if (key.startsWith('::OPTION')) {\n const parts = key.split('~');\n keyLabel = parts[1]; // eslint-disable-line prefer-destructuring\n keyDescr = parts[2]; // eslint-disable-line prefer-destructuring\n } else {\n keyLabel = key;\n }\n\n let detailObjType = '';\n if (data['::type'] === 'object') {\n if (dataType === 'array') {\n detailObjType = 'array of object'; // Array of Object\n } else {\n detailObjType = data['::dataTypeLabel'] || data['::type'];\n }\n } else if (data['::type'] === 'array') {\n if (dataType === 'array') {\n // detailObjType = 'array of array'; // Array of array\n detailObjType = `array of array ${arrayType !== 'object' ? `of ${arrayType}` : ''}`; // Array of array\n } else {\n detailObjType = data['::dataTypeLabel'] || data['::type'];\n }\n }\n\n if (typeof data === 'object') {\n return html`\n ${newSchemaLevel >= 0 && key\n ? html`\n
\n
\n ${(keyLabel || keyDescr)\n ? html`\n \n ${schemaLevel < this.schemaExpandLevel ? '-' : '+'}\n `\n : ''\n }\n ${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' || key.startsWith('::OPTION')\n ? html`${keyLabel}${keyDescr}`\n : keyLabel.endsWith('*')\n ? html`${data['::deprecated'] ? '❌' : ''} ${keyLabel.substring(0, keyLabel.length - 1)}*`\n : html`${data['::deprecated'] ? '❌' : ''} ${keyLabel === '::props' ? '' : keyLabel}`\n }\n ${data['::type'] === 'xxx-of' && dataType === 'array' ? html`ARRAY` : ''} \n
\n
\n ${(data['::type'] || '').includes('xxx-of') ? '' : detailObjType}\n ${data['::readwrite'] === 'readonly' ? ' 🆁' : data['::readwrite'] === 'writeonly' ? ' 🆆' : ''}\n
\n
${unsafeHTML(marked(description || ''))}
\n
`\n : html`\n ${data['::type'] === 'array' && dataType === 'array'\n ? html`\n
\n
\n
\n ${arrayType && arrayType !== 'object' ? `${dataType} of ${arrayType}` : dataType}\n
\n
\n
`\n : ''\n }`\n }\n
\n ${Array.isArray(data) && data[0]\n ? html`${this.generateTree(data[0], 'xxx-of-option', '', '::ARRAY~OF', '', newSchemaLevel, newIndentLevel, '')}`\n : html`\n ${Object.keys(data).map((dataKey) => html`\n ${['::title', '::description', '::type', '::props', '::deprecated', '::array-type', '::readwrite', '::dataTypeLabel'].includes(dataKey)\n ? data[dataKey]['::type'] === 'array' || data[dataKey]['::type'] === 'object'\n ? html`${this.generateTree(\n data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey],\n data[dataKey]['::type'],\n data[dataKey]['::array-type'] || '',\n dataKey,\n data[dataKey]['::description'],\n newSchemaLevel,\n newIndentLevel,\n data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '',\n )}`\n : ''\n : html`${this.generateTree(\n data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey],\n data[dataKey]['::type'],\n data[dataKey]['::array-type'] || '',\n dataKey,\n data[dataKey]?.['::description'] || '',\n newSchemaLevel,\n newIndentLevel,\n data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '',\n )}`\n }\n `)}\n `\n }\n
\n `;\n }\n\n // For Primitive Data types\n // eslint-disable-next-line no-unused-vars\n const [type, readOrWriteOnly, constraint, defaultValue, allowedValues, pattern, schemaDescription, schemaTitle, deprecated] = data.split('~|~');\n if (readOrWriteOnly === '🆁' && this.schemaHideReadOnly === 'true') {\n return;\n }\n if (readOrWriteOnly === '🆆' && this.schemaHideWriteOnly === 'true') {\n return;\n }\n const dataTypeCss = type.replace(/┃.*/g, '').replace(/[^a-zA-Z0-9+]/g, '').substring(0, 4).toLowerCase();\n const typeDivider = type.replaceAll('┃', ' | ');\n const descrExpander = `${schemaDescription.length >= 50 || constraint || defaultValue || allowedValues || pattern ? '' : ''}`;\n let dataTypeHtml = '';\n if (dataType === 'array') {\n dataTypeHtml = html` \n
\n [${typeDivider}] ${readOrWrite === 'readonly' ? '🆁' : readOrWrite === 'writeonly' ? '🆆' : ''}\n
`;\n } else {\n dataTypeHtml = html` \n
\n ${typeDivider} ${readOrWriteOnly}\n
`;\n }\n return html`\n
\n
\n ${keyLabel?.endsWith('*')\n ? html`\n ${keyLabel.substring(0, keyLabel.length - 1)}*`\n : key.startsWith('::OPTION')\n ? html`${keyLabel}${keyDescr}`\n : html`${keyLabel ? html` ${keyLabel}` : html`${schemaTitle}`}`\n }\n
\n ${dataTypeHtml}\n
\n ${html`\n ${deprecated ? html`Deprecated` : ''}\n ${unsafeHTML(marked(dataType === 'array'\n ? `${descrExpander} ${description}`\n : schemaTitle\n ? `${descrExpander} ${schemaTitle}: ${schemaDescription}`\n : `${descrExpander} ${schemaDescription}`))}\n `\n }\n ${constraint ? html`
Constraints: ${constraint}
` : ''}\n ${defaultValue ? html`
Default: ${defaultValue}
` : ''}\n ${allowedValues ? html`
${type === 'const' ? 'Value' : 'Allowed'}: ${allowedValues}
` : ''}\n ${pattern ? html`
Pattern: ${pattern}
` : ''}\n
\n
\n `;\n }\n /* eslint-enable indent */\n\n handleAllEvents(e) {\n if (e.target.classList.contains('obj-toggle')) {\n this.toggleObjectExpand(e);\n } else if (e.target.classList.contains('schema-multiline-toggle')) {\n this.schemaDescriptionExpanded = (this.schemaDescriptionExpanded === 'true' ? 'false' : 'true');\n } else if (e.target.classList.contains('descr-expand-toggle')) {\n const trEl = e.target.closest('.tr');\n if (trEl) {\n trEl.classList.toggle('expanded-descr');\n trEl.style.maxHeight = trEl.scrollHeight;\n }\n }\n }\n\n toggleObjectExpand(e) {\n const rowEl = e.target.closest('.tr');\n if (rowEl.classList.contains('expanded')) {\n rowEl.classList.add('collapsed');\n rowEl.classList.remove('expanded');\n e.target.innerText = '+';\n } else {\n rowEl.classList.remove('collapsed');\n rowEl.classList.add('expanded');\n e.target.innerText = '-';\n }\n }\n}\nif (!customElements.get('schema-table')) customElements.define('schema-table', SchemaTable);\n","import { LitElement, html, css } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport { schemaInObjectNotation, generateExample } from '../utils/schema-utils';\nimport FontStyles from '../styles/font-styles';\nimport FlexStyles from '../styles/flex-styles';\nimport TableStyles from '../styles/table-styles';\nimport InputStyles from '../styles/input-styles';\nimport TabStyles from '../styles/tab-styles';\nimport BorderStyles from '../styles/border-styles';\nimport CustomStyles from '../styles/custom-styles';\nimport './json-tree';\nimport './schema-tree';\nimport './schema-table';\n\nexport default class ApiResponse extends LitElement {\n constructor() {\n super();\n this.selectedStatus = '';\n this.headersForEachRespStatus = {};\n this.mimeResponsesForEachStatus = {};\n this.activeSchemaTab = 'schema';\n }\n\n static get properties() {\n return {\n callback: { type: String },\n webhook: { type: String },\n responses: { type: Object },\n parser: { type: Object },\n schemaStyle: { type: String, attribute: 'schema-style' },\n renderStyle: { type: String, attribute: 'render-style' },\n selectedStatus: { type: String, attribute: 'selected-status' },\n selectedMimeType: { type: String, attribute: 'selected-mime-type' },\n activeSchemaTab: { type: String, attribute: 'active-schema-tab' },\n schemaExpandLevel: { type: Number, attribute: 'schema-expand-level' },\n schemaDescriptionExpanded: { type: String, attribute: 'schema-description-expanded' },\n allowSchemaDescriptionExpandToggle: { type: String, attribute: 'allow-schema-description-expand-toggle' },\n schemaHideReadOnly: { type: String, attribute: 'schema-hide-read-only' },\n schemaHideWriteOnly: { type: String, attribute: 'schema-hide-write-only' },\n };\n }\n\n static get styles() {\n return [\n FontStyles,\n FlexStyles,\n TabStyles,\n TableStyles,\n InputStyles,\n BorderStyles,\n css`\n :where(button, input[type=\"checkbox\"], [tabindex=\"0\"]):focus-visible { box-shadow: var(--focus-shadow); }\n :where(input[type=\"text\"], input[type=\"password\"], select, textarea):focus-visible { border-color: var(--primary-color); }\n .response-panel {\n padding: 10px;\n border: 1px solid var(--light-border-color);\n border-radius: 4px;\n }\n .response-panel-header {\n border-bottom: 1px solid var(--light-border-color);\n }\n .resp-head{\n vertical-align: middle;\n padding:16px 0 8px;\n }\n .resp-descr{\n font-size:calc(var(--font-size-small) + 1px);\n color:var(--light-fg);\n text-align:left;\n }\n .resp-box{\n display: flex;\n flex-direction: row;\n flex: 1 1 auto;\n justify-content: space-around;\n align-items: center;\n column-gap: 12px;\n padding: 12px;\n }\n .resp-box:hover {\n cursor: pointer;\n color: var(--vtex-pink);\n font-weight: bold;\n }\n .resp-box.active {\n font-weight: bold;\n color: var(--vtex-pink);\n border-bottom: 2px solid var(--vtex-pink);\n }\n .resp-title {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n flex: 1 1 auto;\n height: 45px;\n text-transform: uppercase;\n }\n .resp-content {\n padding: 24px 40px;\n max-height: calc(100vh - 5rem - 48px);\n overflow: auto;\n background-color: #FFFFFF;\n }\n .resp-content-body {\n overflow: auto;\n scrollbar-width: thin;\n scrollbar-color: white white;\n }\n .resp-content-body:hover {\n scrollbar-color: #CCCED8 white;\n }\n .resp-content-body::-webkit-scrollbar {\n display: block;\n width: 6px;\n height: 6px;\n background-color: white;\n }\n .resp-content-body::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background: white;\n }\n .resp-content-body:hover::-webkit-scrollbar-thumb {\n background: #CCCED8;\n }\n .resp-content-container {\n display: none;\n background-color: rgba(0,0,0,0.1);\n }\n .top-gap{margin-top:16px;}\n .example-panel{\n font-size:var(--font-size-small);\n margin:0;\n }\n .focused-mode,\n .read-mode {\n margin: 32px 0px;\n display: flex;\n flex-direction: column;\n }\n .dot {\n height: 8px;\n width: 8px;\n border-radius: 50%;\n display: inline-block;\n }\n .success {\n background-color: var(--success-color);\n }\n .informational {\n background-color: var(--informational-color);\n }\n .redirection {\n background-color: var(--redirection-color);\n }\n .error {\n background-color: var(--error-color);\n }\n `,\n CustomStyles,\n ];\n }\n\n render() {\n return html`\n
\n ${this.responseTemplate()}\n
\n `;\n }\n\n resetSelection() {\n this.selectedStatus = '';\n this.selectedMimeType = '';\n }\n\n getResponseStatusType(respStatus) {\n const status = respStatus.toString();\n return status.startsWith('1')\n ? 'informational'\n : status.startsWith('2')\n ? 'success'\n : status.startsWith('3')\n ? 'redirection'\n : (status.startsWith('4') || status.startsWith('5'))\n ? 'error'\n : '';\n }\n\n /* eslint-disable indent */\n responseTemplate() {\n if (!this.responses) { return ''; }\n for (const statusCode in this.responses) {\n if (!this.selectedStatus) {\n this.selectedStatus = statusCode;\n }\n const allMimeResp = {};\n for (const mimeResp in this.responses[statusCode]?.content) {\n const mimeRespObj = this.responses[statusCode].content[mimeResp];\n if (!this.selectedMimeType) {\n this.selectedMimeType = mimeResp;\n }\n // Generate Schema\n const schemaTree = schemaInObjectNotation(mimeRespObj.schema, {});\n // Generate Example\n const respExamples = generateExample(\n mimeRespObj.schema,\n mimeResp,\n mimeRespObj.examples,\n mimeRespObj.example,\n this.callback === 'true' || this.webhook === 'true' ? false : true, // eslint-disable-line no-unneeded-ternary\n this.callback === 'true' || this.webhook === 'true' ? true : false, // eslint-disable-line no-unneeded-ternary\n mimeResp.includes('json') ? 'json' : 'text',\n );\n allMimeResp[mimeResp] = {\n description: this.responses[statusCode].description,\n examples: respExamples,\n selectedExample: respExamples[0]?.exampleId || '',\n schemaTree,\n };\n }\n // Headers for each response status\n const tempHeaders = [];\n for (const key in this.responses[statusCode]?.headers) {\n tempHeaders.push({ name: key, ...this.responses[statusCode].headers[key] });\n }\n this.headersForEachRespStatus[statusCode] = tempHeaders;\n this.mimeResponsesForEachStatus[statusCode] = allMimeResp;\n }\n return html`\n ${Object.keys(this.responses).length >= 1\n ? html`
\n ${Object.keys(this.responses).map((respStatus) => html`\n ${respStatus === '$$ref' // Swagger-Client parser creates '$$ref' object if JSON references are used to create responses - this should be ignored\n ? ''\n : html`\n
{\n this.selectedStatus = respStatus;\n if (this.responses[respStatus].content && Object.keys(this.responses[respStatus].content)[0]) {\n this.selectedMimeType = Object.keys(this.responses[respStatus].content)[0]; // eslint-disable-line prefer-destructuring\n } else {\n this.selectedMimeType = undefined;\n }\n }}\"\n >\n
\n
\n ${this.callback === 'true' ? 'Callback Response' : 'Response'}\n
\n
\n
\n
\n \n
\n
\n ${respStatus}\n
\n
\n
\n `\n }`)\n }
`\n : ''\n }\n
\n\n ${Object.keys(this.responses).map((status) => html`\n
\n
\n
\n
\n
\n ${this.callback === 'true' ? 'Callback Response' : 'Response'}\n
\n
\n
\n
\n \n
\n
\n ${status}\n
\n
\n
\n
\n
\n ${unsafeHTML(marked(this.responses[status]?.description || ''))}\n ${(this.headersForEachRespStatus[status] && this.headersForEachRespStatus[status]?.length > 0)\n ? html`${this.responseHeaderListTemplate(this.headersForEachRespStatus[status])}`\n : ''\n }\n
\n ${Object.keys(this.mimeResponsesForEachStatus[status]).length === 0\n ? ''\n : html` \n
\n ${Object.keys(this.mimeResponsesForEachStatus[status]).length === 1\n ? html` ${Object.keys(this.mimeResponsesForEachStatus[status])[0]} `\n : html`${this.mimeTypeDropdownTemplate(Object.keys(this.mimeResponsesForEachStatus[status]))}`\n } \n
{ if (e.target.tagName.toLowerCase() === 'button') { this.activeSchemaTab = e.target.dataset.tab; } }}\" >\n \n \n
\n
\n ${this.activeSchemaTab === 'example'\n ? html`
\n ${this.mimeExampleTemplate(this.mimeResponsesForEachStatus[status][this.selectedMimeType])}\n
`\n : html`
\n ${this.mimeSchemaTemplate(this.mimeResponsesForEachStatus[status][this.selectedMimeType])}\n
`\n }\n
\n `\n }\n
\n
\n
\n `)}\n `;\n }\n\n responseHeaderListTemplate(respHeaders) {\n return html`\n
Response headers
\n \n ${respHeaders.map((v) => html`\n \n \n \n ${v.schema?.type\n ? html` `\n : ''\n }\n \n ${v.description?.type\n ? html``\n : ''\n }\n \n ${v.schema?.example\n ? html`\n `\n : ''\n }\n \n `)}\n
\n ${v.name || ''}\n \n ${v.schema?.type || ''}\n \n
${unsafeHTML(marked(v.description || ''))}
\n
\n ${v.schema?.example || ''}\n
`;\n }\n\n mimeTypeDropdownTemplate(mimeTypes) {\n return html`\n `;\n }\n\n onSelectExample(e) {\n const exampleContainerEl = e.target.closest('.example-panel');\n const exampleEls = [...exampleContainerEl.querySelectorAll('.example')];\n\n exampleEls.forEach((v) => {\n v.style.display = v.dataset.example === e.target.value ? 'block' : 'none';\n });\n }\n\n mimeExampleTemplate(mimeRespDetails) {\n if (!mimeRespDetails) {\n return html`\n
 No example provided 
\n `;\n }\n return html`\n ${mimeRespDetails.examples.length === 1\n ? html`\n ${mimeRespDetails.examples[0].exampleFormat === 'json'\n ? html`\n ${mimeRespDetails.examples[0].exampleSummary && mimeRespDetails.examples[0].exampleSummary.length > 80 ? html`
${mimeRespDetails.examples[0].exampleSummary}
` : ''}\n ${mimeRespDetails.examples[0].exampleDescription ? html`
${unsafeHTML(marked(mimeRespDetails.examples[0].exampleDescription || ''))}
` : ''}\n `\n : html`\n ${mimeRespDetails.examples[0].exampleSummary && mimeRespDetails.examples[0].exampleSummary.length > 80 ? html`
${mimeRespDetails.examples[0].exampleSummary}
` : ''}\n ${mimeRespDetails.examples[0].exampleDescription ? html`
${unsafeHTML(marked(mimeRespDetails.examples[0].exampleDescription || ''))}
` : ''}\n
${mimeRespDetails.examples[0].exampleValue}
\n `\n }`\n : html`\n \n \n ${mimeRespDetails.examples.map((v) => html`\n
\n ${v.exampleSummary && v.exampleSummary.length > 80 ? html`
${v.exampleSummary}
` : ''}\n ${v.exampleDescription ? html`
${unsafeHTML(marked(v.exampleDescription || ''))}
` : ''}\n ${v.exampleFormat === 'json'\n ? html`\n `\n : html`
${v.exampleValue}
`\n }\n
\n `)}\n
\n `\n }\n `;\n }\n\n mimeSchemaTemplate(mimeRespDetails) {\n if (!mimeRespDetails) {\n return html`\n
 Schema not found
\n `;\n }\n return html`\n ${this.schemaStyle === 'table'\n ? html`\n `\n : html`\n `\n }`;\n }\n /* eslint-enable indent */\n}\n\n// Register the element with the browser\nif (!customElements.get('api-response')) customElements.define('api-response', ApiResponse);\n","/* eslint-disable max-len */\nimport { LitElement, html, css } from 'lit';\n// eslint-disable-next-line import/extensions\nimport checkSymbol from './assets/check-symbol';\nimport copySymbol from './assets/copy-symbol';\nimport './toast-component';\n\n/* eslint-disable indent */\n// eslint-disable-next-line import/prefer-default-export\nexport class ContentCopyButton extends LitElement {\n static properties = {\n id: { type: String },\n content: { type: String },\n copied: { type: Boolean },\n showButton: { type: Boolean },\n showToast: { type: Boolean },\n };\n\n constructor(id, content) {\n super();\n this.id = id;\n this.content = content;\n this.copied = false;\n this.showButton = false;\n this.showToast = false;\n this.addEventListener('closed-toast', () => { this.showToast = false; });\n }\n\n reset() {\n this.copied = false;\n this.showButton = false;\n }\n\n willUpdate(changedProperties) {\n if (changedProperties.has('id')) {\n this.reset();\n }\n }\n\n onButtonClick() {\n navigator.clipboard.writeText(this.content);\n this.copied = true;\n }\n\n onTextClick() {\n navigator.clipboard.writeText(this.content);\n this.showToast = true;\n }\n\n onMouseover() {\n this.showButton = true;\n }\n\n onMouseLeave() {\n this.showButton = false;\n this.copied = false;\n }\n\n render() {\n return html`\n
\n ${this.content}\n \n
\n ${\n this.showToast\n ? html``\n : ''\n }\n `;\n }\n\n static get styles() {\n return [\n css`\n .svg-container {\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-items: flex-start;\n padding: 0px 8px 0px 0px;\n gap: 10px;\n width: 57px;\n height: 20px;\n background: linear-gradient(270deg, #FFFFFF 51.22%, rgba(255, 255, 255, 0) 104.88%);\n }\n\n span {\n flex: 1 0 auto;\n padding: 4px 8px;\n }\n\n span:hover {\n cursor: pointer;\n }\n\n button {\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n cursor: pointer;\n outline: inherit;\n right: 0;\n display: block;\n position: -webkit-sticky;\n position: sticky;\n }\n\n .copy-container {\n width: inherit;\n height: inherit;\n opacity: 0;\n filter: alpha(opacity = 0);\n position: absolute;\n top:0; bottom:0; left:0; right:0;\n display: block;\n z-index: 2;\n background: transparent;\n }\n\n .content-copy-container {\n width: inherit;\n height: inherit;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-wrap: nowrap;\n font-size: 14px;\n white-space: nowrap;\n overflow-y: hidden;\n overflow-x: auto;\n align-items: center;\n }\n\n .content-copy-container::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n\n .content-copy-container::-webkit-scrollbar-track {\n background:var(--input-bg);\n }\n \n .content-copy-container::-webkit-scrollbar-thumb {\n border-radius: 2px;\n background-color: var(--border-color);\n }\n `,\n ];\n }\n}\n\nif (!customElements.get('content-copy-button')) customElements.define('content-copy-button', ContentCopyButton);\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport { rapidocApiKey, downloadResource, viewResource } from '../utils/common-utils';\nimport { pathSecurityTemplate } from './security-scheme-template';\nimport codeSamplesTemplate from './code-samples-template';\nimport callbackTemplate from './callback-template';\nimport '../components/api-request';\nimport '../components/api-response';\nimport '../components/content-copy-button';\nimport processPathDescription from '../utils/magic-block-utils';\nimport { joinURLandPath } from '../utils/url';\nimport renderBlockquote from '../utils/renderBlockquote';\n\n/* eslint-disable indent */\nfunction headingRenderer(tagElementId) {\n const renderer = new marked.Renderer();\n renderer.heading = ((text, level, raw, slugger) => `${text}`);\n return renderer;\n}\n\nexport function expandedEndpointBodyTemplate(path, tagName = '') {\n const acceptContentTypes = new Set();\n for (const respStatus in path.responses) {\n for (const acceptContentType in (path.responses[respStatus]?.content)) {\n acceptContentTypes.add(acceptContentType.trim());\n }\n }\n const accept = [...acceptContentTypes].join(', ');\n\n // Filter API Keys that are non-empty and are applicable to the the path\n const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter((v) => (v.finalKeyValue && path.security?.some((ps) => (v.securitySchemeId in ps)))) || [];\n\n // If a RapiDoc API Key is specified on the element and its value is not hyphen(-) then include it for all paths\n const rapiDocApiKey = this.resolvedSpec.securitySchemes.find((v) => (v.securitySchemeId === rapidocApiKey && v.value !== '-'));\n if (rapiDocApiKey) {\n nonEmptyApiKeys.push(rapiDocApiKey);\n }\n\n const docUrl = `https://developers.vtex.com/docs/api-reference/${this.specUrl.split('/')[3]}`;\n marked.Renderer.prototype.blockquote = renderBlockquote;\n\n const codeSampleTabPanel = path.xCodeSamples ? codeSamplesTemplate.call(this, path.xCodeSamples) : '';\n path.description = processPathDescription(path.description);\n return html`\n ${this.renderStyle === 'read' ? html`
` : ''}\n
\n \n ${path.deprecated ? html`
DEPRECATED
` : ''}\n ${html`\n ${path.xBadges && path.xBadges?.length > 0\n ? html`\n
\n ${path.xBadges.map((v) => (\n html`${v.label}`\n ))\n }\n
\n `\n : ''\n }\n
\n ${(this.renderStyle === 'focused' && tagName !== 'General ⦂') ? html`\n

${this.resolvedSpec.info.title} › ${tagName}

\n ` : ''}\n ${(this.specUrl && this.allowSpecFileDownload) ? html`
\n \n \n
` : ''}\n
\n

${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}

\n ${path.isWebhook\n ? html` WEBHOOK `\n : html`\n
\n
\n ${path.method}\n
\n
\n \n
\n
\n `\n }\n `\n }\n ${path.description ? html`
${unsafeHTML(marked(path.description))}
` : ''}\n \n ${codeSampleTabPanel}\n
\n \n\n ${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}\n\n \n
\n
\n `;\n}\n\nexport default function expandedEndpointTemplate() {\n if (!this.resolvedSpec) { return ''; }\n return html`\n ${this.resolvedSpec.tags.map((tag) => html`\n
\n
${tag.name}
\n \n
\n ${unsafeHTML(`\n
\n ${marked(tag.description || '', this.infoDescriptionHeadingsInNavBar === 'true' ? { renderer: headingRenderer(tag.elementId) } : undefined)}\n
`)\n }\n
\n
\n
\n ${tag.paths.map((path) => expandedEndpointBodyTemplate.call(this, path))}\n
\n `)\n }\n`;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport { schemaInObjectNotation } from '../utils/schema-utils';\nimport '../components/json-tree';\nimport '../components/schema-tree';\nimport '../components/schema-table';\n\nfunction schemaBodyTemplate(sComponent) {\n return html`\n
\n
\n
${sComponent.name} Schema
\n ${this.schemaStyle === 'table'\n ? html`\n `\n : html`\n `\n}\n
`;\n}\n\nfunction componentBodyTemplate(sComponent, componentType) {\n if (sComponent.id.indexOf('schemas-') !== -1) {\n return schemaBodyTemplate.call(this, sComponent);\n }\n return html`\n
\n
\n ${html`\n
${sComponent.name} ${componentType}
\n ${sComponent.component\n ? html`\n
\n \n
`\n : ''}\n `}\n
\n `;\n}\n\nexport default function componentsTemplate() {\n if (!this.resolvedSpec) { return ''; }\n return html`\n ${this.resolvedSpec.components.map((component) => html`\n
\n
${component.name}
\n
\n ${unsafeHTML(`
${marked(component.description ? component.description : '')}
`)}\n
\n
\n
\n ${component.subComponents.filter((c) => c.expanded !== false).map((sComponent) => componentBodyTemplate.call(this, sComponent, component.name))}\n
\n `)\n}\n`;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport processPathDescription from '../utils/magic-block-utils';\nimport { downloadResource, viewResource } from '../utils/common-utils';\nimport renderBlockquote from '../utils/renderBlockquote';\n\n/* eslint-disable indent */\nfunction headingRenderer() {\n const renderer = new marked.Renderer();\n renderer.heading = ((text, level, raw, slugger) => `${text}`);\n return renderer;\n}\n\nexport default function overviewTemplate() {\n this.resolvedSpec.info.description = processPathDescription(this.resolvedSpec.info.description);\n marked.Renderer.prototype.blockquote = renderBlockquote;\n\n return html`\n
\n \n ${this.resolvedSpec?.info\n ? html`\n ${this.specUrl && this.allowSpecFileDownload === 'true'\n ? html`\n
\n \n \n
`\n : ''\n }\n
\n ${this.resolvedSpec.info.title}\n ${!this.resolvedSpec.info.version ? '' : html`\n \n ${this.resolvedSpec.info.version}\n `\n }\n
\n
\n ${this.resolvedSpec.info.contact?.email\n ? html`${this.resolvedSpec.info.contact.name || 'Email'}: \n ${this.resolvedSpec.info.contact.email}\n `\n : ''\n }\n ${this.resolvedSpec.info.contact?.url\n ? html`URL: ${this.resolvedSpec.info.contact.url}`\n : ''\n }\n ${this.resolvedSpec.info.license\n ? html`License: \n ${this.resolvedSpec.info.license.url\n ? html`${this.resolvedSpec.info.license.name}`\n : this.resolvedSpec.info.license.name\n } `\n : ''\n }\n ${this.resolvedSpec.info.termsOfService\n ? html`Terms of Service`\n : ''\n }\n
\n \n
\n ${this.resolvedSpec.info.description\n ? html`${\n unsafeHTML(`\n
\n ${marked(this.resolvedSpec.info.description, this.infoDescriptionHeadingsInNavBar === 'true' ? { renderer: headingRenderer() } : undefined)}\n
`)}`\n : ''\n }\n
\n `\n : ''\n }\n
\n `;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\nimport { marked } from 'marked';\nimport { pathIsInSearch } from '../utils/common-utils';\n\nexport function expandCollapseNavBarTag(navLinkEl, action = 'toggle') {\n const tagAndPathEl = navLinkEl?.closest('.nav-bar-tag-and-paths');\n const pathsUnderTagEl = tagAndPathEl?.querySelector('.nav-bar-paths-under-tag');\n if (tagAndPathEl) {\n const isExpanded = tagAndPathEl.classList.contains('expanded');\n if (isExpanded && (action === 'toggle' || action === 'collapse')) {\n pathsUnderTagEl.style.maxHeight = 0;\n tagAndPathEl.classList.replace('expanded', 'collapsed');\n } else if (!isExpanded && (action === 'toggle' || action === 'expand')) {\n tagAndPathEl.classList.replace('collapsed', 'expanded');\n pathsUnderTagEl.style.maxHeight = `${pathsUnderTagEl.scrollHeight}px`;\n }\n }\n}\n\nexport function expandCollapseAll(event, action = 'expand-all') {\n if (!(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13))) {\n return;\n }\n const navEl = event.target.closest('.nav-scroll');\n const elList = [...navEl.querySelectorAll('.nav-bar-tag-and-paths')];\n if (action === 'expand-all') {\n elList.forEach((el) => {\n const navBarPathsUnderTagEl = el.querySelector('.nav-bar-paths-under-tag');\n el.classList.replace('collapsed', 'expanded');\n navBarPathsUnderTagEl.style.maxHeight = `${navBarPathsUnderTagEl?.scrollHeight}px`;\n });\n } else {\n elList.forEach((el) => {\n el.classList.replace('expanded', 'collapsed');\n el.querySelector('.nav-bar-paths-under-tag').style.maxHeight = 0;\n });\n }\n}\n\nexport function navBarClickAndEnterHandler(event) {\n if (!(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13))) {\n return;\n }\n const navEl = event.target;\n event.stopPropagation();\n if (navEl.dataset?.action === 'navigate') {\n this.scrollToEventTarget(event, false);\n } else if (navEl.dataset?.action === 'expand-all' || (navEl.dataset?.action === 'collapse-all')) {\n expandCollapseAll(event, navEl.dataset.action);\n } else if (navEl.dataset?.action === 'expand-collapse-tag') {\n expandCollapseNavBarTag(navEl, 'toggle');\n }\n}\n\n/* eslint-disable indent */\nexport default function navbarTemplate() {\n if (!this.resolvedSpec || this.resolvedSpec.specLoadError) {\n return html`\n \n `;\n }\n return html`\n
\n ${this.resolvedSpec.infoDescriptionHeaders.length > 0 ? html`
` : ''}\n `\n : html``\n }\n `\n }\n \n ${this.allowServerSelection === 'false'\n ? ''\n : html``\n }\n ${(this.allowAuthentication === 'false' || !this.resolvedSpec.securitySchemes)\n ? ''\n : html``\n }\n\n \n\n \n ${this.resolvedSpec.tags\n .filter((tag) => tag.paths.filter((path) => pathIsInSearch(this.matchPaths, path, this.matchType)).length)\n .map((tag) => html`\n `\n }`\n : ''\n }\n \n
\n `)\n }\n\n \n ${this.resolvedSpec.components && this.showComponents === 'true' && this.renderStyle === 'focused'\n ? html`\n \n ${this.resolvedSpec.components.map((component) => (component.subComponents.length\n ? html`\n \n ${component.subComponents.filter((p) => p.expanded !== false).map((p) => html`\n `)\n }`\n : ''))\n }`\n : ''\n }\n `\n }\n\n`;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport { expandedEndpointBodyTemplate } from './expanded-endpoint-template';\nimport '../components/api-request';\nimport '../components/api-response';\nimport componentsTemplate from './components-template';\nimport overviewTemplate from './overview-template';\nimport serverTemplate from './server-template';\nimport securitySchemeTemplate from './security-scheme-template';\nimport { expandCollapseNavBarTag } from './navbar-template';\n\nfunction headingRenderer(tagElementId) {\n const renderer = new marked.Renderer();\n renderer.heading = ((text, level, raw, slugger) => `${text}`);\n return renderer;\n}\n\nfunction wrapFocusedTemplate(templateToWrap) {\n return html`\n
\n ${templateToWrap}\n
`;\n}\n\nfunction defaultContentTemplate() {\n // In focused mode default content is overview or first path\n if (this.showInfo === 'true') {\n return wrapFocusedTemplate(overviewTemplate.call(this));\n }\n const selectedTagObj = this.resolvedSpec.tags[0];\n const selectedPathObj = this.resolvedSpec.tags[0]?.paths[0];\n return (selectedTagObj && selectedPathObj)\n ? wrapFocusedTemplate(expandedEndpointBodyTemplate.call(this, selectedPathObj, selectedTagObj.name))\n : wrapFocusedTemplate('');\n}\n\n/* eslint-disable indent */\nfunction focusedTagBodyTemplate(tag) {\n return html`\n

${tag.name}

\n ${this.onNavTagClick === 'show-description' && tag.description\n ? html`\n
\n ${\n unsafeHTML(`\n
\n ${marked(tag.description || '', this.infoDescriptionHeadingsInNavBar === 'true' ? { renderer: headingRenderer(tag.elementId) } : undefined)}\n
`)\n }\n
`\n : ''\n }\n `;\n}\n\nexport default function focusedEndpointTemplate() {\n if (!this.focusedElementId || !this.resolvedSpec) {\n return;\n }\n const focusElId = this.focusedElementId;\n let selectedPathObj = null;\n let selectedTagObj = null;\n let focusedTemplate;\n let i = 0;\n if (focusElId.startsWith('overview') && this.showInfo === 'true') {\n focusedTemplate = overviewTemplate.call(this);\n } else if (focusElId === 'auth' && this.allowAuthentication === 'true') {\n focusedTemplate = securitySchemeTemplate.call(this);\n } else if (focusElId === 'servers' && this.allowServerSelection === 'true') {\n focusedTemplate = serverTemplate.call(this);\n } else if (focusElId === 'operations-top') {\n focusedTemplate = html`\n
\n \n
`;\n } else if (focusElId.startsWith('cmp--') && this.showComponents === 'true') {\n focusedTemplate = componentsTemplate.call(this);\n } else if (focusElId.startsWith('tag--')) {\n const idToFocus = focusElId.indexOf('--', 4) > 0 ? focusElId.substring(0, focusElId.indexOf('--', 5)) : focusElId;\n selectedTagObj = this.resolvedSpec.tags.find((v) => v.elementId === idToFocus);\n if (selectedTagObj) {\n focusedTemplate = wrapFocusedTemplate.call(this, focusedTagBodyTemplate.call(this, selectedTagObj));\n } else {\n focusedTemplate = defaultContentTemplate.call(this);\n }\n } else {\n for (i = 0; i < this.resolvedSpec.tags.length; i += 1) {\n selectedTagObj = this.resolvedSpec.tags[i];\n selectedPathObj = this.resolvedSpec.tags[i].paths.find((v) => `${v.elementId}` === focusElId);\n if (selectedPathObj) {\n break;\n }\n }\n if (selectedPathObj) {\n // In focused mode we must expand the nav-bar tag element if it is collapsed\n const newNavEl = this.shadowRoot.getElementById(`link-${focusElId}`);\n expandCollapseNavBarTag(newNavEl, 'expand');\n focusedTemplate = wrapFocusedTemplate.call(\n this,\n expandedEndpointBodyTemplate.call(this, selectedPathObj, (selectedTagObj.name || ''), (selectedTagObj.description || '')),\n );\n } else {\n // if focusedElementId is not found then show the default content (overview or first-path)\n focusedTemplate = defaultContentTemplate.call(this);\n }\n }\n return focusedTemplate;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport '../components/api-request';\nimport '../components/api-response';\nimport '../components/content-copy-button';\nimport codeSamplesTemplate from './code-samples-template';\nimport callbackTemplate from './callback-template';\nimport { pathSecurityTemplate } from './security-scheme-template';\nimport { pathIsInSearch, rapidocApiKey } from '../utils/common-utils';\nimport processPathDescription from '../utils/magic-block-utils';\nimport { joinURLandPath } from '../utils/url';\n\nfunction toggleExpand(path) {\n if (path.expanded) {\n path.expanded = false; // collapse\n if (this.updateRoute === 'true') {\n this.replaceHistoryState('');\n }\n } else {\n path.expanded = true; // Expand\n if (this.updateRoute === 'true') {\n const newHash = `${this.routePrefix || '#'}${path.elementId}`;\n if (window.location.hash !== newHash) {\n this.replaceHistoryState(path.elementId);\n }\n }\n }\n this.requestUpdate();\n}\n\nexport function expandCollapseAll(operationsRootEl, action = 'expand-all') {\n const elList = [...operationsRootEl.querySelectorAll('.section-tag')];\n if (action === 'expand-all') {\n elList.map((el) => {\n el.classList.replace('collapsed', 'expanded');\n });\n } else {\n elList.map((el) => {\n el.classList.replace('expanded', 'collapsed');\n });\n }\n}\n\nfunction onExpandCollapseAll(e, action = 'expand-all') {\n expandCollapseAll.call(this, e.target.closest('.operations-root'), action);\n}\n\n/* eslint-disable indent */\nfunction endpointHeadTemplate(path, pathsExpanded = false) {\n return html`\n { toggleExpand.call(this, path, e); }}\" part=\"section-endpoint-head-${path.expanded ? 'expanded' : 'collapsed'}\" class='endpoint-head ${path.method} ${path.deprecated ? 'deprecated' : ''} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>\n
${path.method}
\n
\n ${path.path} \n ${path.isWebhook ? html` Webhook` : ''}\n
\n ${path.deprecated\n ? html`\n \n deprecated \n `\n : ''\n }\n ${this.showSummaryWhenCollapsed\n ? html`\n
\n
${path.summary || path.shortSummary}
`\n : ''\n }\n
\n `;\n}\n\nfunction endpointBodyTemplate(path) {\n const acceptContentTypes = new Set();\n for (const respStatus in path.responses) {\n for (const acceptContentType in (path.responses[respStatus]?.content)) {\n acceptContentTypes.add(acceptContentType.trim());\n }\n }\n const accept = [...acceptContentTypes].join(', ');\n // Filter API Keys that are non-empty and are applicable to the the path\n const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter((v) => (v.finalKeyValue && path.security?.some((ps) => (v.securitySchemeId in ps)))) || [];\n\n // If a RapiDoc API Key is specified on the element and its value is not hyphen(-) then include it for all paths\n const rapiDocApiKey = this.resolvedSpec.securitySchemes.find((v) => (v.securitySchemeId === rapidocApiKey && v.value !== '-'));\n if (rapiDocApiKey) {\n nonEmptyApiKeys.push(rapiDocApiKey);\n }\n\n const codeSampleTabPanel = path.xCodeSamples ? codeSamplesTemplate(path.xCodeSamples) : '';\n path.description = processPathDescription(path.description);\n return html`\n \n
\n
\n ${path.summary\n ? html`
${path.summary}
`\n : path.shortSummary !== path.description\n ? html`
${path.shortSummary}
`\n : ''\n }\n ${path.xBadges && path.xBadges?.length > 0\n ? html`\n
\n ${path.xBadges.map((v) => (\n html`${v.label}`\n ))\n }\n
\n `\n : ''\n }\n
\n
\n ${path.method}\n
\n
\n \n
\n
\n ${path.description ? html`
${unsafeHTML(path.description)}
` : ''}\n \n ${pathSecurityTemplate.call(this, path.security)}\n ${codeSampleTabPanel}\n
\n
\n
\n 0 ? path.servers[0].url : this.selectedServer.computedUrl}\" \n active-schema-tab = \"${this.defaultSchemaTab}\"\n fill-request-fields-with-example = \"${this.fillRequestFieldsWithExample}\"\n allow-try = \"${this.allowTry}\"\n show-curl-before-try = \"${this.showCurlBeforeTry}\"\n accept = \"${accept}\"\n render-style=\"${this.renderStyle}\" \n schema-style = \"${this.schemaStyle}\" \n schema-expand-level = \"${this.schemaExpandLevel}\"\n schema-description-expanded = \"${this.schemaDescriptionExpanded}\"\n allow-schema-description-expand-toggle = \"${this.allowSchemaDescriptionExpandToggle}\"\n schema-hide-read-only = \"${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}\"\n schema-hide-write-only = \"${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}\"\n fetch-credentials = \"${this.fetchCredentials}\"\n exportparts = \"wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,\n file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param, \n anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle\"\n > \n\n ${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}\n
\n\n \n
\n
`;\n}\n\nexport default function endpointTemplate(showExpandCollapse = true, showTags = true, pathsExpanded = false) {\n if (!this.resolvedSpec) { return ''; }\n return html`\n ${showExpandCollapse\n ? html`\n
\n onExpandCollapseAll(e, 'expand-all')}\" style=\"color:var(--primary-color); cursor:pointer;\">\n Expand all\n \n  |  \n onExpandCollapseAll(e, 'collapse-all')}\" style=\"color:var(--primary-color); cursor:pointer;\" >\n Collapse all\n \n   sections\n
`\n : ''\n }\n ${this.resolvedSpec.tags.map((tag) => html`\n ${showTags\n ? html` \n `\n : html`\n \n `\n }\n `)\n }`;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\n\n/* eslint-disable indent */\nexport default function logoTemplate(style) {\nreturn html`\n
\n \n \n \n \n \n \n \n \n
\n`;\n}\n/* eslint-enable indent */\n","import { html } from 'lit';\nimport logoTemplate from './logo-template';\n\n/* eslint-disable indent */\nexport default function headerTemplate() {\n return html`\n
\n
\n \n ${logoTemplate('height:36px;width:36px;margin-left:5px')}\n \n \n
${this.headingText}
\n
\n
\n ${(this.allowSpecUrlLoad === 'false')\n ? ''\n : html`\n \n
\n `\n } \n ${(this.allowSpecFileLoad === 'false')\n ? ''\n : html`\n \n \n `\n }\n \n ${(this.allowSearch === 'false' || 'read focused'.includes(this.renderStyle))\n ? ''\n : html` \n \n
\n `\n }\n \n ${(this.allowAdvancedSearch === 'false' || 'read focused'.includes(this.renderStyle))\n ? ''\n : html`\n \n `\n }\n
\n
`;\n }\n/* eslint-enable indent */\n","import { html } from 'lit';\nimport '../components/dialog-box';\n\n/* eslint-disable indent */\nexport default function searchByPropertiesModalTemplate() {\n document.addEventListener('close', () => { this.showAdvancedSearchDialog = false; });\n document.addEventListener('open', this.onOpenSearchDialog);\n\n return html`\n \n \n this.onAdvancedSearch(e, 400)}\"\n >\n
\n
\n this.onAdvancedSearch(e, 0)}\">\n \n
\n
\n this.onAdvancedSearch(e, 0)}\">\n \n
\n
\n this.onAdvancedSearch(e, 0)}\">\n \n
\n
\n this.onAdvancedSearch(e, 0)}\">\n \n
\n
\n this.onAdvancedSearch(e, 0)}\">\n \n
\n
\n
\n \n ${this.advancedSearchMatches?.map((path) => html`\n {\n this.matchPaths = ''; // clear quick filter if applied\n this.showAdvancedSearchDialog = false; // Hide Search Dialog\n this.requestUpdate();\n this.scrollToEventTarget(e, true);\n }\n }\"\n > \n ${path.method} \n ${path.path}\n ${path.summary}\n
\n `)\n }\n \n `;\n}\n/* eslint-enable indent */\n","import { LitElement, html } from 'lit';\nimport DialogBoxStyles from '../styles/dialog-box-styles';\n\nexport default class DialogBox extends LitElement {\n static get properties() {\n return {\n heading: { type: String, attribute: 'heading' },\n show: { type: String, attribute: 'show' },\n };\n }\n\n static get styles() {\n return [DialogBoxStyles];\n }\n\n connectedCallback() {\n super.connectedCallback();\n document.addEventListener('keydown', (e) => {\n if (e.code === 'Escape') {\n this.onClose();\n }\n });\n }\n\n attributeChangedCallback(name, oldVal, newVal) {\n if (oldVal !== newVal) {\n if (name === 'heading') {\n this.heading = newVal;\n }\n if (name === 'show') {\n this.show = newVal;\n if (newVal === 'true') {\n document.dispatchEvent(new CustomEvent('open', {\n bubbles: true,\n composed: true,\n detail: this,\n }));\n }\n }\n }\n super.attributeChangedCallback(name, oldVal, newVal);\n }\n\n /* eslint-disable indent */\n render() {\n return html`\n ${this.show === 'true'\n ? html`\n
\n
\n
\n ${this.heading}\n \n
\n
\n \n
\n
\n
`\n : ''\n }`;\n }\n /* eslint-enable indent */\n\n onClose() {\n document.dispatchEvent(new CustomEvent('close', {\n bubbles: true,\n composed: true,\n }));\n }\n}\n\nif (!customElements.get('dialog-box')) customElements.define('dialog-box', DialogBox);\n","import { html } from 'lit';\nimport ColorUtils from './color-utils';\n/* Generates an schema object containing type and constraint info */\nexport default function setTheme(baseTheme, theme = {}) {\n let newTheme = {};\n\n // Common Theme colors\n const primaryColor = theme.primaryColor ? theme.primaryColor : baseTheme === 'dark' ? '#f76b39' : '#ff591e';\n const primaryColorInvert = ColorUtils.color.invert(primaryColor);\n const primaryColorTrans = ColorUtils.color.opacity(primaryColor, '0.4');\n\n // Dark and Light Theme colors\n if (baseTheme === 'dark') {\n const bg1 = theme.bg1 ? theme.bg1 : '#2a2b2c';\n const fg1 = theme.fg1 ? theme.fg1 : '#bbb';\n\n const bg2 = theme.bg2 ? theme.bg2 : ColorUtils.color.brightness(bg1, 5); // or #383838;\n const bg3 = theme.bg3 ? theme.bg3 : ColorUtils.color.brightness(bg1, 17); // or #444;\n const lightBg = theme.bg3 ? theme.bg3 : ColorUtils.color.brightness(bg1, 35);\n const fg2 = theme.fg2 ? theme.fg2 : ColorUtils.color.brightness(fg1, -15); // or #ababab\n const fg3 = theme.fg3 ? theme.fg3 : ColorUtils.color.brightness(fg1, -20); // or #aaa\n const lightFg = theme.fg3 ? theme.fg3 : '#A1A8B3'; // or #777\n const inlineCodeFg = theme.inlineCodeFg ? theme.inlineCodeFg : '#aaa';\n\n const headerColor = theme.headerColor ? theme.headerColor : ColorUtils.color.brightness(bg1, 10);\n\n const navBgColor = theme.navBgColor ? theme.navBgColor : ColorUtils.color.brightness(bg1, 10);\n const navTextColor = theme.navTextColor ? theme.navTextColor : ColorUtils.color.opacity(ColorUtils.color.invert(navBgColor), '0.50');\n const navHoverBgColor = theme.navHoverBgColor ? theme.navHoverBgColor : ColorUtils.color.brightness(navBgColor, -15);\n const navHoverTextColor = theme.navHoverTextColor ? theme.navHoverTextColor : ColorUtils.color.invert(navBgColor);\n const navAccentColor = theme.navAccentColor ? theme.navAccentColor : ColorUtils.color.brightness(primaryColor, 25);\n const navAccentTextColor = theme.navAccentTextColor ? theme.navAccenttextColor : ColorUtils.color.invert(navAccentColor);\n\n const overlayBg = 'rgba(80, 80, 80, 0.4)';\n\n newTheme = {\n bg1,\n bg2,\n bg3,\n lightBg,\n fg1,\n fg2,\n fg3,\n lightFg,\n inlineCodeFg,\n primaryColor,\n primaryColorTrans,\n primaryColorInvert,\n overlayBg,\n navBgColor,\n navTextColor,\n navHoverBgColor,\n navHoverTextColor,\n navAccentColor,\n navAccentTextColor,\n headerColor,\n headerColorInvert: ColorUtils.color.invert(headerColor),\n headerColorDarker: ColorUtils.color.brightness(headerColor, -20),\n headerColorBorder: ColorUtils.color.brightness(headerColor, 10),\n\n borderColor: theme.borderColor || ColorUtils.color.brightness(bg1, 20), // #555\n lightBorderColor: theme.lightBorderColor || '#e7e9ee', // #444\n codeBorderColor: theme.codeBorderColor || ColorUtils.color.brightness(bg1, 30),\n\n inputBg: theme.inputBg || ColorUtils.color.brightness(bg1, -5), // #2f2f2f\n placeHolder: theme.placeHolder || ColorUtils.color.opacity(fg1, '0.3'),\n hoverColor: theme.hoverColor || ColorUtils.color.brightness(bg1, -10), // #2a2a2a\n\n red: theme.red ? theme.red : '#F06560',\n lightRed: theme.lightRed ? theme.lightRed : ColorUtils.color.brightness(bg1, -10), // #2a2a2a\n\n pink: theme.pink ? theme.pink : '#ffb2b2',\n lightPink: theme.lightPink || ColorUtils.color.brightness(bg1, -10),\n vtexPink: theme.vtexPink ? theme.vtexPink : '#D71D55',\n\n green: theme.green || '#7ec699',\n lightGreen: theme.lightGreen || ColorUtils.color.brightness(bg1, -10), // #2a2a2a\n\n blue: theme.blue || '#71b7ff',\n lightBlue: theme.lightBlue || ColorUtils.color.brightness(bg1, -10), // #2a2a2a\n\n orange: theme.orange ? theme.orange : '#f08d49',\n lightOrange: theme.lightOrange || ColorUtils.color.brightness(bg1, -10), // #2a2a2a\n\n yellow: theme.yellow || '#827717',\n lightYellow: theme.lightYellow || ColorUtils.color.brightness(bg1, -10), // #2a2a2a\n\n purple: theme.purple || '#786FF1',\n brown: theme.brown || '#D4AC0D',\n\n codeBg: theme.codeBg || ColorUtils.color.opacity(ColorUtils.color.brightness(bg1, -15), 0.7),\n codeFg: theme.codeFg || '#aaa',\n codePropertyColor: theme.codePropertyColor || '#f8c555',\n codeKeywordColor: theme.codeKeywordColor || '#cc99cd',\n codeOperatorColor: theme.codeOperatorColor || '#67cdcc',\n };\n } else {\n const bg1 = (theme.bg1 ? theme.bg1 : '#fafbfc');\n const fg1 = (theme.fg1 ? theme.fg1 : '#444444');\n const bg2 = theme.bg2 ? theme.bg2 : ColorUtils.color.brightness(bg1, -5); // or '#fafafa'\n const bg3 = theme.bg3 ? theme.bg3 : ColorUtils.color.brightness(bg1, -15); // or '#f6f6f6'\n const lightBg = theme.bg3 ? theme.bg3 : ColorUtils.color.brightness(bg1, -45);\n const fg2 = theme.fg2 ? theme.fg2 : '#545454';\n const fg3 = theme.fg3 ? theme.fg3 : ColorUtils.color.brightness(fg1, 30); // or #666\n const lightFg = theme.fg3 ? theme.fg3 : '#A1A8B3'; // or #999\n const inlineCodeFg = theme.inlineCodeFg ? theme.inlineCodeFg : 'brown';\n\n const headerColor = theme.headerColor ? theme.headerColor : ColorUtils.color.brightness(bg1, -180);\n\n /*\n const navBgColor = theme.navBgColor ? theme.navBgColor : ColorUtils.color.brightness(bg1, -10);\n const navTextColor = theme.navTextColor ? theme.navTextColor : ColorUtils.color.brightness(fg1, 5);\n const navHoverBgColor = theme.navHoverBgColor ? theme.navHoverBgColor : bg1;\n const navHoverTextColor = theme.navHoverTextColor ? theme.navHoverTextColor : primaryColor;\n const navAccentColor = theme.navAccentColor ? theme.navAccentColor : primaryColor;\n */\n const navBgColor = theme.navBgColor ? theme.navBgColor : ColorUtils.color.brightness(bg1, -200);\n const navTextColor = theme.navTextColor ? theme.navTextColor : ColorUtils.color.opacity(ColorUtils.color.invert(navBgColor), '0.65');\n const navHoverBgColor = theme.navHoverBgColor ? theme.navHoverBgColor : ColorUtils.color.brightness(navBgColor, -15);\n const navHoverTextColor = theme.navHoverTextColor ? theme.navHoverTextColor : ColorUtils.color.invert(navBgColor);\n const navAccentColor = theme.navAccentColor ? theme.navAccentColor : ColorUtils.color.brightness(primaryColor, 25);\n const navAccentTextColor = theme.navAccentTextColor ? theme.navAccenttextColor : ColorUtils.color.invert(navAccentColor);\n const overlayBg = 'rgba(0, 0, 0, 0.4)';\n\n newTheme = {\n bg1,\n bg2,\n bg3,\n lightBg,\n fg1,\n fg2,\n fg3,\n lightFg,\n inlineCodeFg,\n primaryColor,\n primaryColorTrans,\n primaryColorInvert,\n overlayBg,\n navBgColor,\n navTextColor,\n navHoverBgColor,\n navHoverTextColor,\n navAccentColor,\n navAccentTextColor,\n headerColor,\n headerColorInvert: ColorUtils.color.invert(headerColor),\n headerColorDarker: ColorUtils.color.brightness(headerColor, -20),\n headerColorBorder: ColorUtils.color.brightness(headerColor, 10),\n\n borderColor: theme.borderColor || '#B9B9B9',\n lightBorderColor: theme.lightBorderColor || '#e7e9ee',\n codeBorderColor: theme.codeBorderColor || 'transparent',\n\n inputBg: theme.inputBg || 'rgba(255, 255, 255, 0.0001)',\n placeHolder: theme.placeHolder || ColorUtils.color.brightness(lightFg, 20), // #dedede\n hoverColor: theme.hoverColor || ColorUtils.color.brightness(bg1, -5), // # f1f1f1\n\n rebelPink: '#e31c58',\n\n red: theme.red || '#F06560',\n lightRed: theme.lightRed || '#fff0f0',\n\n pink: theme.pink ? theme.pink : '#990055',\n lightPink: theme.lightPink ? theme.lightPink : '#ffb2b2',\n vtexPink: theme.vtexPink ? theme.vtexPink : '#D71D55',\n\n green: theme.green || '#690',\n lightGreen: theme.lightGreen || '#fbfff0',\n\n blue: theme.blue || '#47AFE8',\n lightBlue: theme.lightBlue || '#eff8fd',\n\n orange: theme.orange || '#FF9900',\n lightOrange: theme.lightOrange || '#fff5e6',\n\n yellow: theme.yellow || '#827717',\n lightYellow: theme.lightYellow || '#fff5cc',\n\n purple: theme.purple || '#786FF1',\n brown: theme.brown || '#D4AC0D',\n\n fgPositive: '#38853C',\n bgPositive: '#DFF1E0',\n borderPositive: '#83D187',\n\n fgPatch: '#6C6314',\n bgPatch: '#e9e7da',\n borderPatch: '#afa871',\n\n fgWarning: '#D56A00',\n bgWarning: '#FFEBD7',\n borderWarning: '#F5AE70',\n\n fgInfo: '#2978B5',\n bgInfo: '#DEECF7',\n borderInfo: '#7CBBEA',\n\n fgCritical: '#CC3D3D',\n bgCritical: '#F8E3E3',\n borderCritical: '#F49494',\n\n codeBg: theme.codeBg || ColorUtils.color.opacity(ColorUtils.color.brightness(bg1, -15), 0.7),\n codeFg: theme.codeFg || '#666',\n codePropertyColor: theme.codePropertyColor || '#905',\n codeKeywordColor: theme.codeKeywordColor || '#07a',\n codeOperatorColor: theme.codeOperatorColor || '#9a6e3a',\n };\n }\n return html`\n `;\n}\n","import { html } from 'lit';\n\n// Templates\nimport expandedEndpointTemplate from './expanded-endpoint-template';\nimport focusedEndpointTemplate from './focused-endpoint-template';\nimport overviewTemplate from './overview-template';\nimport endpointTemplate from './endpoint-template';\nimport { recoverPersistedApiKeys } from './security-scheme-template';\nimport headerTemplate from './header-template';\nimport navbarTemplate from './navbar-template';\nimport advancedSearchTemplate from './advance-search-template';\nimport SetTheme from '../utils/theme';\nimport { isValidHexColor } from '../utils/color-utils';\n\nexport default function mainBodyTemplate(isMini = false, showExpandCollapse = true, showTags = true, pathsExpanded = false) {\n if (!this.resolvedSpec) {\n return '';\n }\n if (this.persistAuth === 'true') {\n recoverPersistedApiKeys.call(this);\n }\n const newTheme = {\n bg1: isValidHexColor(this.bgColor) ? this.bgColor : '',\n fg1: isValidHexColor(this.textColor) ? this.textColor : '',\n headerColor: isValidHexColor(this.headerColor) ? this.headerColor : '',\n primaryColor: isValidHexColor(this.primaryColor) ? this.primaryColor : '',\n navBgColor: isValidHexColor(this.navBgColor) ? this.navBgColor : '',\n navTextColor: isValidHexColor(this.navTextColor) ? this.navTextColor : '',\n navHoverBgColor: isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',\n navHoverTextColor: isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : '',\n navAccentColor: isValidHexColor(this.navAccentColor) ? this.navAccentColor : '',\n navAccentTextColor: isValidHexColor(this.navAccentTextColor) ? this.navAccentTextColor : '',\n };\n /* eslint-disable indent */\n if (this.resolvedSpec.specLoadError) {\n if (isMini) {\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n
${this.resolvedSpec.info.description}
\n `;\n }\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n \n ${headerTemplate.call(this)}\n
\n \n
\n

${this.resolvedSpec.info.title}

\n
${this.resolvedSpec.info.description}
\n
\n
\n `;\n }\n if (this.resolvedSpec.isSpecLoading) {\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n
\n \n
\n
\n
\n
\n `;\n }\n\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n\n \n ${this.showHeader === 'false' ? '' : headerTemplate.call(this)}\n\n \n ${this.allowAdvancedSearch === 'false' ? '' : advancedSearchTemplate.call(this)}\n\n
\n \n ${((this.renderStyle === 'read' || this.renderStyle === 'focused')\n && this.showSideNav === 'true'\n && this.resolvedSpec\n ) ? navbarTemplate.call(this) : ''\n }\n\n \n
\n \n
\n ${this.loading === true\n ? html`
`\n : html`\n ${this.loadFailed === true\n ? html`
Unable to load the Spec
`\n : html`\n
\n ${this.renderStyle === 'focused'\n ? html`${focusedEndpointTemplate.call(this)}`\n : html`\n ${this.showInfo === 'true' ? overviewTemplate.call(this) : ''}\n
\n \n
\n ${this.renderStyle === 'read'\n ? expandedEndpointTemplate.call(this)\n : endpointTemplate.call(this, showExpandCollapse, showTags, pathsExpanded)\n }\n `\n }\n
\n `\n }`\n }\n
\n \n
\n
\n `;\n}\n/* eslint-enable indent */\n","import { css, LitElement, unsafeCSS } from 'lit';\nimport { marked } from 'marked';\nimport Prism from 'prismjs';\nimport 'prismjs/components/prism-css';\nimport 'prismjs/components/prism-yaml';\nimport 'prismjs/components/prism-go';\nimport 'prismjs/components/prism-java';\nimport 'prismjs/components/prism-json';\nimport 'prismjs/components/prism-bash';\nimport 'prismjs/components/prism-python';\nimport 'prismjs/components/prism-http';\nimport 'prismjs/components/prism-csharp';\n\n// Styles\nimport FontStyles from './styles/font-styles';\nimport InputStyles from './styles/input-styles';\nimport FlexStyles from './styles/flex-styles';\nimport TableStyles from './styles/table-styles';\nimport EndpointStyles from './styles/endpoint-styles';\nimport PrismStyles from './styles/prism-styles';\nimport TabStyles from './styles/tab-styles';\nimport NavStyles from './styles/nav-styles';\nimport InfoStyles from './styles/info-styles';\nimport CustomStyles from './styles/custom-styles';\n// import { expandCollapseNavBarTag } from '@/templates/navbar-template';\nimport { advancedSearch, pathIsInSearch, componentIsInSearch, rapidocApiKey, sleep } from './utils/common-utils';\nimport ProcessSpec from './utils/spec-parser';\nimport mainBodyTemplate from './templates/main-body-template';\nimport { applyApiKey, onClearAllApiKeys } from './templates/security-scheme-template';\nimport { setApiServer } from './templates/server-template';\n\nexport default class RapiDoc extends LitElement {\n constructor() {\n super();\n /* const intersectionObserverOptions = {\n root: this.getRootNode().host,\n rootMargin: '-50px 0px -50px 0px', // when the element is visible 100px from bottom\n threshold: 0,\n };\n this.showSummaryWhenCollapsed = true;\n // Will activate intersection observer only after spec load and hash analyze\n // to scroll to the proper element without being reverted by observer behavior\n this.intersectionObserver = new IntersectionObserver((entries) => { this.onIntersect(entries); }, intersectionObserverOptions);\n */\n this.isIntersectionObserverActive = false;\n }\n\n static get properties() {\n return {\n // Heading\n headingText: { type: String, attribute: 'heading-text' },\n gotoPath: { type: String, attribute: 'goto-path' },\n\n // Spec\n updateRoute: { type: String, attribute: 'update-route' },\n routePrefix: { type: String, attribute: 'route-prefix' },\n specUrl: { type: String, attribute: 'spec-url' },\n spec: { type: String, attribute: 'spec' },\n sortTags: { type: String, attribute: 'sort-tags' },\n generateMissingTags: { type: String, attribute: 'generate-missing-tags' },\n sortEndpointsBy: { type: String, attribute: 'sort-endpoints-by' },\n specFile: { type: String, attribute: false },\n\n // UI Layouts\n layout: { type: String },\n renderStyle: { type: String, attribute: 'render-style' },\n defaultSchemaTab: { type: String, attribute: 'default-schema-tab' },\n responseAreaHeight: { type: String, attribute: 'response-area-height' },\n fillRequestFieldsWithExample: { type: String, attribute: 'fill-request-fields-with-example' },\n persistAuth: { type: String, attribute: 'persist-auth' },\n onNavTagClick: { type: String, attribute: 'on-nav-tag-click' },\n\n // Schema Styles\n schemaStyle: { type: String, attribute: 'schema-style' },\n schemaExpandLevel: { type: Number, attribute: 'schema-expand-level' },\n schemaDescriptionExpanded: { type: String, attribute: 'schema-description-expanded' },\n schemaHideReadOnly: { type: String, attribute: 'schema-hide-read-only' },\n schemaHideWriteOnly: { type: String, attribute: 'schema-hide-write-only' },\n\n // API Server\n apiKeyName: { type: String, attribute: 'api-key-name' },\n apiKeyLocation: { type: String, attribute: 'api-key-location' },\n apiKeyValue: { type: String, attribute: 'api-key-value' },\n defaultApiServerUrl: { type: String, attribute: 'default-api-server' },\n serverUrl: { type: String, attribute: 'server-url' },\n oauthReceiver: { type: String, attribute: 'oauth-receiver' },\n\n // Hide/Show Sections & Enable Disable actions\n showHeader: { type: String, attribute: 'show-header' },\n showSideNav: { type: String, attribute: 'show-side-nav' },\n showInfo: { type: String, attribute: 'show-info' },\n allowAuthentication: { type: String, attribute: 'allow-authentication' },\n allowTry: { type: String, attribute: 'allow-try' },\n showCurlBeforeTry: { type: String, attribute: 'show-curl-before-try' },\n allowSpecUrlLoad: { type: String, attribute: 'allow-spec-url-load' },\n allowSpecFileLoad: { type: String, attribute: 'allow-spec-file-load' },\n allowSpecFileDownload: { type: String, attribute: 'allow-spec-file-download' },\n allowSearch: { type: String, attribute: 'allow-search' },\n allowAdvancedSearch: { type: String, attribute: 'allow-advanced-search' },\n allowServerSelection: { type: String, attribute: 'allow-server-selection' },\n allowSchemaDescriptionExpandToggle: { type: String, attribute: 'allow-schema-description-expand-toggle' },\n showComponents: { type: String, attribute: 'show-components' },\n pageDirection: { type: String, attribute: 'page-direction' },\n\n // Main Colors and Font\n theme: { type: String },\n bgColor: { type: String, attribute: 'bg-color' },\n textColor: { type: String, attribute: 'text-color' },\n headerColor: { type: String, attribute: 'header-color' },\n primaryColor: { type: String, attribute: 'primary-color' },\n fontSize: { type: String, attribute: 'font-size' },\n regularFont: { type: String, attribute: 'regular-font' },\n monoFont: { type: String, attribute: 'mono-font' },\n mediumFont: { type: String, attribute: 'medium-font' },\n loadFonts: { type: String, attribute: 'load-fonts' },\n cssFile: { type: String, attribute: 'css-file' },\n cssClasses: { type: String, attribute: 'css-classes' },\n\n // Nav Bar Colors\n navBgColor: { type: String, attribute: 'nav-bg-color' },\n navTextColor: { type: String, attribute: 'nav-text-color' },\n navHoverBgColor: { type: String, attribute: 'nav-hover-bg-color' },\n navHoverTextColor: { type: String, attribute: 'nav-hover-text-color' },\n navAccentColor: { type: String, attribute: 'nav-accent-color' },\n navAccentTextColor: { type: String, attribute: 'nav-accent-text-color' },\n navActiveItemMarker: { type: String, attribute: 'nav-active-item-marker' },\n navItemSpacing: { type: String, attribute: 'nav-item-spacing' },\n showMethodInNavBar: { type: String, attribute: 'show-method-in-nav-bar' },\n usePathInNavBar: { type: String, attribute: 'use-path-in-nav-bar' },\n infoDescriptionHeadingsInNavBar: { type: String, attribute: 'info-description-headings-in-navbar' },\n\n // Fetch Options\n fetchCredentials: { type: String, attribute: 'fetch-credentials' },\n\n // Filters\n matchPaths: { type: String, attribute: 'match-paths' },\n matchType: { type: String, attribute: 'match-type' },\n\n // Internal Properties\n loading: { type: Boolean }, // indicates spec is being loaded\n focusedElementId: { type: String }, // updating the focusedElementId will automatically render appropriate section in focused mode\n showAdvancedSearchDialog: { type: Boolean },\n advancedSearchMatches: { type: Object },\n };\n }\n\n static get styles() {\n return [\n FontStyles,\n InputStyles,\n FlexStyles,\n TableStyles,\n EndpointStyles,\n PrismStyles,\n TabStyles,\n NavStyles,\n InfoStyles,\n css`\n :host {\n display:flex;\n flex-direction: column;\n min-width:360px;\n width:100%;\n height:100%;\n margin:0;\n padding:0;\n overflow: hidden;\n letter-spacing:normal;\n color:var(--fg);\n background-color:var(--bg);\n font-family:var(--font-regular);\n }\n :where(button, input[type=\"checkbox\"], [tabindex=\"0\"]):focus-visible { box-shadow: var(--focus-shadow); }\n :where(input[type=\"text\"], input[type=\"password\"], select, textarea):focus-visible { border-color: var(--primary-color); }\n .body {\n display:flex;\n height:100%;\n width:100%;\n overflow:hidden;\n max-width: 2087px;\n }\n .main-content { \n margin:0;\n padding: 0; \n display:block;\n flex:1;\n height:100%;\n overflow-y: auto;\n overflow-x: hidden;\n scrollbar-width: thin;\n scrollbar-color: var(--border-color) transparent;\n }\n\n .main-content-inner--view-mode {\n padding: 0 8px;\n }\n .main-content::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n .main-content::-webkit-scrollbar-track {\n background:transparent;\n }\n .main-content::-webkit-scrollbar-thumb {\n background-color: var(--border-color);\n }\n .section-gap.section-tag {\n border-bottom:1px solid var(--border-color);\n }\n .section-tag-header {\n position:relative;\n cursor: n-resize;\n padding: 12px 0;\n }\n .collapsed .section-tag-header:hover{\n cursor: s-resize;\n }\n\n .section-tag-header:hover{\n background-image: linear-gradient(to right, rgba(0,0,0,0), var(--border-color), rgba(0,0,0,0));\n }\n\n .section-tag-header:hover::after {\n position:absolute;\n margin-left:-24px;\n font-size:20px;\n top: calc(50% - 14px);\n color:var(--primary-color);\n content: '⬆'; \n }\n\n .collapsed .section-tag-header::after {\n position:absolute;\n margin-left:-24px;\n font-size:20px;\n top: calc(50% - 14px);\n color: var(--border-color);\n content: '⬇'; \n }\n .collapsed .section-tag-header:hover::after {\n color:var(--primary-color);\n }\n\n .collapsed .section-tag-body {\n display:none;\n }\n\n .logo {\n height:36px;\n width:36px;\n margin-left:5px; \n }\n .only-large-screen-flex,\n .only-large-screen{\n display:none;\n }\n .tag.title {\n text-transform: uppercase;\n }\n .main-header {\n background-color:var(--header-bg);\n color:var(--header-fg);\n width:100%;\n }\n .header-title {\n font-size:calc(var(--font-size-regular) + 8px); \n padding:0 8px;\n }\n input.header-input{\n background:var(--header-color-darker);\n color:var(--header-fg);\n border:1px solid var(--header-color-border);\n flex:1; \n padding-right:24px;\n border-radius:3px;\n }\n input.header-input::placeholder {\n opacity:0.4;\n }\n .loader {\n margin: 16px auto 16px auto; \n border: 4px solid var(--bg3);\n border-radius: 50%;\n border-top: 4px solid var(--primary-color);\n width: 36px;\n height: 36px;\n animation: spin 2s linear infinite;\n }\n .expanded-endpoint-body { \n position: relative;\n padding: 0px; \n }\n .expanded-endpoint-body .tag-description {\n background: var(--code-bg);\n border-radius: var(--border-radius);\n transition: max-height .2s ease-out;\n }\n .expanded-endpoint-body .tag-icon {\n transition: transform .2s ease-out;\n }\n .expanded-endpoint-body .tag-icon.expanded {\n transform: rotate(180deg);\n }\n .divider { \n border-top: 2px solid var(--border-color);\n margin: 24px 0;\n width:100%;\n }\n\n .tooltip {\n cursor:pointer;\n border: 1px solid var(--border-color);\n border-left-width: 4px;\n margin-left:2px;\n }\n .tooltip a {\n color: var(--fg2);\n text-decoration: none;\n }\n .tooltip-text {\n color: var(--fg2);\n max-width: 400px;\n position: absolute;\n z-index:1;\n background-color: var(--bg2);\n visibility: hidden;\n\n overflow-wrap: break-word;\n }\n .tooltip:hover {\n color: var(--primary-color);\n border-color: var(--primary-color);\n }\n .tooltip:hover a:hover {\n color: var(--primary-color);\n }\n\n .tooltip:hover .tooltip-text {\n visibility: visible;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n\n .nav-method { font-weight: bold; margin-right: 4px; font-size: calc(var(--font-size-small) - 2px); white-space: nowrap; }\n .nav-method.false { display: none; }\n\n .nav-method.as-colored-text.get { color:var(--get-color); }\n .nav-method.as-colored-text.put { color:var(--put-color); }\n .nav-method.as-colored-text.post { color:var(--post-color); }\n .nav-method.as-colored-text.delete { color:var(--delete-color); }\n .nav-method.as-colored-text.head, .nav-method.as-colored-text.patch, .nav-method.as-colored-text.options { color:var(--nav-head-color); }\n \n .nav-method.as-colored-block {\n padding: 1px 4px;\n min-width: 30px;\n border-radius: 4px 0 0 4px;\n color: #000;\n }\n .colored-block .nav-method.as-colored-block {\n outline: 1px solid;\n }\n\n .nav-method.as-colored-block.get { background-color: var(--blue); }\n .nav-method.as-colored-block.put { background-color: var(--orange); }\n .nav-method.as-colored-block.post { background-color: var(--green); }\n .nav-method.as-colored-block.delete { background-color: var(--red); }\n .nav-method.as-colored-block.head, .nav-method.as-colored-block.patch , .nav-method.as-colored-block.options { \n background-color: var(--yellow); \n }\n\n @media only screen and (min-width: 768px) {\n .nav-bar {\n width: 260px;\n display:flex;\n }\n .only-large-screen{\n display:block;\n }\n .only-large-screen-flex{\n display:flex;\n }\n .section-gap { \n padding: 0 0 0 24px; \n }\n .section-gap--focused-mode {\n padding: 24px 8px; \n }\n .section-gap--read-mode { \n padding: 0px 80px; \n }\n .endpoint-body {\n position: relative;\n padding:36px 0 48px 0;\n }\n }\n\n @media (min-width: 2560px) {\n .body {\n padding-left: 316px;\n padding-right: 221px;\n }\n }\n\n @media only screen and (min-width: 1024px) {\n .nav-bar {\n width: ${unsafeCSS(this.fontSize === 'default' ? '300px' : this.fontSize === 'large' ? '315px' : '330px')};\n display:flex;\n }\n .section-gap--focused-mode { \n padding: 0px 0px 12px 80px; \n }\n .section-gap--read-mode { \n padding: 0px 80px; \n }\n }`,\n CustomStyles,\n ];\n }\n\n // Startup\n connectedCallback() {\n super.connectedCallback();\n const parent = this.parentElement;\n if (parent) {\n /* if (parent.offsetWidth === 0 && parent.style.width === '') {\n parent.style.width = '100vw';\n }\n if (parent.offsetHeight === 0 && parent.style.height === '') {\n parent.style.height = '100vh';\n } */\n if (parent.tagName === 'BODY') {\n if (!parent.style.marginTop) { parent.style.marginTop = '0'; }\n if (!parent.style.marginRight) { parent.style.marginRight = '0'; }\n if (!parent.style.marginBottom) { parent.style.marginBottom = '0'; }\n if (!parent.style.marginLeft) { parent.style.marginLeft = '0'; }\n }\n }\n\n if (this.loadFonts !== 'false') {\n const fontDescriptor = {\n family: 'Open Sans',\n style: 'normal',\n weight: '300',\n unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD',\n };\n const fontWeight300 = new FontFace(\n 'Open Sans',\n \"url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UN_r8OUuhpKKSTjw.woff2) format('woff2')\",\n fontDescriptor,\n );\n fontDescriptor.weight = '600';\n const fontWeight600 = new FontFace(\n 'Open Sans',\n \"url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UNirkOUuhpKKSTjw.woff2) format('woff2')\",\n fontDescriptor,\n );\n fontWeight300.load().then((font) => { document.fonts.add(font); });\n fontWeight600.load().then((font) => { document.fonts.add(font); });\n }\n\n if (!this.layout || !'row, column,'.includes(`${this.layout},`)) { this.layout = 'row'; }\n if (!this.renderStyle || !'read, view, focused,'.includes(`${this.renderStyle},`)) { this.renderStyle = 'focused'; }\n if (!this.schemaStyle || !'tree, table,'.includes(`${this.schemaStyle},`)) { this.schemaStyle = 'tree'; }\n if (!this.theme || !'light, dark,'.includes(`${this.theme},`)) {\n this.theme = (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) ? 'light' : 'dark';\n }\n if (!this.defaultSchemaTab || !'example, schema, model,'.includes(`${this.defaultSchemaTab},`)) {\n this.defaultSchemaTab = 'example';\n } else if (this.defaultSchemaTab === 'model') {\n this.defaultSchemaTab = 'schema';\n }\n if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) { this.schemaExpandLevel = 99999; }\n if (!this.schemaDescriptionExpanded || !'true, false,'.includes(`${this.schemaDescriptionExpanded},`)) { this.schemaDescriptionExpanded = 'false'; }\n\n if (!this.schemaHideReadOnly || !'default, never,'.includes(`${this.schemaHideReadOnly},`)) { this.schemaHideReadOnly = 'default'; }\n if (!this.schemaHideWriteOnly || !'default, never,'.includes(`${this.schemaHideWriteOnly},`)) { this.schemaHideWriteOnly = 'default'; }\n\n if (!this.fillRequestFieldsWithExample || !'true, false,'.includes(`${this.fillRequestFieldsWithExample},`)) { this.fillRequestFieldsWithExample = 'true'; }\n if (!this.persistAuth || !'true, false,'.includes(`${this.persistAuth},`)) { this.persistAuth = 'false'; }\n if (!this.responseAreaHeight) {\n this.responseAreaHeight = '400px';\n }\n\n if (!this.allowSearch || !'true, false,'.includes(`${this.allowSearch},`)) { this.allowSearch = 'true'; }\n if (!this.allowAdvancedSearch || !'true, false,'.includes(`${this.allowAdvancedSearch},`)) { this.allowAdvancedSearch = 'true'; }\n\n if (!this.allowTry || !'true, false,'.includes(`${this.allowTry},`)) { this.allowTry = 'true'; }\n if (!this.apiKeyValue) { this.apiKeyValue = '-'; }\n if (!this.apiKeyLocation) { this.apiKeyLocation = 'header'; }\n if (!this.apiKeyName) { this.apiKeyName = ''; }\n\n if (!this.oauthReceiver) { this.oauthReceiver = 'oauth-receiver.html'; }\n if (!this.updateRoute || !'true, false,'.includes(`${this.updateRoute},`)) { this.updateRoute = 'true'; }\n if (!this.routePrefix) { this.routePrefix = '#'; }\n if (!this.sortTags || !'true, false,'.includes(`${this.sortTags},`)) { this.sortTags = 'false'; }\n if (!this.generateMissingTags || !'true, false,'.includes(`${this.generateMissingTags},`)) { this.generateMissingTags = 'false'; }\n if (!this.sortEndpointsBy || !'method, path, summary, none,'.includes(`${this.sortEndpointsBy},`)) { this.sortEndpointsBy = 'path'; }\n\n if (!this.onNavTagClick || !'expand-collapse, show-description,'.includes(`${this.onNavTagClick},`)) { this.onNavTagClick = 'expand-collapse'; }\n if (!this.navItemSpacing || !'compact, relaxed, default,'.includes(`${this.navItemSpacing},`)) { this.navItemSpacing = 'default'; }\n if (!this.showMethodInNavBar || !'false, as-plain-text, as-colored-text, as-colored-block,'.includes(`${this.showMethodInNavBar},`)) { this.showMethodInNavBar = 'false'; }\n if (!this.usePathInNavBar || !'true, false,'.includes(`${this.usePathInNavBar},`)) { this.usePathInNavBar = 'false'; }\n if (!this.navActiveItemMarker || !'left-bar, colored-block'.includes(`${this.navActiveItemMarker},`)) { this.navActiveItemMarker = 'left-bar'; }\n\n if (!this.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) { this.fontSize = 'default'; }\n if (!this.showInfo || !'true, false,'.includes(`${this.showInfo},`)) { this.showInfo = 'true'; }\n if (!this.allowServerSelection || !'true, false,'.includes(`${this.allowServerSelection},`)) { this.allowServerSelection = 'true'; }\n if (!this.allowAuthentication || !'true, false,'.includes(`${this.allowAuthentication},`)) { this.allowAuthentication = 'true'; }\n if (!this.allowSchemaDescriptionExpandToggle || !'true, false,'.includes(`${this.allowSchemaDescriptionExpandToggle},`)) { this.allowSchemaDescriptionExpandToggle = 'true'; }\n\n if (!this.showSideNav || !'true false'.includes(this.showSideNav)) { this.showSideNav = 'true'; }\n if (!this.showComponents || !'true false'.includes(this.showComponents)) { this.showComponents = 'false'; }\n if (!this.infoDescriptionHeadingsInNavBar || !'true, false,'.includes(`${this.infoDescriptionHeadingsInNavBar},`)) { this.infoDescriptionHeadingsInNavBar = 'false'; }\n if (!this.fetchCredentials || !'omit, same-origin, include,'.includes(`${this.fetchCredentials},`)) { this.fetchCredentials = ''; }\n if (!this.matchType || !'includes regex'.includes(this.matchType)) { this.matchType = 'includes'; }\n\n if (!this.showAdvancedSearchDialog) { this.showAdvancedSearchDialog = false; }\n\n if (!this.cssFile) { this.cssFile = null; }\n if (!this.cssClasses) { this.cssClasses = ''; }\n\n Prism.languages.node = Prism.languages.javascript;\n\n marked.setOptions({\n highlight: (code, lang) => {\n if (lang === 'curl') lang = 'bash';\n if (Prism.languages[lang]) {\n return Prism.highlight(code, Prism.languages[lang], lang);\n }\n return code;\n },\n });\n\n window.addEventListener('hashchange', () => {\n this.scrollToPath(this.getElementIDFromURL());\n }, true);\n }\n\n // Cleanup\n disconnectedCallback() {\n /* if (this.intersectionObserver) {\n this.intersectionObserver.disconnect();\n } */\n super.disconnectedCallback();\n }\n\n infoDescriptionHeadingRenderer() {\n const renderer = new marked.Renderer();\n renderer.heading = ((text, level, raw, slugger) => `${text}`);\n return renderer;\n }\n\n render() {\n // return render(mainBodyTemplate(this), this.shadowRoot, { eventContext: this });\n /* const cssLinkEl = document.querySelector(`link[href*=\"${this.cssFile}\"]`);\n // adding custom style for RapiDoc\n if (cssLinkEl) {\n this.shadowRoot.appendChild(cssLinkEl.cloneNode());\n } */\n return mainBodyTemplate.call(this);\n }\n\n /* observeExpandedContent() {\n // Main Container\n const observeOverviewEls = this.shadowRoot.querySelectorAll('.observe-me');\n observeOverviewEls.forEach((targetEl) => {\n this.intersectionObserver.observe(targetEl);\n });\n } */\n\n attributeChangedCallback(name, oldVal, newVal) {\n if (name === 'spec-url') {\n if (oldVal !== newVal) {\n // put it at the end of event-loop to load all the attributes\n window.setTimeout(async () => {\n await this.loadSpec(newVal);\n // If goto-path is provided and no location-hash is present then try to scroll there\n if (this.gotoPath && !window.location.hash) {\n this.scrollToPath(this.gotoPath);\n }\n }, 0);\n }\n }\n if (name === 'render-style') {\n if (newVal === 'read') {\n window.setTimeout(() => {\n this.observeExpandedContent();\n }, 100);\n } else {\n // this.intersectionObserver.disconnect();\n }\n }\n if (name === 'api-key-name' || name === 'api-key-location' || name === 'api-key-value') {\n let updateSelectedApiKey = false;\n let apiKeyName = '';\n let apiKeyLocation = '';\n let apiKeyValue = '';\n\n if (name === 'api-key-name') {\n if (this.getAttribute('api-key-location') && this.getAttribute('api-key-value')) {\n apiKeyName = newVal;\n apiKeyLocation = this.getAttribute('api-key-location');\n apiKeyValue = this.getAttribute('api-key-value');\n updateSelectedApiKey = true;\n }\n } else if (name === 'api-key-location') {\n if (this.getAttribute('api-key-name') && this.getAttribute('api-key-value')) {\n apiKeyLocation = newVal;\n apiKeyName = this.getAttribute('api-key-name');\n apiKeyValue = this.getAttribute('api-key-value');\n updateSelectedApiKey = true;\n }\n } else if (name === 'api-key-value') {\n if (this.getAttribute('api-key-name') && this.getAttribute('api-key-location')) {\n apiKeyValue = newVal;\n apiKeyLocation = this.getAttribute('api-key-location');\n apiKeyName = this.getAttribute('api-key-name');\n updateSelectedApiKey = true;\n }\n }\n\n if (updateSelectedApiKey) {\n if (this.resolvedSpec) {\n const rapiDocApiKey = this.resolvedSpec.securitySchemes.find((v) => v.securitySchemeId === rapidocApiKey);\n if (!rapiDocApiKey) {\n this.resolvedSpec.securitySchemes.push({\n securitySchemeId: rapidocApiKey,\n description: 'api-key provided in rapidoc element attributes',\n type: 'apiKey',\n name: apiKeyName,\n in: apiKeyLocation,\n value: apiKeyValue,\n finalKeyValue: apiKeyValue,\n });\n } else {\n rapiDocApiKey.name = apiKeyName;\n rapiDocApiKey.in = apiKeyLocation;\n rapiDocApiKey.value = apiKeyValue;\n rapiDocApiKey.finalKeyValue = apiKeyValue;\n }\n this.requestUpdate();\n }\n }\n }\n super.attributeChangedCallback(name, oldVal, newVal);\n }\n\n onSpecUrlChange() {\n this.setAttribute('spec-url', this.shadowRoot.getElementById('spec-url').value);\n }\n\n onSpecFileChange(e) {\n this.setAttribute('spec-file', this.shadowRoot.getElementById('spec-file').value);\n const specFile = e.target.files[0];\n const reader = new FileReader();\n reader.onload = () => {\n try {\n const specObj = JSON.parse(reader.result);\n this.loadSpec(specObj);\n this.shadowRoot.getElementById('spec-url').value = '';\n } catch (err) {\n console.error('RapiDoc: Unable to read or parse json'); // eslint-disable-line no-console\n }\n };\n // Read the Text file\n reader.readAsText(specFile);\n }\n\n onFileLoadClick() {\n this.shadowRoot.getElementById('spec-file').click();\n }\n\n onSearchChange(e) {\n this.matchPaths = e.target.value;\n this.resolvedSpec.tags.forEach((tag) => tag.paths.filter((v) => {\n if (this.matchPaths) {\n // v.expanded = false;\n if (pathIsInSearch(this.matchPaths, v, this.matchType)) {\n tag.expanded = true;\n }\n }\n }));\n this.resolvedSpec.components.forEach((component) => component.subComponents.filter((v) => {\n v.expanded = false;\n if (!this.matchPaths || componentIsInSearch(this.matchPaths, v)) {\n v.expanded = true;\n }\n }));\n this.requestUpdate();\n }\n\n onClearSearch() {\n const searchEl = this.shadowRoot.getElementById('nav-bar-search');\n searchEl.value = '';\n this.matchPaths = '';\n this.resolvedSpec.components.forEach((component) => component.subComponents.filter((v) => {\n v.expanded = true;\n }));\n }\n\n onShowSearchModalClicked() {\n this.showAdvancedSearchDialog = true;\n }\n\n // Event Handler on Dialog-Box is opened\n async onOpenSearchDialog(e) {\n // Set focus to text input\n const inputEl = e.detail.querySelector('input');\n await sleep(0);\n if (inputEl) {\n inputEl.focus();\n }\n }\n\n // Public Method\n async loadSpec(specUrl) {\n if (!specUrl) {\n return;\n }\n this.matchPaths = '';\n try {\n this.resolvedSpec = {\n specLoadError: false,\n isSpecLoading: true,\n tags: [],\n };\n this.loading = true;\n this.loadFailed = false;\n const processedSpec = await ProcessSpec.call(\n this,\n specUrl,\n this.spec,\n this.generateMissingTags === 'true',\n this.sortTags === 'true',\n this.getAttribute('sort-endpoints-by'),\n this.getAttribute('api-key-name'),\n this.getAttribute('api-key-location'),\n this.getAttribute('api-key-value'),\n this.getAttribute('server-url'),\n );\n this.loading = false;\n this.afterSpecParsedAndValidated(processedSpec);\n } catch (err) {\n this.loading = false;\n this.loadFailed = true;\n this.resolvedSpec = null;\n console.error(`RapiDoc: Unable to resolve the API spec.. ${err.message}`); // eslint-disable-line no-console\n }\n }\n\n async afterSpecParsedAndValidated(spec) {\n this.resolvedSpec = spec;\n this.selectedServer = undefined;\n if (this.defaultApiServerUrl) {\n if (this.defaultApiServerUrl === this.serverUrl) {\n this.selectedServer = {\n url: this.serverUrl,\n computedUrl: this.serverUrl,\n };\n } else if (this.resolvedSpec.servers) {\n this.selectedServer = this.resolvedSpec.servers.find((v) => (v.url === this.defaultApiServerUrl));\n }\n }\n if (!this.selectedServer) {\n if (this.resolvedSpec.servers) {\n this.selectedServer = this.resolvedSpec.servers[0]; // eslint-disable-line prefer-destructuring\n }\n }\n this.requestUpdate();\n // eslint-disable-next-line no-await-in-loop\n while (!await this.updateComplete);\n const specLoadedEvent = new CustomEvent('spec-loaded', { detail: spec });\n this.dispatchEvent(specLoadedEvent);\n\n // Initiate IntersectionObserver and put it at the end of event loop, to allow loading all the child elements (must for larger specs)\n // this.intersectionObserver.disconnect();\n if (this.renderStyle === 'read') {\n await sleep(100);\n this.observeExpandedContent(); // This will auto-highlight the selected nav-item in read-mode\n }\n\n this.isIntersectionObserverActive = true;\n\n // On first time Spec load, try to navigate to location hash if provided\n const elementId = this.getElementIDFromURL();\n\n if (elementId) {\n if (this.renderStyle === 'view') {\n this.expandAndGotoOperation(elementId, true, true);\n } else {\n this.scrollToPath(elementId);\n }\n } else if (this.renderStyle === 'focused') {\n // If goto-path is provided and no location-hash is present then try to scroll to default element\n if (!this.gotoPath) {\n const defaultElementId = this.showInfo ? 'overview' : this.resolvedSpec.tags[0]?.paths[0];\n this.scrollToPath(defaultElementId);\n }\n }\n }\n\n /**\n * Return the URL from where is served the RapiDoc component, removing any hash and route prefix\n */\n getComponentBaseURL() {\n const { href } = window.location;\n\n // Remove end of string # or /\n const cleanRouterPrefix = this.routePrefix.replace(/(#|\\/)$/, '');\n\n if (!cleanRouterPrefix) {\n return href.split('#')[0];\n }\n\n const indexOfRoutePrefix = href.lastIndexOf(cleanRouterPrefix);\n\n if (indexOfRoutePrefix === -1) {\n return href;\n }\n\n return href.slice(0, indexOfRoutePrefix);\n }\n\n /**\n * From the URL return the ID of the element whether it is in the hash or if used a router prefix without a hash\n */\n getElementIDFromURL() {\n const baseURL = this.getComponentBaseURL();\n const elementId = window.location.href.replace(baseURL + this.routePrefix, '');\n return elementId;\n }\n\n replaceHistoryState(hashId) {\n const baseURL = this.getComponentBaseURL();\n window.history.replaceState(null, null, `${baseURL}${this.routePrefix || '#'}${hashId}`);\n }\n\n expandAndGotoOperation(elementId, scrollToElement = true) {\n if (!this.resolvedSpec) {\n return;\n }\n // Expand full operation and tag\n let isExpandingNeeded = true;\n const tmpElementId = elementId.indexOf('#') === -1 ? elementId : elementId.substring(1);\n if (tmpElementId.startsWith('overview') || tmpElementId === 'servers' || tmpElementId === 'auth') {\n isExpandingNeeded = false;\n } else {\n for (let i = 0; i < this.resolvedSpec.tags?.length; i++) {\n const tag = this.resolvedSpec.tags[i];\n const path = tag.paths?.find((p) => p.elementId === elementId);\n if (path) {\n if (path.expanded && tag.expanded) {\n isExpandingNeeded = false;\n } else {\n path.expanded = true;\n tag.expanded = true;\n }\n }\n }\n }\n if (scrollToElement) {\n // requestUpdate() and delay required, else we cant find element\n if (isExpandingNeeded) {\n this.requestUpdate();\n }\n window.setTimeout(() => {\n const gotoEl = this.shadowRoot.getElementById(tmpElementId);\n if (gotoEl) {\n gotoEl.scrollIntoView({ behavior: 'auto', block: 'start' });\n if (this.updateRoute === 'true') {\n this.replaceHistoryState(tmpElementId);\n }\n }\n }, isExpandingNeeded ? 150 : 0);\n }\n }\n\n isValidTopId(id) {\n return (id.startsWith('overview') || id === 'servers' || id === 'auth');\n }\n\n isValidPathId(id) {\n if (id === 'overview' && this.showInfo) {\n return true;\n }\n if (id === 'servers' && this.allowServerSelection) {\n return true;\n }\n if (id === 'auth' && this.allowAuthentication) {\n return true;\n }\n if (id.startsWith('tag--')) {\n return this.resolvedSpec?.tags?.find((tag) => tag.elementId === id);\n }\n return this.resolvedSpec?.tags?.find((tag) => tag.paths.find((path) => path.elementId === id));\n }\n\n onIntersect(entries) {\n if (this.isIntersectionObserverActive === false) {\n return;\n }\n\n entries.forEach((entry) => {\n if (entry.isIntersecting && entry.intersectionRatio > 0) {\n const oldNavEl = this.shadowRoot.querySelector('.nav-bar-tag.active, .nav-bar-path.active, .nav-bar-info.active, .nav-bar-h1.active, .nav-bar-h2.active, .operations.active');\n const newNavEl = this.shadowRoot.getElementById(`link-${entry.target.id}`);\n\n // Add active class in the new element\n if (newNavEl) {\n if (this.updateRoute === 'true') {\n this.replaceHistoryState(entry.target.id);\n }\n // newNavEl.scrollIntoView({ behavior: 'auto', block: 'center' });\n newNavEl.classList.add('active');\n newNavEl.part.add('section-navbar-active-item');\n }\n\n // Remove active class from previous element\n // if it is different from the new one (edge case on loading in read render style)\n if (oldNavEl && oldNavEl !== newNavEl) {\n oldNavEl.classList.remove('active');\n oldNavEl.part.remove('section-navbar-active-item');\n }\n }\n });\n }\n\n // Called by anchor tags created using markdown\n handleHref(e) {\n if (e.target.tagName.toLowerCase() === 'a') {\n if (e.target.getAttribute('href').startsWith('#')) {\n const gotoEl = this.shadowRoot.getElementById(e.target.getAttribute('href').replace('#', ''));\n if (gotoEl) {\n gotoEl.scrollIntoView({ behavior: 'auto', block: 'start' });\n }\n }\n }\n }\n\n /**\n * Called by\n * - onClick of Navigation Bar\n * - onClick of Advanced Search items\n *\n * Functionality:\n * 1. First deactivate IntersectionObserver\n * 2. Scroll to the element\n * 3. Activate IntersectionObserver (after little delay)\n *\n */\n async scrollToEventTarget(event, scrollNavItemToView = true) {\n if (!(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13))) {\n return;\n }\n const navEl = event.target;\n if (!navEl.dataset.contentId) {\n return;\n }\n this.isIntersectionObserverActive = false;\n if (this.renderStyle === 'focused') {\n const requestEl = this.shadowRoot.querySelector('api-request');\n if (requestEl) {\n requestEl.beforeNavigationFocusedMode();\n }\n }\n this.scrollToPath(navEl.dataset.contentId, true, scrollNavItemToView);\n setTimeout(() => {\n this.isIntersectionObserverActive = true;\n }, 300);\n }\n\n // Public Method (scrolls to a given path and highlights the left-nav selection)\n async scrollToPath(elementId, expandPath = true, scrollNavItemToView = true) {\n if (this.renderStyle === 'focused') {\n // for focused mode update this.focusedElementId to update the rendering, else it wont find the needed html elements\n // focusedElementId will get validated in the template\n this.focusedElementId = elementId;\n await sleep(0);\n }\n if (this.renderStyle === 'view') {\n this.expandAndGotoOperation(elementId, expandPath, true);\n } else {\n let isValidElementId = false;\n const contentEl = this.shadowRoot.getElementById(elementId);\n if (contentEl) {\n isValidElementId = true;\n contentEl.scrollIntoView({ behavior: 'auto', block: 'start' });\n } else {\n isValidElementId = false;\n }\n if (isValidElementId) {\n // for focused style it is important to reset request-body-selection and response selection which maintains the state for in case of multiple req-body or multiple response mime-type\n if (this.renderStyle === 'focused') {\n const requestEl = this.shadowRoot.querySelector('api-request');\n if (requestEl) {\n requestEl.afterNavigationFocusedMode();\n }\n const responseEl = this.shadowRoot.querySelector('api-response');\n if (responseEl) {\n responseEl.resetSelection();\n }\n }\n\n // Update Location Hash\n if (this.updateRoute === 'true') {\n this.replaceHistoryState(elementId);\n }\n\n // Update NavBar View and Styles\n const newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);\n\n if (newNavEl) {\n if (scrollNavItemToView) {\n newNavEl.scrollIntoView({ behavior: 'auto', block: 'center' });\n }\n await sleep(0);\n const oldNavEl = this.shadowRoot.querySelector('.nav-bar-tag.active, .nav-bar-path.active, .nav-bar-info.active, .nav-bar-h1.active, .nav-bar-h2.active, .operations.active');\n if (oldNavEl) {\n oldNavEl.classList.remove('active');\n oldNavEl.part.remove('active');\n oldNavEl.part.remove('section-navbar-active-item');\n }\n newNavEl.classList.add('active'); // must add the class after scrolling\n newNavEl.part.add('section-navbar-active-item');\n // this.requestUpdate();\n }\n }\n }\n }\n\n // Public Method - to update security-scheme of type http\n setHttpUserNameAndPassword(securitySchemeId, username, password) {\n return applyApiKey.call(this, securitySchemeId, username, password);\n }\n\n // Public Method - to update security-scheme of type apiKey or OAuth\n setApiKey(securitySchemeId, apiKeyValue) {\n return applyApiKey.call(this, securitySchemeId, '', '', apiKeyValue);\n }\n\n // Public Method\n removeAllSecurityKeys() {\n return onClearAllApiKeys.call(this);\n }\n\n // Public Method\n setApiServer(apiServerUrl) {\n // return apiServerUrl;\n return setApiServer.call(this, apiServerUrl);\n }\n\n // Event handler for Advanced Search text-inputs and checkboxes\n onAdvancedSearch(ev, delay) {\n const eventTargetEl = ev.target;\n clearTimeout(this.timeoutId);\n this.timeoutId = setTimeout(() => {\n let searchInputEl;\n if (eventTargetEl.type === 'text') {\n searchInputEl = eventTargetEl;\n } else {\n searchInputEl = eventTargetEl.closest('.advanced-search-options').querySelector('input[type=text]');\n }\n const searchOptions = [...eventTargetEl.closest('.advanced-search-options').querySelectorAll('input:checked')].map((v) => v.id);\n this.advancedSearchMatches = advancedSearch(searchInputEl.value, this.resolvedSpec.tags, searchOptions);\n }, delay);\n }\n}\nif (!customElements.get('rapi-doc')) customElements.define('rapi-doc', RapiDoc);\n","import { css, LitElement } from 'lit';\nimport { marked } from 'marked';\nimport Prism from 'prismjs';\nimport 'prismjs/components/prism-css';\nimport 'prismjs/components/prism-yaml';\nimport 'prismjs/components/prism-go';\nimport 'prismjs/components/prism-java';\nimport 'prismjs/components/prism-json';\nimport 'prismjs/components/prism-bash';\nimport 'prismjs/components/prism-python';\nimport 'prismjs/components/prism-http';\nimport 'prismjs/components/prism-csharp';\n\n// Styles\nimport FontStyles from '~/styles/font-styles';\nimport InputStyles from '~/styles/input-styles';\nimport FlexStyles from '~/styles/flex-styles';\nimport TableStyles from '~/styles/table-styles';\nimport PrismStyles from '~/styles/prism-styles';\nimport TabStyles from '~/styles/tab-styles';\nimport NavStyles from '~/styles/nav-styles';\nimport InfoStyles from '~/styles/info-styles';\n\nimport EndpointStyles from '~/styles/endpoint-styles';\nimport { rapidocApiKey } from '~/utils/common-utils';\nimport ProcessSpec from '~/utils/spec-parser';\nimport mainBodyTemplate from '~/templates/main-body-template';\nimport { applyApiKey, onClearAllApiKeys } from '~/templates/security-scheme-template';\nimport { setApiServer } from '~/templates/server-template';\n\nexport default class RapiDocMini extends LitElement {\n constructor() {\n super();\n this.isMini = true;\n this.updateRoute = 'false';\n this.renderStyle = 'view';\n this.showHeader = 'false';\n this.allowAdvancedSearch = 'false';\n }\n\n static get properties() {\n return {\n // Spec\n specUrl: { type: String, attribute: 'spec-url' },\n sortEndpointsBy: { type: String, attribute: 'sort-endpoints-by' },\n\n // UI Layouts\n layout: { type: String },\n pathsExpanded: { type: String, attribute: 'paths-expanded' },\n defaultSchemaTab: { type: String, attribute: 'default-schema-tab' },\n responseAreaHeight: { type: String, attribute: 'response-area-height' },\n showSummaryWhenCollapsed: { type: String, attribute: 'show-summary-when-collapsed' },\n fillRequestFieldsWithExample: { type: String, attribute: 'fill-request-fields-with-example' },\n persistAuth: { type: String, attribute: 'persist-auth' },\n\n // Schema Styles\n schemaStyle: { type: String, attribute: 'schema-style' },\n schemaExpandLevel: { type: Number, attribute: 'schema-expand-level' },\n schemaDescriptionExpanded: { type: String, attribute: 'schema-description-expanded' },\n\n // API Server\n apiKeyName: { type: String, attribute: 'api-key-name' },\n apiKeyLocation: { type: String, attribute: 'api-key-location' },\n apiKeyValue: { type: String, attribute: 'api-key-value' },\n defaultApiServerUrl: { type: String, attribute: 'default-api-server' },\n serverUrl: { type: String, attribute: 'server-url' },\n oauthReceiver: { type: String, attribute: 'oauth-receiver' },\n\n allowTry: { type: String, attribute: 'allow-try' },\n\n // Main Colors and Font\n theme: { type: String },\n bgColor: { type: String, attribute: 'bg-color' },\n textColor: { type: String, attribute: 'text-color' },\n primaryColor: { type: String, attribute: 'primary-color' },\n fontSize: { type: String, attribute: 'font-size' },\n regularFont: { type: String, attribute: 'regular-font' },\n monoFont: { type: String, attribute: 'mono-font' },\n mediumFont: { type: String, attribute: 'medium-font' },\n loadFonts: { type: String, attribute: 'load-fonts' },\n\n // Fetch Options\n fetchCredentials: { type: String, attribute: 'fetch-credentials' },\n\n // Filters\n matchPaths: { type: String, attribute: 'match-paths' },\n matchType: { type: String, attribute: 'match-type' },\n\n // Internal Properties\n loading: { type: Boolean }, // indicates spec is being loaded\n };\n }\n\n static get styles() {\n return [\n FontStyles,\n InputStyles,\n FlexStyles,\n TableStyles,\n EndpointStyles,\n PrismStyles,\n TabStyles,\n NavStyles,\n InfoStyles,\n css`\n :host {\n display:flex;\n flex-direction: column;\n min-width:360px;\n width:100%;\n height:100%;\n margin:0;\n padding:0;\n overflow: hidden;\n letter-spacing:normal;\n color:var(--fg);\n background-color:var(--bg);\n font-family:var(--font-regular);\n }\n\n @media only screen and (min-width: 768px) {\n .only-large-screen{\n display:block;\n }\n .only-large-screen-flex{\n display:flex;\n }\n }`,\n ];\n }\n\n // Startup\n connectedCallback() {\n super.connectedCallback();\n\n if (this.loadFonts !== 'false') {\n const fontDescriptor = {\n family: 'Open Sans',\n style: 'normal',\n weight: '300',\n unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD',\n };\n const fontWeight300 = new FontFace(\n 'Open Sans',\n \"url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UN_r8OUuhpKKSTjw.woff2) format('woff2')\",\n fontDescriptor,\n );\n fontDescriptor.weight = '600';\n const fontWeight600 = new FontFace(\n 'Open Sans',\n \"url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UNirkOUuhpKKSTjw.woff2) format('woff2')\",\n fontDescriptor,\n );\n fontWeight300.load().then((font) => { document.fonts.add(font); });\n fontWeight600.load().then((font) => { document.fonts.add(font); });\n }\n\n if (!this.showSummaryWhenCollapsed || !'true, false,'.includes(`${this.showSummaryWhenCollapsed},`)) { this.showSummaryWhenCollapsed = 'true'; }\n if (!this.layout || !'row, column,'.includes(`${this.layout},`)) { this.layout = 'row'; }\n if (!this.schemaStyle || !'tree, table,'.includes(`${this.schemaStyle},`)) { this.schemaStyle = 'tree'; }\n if (!this.theme || !'light, dark,'.includes(`${this.theme},`)) {\n this.theme = (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) ? 'light' : 'dark';\n }\n if (!this.defaultSchemaTab || !'example, schema, model,'.includes(`${this.defaultSchemaTab},`)) {\n this.defaultSchemaTab = 'example';\n } else if (this.defaultSchemaTab === 'model') {\n this.defaultSchemaTab = 'schema';\n }\n this.pathsExpanded = this.pathsExpanded === 'true';\n if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) { this.schemaExpandLevel = 99999; }\n if (!this.schemaDescriptionExpanded || !'true, false,'.includes(`${this.schemaDescriptionExpanded},`)) { this.schemaDescriptionExpanded = 'false'; }\n if (!this.fillRequestFieldsWithExample || !'true, false,'.includes(`${this.fillRequestFieldsWithExample},`)) { this.fillRequestFieldsWithExample = 'true'; }\n if (!this.persistAuth || !'true, false,'.includes(`${this.persistAuth},`)) { this.persistAuth = 'false'; }\n if (!this.responseAreaHeight) { this.responseAreaHeight = '300px'; }\n\n if (!this.allowTry || !'true, false,'.includes(`${this.allowTry},`)) { this.allowTry = 'true'; }\n if (!this.apiKeyValue) { this.apiKeyValue = '-'; }\n if (!this.apiKeyLocation) { this.apiKeyLocation = 'header'; }\n if (!this.apiKeyName) { this.apiKeyName = ''; }\n\n if (!this.oauthReceiver) { this.oauthReceiver = 'oauth-receiver.html'; }\n if (!this.sortTags || !'true, false,'.includes(`${this.sortTags},`)) { this.sortTags = 'false'; }\n if (!this.sortEndpointsBy || !'method, path, summary,'.includes(`${this.sortEndpointsBy},`)) { this.sortEndpointsBy = 'path'; }\n if (!this.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) { this.fontSize = 'default'; }\n if (!this.matchType || !'includes regex'.includes(this.matchType)) { this.matchType = 'includes'; }\n\n if (!this.allowSchemaDescriptionExpandToggle || !'true, false,'.includes(`${this.allowSchemaDescriptionExpandToggle},`)) { this.allowSchemaDescriptionExpandToggle = 'true'; }\n if (!this.fetchCredentials || !'omit, same-origin, include,'.includes(`${this.fetchCredentials},`)) { this.fetchCredentials = ''; }\n\n marked.setOptions({\n highlight: (code, lang) => {\n if (lang === 'curl') lang = 'bash';\n if (Prism.languages[lang]) {\n return Prism.highlight(code, Prism.languages[lang], lang);\n }\n return code;\n },\n });\n }\n\n render() {\n return mainBodyTemplate.call(this, true, false, false, this.pathsExpanded);\n }\n\n attributeChangedCallback(name, oldVal, newVal) {\n if (name === 'spec-url') {\n if (oldVal !== newVal) {\n // put it at the end of event-loop to load all the attributes\n window.setTimeout(async () => {\n await this.loadSpec(newVal);\n }, 0);\n }\n }\n if (name === 'api-key-name' || name === 'api-key-location' || name === 'api-key-value') {\n let updateSelectedApiKey = false;\n let apiKeyName = '';\n let apiKeyLocation = '';\n let apiKeyValue = '';\n\n if (name === 'api-key-name') {\n if (this.getAttribute('api-key-location') && this.getAttribute('api-key-value')) {\n apiKeyName = newVal;\n apiKeyLocation = this.getAttribute('api-key-location');\n apiKeyValue = this.getAttribute('api-key-value');\n updateSelectedApiKey = true;\n }\n } else if (name === 'api-key-location') {\n if (this.getAttribute('api-key-name') && this.getAttribute('api-key-value')) {\n apiKeyLocation = newVal;\n apiKeyName = this.getAttribute('api-key-name');\n apiKeyValue = this.getAttribute('api-key-value');\n updateSelectedApiKey = true;\n }\n } else if (name === 'api-key-value') {\n if (this.getAttribute('api-key-name') && this.getAttribute('api-key-location')) {\n apiKeyValue = newVal;\n apiKeyLocation = this.getAttribute('api-key-location');\n apiKeyName = this.getAttribute('api-key-name');\n updateSelectedApiKey = true;\n }\n }\n\n if (updateSelectedApiKey) {\n if (this.resolvedSpec) {\n const rapiDocApiKey = this.resolvedSpec.securitySchemes.find((v) => v.securitySchemeId === rapidocApiKey);\n if (!rapiDocApiKey) {\n this.resolvedSpec.securitySchemes.push({\n apiKeyId: rapidocApiKey,\n description: 'api-key provided in rapidoc element attributes',\n type: 'apiKey',\n name: apiKeyName,\n in: apiKeyLocation,\n value: apiKeyValue,\n finalKeyValue: apiKeyValue,\n });\n } else {\n rapiDocApiKey.name = apiKeyName;\n rapiDocApiKey.in = apiKeyLocation;\n rapiDocApiKey.value = apiKeyValue;\n rapiDocApiKey.finalKeyValue = apiKeyValue;\n }\n this.requestUpdate();\n }\n }\n }\n super.attributeChangedCallback(name, oldVal, newVal);\n }\n\n onSpecUrlChange() {\n this.setAttribute('spec-url', this.shadowRoot.getElementById('spec-url').value);\n }\n\n // Public Method\n async loadSpec(specUrl) {\n if (!specUrl) {\n return;\n }\n try {\n this.resolvedSpec = {\n specLoadError: false,\n isSpecLoading: true,\n tags: [],\n };\n this.loading = true;\n this.loadFailed = false;\n this.requestUpdate();\n const spec = await ProcessSpec.call(\n this,\n specUrl,\n this.generateMissingTags === 'true',\n this.sortTags === 'true',\n this.getAttribute('sort-endpoints-by'),\n this.getAttribute('api-key-name'),\n this.getAttribute('api-key-location'),\n this.getAttribute('api-key-value'),\n this.getAttribute('server-url'),\n );\n this.loading = false;\n this.afterSpecParsedAndValidated(spec);\n } catch (err) {\n this.loading = false;\n this.loadFailed = true;\n this.resolvedSpec = null;\n console.error(`RapiDoc: Unable to resolve the API spec.. ${err.message}`); // eslint-disable-line no-console\n }\n }\n\n // Public Method - to update security-scheme of type http\n setHttpUserNameAndPassword(securitySchemeId, username, password) {\n return applyApiKey.call(this, securitySchemeId, username, password);\n }\n\n // Public Method - to update security-scheme of type apiKey or OAuth\n setApiKey(securitySchemeId, apiKeyValue) {\n return applyApiKey.call(this, securitySchemeId, '', '', apiKeyValue);\n }\n\n // Public Method\n removeAllSecurityKeys() {\n return onClearAllApiKeys.call(this);\n }\n\n // Public Method\n setApiServer(apiServerUrl) {\n // return apiServerUrl;\n return setApiServer.call(this, apiServerUrl);\n }\n\n async afterSpecParsedAndValidated(spec) {\n this.resolvedSpec = spec;\n this.selectedServer = undefined;\n if (this.defaultApiServerUrl) {\n if (this.defaultApiServerUrl === this.serverUrl) {\n this.selectedServer = {\n url: this.serverUrl,\n computedUrl: this.serverUrl,\n };\n } else if (this.resolvedSpec.servers) {\n this.selectedServer = this.resolvedSpec.servers.find((v) => (v.url === this.defaultApiServerUrl));\n }\n }\n if (!this.selectedServer) {\n if (this.resolvedSpec.servers) {\n this.selectedServer = this.resolvedSpec.servers[0]; // eslint-disable-line prefer-destructuring\n }\n }\n this.requestUpdate();\n // eslint-disable-next-line no-await-in-loop\n while (!await this.updateComplete);\n const specLoadedEvent = new CustomEvent('spec-loaded', { detail: spec });\n this.dispatchEvent(specLoadedEvent);\n }\n\n // Called by anchor tags created using markdown\n handleHref(e) {\n if (e.target.tagName.toLowerCase() === 'a') {\n if (e.target.getAttribute('href').startsWith('#')) {\n const gotoEl = this.shadowRoot.getElementById(e.target.getAttribute('href').replace('#', ''));\n if (gotoEl) {\n gotoEl.scrollIntoView({ behavior: 'auto', block: 'start' });\n }\n }\n }\n }\n}\nif (!customElements.get('rapi-doc-mini')) customElements.define('rapi-doc-mini', RapiDocMini);\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\n\n// Templates\nimport overviewTemplate from '~/templates/overview-template';\nimport headerTemplate from '~/templates/header-template';\nimport { schemaInObjectNotation, generateExample } from '~/utils/schema-utils';\nimport '~/components/json-tree';\nimport '~/components/schema-tree';\nimport SetTheme from '~/utils/theme';\nimport { isValidHexColor } from '~/utils/color-utils';\n\n/* eslint-disable indent */\n// Json Schema Nav Template\nfunction jsonSchemaNavTemplate() {\n return html`\n \n `;\n}\n\n// Json Schema Body Template\nfunction jsonSchemaBodyTemplate() {\n return html`\n ${this.showInfo === 'true' ? overviewTemplate.call(this) : ''}\n
\n ${this.resolvedSpec.schemaAndExamples.map((jSchemaBody) => {\n const examplesObj = generateExample(jSchemaBody.schema, 'json', jSchemaBody.examples, jSchemaBody.example, true, false, 'json', true);\n jSchemaBody.selectedExample = examplesObj[0]?.exampleId;\n return html`\n
\n
\n
${jSchemaBody.name}
\n ${unsafeHTML(marked(jSchemaBody.description || ''))}\n
\n
\n
\n \n
\n
\n ${examplesObj.length > 1\n ? html``\n : html`
${examplesObj[0].exampleSummary}
`\n }\n ${examplesObj.map((v) => html`\n `)\n }\n
\n
\n
`;\n })\n }\n
\n `;\n}\n/* eslint-enable indent */\n\n// Json Schema Root Template\nexport default function jsonSchemaViewerTemplate(isMini = false) {\n// export default function jsonSchemaViewerTemplate(isMini = false, showExpandCollapse = true, showTags = true, pathsExpanded = false) {\n if (!this.resolvedSpec) {\n return '';\n }\n const newTheme = {\n bg1: isValidHexColor(this.bgColor) ? this.bgColor : '',\n fg1: isValidHexColor(this.textColor) ? this.textColor : '',\n headerColor: isValidHexColor(this.headerColor) ? this.headerColor : '',\n primaryColor: isValidHexColor(this.primaryColor) ? this.primaryColor : '',\n navBgColor: isValidHexColor(this.navBgColor) ? this.navBgColor : '',\n navTextColor: isValidHexColor(this.navTextColor) ? this.navTextColor : '',\n navHoverBgColor: isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',\n navHoverTextColor: isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : '',\n navAccentColor: isValidHexColor(this.navAccentColor) ? this.navAccentColor : '',\n navAccenttextColor: isValidHexColor(this.navAccentTextColor) ? this.navAccentTextColor : '',\n };\n /* eslint-disable indent */\n if (this.resolvedSpec.specLoadError) {\n if (isMini) {\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n
${this.resolvedSpec.info.description}
\n `;\n }\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n \n ${headerTemplate.call(this)}\n

Header

\n
\n \n
\n

${this.resolvedSpec.info.title}

\n
${this.resolvedSpec.info.description}
\n
\n
\n `;\n }\n if (this.resolvedSpec.isSpecLoading) {\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n
\n \n
\n
\n
\n
\n `;\n }\n\n return html`\n ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}\n\n \n ${this.showHeader === 'false' ? '' : headerTemplate.call(this)}\n \n
\n\n \n ${jsonSchemaNavTemplate.call(this)}\n\n \n
\n \n
\n ${this.loading === true\n ? html`
`\n : html`\n ${this.loadFailed === true\n ? html`
Unable to load the Spec
`\n : html`\n
{ this.handleHref(e); }}\">\n ${jsonSchemaBodyTemplate.call(this)}\n
\n `\n }`\n }\n
\n \n
\n
\n `;\n}\n/* eslint-enable indent */\n","import { css, LitElement } from 'lit';\nimport { marked } from 'marked';\nimport Prism from 'prismjs';\nimport 'prismjs/components/prism-css';\nimport 'prismjs/components/prism-yaml';\nimport 'prismjs/components/prism-go';\nimport 'prismjs/components/prism-java';\nimport 'prismjs/components/prism-json';\nimport 'prismjs/components/prism-bash';\nimport 'prismjs/components/prism-python';\nimport 'prismjs/components/prism-http';\nimport 'prismjs/components/prism-csharp';\n\n// Styles\nimport FontStyles from '~/styles/font-styles';\nimport InputStyles from '~/styles/input-styles';\nimport FlexStyles from '~/styles/flex-styles';\nimport TableStyles from '~/styles/table-styles';\nimport PrismStyles from '~/styles/prism-styles';\nimport TabStyles from '~/styles/tab-styles';\nimport NavStyles from '~/styles/nav-styles';\nimport InfoStyles from '~/styles/info-styles';\n\nimport EndpointStyles from '~/styles/endpoint-styles';\nimport ProcessSpec from '~/utils/spec-parser';\nimport jsonSchemaViewerTemplate from '~/templates/json-schema-viewer-template';\n\nexport default class JsonSchemaViewer extends LitElement {\n constructor() {\n super();\n this.isMini = false;\n this.updateRoute = 'false';\n this.renderStyle = 'focused';\n this.showHeader = 'true';\n this.allowAdvancedSearch = 'false';\n this.selectedExampleForEachSchema = {};\n }\n\n static get properties() {\n return {\n // Spec\n specUrl: { type: String, attribute: 'spec-url' },\n\n // Schema Styles\n schemaStyle: { type: String, attribute: 'schema-style' },\n schemaExpandLevel: { type: Number, attribute: 'schema-expand-level' },\n schemaDescriptionExpanded: { type: String, attribute: 'schema-description-expanded' },\n allowSchemaDescriptionExpandToggle: { type: String, attribute: 'allow-schema-description-expand-toggle' },\n\n // Hide/show Sections\n showHeader: { type: String, attribute: 'show-header' },\n showSideNav: { type: String, attribute: 'show-side-nav' },\n showInfo: { type: String, attribute: 'show-info' },\n\n // Allow or restrict features\n allowSpecUrlLoad: { type: String, attribute: 'allow-spec-url-load' },\n allowSpecFileLoad: { type: String, attribute: 'allow-spec-file-load' },\n allowSpecFileDownload: { type: String, attribute: 'allow-spec-file-download' },\n allowSearch: { type: String, attribute: 'allow-search' },\n\n // Main Colors and Font\n theme: { type: String },\n bgColor: { type: String, attribute: 'bg-color' },\n textColor: { type: String, attribute: 'text-color' },\n primaryColor: { type: String, attribute: 'primary-color' },\n fontSize: { type: String, attribute: 'font-size' },\n regularFont: { type: String, attribute: 'regular-font' },\n monoFont: { type: String, attribute: 'mono-font' },\n loadFonts: { type: String, attribute: 'load-fonts' },\n\n // Internal Properties\n loading: { type: Boolean }, // indicates spec is being loaded\n };\n }\n\n static get styles() {\n return [\n FontStyles,\n InputStyles,\n FlexStyles,\n TableStyles,\n EndpointStyles,\n PrismStyles,\n TabStyles,\n NavStyles,\n InfoStyles,\n css`\n :host {\n display:flex;\n flex-direction: column;\n min-width:360px;\n width:100%;\n height:100%;\n margin:0;\n padding:0;\n overflow: hidden;\n letter-spacing:normal;\n color:var(--fg);\n background-color:var(--bg);\n font-family:var(--font-regular);\n }\n .body {\n display:flex;\n height:100%;\n width:100%;\n overflow:hidden;\n }\n .nav-bar {\n width: 230px;\n display:flex;\n }\n\n .main-content { \n margin:0;\n padding: 16px; \n display:block;\n flex:1;\n height:100%;\n overflow-y: auto;\n overflow-x: hidden;\n scrollbar-width: thin;\n scrollbar-color: var(--border-color) transparent;\n }\n .main-content-inner--view-mode {\n padding: 0 8px;\n }\n .main-content::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n .main-content::-webkit-scrollbar-track {\n background:transparent;\n }\n .main-content::-webkit-scrollbar-thumb {\n background-color: var(--border-color);\n }\n .main-header {\n background-color:var(--header-bg);\n color:var(--header-fg);\n width:100%;\n }\n .header-title {\n font-size:calc(var(--font-size-regular) + 8px); \n padding:0 8px;\n }\n input.header-input{\n background:var(--header-color-darker);\n color:var(--header-fg);\n border:1px solid var(--header-color-border);\n flex:1; \n padding-right:24px;\n border-radius:3px;\n }\n input.header-input::placeholder {\n opacity:0.4;\n }\n .loader {\n margin: 16px auto 16px auto; \n border: 4px solid var(--bg3);\n border-radius: 50%;\n border-top: 4px solid var(--primary-color);\n width: 36px;\n height: 36px;\n animation: spin 2s linear infinite;\n }\n @media only screen and (min-width: 768px) {\n .only-large-screen{\n display:block;\n }\n .only-large-screen-flex{\n display:flex;\n }\n }`,\n ];\n }\n\n // Startup\n connectedCallback() {\n super.connectedCallback();\n const parent = this.parentElement;\n if (parent) {\n if (parent.offsetWidth === 0 && parent.style.width === '') {\n parent.style.width = '100vw';\n }\n if (parent.offsetHeight === 0 && parent.style.height === '') {\n parent.style.height = '100vh';\n }\n if (parent.tagName === 'BODY') {\n if (!parent.style.marginTop) { parent.style.marginTop = '0'; }\n if (!parent.style.marginRight) { parent.style.marginRight = '0'; }\n if (!parent.style.marginBottom) { parent.style.marginBottom = '0'; }\n if (!parent.style.marginLeft) { parent.style.marginLeft = '0'; }\n }\n }\n\n if (this.loadFonts !== 'false') {\n const fontDescriptor = {\n family: 'Open Sans',\n style: 'normal',\n weight: '300',\n unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD',\n };\n const fontWeight300 = new FontFace(\n 'Open Sans',\n \"url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UN_r8OUuhpKKSTjw.woff2) format('woff2')\",\n fontDescriptor,\n );\n fontDescriptor.weight = '600';\n const fontWeight600 = new FontFace(\n 'Open Sans',\n \"url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UNirkOUuhpKKSTjw.woff2) format('woff2')\",\n fontDescriptor,\n );\n fontWeight300.load().then((font) => { document.fonts.add(font); });\n fontWeight600.load().then((font) => { document.fonts.add(font); });\n }\n\n this.renderStyle = 'focused';\n this.pathsExpanded = this.pathsExpanded === 'true';\n\n if (!this.showInfo || !'true, false,'.includes(`${this.showInfo},`)) { this.showInfo = 'true'; }\n if (!this.showSideNav || !'true false'.includes(this.showSideNav)) { this.showSideNav = 'true'; }\n if (!this.showHeader || !'true, false,'.includes(`${this.showHeader},`)) { this.showHeader = 'true'; }\n\n if (!this.schemaStyle || !'tree, table,'.includes(`${this.schemaStyle},`)) { this.schemaStyle = 'tree'; }\n if (!this.theme || !'light, dark,'.includes(`${this.theme},`)) {\n this.theme = (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) ? 'light' : 'dark';\n }\n if (!this.allowSearch || !'true, false,'.includes(`${this.allowSearch},`)) { this.allowSearch = 'true'; }\n if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) { this.schemaExpandLevel = 99999; }\n if (!this.schemaDescriptionExpanded || !'true, false,'.includes(`${this.schemaDescriptionExpanded},`)) { this.schemaDescriptionExpanded = 'false'; }\n if (!this.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) { this.fontSize = 'default'; }\n if (!this.matchType || !'includes regex'.includes(this.matchType)) { this.matchType = 'includes'; }\n if (!this.allowSchemaDescriptionExpandToggle || !'true, false,'.includes(`${this.allowSchemaDescriptionExpandToggle},`)) { this.allowSchemaDescriptionExpandToggle = 'true'; }\n\n marked.setOptions({\n highlight: (code, lang) => {\n if (lang === 'curl') lang = 'bash';\n if (Prism.languages[lang]) {\n return Prism.highlight(code, Prism.languages[lang], lang);\n }\n return code;\n },\n });\n }\n\n render() {\n return jsonSchemaViewerTemplate.call(this, true, false, false, this.pathsExpanded);\n }\n\n attributeChangedCallback(name, oldVal, newVal) {\n if (name === 'spec-url') {\n if (oldVal !== newVal) {\n // put it at the end of event-loop to load all the attributes\n window.setTimeout(async () => {\n await this.loadSpec(newVal);\n }, 0);\n }\n }\n super.attributeChangedCallback(name, oldVal, newVal);\n }\n\n onSpecUrlChange() {\n this.setAttribute('spec-url', this.shadowRoot.getElementById('spec-url').value);\n }\n\n onSearchChange(e) {\n // Todo: Filter Search\n this.matchPaths = e.target.value;\n }\n\n // Public Method\n async loadSpec(specUrl) {\n if (!specUrl) {\n return;\n }\n try {\n this.resolvedSpec = {\n specLoadError: false,\n isSpecLoading: true,\n tags: [],\n };\n this.loading = true;\n this.loadFailed = false;\n this.requestUpdate();\n const spec = await ProcessSpec.call(\n this,\n specUrl,\n this.generateMissingTags === 'true',\n this.sortTags === 'true',\n this.getAttribute('sort-endpoints-by'),\n );\n this.loading = false;\n this.afterSpecParsedAndValidated(spec);\n } catch (err) {\n this.loading = false;\n this.loadFailed = true;\n this.resolvedSpec = null;\n console.error(`RapiDoc: Unable to resolve the API spec.. ${err.message}`); // eslint-disable-line no-console\n }\n }\n\n async afterSpecParsedAndValidated(spec) {\n this.resolvedSpec = spec;\n const specLoadedEvent = new CustomEvent('spec-loaded', { detail: spec });\n this.dispatchEvent(specLoadedEvent);\n }\n\n // Called by anchor tags created using markdown\n handleHref(e) {\n if (e.target.tagName.toLowerCase() === 'a') {\n if (e.target.getAttribute('href').startsWith('#')) {\n const gotoEl = this.shadowRoot.getElementById(e.target.getAttribute('href').replace('#', ''));\n if (gotoEl) {\n gotoEl.scrollIntoView({ behavior: 'auto', block: 'start' });\n }\n }\n }\n }\n\n // Example Dropdown @change Handler\n onSelectExample(e) {\n const exampleContainerEl = e.target.closest('.json-schema-example-panel');\n const exampleEls = [...exampleContainerEl.querySelectorAll('.example')];\n exampleEls.forEach((v) => {\n v.style.display = v.dataset.example === e.target.value ? 'flex' : 'none';\n });\n }\n\n async scrollToEventTarget(event) {\n const navEl = event.currentTarget;\n if (!navEl.dataset.contentId) {\n return;\n }\n const contentEl = this.shadowRoot.getElementById(navEl.dataset.contentId);\n if (contentEl) {\n contentEl.scrollIntoView({ behavior: 'auto', block: 'start' });\n }\n }\n}\nif (!customElements.get('json-schema-viewer')) customElements.define('json-schema-viewer', JsonSchemaViewer);\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/dist/rapidoc.js b/dist/rapidoc.js index 1b901cb83..566b0ff95 100644 --- a/dist/rapidoc.js +++ b/dist/rapidoc.js @@ -22322,7 +22322,7 @@ class ApiRequest extends lit_element_s {
${this.codeExampleTemplate('flex')} -
+
${this.responseMessage ? lit_html_x`
@@ -25885,7 +25885,7 @@ class RapiDoc extends lit_element_s { } .expanded-endpoint-body { position: relative; - padding: 6px 0px; + padding: 0px; } .expanded-endpoint-body .tag-description { background: var(--code-bg); @@ -25986,7 +25986,7 @@ class RapiDoc extends lit_element_s { padding: 24px 8px; } .section-gap--read-mode { - padding: 24px 8px; + padding: 0px 80px; } .endpoint-body { position: relative; @@ -26007,10 +26007,10 @@ class RapiDoc extends lit_element_s { display:flex; } .section-gap--focused-mode { - padding: 12px 80px 12px 80px; + padding: 0px 0px 12px 80px; } .section-gap--read-mode { - padding: 24px 80px 12px 80px; + padding: 0px 80px; } }`, custom_styles]; } @@ -65556,8 +65556,8 @@ var PT = function PT(str) { }; var vatMatchers = { - /** - * European Union VAT identification numbers + /** + * European Union VAT identification numbers */ AT: function AT(str) { return /^(AT)?U\d{8}$/.test(str); @@ -65639,8 +65639,8 @@ var vatMatchers = { return /^(SE)?\d{12}$/.test(str); }, - /** - * VAT numbers of non-EU countries + /** + * VAT numbers of non-EU countries */ AL: function AL(str) { return /^(AL)?\w{9}[A-Z]$/.test(str); @@ -65712,8 +65712,8 @@ var vatMatchers = { return /^(UZ)?\d{9}$/.test(str); }, - /** - * VAT numbers of Latin American countries + /** + * VAT numbers of Latin American countries */ AR: function AR(str) { return /^(AR)?\d{11}$/.test(str); diff --git a/src/components/api-dropdown-actions.js b/src/components/api-dropdown-actions.js new file mode 100644 index 000000000..6cda1cb93 --- /dev/null +++ b/src/components/api-dropdown-actions.js @@ -0,0 +1,195 @@ +import { LitElement, css, html } from 'lit' +import postmanIcon from './assets/postman-icon' +import openapiIcon from './assets/openapi-icon' +import iconCaret from './assets/icon-caret' +import { downloadResource, viewResource } from '../utils/common-utils'; + +class ApiActionsMenu extends LitElement { + static properties = { + specUrl: { type: String }, + postmanUrl: { type: String }, + open: { type: Boolean, reflect: true }, + } + + constructor() { + super() + this.specUrl = '' + this.postmanUrl = '' + this.open = false + + // fechar ao clicar fora / ESC (opcional mas útil) + this._onDocClick = (e) => { + if (!this.open) return + const path = e.composedPath() + if (!path.includes(this)) this.open = false + } + this._onKeyDown = (e) => { + if (e.key === 'Escape') this.open = false + } + } + + connectedCallback() { + super.connectedCallback() + document.addEventListener('click', this._onDocClick) + document.addEventListener('keydown', this._onKeyDown, true) + } + + disconnectedCallback() { + document.removeEventListener('click', this._onDocClick) + document.removeEventListener('keydown', this._onKeyDown, true) + super.disconnectedCallback() + } + + static styles = css` + :host { + display: inline-flex; + position: relative; + } + + .main-btn { + font-family: var(--font-regular); + color: #4a596b; + display: flex; + align-items: center; + gap: 8px; + padding: 0px 8px; + height: 36px; + background: #fff; + border: 1px solid #e7e9ee; + border-radius: 4px 0 0 4px; + cursor: pointer; + border-right: none; + font-size: 12px; + } + + .main-btn:hover { + background: #f8fafc; + } + + .toggle-btn { + padding: 0px 4px; + background: #fff; + border: 1px solid #e7e9ee; + border-radius: 0 4px 4px 0; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + height: 36px; + width: 28px; + font-size: 12px; + } + + .toggle-btn:hover { + background: #f8fafc; + } + + .menu { + position: absolute; + top: calc(100% + 6px); + right: 0; + background: #fff; + border: 1px solid #e5e7eb; + border-radius: 8px; + box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08); + min-width: 240px; + z-index: 100; + } + + .item { + display: flex; + align-items: center; + gap: 8px; + width: 100%; + background: none; + border: 0; + text-align: left; + padding: 8px; + cursor: pointer; + font-size: 12px; + color: #4a596b; + font-family: var(--font-regular); + height: 40px; + } + + .item:hover { + background: #f3f4f6; + } + + .divider { + height: 1px; + background: #e5e7eb; + } + + .caret { + display: flex; + align-items: center; + justify-content: center; + transition: none; + } + + :host([open]) .caret { + transform: rotate(180deg); + } + ` + + _toggleMenu() { + this.open = !this.open + } + + render() { + return html` + + + + + ${this.open + ? html` + + ` + : null} + ` + } +} + +customElements.define('api-dropdown-actions', ApiActionsMenu) diff --git a/src/components/api-request.js b/src/components/api-request.js index 145b440b4..33d2b466d 100644 --- a/src/components/api-request.js +++ b/src/components/api-request.js @@ -14,6 +14,7 @@ import PrismStyles from '../styles/prism-styles'; import PrismLanguagesStyles from '../styles/prism-languages-styles'; import CustomStyles from '../styles/custom-styles'; import { copyToClipboard, downloadResource, viewResource } from '../utils/common-utils'; +import { joinURLandPath } from '../utils/url'; import { schemaInObjectNotation, getTypeInfo, generateExample, @@ -31,6 +32,10 @@ import securitySchemeTemplate from '../templates/security-scheme-template'; import languagePickerTemplate from '../templates/language-picker-template'; import updateCodeExample from '../utils/update-code-example'; import copySymbol from './assets/copy-symbol'; +import checkSymbol from './assets/check-symbol'; +import playIcon from './assets/play-icon'; +import trashIcon from './assets/trash-icon'; +import "./api-dropdown-actions" export default class ApiRequest extends LitElement { constructor() { @@ -50,6 +55,7 @@ export default class ApiRequest extends LitElement { this.activeParameterSchemaTabs = {}; this.showCurlBeforeTry = true; this.selectedLanguage = 'shell'; + this._copied = false; } static get properties() { @@ -61,6 +67,11 @@ export default class ApiRequest extends LitElement { servers: { type: Array }, method: { type: String }, path: { type: String }, + pathDescription: { type: String, attribute: 'path-description' }, + shortSummary: { type: String, attribute: 'short-summary' }, + tagName: { type: String, attribute: 'tag-name' }, + responses: { type: Object }, + defaultSchemaTab: { type: String, attribute: 'default-schema-tab' }, security: { type: Array }, parameters: { type: Array }, request_body: { type: Object }, @@ -105,8 +116,13 @@ export default class ApiRequest extends LitElement { selectedLanguage: { type: String }, // open-api file download + postmanUrl: { type: String, attribute: 'postman-url' }, specUrl: { type: String, attribute: 'spec-url' }, allowSpecFileDownload: { type: String, attribute: 'allow-spec-file-download' }, + + _copied: { state: true }, + codeExample: { type: String }, + selectedLanguage: { type: String }, }; } @@ -125,10 +141,6 @@ export default class ApiRequest extends LitElement { :where(button, input[type="checkbox"], [tabindex="0"]):focus-visible { box-shadow: var(--focus-shadow); } :where(input[type="text"], input[type="password"], select, textarea):focus-visible { border-color: var(--primary-color); } tag-input:focus-within { outline: 1px solid;} - .read-mode { - border-top: 1px solid #E7E9EE; - margin-top: 24px; - } .param-name { font-size: 14px; @@ -239,15 +251,62 @@ export default class ApiRequest extends LitElement { } render() { + const docUrl = `https://developers.vtex.com/docs/api-reference/${this.specUrl.split('/').filter(Boolean).pop()}`; + return html`
+
+
+ ${(this.renderStyle === 'focused' && this.tagName !== 'General ⦂') ? html` +

${this.resolvedSpec.info.title} › ${this.tagName}

+ ` : ''} +
+ + + +
+ +

${this.shortSummary || `${this.method.toUpperCase()} ${this.path}`}

+ ${this.webhook === 'true' + ? html` WEBHOOK ` + : html` +
+
+ ${this.method} +
+
+ +
+
+ ` + } + ${this.pathDescription ? html`
${unsafeHTML(marked(this.pathDescription))}
` : ''} ${guard([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('path'))} ${guard([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('query'))} ${this.requestBodyTemplate()} ${guard([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('header'))} ${guard([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('cookie'))} ${this.allowTry === 'false' ? '' : html`${this.apiCallTemplate()}`} +
${languagePickerTemplate.call(this)} @@ -554,7 +613,7 @@ export default class ApiRequest extends LitElement { >
-
+
${tableRows} @@ -1026,11 +1085,31 @@ export default class ApiRequest extends LitElement { `; } + async _copyCode(code) { + try { + await navigator.clipboard.writeText(code); + this._copied = true; + setTimeout(() => (this._copied = false), 3000); + } catch (err) { + console.error('Unable to copy', err); + } + } + codeExampleTemplate(display = 'flex') { + const code = this.codeExample.replace(/\\$/, ''); return html`
- -
${unsafeHTML(Prism.highlight(this.codeExample.trim().replace(/\\$/, ''), Prism.languages[this.selectedLanguage], this.selectedLanguage))}
+ +
${unsafeHTML(Prism.highlight(this.codeExample.trim().replace(/\\$/, ''), Prism.languages[this.selectedLanguage], this.selectedLanguage))}
`; } @@ -1055,11 +1134,9 @@ export default class ApiRequest extends LitElement { } } return html` - - -
+
${this.codeExampleTemplate('flex')} -
+
${this.responseMessage ? html`
@@ -1081,7 +1158,7 @@ export default class ApiRequest extends LitElement {
` : html` ${this.responseText ? html` -
+
${responseContent}
` @@ -1089,6 +1166,10 @@ export default class ApiRequest extends LitElement { }` }
+
+
+ +
`; } diff --git a/src/components/assets/check-symbol.js b/src/components/assets/check-symbol.js index 0228af4b9..7f6ed8e7c 100644 --- a/src/components/assets/check-symbol.js +++ b/src/components/assets/check-symbol.js @@ -3,12 +3,23 @@ import { html } from 'lit'; /* eslint-disable indent */ export default function checkSymbol(dimensions) { - const width = dimensions?.width ?? 20; - const height = dimensions?.height ?? 20; + const width = dimensions?.width ?? 24 + const height = dimensions?.height ?? 24 return html` - - - - - `; + + + + ` } diff --git a/src/components/assets/copy-symbol.js b/src/components/assets/copy-symbol.js index 0ca94a6eb..1476400fb 100644 --- a/src/components/assets/copy-symbol.js +++ b/src/components/assets/copy-symbol.js @@ -3,10 +3,29 @@ import { html } from 'lit'; /* eslint-disable indent */ export default function copySymbol() { -return html` - - - - -`; + return html` + + + + + ` } diff --git a/src/components/assets/icon-caret.js b/src/components/assets/icon-caret.js new file mode 100644 index 000000000..29b8cd255 --- /dev/null +++ b/src/components/assets/icon-caret.js @@ -0,0 +1,25 @@ +/* eslint-disable max-len */ +import { html } from 'lit' + +/* eslint-disable indent */ +export default function iconCaret(dimensions) { + const width = dimensions?.width ?? 24 + const height = dimensions?.height ?? 24 + return html` + + + + ` +} diff --git a/src/components/assets/openapi-icon.js b/src/components/assets/openapi-icon.js index 85d44a044..38fb04100 100644 --- a/src/components/assets/openapi-icon.js +++ b/src/components/assets/openapi-icon.js @@ -1,48 +1,24 @@ /* eslint-disable no-tabs */ /* eslint-disable max-len */ -import { html } from 'lit'; +import { html } from 'lit' /* eslint-disable indent */ export default function openapiIcon(dimensions) { - const width = dimensions?.width ?? 16; - const height = dimensions?.height ?? 16; + const width = dimensions?.width ?? 14 + const height = dimensions?.height ?? 14 return html` -
- - - - - - - - - - - - -
- `; + + + + ` } diff --git a/src/components/assets/play-icon.js b/src/components/assets/play-icon.js new file mode 100644 index 000000000..c21b1b70d --- /dev/null +++ b/src/components/assets/play-icon.js @@ -0,0 +1,24 @@ +/* eslint-disable max-len */ +import { html } from 'lit'; + +/* eslint-disable indent */ +export default function playIcon(dimensions) { + const width = dimensions?.width ?? 12 + const height = dimensions?.height ?? 12 + return html` + + + + ` +} diff --git a/src/components/assets/postman-icon.js b/src/components/assets/postman-icon.js index 3dae6393d..f60ccc89f 100644 --- a/src/components/assets/postman-icon.js +++ b/src/components/assets/postman-icon.js @@ -1,111 +1,109 @@ /* eslint-disable max-len */ -import { html } from 'lit'; +import { html } from 'lit' /* eslint-disable indent */ export default function postmanIcon(dimensions) { - const width = dimensions?.width ?? 16; - const height = dimensions?.height ?? 16; + const width = dimensions?.width ?? 14 + const height = dimensions?.height ?? 14 return html` -
- - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - -
- `; + + + ` } diff --git a/src/components/assets/trash-icon.js b/src/components/assets/trash-icon.js new file mode 100644 index 000000000..2d2736283 --- /dev/null +++ b/src/components/assets/trash-icon.js @@ -0,0 +1,39 @@ +/* eslint-disable max-len */ +import { html } from 'lit'; + +/* eslint-disable indent */ +export default function copySymbol(dimensions) { + const width = dimensions?.width ?? 12 + const height = dimensions?.height ?? 12 + + return html` + + + + + + + + ` +} diff --git a/src/components/base-url.js b/src/components/base-url.js index 5ea6bd10a..4fc730d4d 100644 --- a/src/components/base-url.js +++ b/src/components/base-url.js @@ -95,11 +95,6 @@ export class BaseUrl extends LitElement {
- ${ - this.showToast - ? html`` - : '' - } `; } @@ -137,9 +132,9 @@ export class BaseUrl extends LitElement { } .container { - height: 42px; + height: 28px; font-size:14px; - border: 1px solid var(--border-color); + border: 1px solid #e7e9ee; border-radius: 4px; margin: 4px 0px; position: relative; diff --git a/src/components/content-copy-button.js b/src/components/content-copy-button.js index fedb626f2..0f419382c 100644 --- a/src/components/content-copy-button.js +++ b/src/components/content-copy-button.js @@ -70,11 +70,6 @@ export class ContentCopyButton extends LitElement {
- ${ - this.showToast - ? html`` - : '' - } `; } diff --git a/src/rapidoc.js b/src/rapidoc.js index e166af1c8..a4b1df1c6 100644 --- a/src/rapidoc.js +++ b/src/rapidoc.js @@ -179,7 +179,6 @@ export default class RapiDoc extends LitElement { display:flex; height:100%; width:100%; - overflow:hidden; max-width: 2087px; } .main-content { @@ -291,7 +290,7 @@ export default class RapiDoc extends LitElement { } .expanded-endpoint-body { position: relative; - padding: 6px 0px; + padding: 0px; } .expanded-endpoint-body .tag-description { background: var(--code-bg); @@ -392,7 +391,7 @@ export default class RapiDoc extends LitElement { padding: 24px 8px; } .section-gap--read-mode { - padding: 24px 8px; + padding: 0px 80px; } .endpoint-body { position: relative; @@ -400,23 +399,16 @@ export default class RapiDoc extends LitElement { } } - @media (min-width: 2560px) { - .body { - padding-left: 316px; - padding-right: 221px; - } - } - @media only screen and (min-width: 1024px) { .nav-bar { width: ${unsafeCSS(this.fontSize === 'default' ? '300px' : this.fontSize === 'large' ? '315px' : '330px')}; display:flex; } .section-gap--focused-mode { - padding: 12px 80px 12px 80px; + padding: 0px 0px 12px 80px; } .section-gap--read-mode { - padding: 24px 80px 12px 80px; + padding: 0px 80px; } }`, CustomStyles, diff --git a/src/styles/custom-styles.js b/src/styles/custom-styles.js index d7e429bf5..f30649e33 100644 --- a/src/styles/custom-styles.js +++ b/src/styles/custom-styles.js @@ -7,10 +7,12 @@ customize their theme. Simply add your css to this file and yarn build. export default css` .code-container { - tab-size: 4; + tab-size: 2; + padding-left: 32px !important; + padding-right: 32px !important; } -.code-container > code { - font-size: 14px; +.code-container * { + font-size: 12px !important; line-height: 20px; } @@ -30,7 +32,7 @@ export default css` font-size: 18px; font-weight: 400; line-height: 18px; - color: #4A4A4A; + color: #4a4a4a; } .label-operation-container { @@ -88,15 +90,15 @@ export default css` } .right-box-title { - color: #4A4A4A; - font-size: 18px; - line-height: 20px; - font-weight: 400; + color: #6b7785; + font-size: 12px; + font-weight: 600; + text-transform: uppercase; } .right-box-container { - margin-top: 16px; - padding-inline: 16px; + margin-top: 12px; + padding-inline: 12px; } .right-box-label { @@ -108,18 +110,18 @@ export default css` .right-box-input { width: 100%; - height: 44px; + height: 28px; } .right-box-content { - border: 1px solid rgb(204, 206, 216); + border: 1px solid #e7e9ee; border-radius: 4px; - padding-block: 24px; - margin-top: 24px; + padding-block: 10px; + margin-top: 8px; } .right-box-select { - padding-inline: 16px; + padding-inline: 8px; width: 100%; } @@ -154,8 +156,7 @@ export default css` flex-direction: row; justify-content: space-between; align-items: center; - - padding: 16px 0px; + padding: 8px 0px; gap: 5px; } @@ -248,9 +249,9 @@ export default css` border: 1px solid rgb(59, 59, 59); } -.data-example{ - background: #FFF3F6; - border: 1px solid #FFE0EF; +.data-example { + background: #fff3f6; + border: 1px solid #ffe0ef; border-radius: 4px; font-family: var(--font-mono); font-size: var(--font-size-small); @@ -258,13 +259,14 @@ export default css` padding: 0.2em 0.4em; } -.data-example:hover{ +.data-example:hover { border: 1px solid #ffb5cb; } .language-show-more:active { border-color: rgb(59, 59, 59); - box-shadow: rgb(255 255 255) 0px 0px 0px 1px, rgb(185 185 185) 0px 0px 0px 3px; + box-shadow: rgb(255 255 255) 0px 0px 0px 1px, + rgb(185 185 185) 0px 0px 0px 3px; } .more-languages-dropdown { @@ -281,6 +283,6 @@ export default css` z-index: 1; - transition: visibility 0.3s linear,opacity 0.3s linear; + transition: visibility 0.3s linear, opacity 0.3s linear; } `; diff --git a/src/styles/flex-styles.js b/src/styles/flex-styles.js index 8e034b7ed..3124de84f 100644 --- a/src/styles/flex-styles.js +++ b/src/styles/flex-styles.js @@ -9,7 +9,6 @@ export default css` } .row-api { flex: 1fr 1fr; - align-items: center; flex-direction: row; align-items: flex-start; justify-content: space-evenly; @@ -23,39 +22,40 @@ export default css` } .row-api-left { min-width: 288px; - max-width: 720px; flex: 2 1 0%; justify-content: flex-end; padding-right: 32px; + border-right: 1px solid #e7e9ee; } .row-api-right { min-width: 288px; - max-width: 702px; flex: 1; justify-content: flex-start; - border-left: 1px solid #E7E9EE; + position: sticky; + top: 0; + align-self: flex-start; } - .row-api-right-box{ - text-align:left; - direction:ltr; - margin-block: 32px 16px; + .row-api-right-box { + text-align: left; + direction: ltr; + margin-top: 24px; padding-left: 32px; + padding-right: 32px; } - .clear-btn{ - margin-left: 32px + .row-api-right-box:first-child { + margin-top: 12px; } - @media (max-width: 1280px) { .row-api { flex-direction: column; justify-content: flex-start; align-items: center; } - .row-api-right-box{ + .row-api-right-box { padding-left: 0px; } - .clear-btn{ - margin-left: 0px + .clear-btn { + margin-left: 0px; } .row-api-left, diff --git a/src/styles/font-styles.js b/src/styles/font-styles.js index 750700786..e5d9e2ece 100644 --- a/src/styles/font-styles.js +++ b/src/styles/font-styles.js @@ -31,7 +31,7 @@ export default css` .regular-font-size { font-size: var(--font-size-regular); } .small-font-size { font-size: var(--font-size-small); } .upper { font-size: 14px; text-transform: uppercase; } - .operation-tag { font-size: 16px; line-height: 18px; color: #6b7785; } + .operation-tag { font-size: 14px; line-height: 16px; color: #6b7785; margin-top: 0px; padding-top: 0px } .primary-text{ color: var(--primary-color); } .bold-text { font-weight:bold; } .gray-text { color: var(--light-fg); } @@ -100,7 +100,6 @@ export default css` background: url('https://vtex-dev-portal-navigation.fra1.digitaloceanspaces.com/info.svg') no-repeat 0 0; background-size: 20px 20px; - position: absolute; } .m-markdown .warning-blockquote { @@ -116,7 +115,6 @@ export default css` background: url('https://vtex-dev-portal-navigation.fra1.digitaloceanspaces.com/warning.svg') no-repeat 0 0; background-size: 20px 20px; - position: absolute; } .m-markdown .danger-blockquote { @@ -132,7 +130,6 @@ export default css` background: url('https://vtex-dev-portal-navigation.fra1.digitaloceanspaces.com/danger.svg') no-repeat 0 0; background-size: 20px 20px; - position: absolute; } blockquote p{ @@ -173,7 +170,7 @@ export default css` } .m-markdown code span { - font-size: 14px; + font-size: 12px; } .m-markdown-small code { diff --git a/src/styles/input-styles.js b/src/styles/input-styles.js index 750c72a32..bfdddb5db 100644 --- a/src/styles/input-styles.js +++ b/src/styles/input-styles.js @@ -31,7 +31,33 @@ export default css` .m-btn-primary:hover { background-color: #000711; } -.m-btn-secondary{ +.icon-btn { + border: 1px solid #e7e9ee; + color: #4a596b; + display: inline-flex; + align-items: center; + gap: 8px; + min-height: 36px; +} +.icon-btn:hover{ + background-color: #f8f7fc; +} +.clear-btn { + margin-left: 0px; + background-color: #fff; + cursor: pointer; + padding-left: 8px; + padding-right: 8px; + border-radius: 4px; +} +.flex-btns { + display: flex; + margin-top: 12px; + justify-content: end; + gap: 8px; + padding-right: 32px; +} +.m-btn-secondary { background: #e7e9ee; color: #142032; } @@ -45,12 +71,22 @@ export default css` .m-btn-tertiary:hover { color: #000711; } -.m-btn.thin-border { border-width: 1px; } -.m-btn.large { padding:8px 14px; } -.m-btn.small { padding:5px 12px; } -.m-btn.tiny { padding:5px 6px; } -.m-btn.circle { border-radius: 50%; } -.m-btn.nav:hover { +.m-btn.thin-border { + border-width: 1px; +} +.m-btn.large { + padding: 8px 14px; +} +.m-btn.small { + padding: 5px 12px; +} +.m-btn.tiny { + padding: 5px 6px; +} +.m-btn.circle { + border-radius: 50%; +} +.m-btn.nav:hover { background-color: var(--nav-accent-color); } .m-btn:disabled{ @@ -80,10 +116,11 @@ export default css` outline: inherit; display: block; } -.copy-button{ +.copy-button { opacity: 0.3; } -.check-button, .copy-button:hover{ +.check-button, +.copy-button:hover { opacity: 1; } @@ -91,7 +128,7 @@ input, textarea, select, pre { color: #000000; outline: none; background-color: var(--input-bg); - border: 1px solid #B9B9B9; + border: 1px solid #b9b9b9; border-radius: var(--border-radius); } button { @@ -107,7 +144,7 @@ input[type="text"], input[type="password"] { font-family:var(--font-mono); font-size: var(--font-size-mono); - transition: border .2s; + transition: border 0.2s; padding: 6px 8px; line-height: 140%; } @@ -115,9 +152,9 @@ input[type="password"] { select { font-family: var(--font-regular); padding: 8px; - background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%3E%3Cpath%20d%3D%22M10.3%203.3L6%207.6%201.7%203.3A1%201%200%2000.3%204.7l5%205a1%201%200%20001.4%200l5-5a1%201%200%2010-1.4-1.4z%22%20fill%3D%22%23777777%22%2F%3E%3C%2Fsvg%3E"); + background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%3E%3Cpath%20d%3D%22M10.3%203.3L6%207.6%201.7%203.3A1%201%200%2000.3%204.7l5%205a1%201%200%20001.4%200l5-5a1%201%200%2010-1.4-1.4z%22%20fill%3D%22%23777777%22%2F%3E%3C%2Fsvg%3E'); background-position: calc(100% - 14px) center; - background-repeat: no-repeat; + background-repeat: no-repeat; background-size: 10px; -webkit-appearance: none; -moz-appearance: none; @@ -152,8 +189,8 @@ input[type="password"]:active { input[type="file"]{ font-family: var(--font-regular); - padding:2px; - cursor:pointer; + padding: 2px; + cursor: pointer; border: 1px solid var(--primary-color); min-height: calc(var(--font-size-small) + 18px); } @@ -162,12 +199,12 @@ input[type="file"]::-webkit-file-upload-button { font-family: var(--font-regular); font-size: var(--font-size-small); outline: none; - cursor:pointer; + cursor: pointer; padding: 3px 8px; border: 1px solid var(--primary-color); background-color: var(--primary-color); color: var(--primary-color-invert); - border-radius: var(--border-radius);; + border-radius: var(--border-radius); -webkit-appearance: none; } diff --git a/src/templates/code-samples-template.js b/src/templates/code-samples-template.js index 75fc405ee..cd48977ff 100644 --- a/src/templates/code-samples-template.js +++ b/src/templates/code-samples-template.js @@ -25,7 +25,12 @@ export default function codeSamplesTemplate(xCodeSamples) {
${xCodeSamples.map((v, i) => html`
- +
${Prism.languages[v.lang?.toLowerCase()] ? unsafeHTML(Prism.highlight(v.source, Prism.languages[v.lang?.toLowerCase()], v.lang?.toLowerCase())) : v.source}
`) } diff --git a/src/templates/endpoint-template.js b/src/templates/endpoint-template.js index 4e11d130f..eaa4575bf 100644 --- a/src/templates/endpoint-template.js +++ b/src/templates/endpoint-template.js @@ -182,9 +182,15 @@ function endpointBodyTemplate(path) { class = "${this.renderStyle}-mode ${this.layout}-layout" style = "width:100%;" schema-short-summary="${path.shortSummary}" + short-summary = "${path.shortSummary}" + tag-name = "" + doc-url = "" webhook = "${path.isWebhook}" method = "${path.method}" path = "${path.path}" + path-description = "${path.description}" + .responses = "${path.responses}" + default-schema-tab = "${this.defaultSchemaTab}" .security = "${path.security}" .parameters = "${path.parameters}" .request_body = "${path.requestBody}" diff --git a/src/templates/expanded-endpoint-template.js b/src/templates/expanded-endpoint-template.js index d21426611..38bb9bbdb 100644 --- a/src/templates/expanded-endpoint-template.js +++ b/src/templates/expanded-endpoint-template.js @@ -9,10 +9,7 @@ import '../components/api-request'; import '../components/api-response'; import '../components/content-copy-button'; import processPathDescription from '../utils/magic-block-utils'; -import { joinURLandPath } from '../utils/url'; import renderBlockquote from '../utils/renderBlockquote'; -import postmanIcon from '../components/assets/postman-icon'; -import openapiIcon from '../components/assets/openapi-icon'; /* eslint-disable indent */ function headingRenderer(tagElementId) { @@ -39,7 +36,6 @@ export function expandedEndpointBodyTemplate(path, tagName = '') { nonEmptyApiKeys.push(rapiDocApiKey); } - const docUrl = `https://developers.vtex.com/docs/api-reference/${this.specUrl.split('/')[3]}`; marked.Renderer.prototype.blockquote = renderBlockquote; const codeSampleTabPanel = path.xCodeSamples ? codeSamplesTemplate.call(this, path.xCodeSamples) : ''; @@ -60,51 +56,9 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
` : '' - } -
- ${(this.renderStyle === 'focused' && tagName !== 'General ⦂') ? html` -

${this.resolvedSpec.info.title} › ${tagName}

- ` : ''} -
-
- ${(this.specUrl && this.allowSpecFileDownload) ? html`
- - -
` : ''} - ${this.postmanUrl ? html`
- - -
` : ''} -
-

${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}

- ${path.isWebhook - ? html` WEBHOOK ` - : html` -
-
- ${path.method} -
-
- -
-
- ` - } + } ` } - ${path.description ? html`
${unsafeHTML(marked(path.description))}
` : ''} ${codeSampleTabPanel}
@@ -112,9 +66,14 @@ export function expandedEndpointBodyTemplate(path, tagName = '') { class = "${this.renderStyle}-mode" style = "width:100%;" schema-short-summary = "${path.shortSummary}" + short-summary = "${path.shortSummary}" + tag-name = "${tagName}" webhook = "${path.isWebhook}" method = "${path.method}" path = "${path.path}" + path-description = "${path.description}" + .responses = "${path.responses}" + default-schema-tab = "${this.defaultSchemaTab}" .security = "${path.security}" .parameters = "${path.parameters}" .request_body = "${path.requestBody}" @@ -145,24 +104,6 @@ export function expandedEndpointBodyTemplate(path, tagName = '') { > ${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''} - -
`; diff --git a/src/templates/overview-template.js b/src/templates/overview-template.js index 31329a36c..311cc4d36 100644 --- a/src/templates/overview-template.js +++ b/src/templates/overview-template.js @@ -2,10 +2,8 @@ import { html } from 'lit'; import { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions import { marked } from 'marked'; import processPathDescription from '../utils/magic-block-utils'; -import { downloadResource, viewResource } from '../utils/common-utils'; import renderBlockquote from '../utils/renderBlockquote'; -import postmanIcon from '../components/assets/postman-icon'; -import openapiIcon from '../components/assets/openapi-icon'; +import '../components/api-dropdown-actions'; /* eslint-disable indent */ function headingRenderer() { @@ -23,27 +21,11 @@ export default function overviewTemplate() { ${this.resolvedSpec?.info ? html` -
- ${(this.specUrl && this.allowSpecFileDownload) ? html`
- - -
` : ''} - ${this.postmanUrl ? html`
- - -
` : ''} +
+ +
${this.resolvedSpec.info.title} diff --git a/src/templates/security-scheme-template.js b/src/templates/security-scheme-template.js index cf9c877a9..ee8faa463 100644 --- a/src/templates/security-scheme-template.js +++ b/src/templates/security-scheme-template.js @@ -451,7 +451,7 @@ export default function securitySchemeTemplate() {
Authentication
${selectSecuritySchemeTemplate.call(this)} -
+
${this.resolvedSpec.security.map((scheme, id) => { return html` ${id === this.selectedAuthScheme ? html`
diff --git a/src/utils/common-utils.js b/src/utils/common-utils.js index 6f40572ef..a03e0feea 100644 --- a/src/utils/common-utils.js +++ b/src/utils/common-utils.js @@ -1,3 +1,6 @@ +import { render } from 'lit'; +import checkSymbol from "../components/assets/check-symbol"; + /* For Delayed Event Handler Execution */ export function debounce(fn, delay) { let timeoutID = null; @@ -18,31 +21,33 @@ export function sleep(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); } -export function copyToClipboard(data, e) { - const btnEl = e.target.closest('button'); - const textArea = document.createElement('textarea'); - textArea.value = data; - textArea.style.position = 'fixed'; // avoid scrolling to bottom - document.body.appendChild(textArea); - textArea.focus(); - textArea.select(); +export async function copyToClipboard(data, e) { + const btnEl = e.currentTarget?.closest('button') || e.target.closest('button'); + + const originalContent = btnEl.cloneNode(true); + try { - document.execCommand('copy'); - btnEl.innerHTML = ` - - - `; + if (navigator.clipboard?.writeText) { + await navigator.clipboard.writeText(data); + } else { + const textArea = document.createElement('textarea'); + textArea.value = data; + textArea.style.position = 'fixed'; + document.body.appendChild(textArea); + textArea.focus(); + textArea.select(); + document.execCommand('copy'); + document.body.removeChild(textArea); + } + + render(checkSymbol(), btnEl); + setTimeout(() => { - btnEl.innerHTML = ` - - - - `; + btnEl.replaceWith(originalContent); }, 5000); } catch (err) { console.error('Unable to copy', err); // eslint-disable-line no-console } - document.body.removeChild(textArea); } export function getBaseUrlFromUrl(url) { diff --git a/src/utils/theme.js b/src/utils/theme.js index 5b71f0bb1..d710b7e0e 100644 --- a/src/utils/theme.js +++ b/src/utils/theme.js @@ -164,10 +164,10 @@ export default function setTheme(baseTheme, theme = {}) { lightPink: theme.lightPink ? theme.lightPink : '#ffb2b2', vtexPink: theme.vtexPink ? theme.vtexPink : '#D71D55', - green: theme.green || '#690', + green: theme.green || '#79A479', lightGreen: theme.lightGreen || '#fbfff0', - blue: theme.blue || '#47AFE8', + blue: theme.blue || '#2953B2', lightBlue: theme.lightBlue || '#eff8fd', orange: theme.orange || '#FF9900', @@ -227,7 +227,7 @@ export default function setTheme(baseTheme, theme = {}) { --resp-area-height: ${this.responseAreaHeight}; --font-size-small: ${this.fontSize === 'default' ? '12px' : (this.fontSize === 'large' ? '13px' : '14px')}; --font-size-mono: ${this.fontSize === 'default' ? '13px' : (this.fontSize === 'large' ? '14px' : '15px')}; - --font-size-regular: ${this.fontSize === 'default' ? '16px' : (this.fontSize === 'large' ? '17px' : '18px')}; + --font-size-regular: ${this.fontSize === 'default' ? '14px' : (this.fontSize === 'large' ? '17px' : '18px')}; --dialog-z-index: 1000; --focus-shadow: 0 0 0 1px transparent, 0 0 0 3px ${newTheme.primaryColorTrans};