{"version":3,"file":"rapidoc-min.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACDA;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;ACKA;;ACKA;AC2QA;AACA;AACA;AAIA;AAIA;AAIA;AAEA;;;AAIA;;AAEA;AACA;AACA;AACA;;;;;AAKA;AAGA;;AAGA;AACA;AACA;;AAIA;;AAGA;AACA;;;;AAIA;AAGA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAKA;;AAGA;AACA;;;AAKA;;AAOA;AAqBA;;;;AAIA;AAEA;;AAEA;;AAIA;;AAGA;AACA;;;AAGA;AACA;AAEA;AACA;AACA;;AAIA;;AAGA;AACA;;AAIA;;AAGA;;;AAMA;AAEA;;;AAGA;AACA;AACA;AAGA;AAGA;;;;;AAMA;AACA;;AAEA;;;AAGA;;AAEA;;;AAKA;;;AAIA;;;AAGA;;AAIA;;;AA5FA;;;;;;;AAwIA;;AAEA;AAEA;;;AAGA;;;AAMA;;AAEA;;;;;AAOA;;AAEA;AAKA;;AAGA;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;;AAGA;AACA;AACA;;;;;AAOA;;;AAQA;;;AC1jBA;;AAYA;;AAEA;AACA;AACA;AACA;;ACxBA;;AAGA;;AAEA;AACA;;;AAGA;;;AAGA;;AAEA;;AAEA;;;;AAIA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;AAQA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACpDA;;;;;;;;;;;;;;;;;;;;;ACLA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACgFA;;;AAUA;;AAEA;;AAKA;AAUA;;AAEA;;AAEA;AACA;;;AAIA;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC0PA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AApRA;AAQA;;AAEA;AACA;;AAGA;AACA;;AAEA;;AAIA;AAIA;AAEA;;AAWA;AAwBA;AACA;AASA;AA0DA;AACA;AACA;AAMA;AACA;AACA;AAGA;AACA;;AAEA;;AAEA;AACA;AAGA;AACA;;;;AA4BA;AAQA;AA4BA;AACA;AACA;AACA;AAMA;AACA;AACA;;;;AAIA;AACA;AAEA;AACA;AAOA;AACA;AACA;AACA;;;AAOA;;AC9UA;AACA;;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC29CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAxzCA;AAOA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;;AAMA;AAuBA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;;AAKA;;AAEA;AA4EA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;;AAMA;AAEA;AACA;;;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;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAGA;AAGA;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA;;AAGA;;;AAKA;;AAEA;AACA;;;AAMA;AACA;;;AAGA;;AAKA;AA8DA;AACA;AACA;AACA;;;AAOA;AAqBA;;AAEA;AAGA;AACA;AACA;;;;AAKA;AAGA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;;;;;;AAOA;AACA;AACA;;AAEA;;;;;;AAQA;;AAoBA;;AAOA;AAIA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAIA;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAQA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAGA;AACA;AACA;;AAEA;AAIA;AAEA;AACA;;AAMA;;;AAiBA;AAiBA;AACA;;;AAGA;AACA;;;;;;AAMA;AACA;AACA;AACA;;;;AAIA;;AAGA;AACA;;AAEA;AACA;AACA;AACA;;;;AAQA;AAcA;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;AACA;AAGA;;;;;;AAMA;AACA;;;;;;;;AAQA;;;AAIA;AACA;AACA;;;AAGA;;;AAGA;AAEA;AAGA;AAEA;;AAEA;;;AAGA;AACA;AACA;;AAEA;;;AAOA;;AAIA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;;AAIA;;;AAMA;;;;AAMA;AACA;;;AAMA;;AAEA;;AAKA;;AAEA;;;;AAIA;AACA;;;AAGA;AAIA;;AAIA;;AAEA;;;AAGA;AAIA;AACA;AACA;;AAEA;AAEA;AACA;;;AAGA;AAIA;AAEA;AACA;AACA;;AAMA;AACA;AACA;;AAEA;AACA;AACA;;AAKA;AAKA;AACA;;AAIA;;AAEA;AACA;;;AAIA;;AAEA;;AAMA;;;;AAIA;;;;AAIA;AAEA;AAEA;AAIA;;;AAOA;AAGA;;;AAGA;;AAEA;AAGA;;AAEA;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC77BA;AAQA;;AAEA;AACA;;AAGA;AACA;;AAEA;;AAIA;;;;;;;AAUA;AAEA;;;AAYA;AAuBA;AACA;AACA;AAUA;AAsCA;AAEA;AACA;AACA;;AAGA;AACA;AACA;;AAEA;AACA;AAGA;AAMA;;AAEA;AACA;AACA;;AAEA;AACA;AAEA;;;;AAKA;;;AAGA;;;AAMA;AAGA;AACA;;;;AAgCA;AAWA;AACA;AAGA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAEA;AACA;;AAMA;AACA;AACA;AACA;AAEA;AACA;AAOA;AACA;AACA;AACA;;;AAOA;ACzSA;AACA;AACA;AACA;AACA;AACA;;AAGA;;AAKA;AAGA;AACA;;AAIA;AACA;;;AAIA;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;;;;;;AAMA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AASA;AAGA;AACA;AACA;AACA;;AAEA;;;;AASA;;;AAhBA;;AC/GA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;;AAOA;;AAMA;AACA;AACA;AACA;;AAGA;AACA;;;AAOA;AAGA;AACA;AACA;;AAEA;;;;AAIA;;;AAVA;;AC9CA;AACA;;AAGA;AACA;;AAEA;AAFA;;;AAOA;AAEA;AACA;AAGA;AAIA;AAEA;AAMA;AAIA;;AAGA;AACA;AAIA;;;;AAMA;;AASA;;ACpEA;;;AAmCA;;AAEA;;AAEA;;AAGA;AACA;;AAEA;;;AAIA;AACA;AACA;;AAGA;AACA;;AAGA;;;;;AAMA;AACA;AACA;;;;AAIA;;;AAMA;AAOA;;;AAGA;AAGA;;;AAGA;AACA;AACA;AACA;;;AAGA;AACA;;;;AAbA;AAkBA;;;AAGA;AC3GA;;;;AA0CA;AACA;;AAEA;AAGA;AACA;;;;;;;AASA;;;;;AAKA;AAEA;;AAEA;;AAKA;AAGA;;;;;;AAQA;AACA;AAGA;AAEA;AAEA;AACA;;AAIA;;AAEA;AACA;AACA;AACA;;AAEA;;;AAIA;AACA;AAEA;;AA1BA;;AAgCA;AAIA;;AAKA;;AAEA;AAEA;AACA;;;;;;AAQA;AAGA;AACA;;;AAKA;AACA;AACA;AACA;;AAQA;AACA;;;;AASA;AAEA;;AAIA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;AAQA;;;AAQA;AACA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;;;;;;;;AAYA;;;;;AAMA;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;ACvOA;;AASA;AAIA;AAeA;AACA;;AAGA;AAMA;AAMA;;;AAoBA;AC5BA;AACA;AACA;AACA;AACA;;AAEA;;;AAIA;AAGA;;AAGA;;AAOA;AAmBA;;AAEA;AAMA;;AAGA;;AAKA;;AAIA;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;;;;;;AAMA;;;;AAIA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AASA;AAGA;;AAGA;;;;AAIA;;;;AAIA;AAGA;AACA;AAEA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AAMA;AACA;AACA;;;AAIA;;AAGA;AAMA;AACA;AACA;;;;AAnDA;;;;ACxKA;AAEA;;;;;;;;;;;;;ACOA;;;AAGA;;;;;;;AASA;AACA;;;;;AAMA;;;;;AAOA;AACA;;;AAGA;;;AAIA;AAGA;;;;AAKA;AAGA;;;;;ADtDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AE0EA;AAOA;AACA;AACA;;;AAGA;;;AAMA;AA8CA;AAEA;AACA;;AAIA;AAQA;AACA;;;AAGA;AACA;;;AAOA;AACA;;AAEA;AACA;;AAKA;;AAIA;AACA;AACA;;AAEA;;AAKA;AAEA;AACA;AAEA;;;;AAUA;;;AAIA;;;AAGA;;;AAGA;;;AAGA;;;AAGA;;;;AAOA;AAEA;AACA;AAIA;AAgBA;AAEA;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AAEA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAGA;AACA;;AAEA;;;;;AAxCA;AACA;AAkDA;AAOA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AAxBA;AACA;AC1SA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACEA;;;AAOA;;;;;;;;;AASA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;;;AAMA;;;AAGA;AACA;;AAEA;;AASA;AACA;AACA;;;;ACSA;AA1BA;;;;AAKA;AACA;;;;;;AAMA;;;;;;;AC2IA;AACA;AACA;;AAEA;;AAMA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;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;;;AAGA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;ACzQA;AAsBA;AACA;AAGA;AACA;;AAEA;;;;AAIA;AACA;;;AAKA;AAEA;;;AAGA;;;;AAOA;AACA;;;AAGA;;;AAGA;;AAEA;;AAEA;;;;;AASA;AACA;AAGA;AAGA;AACA;AAGA;AACA;AACA;;;;AAIA;;;;;;;;ACxEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkWA;;;;;;;;;AASA;;;;;;;;;;;;;;;;;;;;;;;ACtQA;;;;;;;;;AC3GA;;;;;;AAMA;AACA;AACA;;AAIA;;;;AASA;AAEA;;AAEA;AAIA;;AAEA;AACA;;;;;AAKA;AACA;AACA;AACA;;;;;;AAMA;AAEA;AACA;AACA;;AAGA;AAGA;;AAEA;AACA;;AAEA;;;;;;AAcA;AAoBA;AACA;AAGA;AACA;;AAEA;;;;;AAKA;AACA;;;AAKA;AAEA;;;AAGA;;;;AAOA;AACA;;;AAGA;;AAEA;;;AAGA;;;;;AAKA;AACA;AAGA;AAGA;AACA;;;;;;;ACrHA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC0HA","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/utils/common-utils.js","webpack://rapidoc/./src/templates/security-scheme-template.js","webpack://rapidoc/./src/templates/code-samples-template.js","webpack://rapidoc/./src/templates/callback-template.js","webpack://rapidoc/./node_modules/lit-html/directives/guard.js","webpack://rapidoc/./src/utils/schema-utils.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/api-request.js","webpack://rapidoc/./src/components/schema-table.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/server-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/components/api-response.js","webpack://rapidoc/./src/styles/dialog-box-styles.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/oauth-receiver.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 border-radius: var(--border-radius);\n font-weight: 600;\n display: inline-block;\n padding: 6px 16px;\n font-size: var(--font-size-small);\n outline: 0;\n line-height: 1;\n text-align: center;\n white-space: nowrap;\n border: 2px solid var(--primary-color);\n background-color:transparent;\n transition: background-color 0.2s;\n user-select: none;\n cursor: pointer;\n box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);\n}\n.m-btn.primary {\n background-color: var(--primary-color);\n color: var(--primary-color-invert);\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:hover { \n background-color: var(--primary-color);\n color: var(--primary-color-invert);\n}\n.m-btn.nav { border: 2px solid var(--nav-accent-color); }\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\ninput, textarea, select, button, pre {\n color:var(--fg);\n outline: none;\n background-color: var(--input-bg);\n border: 1px solid var(--border-color);\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-weight: 400;\n font-size: var(--font-size-small);\n transition: border .2s;\n padding: 6px 5px;\n}\n\nselect {\n font-family: var(--font-regular);\n padding: 5px 30px 5px 5px;\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% - 5px) 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\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:1px solid var(--primary-color);\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(--blue);\n font-family:var(--font-mono);\n margin-bottom:2px;\n}\n\ninput[type=\"checkbox\"]:focus{\n outline:0;\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 box-shadow: inset 0 0 0 13px 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`;\n","import { css } from 'lit';\n\nexport default css`\n.row, .col{\n display:flex;\n} \n.row {\n align-items:center;\n flex-direction: row;\n}\n.col {\n align-items:stretch;\n flex-direction: column;\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:var(--font-size-small);\n font-weight:bold;\n vertical-align: middle;\n margin: 12px 0 4px 0;\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 border-color:var(--orange); \n background-color:var(--light-orange); \n}\n.m-endpoint > .endpoint-head.post:hover,\n.m-endpoint > .endpoint-head.post.expanded {\n border-color:var(--green); \n background-color:var(--light-green); \n}\n.m-endpoint > .endpoint-head.get:hover,\n.m-endpoint > .endpoint-head.get.expanded {\n border-color:var(--blue); \n background-color:var(--light-blue); \n}\n.m-endpoint > .endpoint-head.delete:hover,\n.m-endpoint > .endpoint-head.delete.expanded {\n border-color:var(--red); \n background-color:var(--light-red); \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 border-width:0px 1px 1px 5px;\n border-style:solid;\n box-shadow: 0px 4px 3px -3px rgba(0, 0, 0, 0.15);\n}\n.m-endpoint .endpoint-body.delete{ border-color:var(--red); }\n.m-endpoint .endpoint-body.put{ border-color:var(--orange); }\n.m-endpoint .endpoint-body.post{border-color:var(--green);}\n.m-endpoint .endpoint-body.get{ border-color:var(--blue); }\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:8px 8px;\n}\n.summary .title{\n font-size:calc(var(--font-size-regular) + 2px);\n margin-bottom: 6px;\n word-break: break-all;\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(--red);}\n.endpoint-head .method.put{ border: 2px solid var(--orange); }\n.endpoint-head .method.post{ border: 2px solid var(--green); }\n.endpoint-head .method.get{ border: 2px solid var(--blue); }\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 margin-top:16px;\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:16px 8px;\n overflow:hidden;\n}\n.view-mode-request {\n border-width:0 0 1px 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(--orange); \n}\n.post .view-mode-request { \n border-color:var(--green); \n}\n.get .view-mode-request { \n border-color:var(--blue); \n}\n.delete .view-mode-request { \n border-color:var(--red); \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:8px 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(--blue);\n}\n\n.token.boolean,\n.token.number,\n.token.function {\n color: var(--red);\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 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: 3px 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 font-size:var(--font-size-small);\n margin-right:16px;\n padding:1px;\n}\n.tab-btn.active {\n border-bottom: 3px solid var(--primary-color); \n font-weight:bold;\n color:var(--primary-color);\n}\n\n.tab-btn:hover {\n color:var(--primary-color);\n}\n.tab-content {\n margin:-1px 0 0 0;\n position:relative;\n min-height: 50px;\n}\n`;\n","import { css } from 'lit';\n\nexport default css`\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\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-paths-under-tag {\n display:none;\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 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.active,\n.nav-bar-h2.active,\n.nav-bar-info.active,\n.nav-bar-tag.active,\n.nav-bar-path.active,\n.nav-bar-section.operations.active {\n border-left:4px solid var(--nav-accent-color);\n color:var(--nav-hover-text-color);\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);margin-top:8px\n margin-left: -15px;\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\n`;\n","/* For Delayed Event Handler Execution */\nexport function debounce(fn, delay) {\n let timeoutID = null;\n return (...args) => {\n clearTimeout(timeoutID);\n const that = this;\n timeoutID = setTimeout(() => {\n fn.apply(that, args);\n }, delay);\n };\n}\n\nexport const invalidCharsRegEx = /[\\s#:?&={}]/g; // used for generating valid html element ids by replacing the invalid chars with hyphen (-)\nexport const rapidocApiKey = '_rapidoc_api_key';\n\nexport function sleep(ms) {\n // eslint-disable-next-line no-promise-executor-return\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nexport function copyToClipboard(data, e) {\n const btnEl = e.currentTarget;\n const textArea = document.createElement('textarea');\n textArea.value = data;\n textArea.style.position = 'fixed'; // avoid scrolling to bottom\n document.body.appendChild(textArea);\n textArea.focus();\n textArea.select();\n try {\n document.execCommand('copy');\n btnEl.innerText = 'Copied';\n setTimeout(() => {\n btnEl.innerText = 'Copy';\n }, 5000);\n } catch (err) {\n console.error('Unable to copy', err); // eslint-disable-line no-console\n }\n document.body.removeChild(textArea);\n}\n\nexport function getBaseUrlFromUrl(url) {\n const pathArray = url.split('/');\n return `${pathArray[0]}//${pathArray[2]}`;\n}\n\nexport async function wait(ms) {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n\nexport function componentIsInSearch(searchVal, component) {\n return component.name.toLowerCase().includes(searchVal.toLowerCase());\n}\n\nexport function pathIsInSearch(searchVal, path, matchType = 'includes') {\n if (matchType === 'includes') {\n const stringToSearch = `${path.method} ${path.path} ${path.summary || path.description || ''} ${path.operationId || ''}`.toLowerCase();\n return stringToSearch.includes(searchVal.toLowerCase());\n }\n const regex = new RegExp(searchVal, 'i');\n return regex.test(`${path.method} ${path.path}`);\n}\n\nexport function schemaKeys(schemaProps, result = new Set()) {\n if (!schemaProps) {\n return result;\n }\n Object.keys(schemaProps).forEach((key) => {\n result.add(key);\n if (schemaProps[key].properties) {\n schemaKeys(schemaProps[key].properties, result);\n } else if (schemaProps[key].items?.properties) {\n schemaKeys(schemaProps[key].items?.properties, result);\n }\n });\n return result;\n}\n\nexport function advancedSearch(searchVal, allSpecTags, searchOptions = []) {\n if (!searchVal.trim() || searchOptions.length === 0) {\n return;\n }\n\n const pathsMatched = [];\n allSpecTags.forEach((tag) => {\n tag.paths.forEach((path) => {\n let stringToSearch = '';\n if (searchOptions.includes('search-api-path')) {\n stringToSearch = path.path;\n }\n if (searchOptions.includes('search-api-descr')) {\n stringToSearch = `${stringToSearch} ${path.summary || path.description || ''}`;\n }\n if (searchOptions.includes('search-api-params')) {\n stringToSearch = `${stringToSearch} ${path.parameters?.map((v) => v.name).join(' ') || ''}`;\n }\n\n if (searchOptions.includes('search-api-request-body') && path.requestBody) {\n let schemaKeySet = new Set();\n for (const contentType in path.requestBody?.content) {\n if (path.requestBody.content[contentType].schema?.properties) {\n schemaKeySet = schemaKeys(path.requestBody.content[contentType].schema?.properties);\n }\n stringToSearch = `${stringToSearch} ${[...schemaKeySet].join(' ')}`;\n }\n }\n\n if (searchOptions.includes('search-api-resp-descr')) {\n stringToSearch = `${stringToSearch} ${Object.values(path.responses).map((v) => v.description || '').join(' ')}`;\n }\n\n if (stringToSearch.toLowerCase().includes(searchVal.trim().toLowerCase())) {\n pathsMatched.push({\n elementId: path.elementId,\n method: path.method,\n path: path.path,\n summary: path.summary || path.description || '',\n deprecated: path.deprecated,\n });\n }\n });\n });\n return pathsMatched;\n}\n\nexport function prettyXml(sourceXmlString) {\n const xmlDoc = new DOMParser().parseFromString(sourceXmlString, 'text/xml');\n const xsltDoc = new DOMParser().parseFromString([\n // describes how we want to modify the XML - indent everything\n `\n \n \n \n \n \n \n \n \n `,\n ].join('\\n'), 'application/xml');\n const xsltProcessor = new XSLTProcessor();\n xsltProcessor.importStylesheet(xsltDoc);\n const resultDoc = xsltProcessor.transformToDocument(xmlDoc);\n return new XMLSerializer().serializeToString(resultDoc);\n}\n/*\nexport function hasValidPathInUrlHash(tags) {\n return tags.find((tag) => tag.paths.find((path) => window.location.hash.substring(1) === path.elementId));\n}\n*/\n\nexport function downloadResource(url, fileName) {\n if (url) {\n const a = document.createElement('a');\n document.body.appendChild(a);\n a.style = 'display: none';\n a.href = url;\n a.download = fileName;\n a.click();\n a.remove();\n }\n}\n\nexport function viewResource(url) {\n if (url) {\n const a = document.createElement('a');\n document.body.appendChild(a);\n a.style = 'display: none';\n a.href = url;\n a.target = '_blank';\n a.click();\n a.remove();\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';\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 ${btoa(`${username}:${password}`)}`;\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 !== '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 ${btoa(`${clientId}:${clientSecret}`)}`);\n } else {\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)}random`).slice(2, 9);\n const nonce = (`${Math.random().toString(36)}random`).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 isUrlAbsolute = (url) => (url.indexOf('://') > 0 || url.indexOf('//') === 0);\n if (refreshUrl && !isUrlAbsolute(refreshUrl)) {\n refreshUrl = `${this.selectedServer.computedUrl}/${refreshUrl.replace(/^\\//, '')}`;\n }\n if (tokenUrl && !isUrlAbsolute(tokenUrl)) {\n tokenUrl = `${this.selectedServer.computedUrl}/${tokenUrl.replace(/^\\//, '')}`;\n }\n if (authorizationUrl && !isUrlAbsolute(authorizationUrl)) {\n authorizationUrl = `${this.selectedServer.computedUrl}/${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 ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'password'\n ? html`\n `\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\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
AUTHENTICATION
\n\n
\n ${providedApiKeys.length > 0\n ? html`\n
${providedApiKeys.length} API key applied
\n
\n `\n : html`
No API key applied
`\n }\n
\n ${this.resolvedSpec.securitySchemes && this.resolvedSpec.securitySchemes.length > 0\n ? html`\n \n ${this.resolvedSpec.securitySchemes.map((v) => html`\n \n \n \n ${v.type.toLowerCase() === 'oauth2'\n ? html`\n \n \n \n `\n : ''\n }\n `)}\n
\n
\n ${v.typeDisplay}\n ${v.finalKeyValue\n ? html`\n ${v.finalKeyValue ? 'Key Applied' : ''} \n \n `\n : ''\n }\n
\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.type.toLowerCase() === 'apikey'\n ? html`Send ${v.name} in ${v.in}`\n : html`Send Authorization in header containing the word Bearer followed by a space and a Token String.`\n }\n
\n
\n ${v.in !== 'cookie'\n ? html`\n \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 \n \n
`\n : ''\n }\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\nexport function pathSecurityTemplate(pathSecurity) {\n if (this.resolvedSpec.securitySchemes && pathSecurity) {\n const orSecurityKeys1 = [];\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 \n \n \n \n ${orSecurityKeys1.map((orSecurityItem1, i) => html`\n\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","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';\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/* 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{noChange as r}from\"../lit-html.js\";import{directive as t,Directive as s}from\"../directive.js\";\n/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst e={},i=t(class extends s{constructor(){super(...arguments),this.nt=e}render(r,t){return t()}update(t,[s,e]){if(Array.isArray(s)){if(Array.isArray(this.nt)&&this.nt.length===s.length&&s.every(((r,t)=>r===this.nt[t])))return r}else if(this.nt===s)return r;return this.nt=Array.isArray(s)?Array.from(s):s,this.render(s,e)}});export{i as guard};\n//# sourceMappingURL=guard.js.map\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) {\n dataType = dataType.replace('string', schema.enum ? 'enum' : schema.format);\n }\n if (schema.nullable) {\n dataType += '┃null';\n }\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: schema.default != null ? `${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\n // Set Allowed Values\n info.allowedValues = Array.isArray(schema.enum) ? schema.enum.join('┃') : '';\n if (dataType === 'array' && schema.items) {\n const arrayItemType = schema.items?.type;\n const arrayItemDefault = schema.items?.default !== undefined ? schema.items.default : '';\n\n info.arrayType = `${schema.type} of ${Array.isArray(arrayItemType) ? arrayItemType.join('') : arrayItemType}`;\n info.default = arrayItemDefault;\n info.allowedValues = Array.isArray(schema.items?.enum) ? schema.items.enum.join('┃') : '';\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}\nexport function nestExampleIfPresent(example) {\n return example ? { Example: { value: example } } : example;\n}\nexport function normalizeExamples(examples, dataType = 'string') {\n let exampleVal;\n let exampleList;\n if (examples) {\n if (examples.constructor === Object) {\n const exampleValAndDescr = Object.values(examples);\n exampleVal = exampleValAndDescr.length > 0\n ? typeof exampleValAndDescr[0].value === 'boolean' || typeof exampleValAndDescr[0].value === 'number'\n ? exampleValAndDescr[0].value.toString()\n : exampleValAndDescr[0].value\n : '';\n exampleList = Object.values(examples).map((v) => ({\n value: typeof v.value === 'boolean' || typeof v.value === 'number' ? v.value.toString() : v.value,\n description: v.description || v.summary || v.value,\n }));\n } else {\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 if (examples.length > 0) {\n if (dataType === 'array') {\n [exampleVal] = examples;\n exampleList = examples.map((v) => ({ value: v, description: Array.isArray(v) ? v.join(' , ') : v }));\n } else {\n exampleVal = examples[0].toString();\n exampleList = examples.map((v) => ({ value: v.toString(), description: v }));\n }\n }\n }\n return {\n exampleVal,\n exampleList,\n };\n }\n return {\n exampleVal: '',\n exampleList: [],\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) { 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 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.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 if (Array.isArray(obj[prop])) {\n xmlText = `${xmlText}\\n${indent}<${prop}> ${json2xml(obj[prop], level + 1)}\\n${indent}`;\n } else if (typeof obj[prop] === 'object') {\n xmlText = `${xmlText}\\n${indent}<${prop}> ${json2xml(obj[prop], level + 1)}\\n${indent}`;\n } else {\n xmlText = `${xmlText}\\n${indent}<${prop}> ${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}\n\nfunction removeTitlesAndDescriptions(obj) {\n if (typeof obj !== 'object' || obj === null) {\n return;\n }\n delete obj['::TITLE'];\n delete obj['::DESCRIPTION'];\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\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 objWithSchemaProps[propertyName] = getSampleValueByType(schema.properties[propertyName]);\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 const arraySamples = [];\n for (const key in itemSamples) {\n arraySamples[key] = [itemSamples[key]];\n }\n obj = mergePropertyExamples(obj, propertyName, arraySamples);\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 = '';\n if (schema.title) {\n markdown = `**${schema.title}:** `;\n }\n if (schema.description) {\n markdown = `${markdown} ${schema.description} ${schema.minItems || schema.maxItems ? '
' : ''}`;\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['::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['::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'] = 'xxx-of';\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'] = 'xxx-of';\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 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 if (schema.additionalProperties) {\n obj[''] = 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 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 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) { // Note: schema.examples (plurals) is not allowed as per spec\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 && schema.xml.name) ? `<${schema.xml.name}>` : '';\n xmlRootEnd = (schema.xml && schema.xml.name) ? `` : '';\n exampleFormat = 'text';\n } else {\n exampleFormat = outputType;\n }\n\n const samples = schemaToSampleObj(\n schema,\n {\n includeReadOnly,\n includeWriteOnly,\n deprecated: true,\n },\n );\n\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 removeTitlesAndDescriptions(samples[samplesKey]);\n\n if (mimeType?.toLowerCase().includes('xml')) {\n exampleValue = `${xmlRootStart}${json2xml(samples[samplesKey])}\\n${xmlRootEnd}`;\n } else {\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 { 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';\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 .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 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 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\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 (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// Register the element with the browser\ncustomElements.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-descr .tr {\n max-height:calc(var(--font-size-small) + 8px);\n }\n .collapsed-descr .m-markdown-small p {\n line-height:calc(var(--font-size-small) + 6px);\n }\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\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 display:none;\n }\n .inside-bracket.object,\n .inside-bracket.array {\n border-left: 1px dotted var(--border-color);\n }\n .inside-bracket.xxx-of {\n padding:5px 0px;\n border-style: dotted;\n border-width: 0 0 1px 0;\n border-color:var(--primary-color);\n }`,\n CustomStyles,\n ];\n }\n\n /* eslint-disable indent */\n render() {\n return html`\n
\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
\n ${this.data?.['::description']\n ? html` ${unsafeHTML(marked(this.data['::description'] || ''))}`\n : ''\n }\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 && 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\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 = parts[1]; // eslint-disable-line prefer-destructuring\n keyDescr = parts[2]; // eslint-disable-line prefer-destructuring\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 ${data['::type'] === 'xxx-of' && dataType === 'array' ? html`ARRAY` : ''} \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'].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 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\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 ${dataType === 'array' ? html`${unsafeHTML(marked(description))}` : ''}\n ${schemaDescription\n ? html`\n ${unsafeHTML(marked(`${schemaTitle ? `**${schemaTitle}:**` : ''} ${schemaDescription} ${constraint || defaultValue || allowedValues || pattern ? '' : ''}`))}\n `\n : schemaTitle\n ? html`${schemaTitle} ${constraint || defaultValue || allowedValues || pattern\n ? html``\n : ''}`\n : ''\n }\n ${constraint ? html`
Constraints: ${constraint}
` : ''}\n ${defaultValue ? html`
Default: ${defaultValue}
` : ''}\n ${allowedValues ? html`
Allowed: ${allowedValues}
` : ''}\n ${pattern ? html`
Pattern: ${pattern}
` : ''}\n
\n
\n `;\n }\n /* eslint-enable indent */\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}\ncustomElements.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) => 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::placeholder {\n color: var(--placeholder-color);\n opacity:1;\n }\n `];\n }\n}\n// Register the element with the browser\ncustomElements.define('tag-input', TagInput);\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 { live } from 'lit/directives/live.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\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 CustomStyles from '~/styles/custom-styles';\nimport { copyToClipboard, prettyXml, downloadResource, viewResource } from '~/utils/common-utils';\nimport { schemaInObjectNotation, getTypeInfo, generateExample, normalizeExamples, getSchemaFromParam, json2xml, nestExampleIfPresent } from '~/utils/schema-utils';\nimport '~/components/json-tree';\nimport '~/components/schema-tree';\nimport '~/components/tag-input';\n\nexport default class ApiRequest extends LitElement {\n constructor() {\n super();\n this.responseMessage = '';\n this.responseStatus = 'success';\n this.responseHeaders = '';\n this.responseText = '';\n this.responseUrl = '';\n this.curlSyntax = '';\n this.activeResponseTab = 'response'; // allowed values: response, headers, curl\n this.selectedRequestBodyType = '';\n this.selectedRequestBodyExample = '';\n this.activeParameterSchemaTabs = {};\n }\n\n static get properties() {\n return {\n serverUrl: { type: String, attribute: 'server-url' },\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 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 fillRequestFieldsWithExample: { type: String, attribute: 'fill-request-fields-with-example' },\n useSummaryToListExamples: { type: String, attribute: 'use-summary-to-list-example' },\n allowTry: { type: String, attribute: 'allow-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 }\n\n static get styles() {\n return [\n TableStyles,\n InputStyles,\n FontStyles,\n FlexStyles,\n BorderStyles,\n TabStyles,\n PrismStyles,\n css`\n *, *:before, *:after { box-sizing: border-box; }\n \n .read-mode {\n margin-top: 24px;\n }\n .param-name,\n .param-type {\n margin: 1px 0;\n text-align: right;\n line-height: var(--font-size-small);\n }\n .param-name {\n color: var(--fg); \n font-family: var(--font-mono);\n }\n .param-name.deprecated { \n color: var(--red);\n }\n .param-type{\n color: var(--light-fg); \n font-family: var(--font-regular);\n }\n .param-constraint{\n min-width:100px;\n }\n .param-constraint:empty{\n display:none;\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 ${this.callback === 'true' ? 'CALLBACK REQUEST' : 'REQUEST'}\n
\n
\n ${guard([this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('path'))}\n ${guard([this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('query'))}\n ${this.requestBodyTemplate()}\n ${guard([this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('header'))}\n ${guard([this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('cookie'))}\n ${this.allowTry === 'false' ? '' : html`${this.apiCallTemplate()}`}\n
\n
\n `;\n }\n\n updated(changedProperties) {\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 if (changedProperties.size === 1 && changedProperties.has('activeSchemaTab')) {\n // dont update example as only tabs is switched\n } else {\n const exampleTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea[data-ptype=\"form-data\"]')];\n exampleTextAreaEls.forEach((el) => {\n const origExampleEl = this.shadowRoot.querySelector(`textarea[data-pname='hidden-${el.dataset.pname}']`);\n if (origExampleEl) {\n el.value = origExampleEl.value;\n }\n });\n }\n }\n }\n\n /* eslint-disable indent */\n\n exampleListTemplate(paramName, paramType, exampleList = []) {\n return html`\n ${(exampleList.length > 0\n ? html`Example: \n ${exampleList.map((v, i) => html`\n ${i === 0 ? '' : '┃'}\n ${paramType === 'array' ? '[' : ''}\n {\n const inputEl = e.target.closest('table').querySelector(`[data-pname=\"${paramName}\"]`);\n if (inputEl) {\n if (e.target.dataset.exampleType === 'array') {\n inputEl.value = e.target.dataset.example.split('~|~');\n } else {\n inputEl.value = e.target.dataset.example;\n }\n }\n }\n }\"\n >\n ${this.useSummaryToListExamples === 'true'\n ? v.description || v.summary || (v.value && Array.isArray(v.value) ? (v.value?.join(', ')) : (v.value || ''))\n : v.value && Array.isArray(v.value) ? (v.value?.join(', ')) : (v.value || '')\n }\n \n ${paramType === 'array' ? '] ' : ''}\n `)}\n `\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 PARAMETERS';\n } else if (paramType === 'query') {\n title = 'QUERY-STRING PARAMETERS';\n } else if (paramType === 'header') {\n title = 'REQUEST 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; // eslint-disable-line no-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\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 || 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.schemaHideReadOnly && (this.schemaHideReadOnly.includes(this.method) || this.schemaHideReadOnly === 'true')),\n !(this.schemaHideWriteOnly && (this.schemaHideWriteOnly.includes(this.method) || this.schemaHideWriteOnly === 'true')),\n 'text',\n false,\n )[0].exampleValue;\n }\n const labelColWidth = 'read focused'.includes(this.renderStyle) ? '200px' : '160px';\n tableRows.push(html`\n \n \n
\n ${param.deprecated ? html`` : ''}\n ${param.required ? html`*` : ''}\n ${param.name}\n
\n
\n ${paramSchema.type === 'array'\n ? `${paramSchema.arrayType}`\n : `${paramSchema.format ? paramSchema.format : paramSchema.type}`\n }\n
\n \n ${this.allowTry === 'true'\n ? html`\n \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 }\n `\n : ''\n }\n ${paramSchema.default || paramSchema.constrain || paramSchema.allowedValues || paramSchema.pattern\n ? html`\n \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('table').querySelector(`[data-pname=\"${param.name}\"]`);\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 }}\"\n >${v}`\n }`)}\n
\n `\n : html``\n }\n \n \n ${this.allowTry === 'true' ? html` ` : ''}\n \n ${unsafeHTML(marked(param.description || ''))}\n ${this.exampleListTemplate.call(this, param.name, paramSchema.type, example.exampleList)}\n \n \n `);\n }\n\n return html`\n
${title}
\n
\n \n ${tableRows}\n
\n
`;\n }\n\n resetRequestBodySelection() {\n this.selectedRequestBodyType = '';\n this.selectedRequestBodyExample = '';\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 }, 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.schemaHideReadOnly && (this.schemaHideReadOnly.includes(this.method) || this.schemaHideReadOnly === 'true')),\n !(this.schemaHideWriteOnly && (this.schemaHideWriteOnly.includes(this.method) || this.schemaHideWriteOnly === 'true')),\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.schemaHideReadOnly && (this.schemaHideReadOnly.includes(this.method) || this.schemaHideReadOnly === 'true')),\n !(this.schemaHideWriteOnly && (this.schemaHideWriteOnly.includes(this.method) || this.schemaHideWriteOnly === 'true')),\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 ${this.activeSchemaTab === 'example'\n ? html`
${reqBodyExampleHtml}
`\n : html`
${reqBodySchemaHtml}
`\n }\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.schemaHideReadOnly && (this.schemaHideReadOnly.includes(this.method) || this.schemaHideReadOnly === 'true')),\n !(this.schemaHideWriteOnly && (this.schemaHideWriteOnly.includes(this.method) || this.schemaHideWriteOnly === 'true')),\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
`\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 : ''\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('table').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 }}\"\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 apiResponseTabTemplate() {\n const responseFormat = this.responseHeaders.includes('json') ? 'json' : (this.responseHeaders.includes('html') || this.responseHeaders.includes('xml')) ? 'html' : '';\n return html`\n
\n
Response Status: ${this.responseMessage}
\n
\n \n
\n
\n
{\n if (e.target.classList.contains('tab-btn') === false) { return; }\n this.activeResponseTab = e.target.dataset.tab;\n }}\">\n \n \n \n
\n ${this.responseIsBlob\n ? html`\n
\n \n ${this.responseBlobType === 'view'\n ? html``\n : ''\n }\n
`\n : html`\n
\n \n
${responseFormat\n                ? html`${unsafeHTML(Prism.highlight(this.responseText, Prism.languages[responseFormat], responseFormat))}`\n                : `${this.responseText}`\n              }
\n
`\n }\n
\n \n
${unsafeHTML(Prism.highlight(this.responseHeaders, Prism.languages.css, 'css'))}
\n
\n
\n \n
${unsafeHTML(Prism.highlight(this.curlSyntax.trim().replace(/\\\\$/, ''), Prism.languages.shell, 'shell'))}
\n
\n
`;\n }\n\n apiCallTemplate() {\n let selectServerDropdownHtml = '';\n\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 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 this.parameters.length > 0 || this.request_body\n ? html`\n \n `\n : ''\n }\n \n
\n ${this.responseMessage === '' ? '' : this.apiResponseTabTemplate()}\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 me = this;\n const tryBtnEl = e.target;\n let fetchUrl;\n let curlUrl;\n let curl = '';\n let curlHeaders = '';\n let curlData = '';\n let curlForm = '';\n const respEl = this.closest('.expanded-req-resp-container, .req-resp-container')?.getElementsByTagName('api-response')[0];\n const acceptHeader = respEl?.selectedMimeType;\n const requestPanelEl = e.target.closest('.request-panel');\n const pathParamEls = [...requestPanelEl.querySelectorAll(\"[data-ptype='path']\")];\n const queryParamEls = [...requestPanelEl.querySelectorAll(\"[data-ptype='query']\")];\n const queryParamObjTypeEls = [...requestPanelEl.querySelectorAll(\"[data-ptype='query-object']\")];\n const headerParamEls = [...requestPanelEl.querySelectorAll(\"[data-ptype='header']\")];\n const requestBodyContainerEl = requestPanelEl.querySelector('.request-body-container');\n fetchUrl = this.path;\n const fetchOptions = {\n method: this.method.toUpperCase(),\n };\n // Generate URL using Path Params\n pathParamEls.map((el) => {\n fetchUrl = fetchUrl.replace(`{${el.dataset.pname}}`, encodeURIComponent(el.value));\n });\n\n // Query Params\n const urlQueryParamsMap = new Map();\n const queryParamsWithReservedCharsAllowed = [];\n if (queryParamEls.length > 0) {\n queryParamEls.forEach((el) => {\n const queryParam = new URLSearchParams();\n if (el.dataset.paramAllowReserved === 'true') {\n queryParamsWithReservedCharsAllowed.push(el.dataset.pname);\n }\n if (el.dataset.array === 'false') {\n if (el.value !== '') {\n queryParam.append(el.dataset.pname, el.value);\n }\n } else {\n const { paramSerializeStyle, paramSerializeExplode } = el.dataset;\n let vals = ((el.value && Array.isArray(el.value)) ? el.value : []);\n vals = Array.isArray(vals) ? vals.filter((v) => v !== '') : [];\n if (vals.length > 0) {\n if (paramSerializeStyle === 'spaceDelimited') {\n queryParam.append(el.dataset.pname, vals.join(' ').replace(/^\\s|\\s$/g, ''));\n } else if (paramSerializeStyle === 'pipeDelimited') {\n queryParam.append(el.dataset.pname, vals.join('|').replace(/^\\||\\|$/g, ''));\n } else {\n if (paramSerializeExplode === 'true') { // eslint-disable-line no-lonely-if\n vals.forEach((v) => { queryParam.append(el.dataset.pname, v); });\n } else {\n queryParam.append(el.dataset.pname, vals.join(',').replace(/^,|,$/g, ''));\n }\n }\n }\n }\n if (queryParam.toString()) {\n urlQueryParamsMap.set(el.dataset.pname, queryParam);\n }\n });\n }\n\n // Query Params (Dynamic - create from JSON)\n if (queryParamObjTypeEls.length > 0) {\n queryParamObjTypeEls.map((el) => {\n const queryParam = new URLSearchParams();\n try {\n let queryParamObj = {};\n const { paramSerializeStyle, paramSerializeExplode } = el.dataset;\n queryParamObj = Object.assign(queryParamObj, JSON.parse(el.value.replace(/\\s+/g, ' ')));\n if (el.dataset.paramAllowReserved === 'true') {\n queryParamsWithReservedCharsAllowed.push(el.dataset.pname);\n }\n if ('json xml'.includes(paramSerializeStyle)) {\n if (paramSerializeStyle === 'json') {\n queryParam.append(el.dataset.pname, JSON.stringify(queryParamObj));\n } else if (paramSerializeStyle === 'xml') {\n queryParam.append(el.dataset.pname, json2xml(queryParamObj));\n }\n } else {\n for (const key in queryParamObj) {\n if (typeof queryParamObj[key] === 'object') {\n if (Array.isArray(queryParamObj[key])) {\n if (paramSerializeStyle === 'spaceDelimited') {\n queryParam.append(key, queryParamObj[key].join(' '));\n } else if (paramSerializeStyle === 'pipeDelimited') {\n queryParam.append(key, queryParamObj[key].join('|'));\n } else {\n if (paramSerializeExplode === 'true') { // eslint-disable-line no-lonely-if\n queryParamObj[key].forEach((v) => {\n queryParam.append(key, v);\n });\n } else {\n queryParam.append(key, queryParamObj[key]);\n }\n }\n }\n } else {\n queryParam.append(key, queryParamObj[key]);\n }\n }\n }\n } catch (err) {\n console.log('RapiDoc: unable to parse %s into object', el.value); // eslint-disable-line no-console\n }\n if (queryParam.toString()) {\n urlQueryParamsMap.set(el.dataset.pname, queryParam);\n }\n });\n }\n let urlQueryParamString = '';\n if (urlQueryParamsMap.size) {\n urlQueryParamString = '?';\n urlQueryParamsMap.forEach((val, pname) => {\n if (queryParamsWithReservedCharsAllowed.includes(pname)) {\n urlQueryParamString += `${pname}=`;\n urlQueryParamString += val.getAll(pname).join(`&${pname}=`);\n urlQueryParamString += '&';\n } else {\n urlQueryParamString += `${val.toString()}&`;\n }\n });\n urlQueryParamString = urlQueryParamString.slice(0, -1);\n }\n fetchUrl = `${fetchUrl}${urlQueryParamString}`;\n\n // Add authentication Query-Param if provided\n this.api_keys\n .filter((v) => (v.in === 'query'))\n .forEach((v) => {\n fetchUrl = `${fetchUrl}${fetchUrl.includes('?') ? '&' : '?'}${v.name}=${encodeURIComponent(v.finalKeyValue)}`;\n });\n\n // Final URL for API call\n fetchUrl = `${this.serverUrl.replace(/\\/$/, '')}${fetchUrl}`;\n if (fetchUrl.startsWith('http') === false) {\n const url = new URL(fetchUrl, window.location.href);\n curlUrl = url.href;\n } else {\n curlUrl = fetchUrl;\n }\n curl = `curl -X ${this.method.toUpperCase()} \"${curlUrl}\" \\\\\\n`;\n const reqHeaders = new Headers();\n if (acceptHeader) {\n // Uses the acceptHeader from Response panel\n reqHeaders.append('Accept', acceptHeader);\n curlHeaders += ` -H \"Accept: ${acceptHeader}\" \\\\\\n`;\n } else if (this.accept) {\n reqHeaders.append('Accept', this.accept);\n curlHeaders += ` -H \"Accept: ${this.accept}\" \\\\\\n`;\n }\n\n // Add Authentication Header if provided\n this.api_keys\n .filter((v) => (v.in === 'header'))\n .forEach((v) => {\n reqHeaders.append(v.name, v.finalKeyValue);\n curlHeaders += ` -H \"${v.name}: ${v.finalKeyValue}\" \\\\\\n`;\n });\n\n // Add Header Params\n headerParamEls.map((el) => {\n if (el.value) {\n reqHeaders.append(el.dataset.pname, el.value);\n curlHeaders += ` -H \"${el.dataset.pname}: ${el.value}\" \\\\\\n`;\n }\n });\n\n // Request Body Params\n if (requestBodyContainerEl) {\n const requestBodyType = requestBodyContainerEl.dataset.selectedRequestBodyType;\n if (requestBodyType.includes('form-urlencoded')) {\n // url-encoded Form Params (dynamic) - Parse JSON and generate Params\n const formUrlDynamicTextAreaEl = requestPanelEl.querySelector(\"[data-ptype='dynamic-form']\");\n if (formUrlDynamicTextAreaEl) {\n const val = formUrlDynamicTextAreaEl.value;\n const formUrlDynParams = new URLSearchParams();\n let proceed = true;\n let tmpObj;\n if (val) {\n try {\n tmpObj = JSON.parse(val);\n } catch (err) {\n proceed = false;\n console.warn('RapiDoc: Invalid JSON provided', err); // eslint-disable-line no-console\n }\n } else {\n proceed = false;\n }\n if (proceed) {\n for (const prop in tmpObj) {\n formUrlDynParams.append(prop, JSON.stringify(tmpObj[prop]));\n }\n fetchOptions.body = formUrlDynParams;\n curlData = ` -d ${formUrlDynParams.toString()} \\\\\\n`;\n }\n } else {\n // url-encoded Form Params (regular)\n const formUrlEls = [...requestPanelEl.querySelectorAll(\"[data-ptype='form-urlencode']\")];\n const formUrlParams = new URLSearchParams();\n formUrlEls\n .filter((v) => (v.type !== 'file'))\n .forEach((el) => {\n if (el.dataset.array === 'false') {\n if (el.value) {\n formUrlParams.append(el.dataset.pname, el.value);\n }\n } else {\n const vals = (el.value && Array.isArray(el.value)) ? el.value.join(',') : '';\n formUrlParams.append(el.dataset.pname, vals);\n }\n });\n fetchOptions.body = formUrlParams;\n curlData = ` -d ${formUrlParams.toString()} \\\\\\n`;\n }\n } else if (requestBodyType.includes('form-data')) {\n const formDataParams = new FormData();\n const formDataEls = [...requestPanelEl.querySelectorAll(\"[data-ptype='form-data']\")];\n formDataEls.forEach((el) => {\n if (el.dataset.array === 'false') {\n if (el.type === 'file' && el.files[0]) {\n formDataParams.append(el.dataset.pname, el.files[0], el.files[0].name);\n curlForm += ` -F \"${el.dataset.pname}=@${el.files[0].name}\" \\\\\\n`;\n } else if (el.value) {\n formDataParams.append(el.dataset.pname, el.value);\n curlForm += ` -F \"${el.dataset.pname}=${el.value}\" \\\\\\n`;\n }\n } else if (el.value && Array.isArray(el.value)) {\n el.value.forEach((v) => {\n curlForm = `${curlForm} -F \"${el.dataset.pname}[]=${v}\" \\\\\\n`;\n });\n formDataParams.append(el.dataset.pname, el.value.join(','));\n }\n });\n fetchOptions.body = formDataParams;\n } else if (/^audio\\/|^image\\/|^video\\/|^font\\/|tar$|zip$|7z$|rtf$|msword$|excel$|\\/pdf$|\\/octet-stream$/.test(requestBodyType)) {\n const bodyParamFileEl = requestPanelEl.querySelector('.request-body-param-file');\n if (bodyParamFileEl?.files[0]) {\n fetchOptions.body = bodyParamFileEl.files[0]; // eslint-disable-line prefer-destructuring\n curlData = ` --data-binary @${bodyParamFileEl.files[0].name} \\\\\\n`;\n }\n } else if (requestBodyType.includes('json') || requestBodyType.includes('xml') || requestBodyType.includes('text')) {\n const exampleTextAreaEl = requestPanelEl.querySelector('.request-body-param-user-input');\n if (exampleTextAreaEl?.value) {\n fetchOptions.body = exampleTextAreaEl.value;\n if (requestBodyType.includes('json')) {\n try {\n curlData = ` -d '${JSON.stringify(JSON.parse(exampleTextAreaEl.value))}' \\\\\\n`;\n } catch (err) {\n // Ignore.\n }\n }\n if (!curlData) {\n curlData = ` -d '${exampleTextAreaEl.value.replace(/'/g, '\\'\"\\'\"\\'')}' \\\\\\n`;\n }\n }\n }\n // Common for all request-body\n if (!requestBodyType.includes('form-data')) {\n // For multipart/form-data dont set the content-type to allow creation of browser generated part boundaries\n reqHeaders.append('Content-Type', requestBodyType);\n }\n curlHeaders += ` -H \"Content-Type: ${requestBodyType}\" \\\\\\n`;\n }\n this.responseUrl = '';\n this.responseHeaders = [];\n this.curlSyntax = '';\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 this.curlSyntax = `${curl}${curlHeaders}${curlData}${curlForm}`;\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 fetchRequest = new Request(fetchUrl, fetchOptions);\n this.dispatchEvent(new CustomEvent('before-try', {\n bubbles: true,\n composed: true,\n detail: {\n request: fetchRequest,\n controller,\n },\n }));\n\n let fetchResponse;\n let responseClone;\n try {\n let respBlob;\n let respJson;\n let respText;\n tryBtnEl.disabled = true;\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.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 = prettyXml(respText);\n }\n this.responseText = respText;\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 } 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 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 // Cleanup ObjectURL forthe 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\ncustomElements.define('api-request', ApiRequest);\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 .table .tr {\n width: calc(100% - 5px);\n padding: 0 0 0 5px;\n border-bottom: 1px dotted var(--light-border-color);\n }\n .table .td {\n padding: 4px 0;\n }\n .table .key {\n width: 240px;\n }\n .key.deprecated .key-label {\n color: var(--red);\n }\n\n .table .key-type {\n white-space: normal;\n width: 150px;\n }\n .collapsed-descr .tr {\n max-height: calc(var(--font-size-small) + var(--font-size-small) + 4px);\n }\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
\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
\n ${this.data?.['::description']\n ? html` ${unsafeHTML(marked(this.data['::description'] || ''))}`\n : ''\n }\n
\n
\n
Field
\n
Type
\n
Description
\n
\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 : ''\n } \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 dataType === 'array'\n ? html` [ ] `\n : dataType === 'object'\n ? html` { } `\n : html` schema undefined `\n }\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 = 16 * 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 = 'object';\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 = 'array';\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 this.toggleObjectExpand(e, keyLabel)} \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
\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'].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 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 let dataTypeHtml = '';\n if (dataType === 'array') {\n dataTypeHtml = html` \n
\n [${type}] ${readOrWrite === 'readonly' ? '🆁' : readOrWrite === 'writeonly' ? '🆆' : ''}\n
`;\n } else {\n dataTypeHtml = html` \n
\n ${type} ${readOrWriteOnly}\n
`;\n }\n return html`\n
\n
\n ${deprecated ? html`` : ''}\n ${keyLabel?.endsWith('*')\n ? html`\n ${keyLabel.substring(0, keyLabel.length - 1)}\n *`\n : key.startsWith('::OPTION')\n ? html`${keyLabel}${keyDescr}`\n : html`${keyLabel ? html` ${keyLabel}` : html`${schemaTitle}`}`\n }\n
\n ${dataTypeHtml}\n
{ this.schemaDescriptionExpanded = 'true'; }}\">\n ${dataType === 'array' ? html`${unsafeHTML(marked(description))}` : ''}\n ${schemaDescription\n ? html`\n ${unsafeHTML(marked(`${schemaTitle ? `**${schemaTitle}:**` : ''} ${schemaDescription} ${constraint || defaultValue || allowedValues || pattern ? '' : ''}`))}\n `\n : schemaTitle\n ? html`${schemaTitle} ${constraint || defaultValue || allowedValues || pattern\n ? html``\n : ''}`\n : ''\n }\n ${constraint ? html`
Constraints: ${constraint}
` : ''}\n ${defaultValue ? html`
Default: ${defaultValue}
` : ''}\n ${allowedValues ? html`
Allowed: ${allowedValues}
` : ''}\n ${pattern ? html`
Pattern: ${pattern}
` : ''}\n
\n
\n `;\n }\n /* eslint-enable indent */\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}\ncustomElements.define('schema-table', SchemaTable);\n","import { html } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\nimport { rapidocApiKey } from '~/utils/common-utils';\nimport { pathSecurityTemplate } from '~/templates/security-scheme-template';\nimport codeSamplesTemplate from '~/templates/code-samples-template';\nimport callbackTemplate from '~/templates/callback-template';\nimport '~/components/api-request';\nimport '~/components/api-response';\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 codeSampleTabPanel = path.xCodeSamples ? codeSamplesTemplate.call(this, path.xCodeSamples) : '';\n return html`\n ${this.renderStyle === 'read' ? html`
` : ''}\n
\n ${(this.renderStyle === 'focused' && tagName !== 'General ⦂') ? html`

${tagName}

` : ''}\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

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

\n ${path.isWebhook\n ? html` WEBHOOK `\n : html`\n
\n ${path.method} \n ${path.path}\n
\n `\n }\n `\n }\n ${path.description ? html`
${unsafeHTML(marked(path.description))}
` : ''}\n ${pathSecurityTemplate.call(this, path.security)}\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 ${\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, 'BBB'))}\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 { downloadResource, viewResource } from '~/utils/common-utils';\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 return html`\n
\n ${this.resolvedSpec?.info\n ? html`\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 ${this.specUrl && this.allowSpecFileDownload === 'true'\n ? html`\n
\n \n ${this.specUrl?.trim().toLowerCase().endsWith('json')\n ? html``\n : ''\n }\n
`\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 { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions\nimport { marked } from 'marked';\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('table').querySelectorAll('input, select')];\n let tempUrl = serverObj.url;\n inputEls.forEach((v) => {\n const regex = new RegExp(`{${v.dataset.var}}`, 'g');\n tempUrl = tempUrl.replace(regex, v.value);\n });\n serverObj.computedUrl = tempUrl;\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
SERVER VARIABLES
\n \n ${Object.entries(this.selectedServer.variables).map((kv) => html`\n \n \n \n \n ${kv[1].description\n ? html``\n : ''\n }\n `)}\n
${kv[0]}\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
${unsafeHTML(marked(kv[1].description))}
\n `\n : '';\n}\n\nexport default function serverTemplate() {\n if (!this.resolvedSpec || this.resolvedSpec.specLoadError) { return ''; }\n return html`\n
\n
API SERVER
\n
\n ${!this.resolvedSpec.servers || this.resolvedSpec.servers?.length === 0\n ? ''\n : html`\n ${this.resolvedSpec?.servers.map((server, i) => html`\n { setApiServer.call(this, server.url); }}\n .checked = '${this.selectedServer.url === server.url}'\n style = 'margin:4px 0; cursor:pointer'\n />\n \n
\n `)}\n `}\n
SELECTED: ${this.selectedServer?.computedUrl || 'none'}
\n
\n \n ${serverVarsTemplate.call(this)}\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 if (tagAndPathEl) {\n const isExpanded = tagAndPathEl.classList.contains('expanded');\n if (isExpanded && (action === 'toggle' || action === 'collapse')) {\n tagAndPathEl.classList.replace('expanded', 'collapsed');\n } else if (!isExpanded && (action === 'toggle' || action === 'expand')) {\n tagAndPathEl.classList.replace('collapsed', 'expanded');\n }\n }\n}\n\nexport function expandCollapseAll(navEl, action = 'expand-all') {\n const elList = [...navEl.querySelectorAll('.nav-bar-tag-and-paths')];\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 onExpandCollapse(e) {\n expandCollapseNavBarTag(e.target, 'toggle');\n}\n\nfunction onExpandCollapseAll(e, action = 'expand-all') {\n expandCollapseAll(e.target.closest('.nav-scroll'), action);\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`;\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 '~/templates/expanded-endpoint-template';\nimport '~/components/api-request';\nimport '~/components/api-response';\nimport componentsTemplate from '~/templates/components-template';\nimport overviewTemplate from '~/templates/overview-template';\nimport serverTemplate from '~/templates/server-template';\nimport securitySchemeTemplate from '~/templates/security-scheme-template';\nimport { expandCollapseNavBarTag } from '~/templates/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(this, expandedEndpointBodyTemplate.call(this, selectedPathObj, selectedTagObj.name));\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 codeSamplesTemplate from '~/templates/code-samples-template';\nimport callbackTemplate from '~/templates/callback-template';\nimport { pathSecurityTemplate } from '~/templates/security-scheme-template';\nimport { pathIsInSearch, rapidocApiKey } from '~/utils/common-utils';\n\nfunction toggleExpand(path) {\n if (path.expanded) {\n path.expanded = false; // collapse\n if (this.updateRoute === 'true') {\n window.history.replaceState(null, null, `${window.location.href.split('#')[0]}${this.routePrefix === '#' ? '' : `${this.routePrefix}`}`);\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 window.history.replaceState(null, null, `${window.location.href.split('#')[0]}${newHash}`);\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 return html`\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 ${path.description ? html`
${unsafeHTML(marked(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 use-summary-to-list-example = \"${this.useSummaryToListExamples}\"\n allow-try = \"${this.allowTry}\"\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 = \"${path.isWebhook ? this.schemaHideWriteOnly : this.schemaHideReadOnly}\"\n schema-hide-write-only = \"${path.isWebhook ? this.schemaHideReadOnly : this.schemaHideWriteOnly}\"\n fetch-credentials = \"${this.fetchCredentials}\"\n exportparts = \"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 '~/templates/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 { 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 '~/components/schema-tree';\nimport '~/components/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 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 .resp-head{\n vertical-align: middle;\n padding:16px 0 8px;\n }\n .resp-head.divider{\n border-top: 1px solid var(--border-color);\n margin-top:10px;\n }\n .resp-status{ \n font-weight:bold;\n font-size:calc(var(--font-size-small) + 1px);\n }\n .resp-descr{\n font-size:calc(var(--font-size-small) + 1px);\n color:var(--light-fg);\n text-align:left;\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 padding-top:24px;\n margin-top:12px;\n border-top: 1px dashed var(--border-color);\n }`,\n CustomStyles,\n ];\n }\n\n render() {\n return html`\n
\n
\n ${this.callback === 'true' ? 'CALLBACK RESPONSE' : 'RESPONSE'}\n
\n
\n ${this.responseTemplate()}\n
\n
\n `;\n }\n\n resetSelection() {\n this.selectedStatus = '';\n this.selectedMimeType = '';\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.schemaHideReadOnly && (this.schemaHideReadOnly.includes(this.method) || this.schemaHideReadOnly === 'true')),\n !(this.schemaHideWriteOnly && (this.schemaHideWriteOnly.includes(this.method) || this.schemaHideWriteOnly === 'true')),\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 }`)\n }`\n : html`${Object.keys(this.responses)[0]}`\n }\n
\n\n ${Object.keys(this.responses).map((status) => html`\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
{ if (e.target.tagName.toLowerCase() === 'button') { this.activeSchemaTab = e.target.dataset.tab; } }}\" >\n \n \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
\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 responseHeaderListTemplate(respHeaders) {\n return html`\n
RESPONSE HEADERS
\n \n ${respHeaders.map((v) => html`\n \n \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\ncustomElements.define('api-response', ApiResponse);\n","import { css } from 'lit';\n\nexport default css`\n *, *:before, *:after { box-sizing: border-box; }\n\n .dialog-box-overlay {\n background-color: var(--overlay-bg);\n position: fixed;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100vh;\n overflow: hidden;\n z-index: var(--dialog-z-index);\n }\n \n .dialog-box {\n position: fixed;\n top: 100px;\n left: 50%;\n transform: translate(-50%, 0%);\n display: flex;\n flex-direction: column;\n width: 70vw;\n background-color: var(--bg2);\n color: var(--fg2);\n border-radius: 4px;\n max-height: 500px;\n overflow: hidden;\n border: 1px solid var(--border-color);\n box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);\n }\n \n .dialog-box-header {\n position: sticky;\n top: 0;\n align-self: stretch;\n display: flex;\n align-items: center;\n padding: 0px 16px;\n min-height: 60px;\n max-height: 60px;\n border-bottom: 1px solid var(--light-border-color);\n overflow: hidden;\n }\n \n .dialog-box-header button {\n font-size: 1.5rem;\n font-weight: 700;\n line-height: 1;\n color: var(--fg);\n border: none;\n outline: none;\n background-color: transparent;\n cursor:pointer;\n border: 1px solid transparent;\n border-radius: 50%;\n margin-right: -8px;\n }\n .dialog-box-header button:hover {\n border-color: var(--primary-color);\n }\n\n .dialog-box-content {\n padding: 16px;\n display:block;\n overflow: auto;\n height: 100%;\n }\n\n .dialog-box-title {\n flex-grow: 1;\n font-size:24px;\n }\n`;\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\ncustomElements.define('dialog-box', DialogBox);\n","import { html } from 'lit';\nimport ColorUtils from '~/utils/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.8');\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 : ColorUtils.color.brightness(fg1, -65); // or #777\n const inlineCodeFg = theme.inlineCodeFg ? theme.inlineCodeFg : '#aaa';\n const selectionBg = '#bbb';\n const selectionFg = '#eee';\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 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 selectionBg,\n selectionFg,\n overlayBg,\n navBgColor,\n navTextColor,\n navHoverBgColor,\n navHoverTextColor,\n navAccentColor,\n\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 || ColorUtils.color.brightness(bg1, 15), // #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\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 : ColorUtils.color.brightness(fg1, 17); // or '#555'\n const fg3 = theme.fg3 ? theme.fg3 : ColorUtils.color.brightness(fg1, 30); // or #666\n const lightFg = theme.fg3 ? theme.fg3 : ColorUtils.color.brightness(fg1, 70); // or #999\n const inlineCodeFg = theme.inlineCodeFg ? theme.inlineCodeFg : 'brown';\n\n const selectionBg = '#444';\n const selectionFg = '#eee';\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 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 selectionBg,\n selectionFg,\n overlayBg,\n navBgColor,\n navTextColor,\n navHoverBgColor,\n navHoverTextColor,\n navAccentColor,\n\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, -38),\n lightBorderColor: theme.lightBorderColor || ColorUtils.color.brightness(bg1, -23),\n codeBorderColor: theme.codeBorderColor || 'transparent',\n\n inputBg: theme.inputBg || ColorUtils.color.brightness(bg1, 10), // #fff\n placeHolder: theme.placeHolder || ColorUtils.color.brightness(lightFg, 20), // #dedede\n hoverColor: theme.hoverColor || ColorUtils.color.brightness(bg1, -5), // # f1f1f1\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\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 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 '~/templates/expanded-endpoint-template';\nimport focusedEndpointTemplate from '~/templates/focused-endpoint-template';\nimport overviewTemplate from '~/templates/overview-template';\nimport endpointTemplate from '~/templates/endpoint-template';\nimport serverTemplate from '~/templates/server-template';\nimport securitySchemeTemplate, { recoverPersistedApiKeys } from '~/templates/security-scheme-template';\nimport headerTemplate from '~/templates/header-template';\nimport navbarTemplate from '~/templates/navbar-template';\nimport advancedSearchTemplate from '~/templates/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 };\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
{ this.handleHref(e); }}\">\n ${this.renderStyle === 'focused'\n ? html`${focusedEndpointTemplate.call(this)}`\n : html`\n ${this.showInfo === 'true' ? overviewTemplate.call(this) : ''}\n ${this.allowServerSelection === 'true' ? serverTemplate.call(this) : ''}\n ${this.allowAuthentication === 'true' ? securitySchemeTemplate.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 this.isIntersectionObserverActive = true;\n this.intersectionObserver = new IntersectionObserver((entries) => { this.onIntersect(entries); }, intersectionObserverOptions);\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 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 useSummaryToListExamples: { type: String, attribute: 'use-summary-to-list-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 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 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 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 .body {\n display:flex;\n height:100%;\n width:100%;\n overflow:hidden;\n }\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\n .section-gap.section-tag {\n border-bottom:1px solid var(--border-color);\n }\n .section-gap,\n .section-gap--focused-mode,\n .section-gap--read-mode { \n padding: 0px 4px; \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.deprecated{ filter:opacity(0.6); }\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(--nav-get-color); }\n .nav-method.as-colored-text.put { color:var(--nav-put-color); }\n .nav-method.as-colored-text.post { color:var(--nav-post-color); }\n .nav-method.as-colored-text.delete { color:var(--nav-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\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 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 = 'read'; }\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 const writeMethodsWithBody = ['post', 'put', 'patch'];\n if (!this.schemaHideReadOnly) {\n this.schemaHideReadOnly = writeMethodsWithBody;\n } else if (this.schemaHideReadOnly !== 'never') {\n this.schemaHideReadOnly = writeMethodsWithBody.filter((value) => this.schemaHideReadOnly.includes(value));\n if (this.schemaHideReadOnly.length === 0) {\n this.schemaHideReadOnly = writeMethodsWithBody;\n }\n }\n this.schemaHideReadOnly += ['get', 'head', 'delete', 'options'];\n this.schemaHideWriteOnly = this.schemaHideWriteOnly !== 'never';\n if (!this.fillRequestFieldsWithExample || !'true, false,'.includes(`${this.fillRequestFieldsWithExample},`)) { this.fillRequestFieldsWithExample = 'true'; }\n if (!this.useSummaryToListExamples || !'true, false,'.includes(`${this.useSummaryToListExamples},`)) { this.useSummaryToListExamples = 'false'; }\n if (!this.persistAuth || !'true, false,'.includes(`${this.persistAuth},`)) { this.persistAuth = 'false'; }\n if (!this.onNavTagClick || !'expand-collapse, show-description,'.includes(`${this.onNavTagClick},`)) { this.onNavTagClick = 'expand-collapse'; }\n if (!this.responseAreaHeight) {\n this.responseAreaHeight = '300px';\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 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.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) { this.fontSize = 'default'; }\n\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 marked.setOptions({\n highlight: (code, lang) => {\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 const regEx = new RegExp(`^${this.routePrefix}`, 'i');\n const elementId = window.location.hash.replace(regEx, '');\n this.scrollTo(elementId);\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.scrollTo(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 onSepcUrlChange() {\n this.setAttribute('spec-url', this.shadowRoot.getElementById('spec-url').value);\n }\n\n onSepcFileChange(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 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 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 // On first time Spec load, try to navigate to location hash if provided\n const locationHash = window.location.hash?.substring(1);\n if (locationHash) {\n const regEx = new RegExp(`^${this.routePrefix}`, 'i');\n const elementId = window.location.hash.replace(regEx, '');\n if (this.renderStyle === 'view') {\n this.expandAndGotoOperation(elementId, true, true);\n } else {\n this.scrollTo(elementId);\n }\n } else if (this.renderStyle === 'focused') {\n const defaultElementId = this.showInfo ? 'overview' : this.resolvedSpec.tags[0]?.paths[0];\n this.scrollTo(defaultElementId);\n }\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 window.history.replaceState(null, null, `${this.routePrefix || '#'}${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 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 window.history.replaceState(null, null, `${window.location.href.split('#')[0]}${this.routePrefix || '#'}${entry.target.id}`);\n }\n newNavEl.scrollIntoView({ behavior: 'auto', block: 'center' });\n newNavEl.classList.add('active');\n }\n // Remove active class from previous element\n if (oldNavEl) {\n oldNavEl.classList.remove('active');\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 const navEl = event.currentTarget;\n if (!navEl.dataset.contentId) {\n return;\n }\n this.isIntersectionObserverActive = false;\n this.scrollTo(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 scrollTo(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.resetRequestBodySelection();\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 window.history.replaceState(null, null, `${this.routePrefix || '#'}${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 }\n newNavEl.classList.add('active'); // must add the class after scrolling\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 searcOptions = [...eventTargetEl.closest('.advanced-search-options').querySelectorAll('input:checked')].map((v) => v.id);\n this.advancedSearchMatches = advancedSearch(searchInputEl.value, this.resolvedSpec.tags, searcOptions);\n }, delay);\n }\n}\ncustomElements.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 useSummaryToListExamples: { type: String, attribute: 'use-summary-to-list-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 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.useSummaryToListExamples || !'true, false,'.includes(`${this.useSummaryToListExamples},`)) { this.useSummaryToListExamples = 'false'; }\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 (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 onSepcUrlChange() {\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}\ncustomElements.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 };\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","export default class OauthReceiver extends HTMLElement {\n connectedCallback() {\n this.receiveAuthParms();\n window.addEventListener('storage', (e) => this.receiveStorage(e), true);\n }\n\n /**\n * Read OAuth2 parameters and sends them off\n * to the window opener through `window.postMessage`.\n */\n receiveAuthParms() {\n let authData = {};\n if (document.location.search) { // Applies to authorizationCode flow\n const params = new URLSearchParams(document.location.search);\n const code = params.get('code');\n const error = params.get('error');\n const state = params.get('state');\n authData = {\n code,\n error,\n state,\n responseType: 'code',\n };\n } else if (window.location.hash) { // Applies to Implicit flow\n const token_type = this.parseQueryString(window.location.hash.substring(1), 'token_type'); // eslint-disable-line camelcase\n const access_token = this.parseQueryString(window.location.hash.substring(1), 'access_token'); // eslint-disable-line camelcase\n authData = { token_type, access_token, responseType: 'token' }; // eslint-disable-line camelcase\n }\n\n if (window.opener) {\n window.opener.postMessage(authData, this.target);\n return;\n }\n sessionStorage.setItem('rapidoc-oauth-data', JSON.stringify(authData)); // Fallback to session storage if window.opener dont exist\n }\n\n relayAuthParams(e) {\n if (window.parent) {\n if (e.key === 'rapidoc-oauth-data') {\n const authData = JSON.parse(e.newValue);\n window.parent.postMessage(authData, this.target);\n }\n }\n }\n\n parseQueryString(queryString, key) {\n const vars = queryString.split('&');\n for (let i = 0; i < vars.length; i++) {\n const pair = vars[i].split('=');\n if (decodeURIComponent(pair[0]) === key) {\n return decodeURIComponent(pair[1]);\n }\n }\n }\n}\ncustomElements.define('oauth-receiver', OauthReceiver);\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.responseAreaHeight) { this.responseAreaHeight = '300px'; }\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 (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 onSepcUrlChange() {\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}\ncustomElements.define('json-schema-viewer', JsonSchemaViewer);\n"],"names":[],"sourceRoot":""}