1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | (() => {
|
10 | var __webpack_modules__ = ({
|
11 |
|
12 | 656:
|
13 | ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
|
14 |
|
15 | "use strict";
|
16 |
|
17 |
|
18 |
|
19 | ;
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | const css_tag_t=window,e=css_tag_t.ShadowRoot&&(void 0===css_tag_t.ShadyCSS||css_tag_t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),n=new WeakMap;class o{constructor(t,e,n){if(this._$cssResult$=!0,n!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const s=this.t;if(e&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=n.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n.set(s,t))}return t}toString(){return this.cssText}}const r=t=>new o("string"==typeof t?t:t+"",void 0,s),i=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,s,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[n+1]),t[0]);return new o(n,t,s)},S=(s,n)=>{e?s.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((e=>{const n=document.createElement("style"),o=css_tag_t.litNonce;void 0!==o&&n.setAttribute("nonce",o),n.textContent=e.cssText,s.appendChild(n)}))},c=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r(e)})(t):t;
|
26 |
|
27 |
|
28 | ;
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | */var reactive_element_s;const reactive_element_e=window,reactive_element_r=reactive_element_e.trustedTypes,h=reactive_element_r?reactive_element_r.emptyScript:"",reactive_element_o=reactive_element_e.reactiveElementPolyfillSupport,reactive_element_n={toAttribute(t,i){switch(i){case Boolean:t=t?h:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,i){let s=t;switch(i){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},a=(t,i)=>i!==t&&(i==i||t==t),l={attribute:!0,type:String,converter:reactive_element_n,reflect:!1,hasChanged:a};class d extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var i;this.finalize(),(null!==(i=this.h)&&void 0!==i?i:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((i,s)=>{const e=this._$Ep(s,i);void 0!==e&&(this._$Ev.set(e,s),t.push(e))})),t}static createProperty(t,i=l){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){const s="symbol"==typeof t?Symbol():"__"+t,e=this.getPropertyDescriptor(t,s,i);void 0!==e&&Object.defineProperty(this.prototype,t,e)}}static getPropertyDescriptor(t,i,s){return{get(){return this[i]},set(e){const r=this[t];this[i]=e,this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||l}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const s of i)this.createProperty(s,t[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(i){const s=[];if(Array.isArray(i)){const e=new Set(i.flat(1/0).reverse());for(const i of e)s.unshift(c(i))}else void 0!==i&&s.push(c(i));return s}static _$Ep(t,i){const s=i.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var i,s;(null!==(i=this._$ES)&&void 0!==i?i:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(s=t.hostConnected)||void 0===s||s.call(t))}removeController(t){var i;null===(i=this._$ES)||void 0===i||i.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])}))}createRenderRoot(){var t;const s=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return S(s,this.constructor.elementStyles),s}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostConnected)||void 0===i?void 0:i.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostDisconnected)||void 0===i?void 0:i.call(t)}))}attributeChangedCallback(t,i,s){this._$AK(t,s)}_$EO(t,i,s=l){var e;const r=this.constructor._$Ep(t,s);if(void 0!==r&&!0===s.reflect){const h=(void 0!==(null===(e=s.converter)||void 0===e?void 0:e.toAttribute)?s.converter:reactive_element_n).toAttribute(i,s.type);this._$El=t,null==h?this.removeAttribute(r):this.setAttribute(r,h),this._$El=null}}_$AK(t,i){var s;const e=this.constructor,r=e._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=e.getPropertyOptions(r),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(s=t.converter)||void 0===s?void 0:s.fromAttribute)?t.converter:reactive_element_n;this._$El=r,this[r]=h.fromAttribute(i,t.type),this._$El=null}}requestUpdate(t,i,s){let e=!0;void 0!==t&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||a)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),!0===s.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,s))):e=!1),!this.isUpdatePending&&e&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,i)=>this[i]=t)),this._$Ei=void 0);let i=!1;const s=this._$AL;try{i=this.shouldUpdate(s),i?(this.willUpdate(s),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostUpdate)||void 0===i?void 0:i.call(t)})),this.update(s)):this._$Ek()}catch(t){throw i=!1,this._$Ek(),t}i&&this._$AE(s)}willUpdate(t){}_$AE(t){var i;null===(i=this._$ES)||void 0===i||i.forEach((t=>{var i;return null===(i=t.hostUpdated)||void 0===i?void 0:i.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,i)=>this._$EO(i,this[i],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}d.finalized=!0,d.elementProperties=new Map,d.elementStyles=[],d.shadowRootOptions={mode:"open"},null==reactive_element_o||reactive_element_o({ReactiveElement:d}),(null!==(reactive_element_s=reactive_element_e.reactiveElementVersions)&&void 0!==reactive_element_s?reactive_element_s:reactive_element_e.reactiveElementVersions=[]).push("1.6.1");
|
35 |
|
36 |
|
37 | ;
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | var lit_html_t;const lit_html_i=window,lit_html_s=lit_html_i.trustedTypes,lit_html_e=lit_html_s?lit_html_s.createPolicy("lit-html",{createHTML:t=>t}):void 0,lit_html_o=`lit$${(Math.random()+"").slice(9)}$`,lit_html_n="?"+lit_html_o,lit_html_l=`<${lit_html_n}>`,lit_html_h=document,lit_html_r=(t="")=>lit_html_h.createComment(t),lit_html_d=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u=Array.isArray,lit_html_c=t=>u(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),v=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,lit_html_a=/-->/g,f=/>/g,_=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),m=/'/g,p=/"/g,$=/^(?:script|style|textarea|title)$/i,g=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),y=g(1),w=g(2),x=Symbol.for("lit-noChange"),b=Symbol.for("lit-nothing"),T=new WeakMap,A=lit_html_h.createTreeWalker(lit_html_h,129,null,!1),E=(t,i)=>{const s=t.length-1,n=[];let h,r=2===i?"<svg>":"",d=v;for(let i=0;i<s;i++){const s=t[i];let e,u,c=-1,g=0;for(;g<s.length&&(d.lastIndex=g,u=d.exec(s),null!==u);)g=d.lastIndex,d===v?"!--"===u[1]?d=lit_html_a:void 0!==u[1]?d=f:void 0!==u[2]?($.test(u[2])&&(h=RegExp("</"+u[2],"g")),d=_):void 0!==u[3]&&(d=_):d===_?">"===u[0]?(d=null!=h?h:v,c=-1):void 0===u[1]?c=-2:(c=d.lastIndex-u[2].length,e=u[1],d=void 0===u[3]?_:'"'===u[3]?p:m):d===p||d===m?d=_:d===lit_html_a||d===f?d=v:(d=_,h=void 0);const y=d===_&&t[i+1].startsWith("/>")?" ":"";r+=d===v?s+lit_html_l:c>=0?(n.push(e),s.slice(0,c)+"$lit$"+s.slice(c)+lit_html_o+y):s+lit_html_o+(-2===c?(n.push(void 0),i):y)}const u=r+(t[s]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==lit_html_e?lit_html_e.createHTML(u):u,n]};class C{constructor({strings:t,_$litType$:i},e){let l;this.parts=[];let h=0,d=0;const u=t.length-1,c=this.parts,[v,a]=E(t,i);if(this.el=C.createElement(v,e),A.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(l=A.nextNode())&&c.length<u;){if(1===l.nodeType){if(l.hasAttributes()){const t=[];for(const i of l.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(lit_html_o)){const s=a[d++];if(t.push(i),void 0!==s){const t=l.getAttribute(s.toLowerCase()+"$lit$").split(lit_html_o),i=/([.?@])?(.*)/.exec(s);c.push({type:1,index:h,name:i[2],strings:t,ctor:"."===i[1]?M:"?"===i[1]?k:"@"===i[1]?H:lit_html_S})}else c.push({type:6,index:h})}for(const i of t)l.removeAttribute(i)}if($.test(l.tagName)){const t=l.textContent.split(lit_html_o),i=t.length-1;if(i>0){l.textContent=lit_html_s?lit_html_s.emptyScript:"";for(let s=0;s<i;s++)l.append(t[s],lit_html_r()),A.nextNode(),c.push({type:2,index:++h});l.append(t[i],lit_html_r())}}}else if(8===l.nodeType)if(l.data===lit_html_n)c.push({type:2,index:h});else{let t=-1;for(;-1!==(t=l.data.indexOf(lit_html_o,t+1));)c.push({type:7,index:h}),t+=lit_html_o.length-1}h++}}static createElement(t,i){const s=lit_html_h.createElement("template");return s.innerHTML=t,s}}function P(t,i,s=t,e){var o,n,l,h;if(i===x)return i;let r=void 0!==e?null===(o=s._$Co)||void 0===o?void 0:o[e]:s._$Cl;const u=lit_html_d(i)?void 0:i._$litDirective$;return(null==r?void 0:r.constructor)!==u&&(null===(n=null==r?void 0:r._$AO)||void 0===n||n.call(r,!1),void 0===u?r=void 0:(r=new u(t),r._$AT(t,s,e)),void 0!==e?(null!==(l=(h=s)._$Co)&&void 0!==l?l:h._$Co=[])[e]=r:s._$Cl=r),void 0!==r&&(i=P(t,r._$AS(t,i.values),r,e)),i}class V{constructor(t,i){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:lit_html_h).importNode(s,!0);A.currentNode=o;let n=A.nextNode(),l=0,r=0,d=e[0];for(;void 0!==d;){if(l===d.index){let i;2===d.type?i=new N(n,n.nextSibling,this,t):1===d.type?i=new d.ctor(n,d.name,d.strings,this,t):6===d.type&&(i=new I(n,this,t)),this.u.push(i),d=e[++r]}l!==(null==d?void 0:d.index)&&(n=A.nextNode(),l++)}return o}p(t){let i=0;for(const s of this.u)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class N{constructor(t,i,s,e){var o;this.type=2,this._$AH=b,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cm=null===(o=null==e?void 0:e.isConnected)||void 0===o||o}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=P(this,t,i),lit_html_d(t)?t===b||null==t||""===t?(this._$AH!==b&&this._$AR(),this._$AH=b):t!==this._$AH&&t!==x&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):lit_html_c(t)?this.k(t):this.g(t)}O(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==b&&lit_html_d(this._$AH)?this._$AA.nextSibling.data=t:this.T(lit_html_h.createTextNode(t)),this._$AH=t}$(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=C.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.p(s);else{const t=new V(o,this),i=t.v(this.options);t.p(s),this.T(i),this._$AH=t}}_$AC(t){let i=T.get(t.strings);return void 0===i&&T.set(t.strings,i=new C(t)),i}k(t){u(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new N(this.O(lit_html_r()),this.O(lit_html_r()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cm=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class lit_html_S{constructor(t,i,s,e,o){this.type=1,this._$AH=b,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=b}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=P(this,t,i,0),n=!lit_html_d(t)||t!==this._$AH&&t!==x,n&&(this._$AH=t);else{const e=t;let l,h;for(t=o[0],l=0;l<o.length-1;l++)h=P(this,e[s+l],i,l),h===x&&(h=this._$AH[l]),n||(n=!lit_html_d(h)||h!==this._$AH[l]),h===b?t=b:t!==b&&(t+=(null!=h?h:"")+o[l+1]),this._$AH[l]=h}n&&!e&&this.j(t)}j(t){t===b?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class M extends lit_html_S{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===b?void 0:t}}const R=lit_html_s?lit_html_s.emptyScript:"";class k extends lit_html_S{constructor(){super(...arguments),this.type=4}j(t){t&&t!==b?this.element.setAttribute(this.name,R):this.element.removeAttribute(this.name)}}class H extends lit_html_S{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=P(this,t,i,0))&&void 0!==s?s:b)===x)return;const e=this._$AH,o=t===b&&e!==b||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==b&&(e===b||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class I{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){P(this,t)}}const L={P:"$lit$",A:lit_html_o,M:lit_html_n,C:1,L:E,R:V,D:lit_html_c,V:P,I:N,H:lit_html_S,N:k,U:H,B:M,F:I},z=lit_html_i.litHtmlPolyfillSupport;null==z||z(C,N),(null!==(lit_html_t=lit_html_i.litHtmlVersions)&&void 0!==lit_html_t?lit_html_t:lit_html_i.litHtmlVersions=[]).push("2.6.1");const Z=(t,i,s)=>{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=n._$litPart$;if(void 0===l){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=l=new N(i.insertBefore(lit_html_r(),t),t,void 0,null!=s?s:{})}return l._$AI(t),l};
|
44 |
|
45 |
|
46 | ;
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 | var lit_element_l,lit_element_o;const lit_element_r=(/* unused pure expression or super */ null && (t));class lit_element_s extends d{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=Z(i,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return x}}lit_element_s.finalized=!0,lit_element_s._$litElement$=!0,null===(lit_element_l=globalThis.litElementHydrateSupport)||void 0===lit_element_l||lit_element_l.call(globalThis,{LitElement:lit_element_s});const lit_element_n=globalThis.litElementPolyfillSupport;null==lit_element_n||lit_element_n({LitElement:lit_element_s});const lit_element_h={_$AK:(t,e,i)=>{t._$AK(e,i)},_$AL:t=>t._$AL};(null!==(lit_element_o=globalThis.litElementVersions)&&void 0!==lit_element_o?lit_element_o:globalThis.litElementVersions=[]).push("3.2.0");
|
53 |
|
54 |
|
55 | ;
|
56 |
|
57 |
|
58 |
|
59 | ;
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 | function getDefaults() {
|
72 | return {
|
73 | async: false,
|
74 | baseUrl: null,
|
75 | breaks: false,
|
76 | extensions: null,
|
77 | gfm: true,
|
78 | headerIds: true,
|
79 | headerPrefix: '',
|
80 | highlight: null,
|
81 | langPrefix: 'language-',
|
82 | mangle: true,
|
83 | pedantic: false,
|
84 | renderer: null,
|
85 | sanitize: false,
|
86 | sanitizer: null,
|
87 | silent: false,
|
88 | smartypants: false,
|
89 | tokenizer: null,
|
90 | walkTokens: null,
|
91 | xhtml: false
|
92 | };
|
93 | }
|
94 |
|
95 | let defaults = getDefaults();
|
96 |
|
97 | function changeDefaults(newDefaults) {
|
98 | defaults = newDefaults;
|
99 | }
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | const escapeTest = /[&<>"']/;
|
105 | const escapeReplace = new RegExp(escapeTest.source, 'g');
|
106 | const escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
|
107 | const escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g');
|
108 | const escapeReplacements = {
|
109 | '&': '&',
|
110 | '<': '<',
|
111 | '>': '>',
|
112 | '"': '"',
|
113 | "'": '''
|
114 | };
|
115 | const getEscapeReplacement = (ch) => escapeReplacements[ch];
|
116 | function marked_esm_escape(html, encode) {
|
117 | if (encode) {
|
118 | if (escapeTest.test(html)) {
|
119 | return html.replace(escapeReplace, getEscapeReplacement);
|
120 | }
|
121 | } else {
|
122 | if (escapeTestNoEncode.test(html)) {
|
123 | return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
|
124 | }
|
125 | }
|
126 |
|
127 | return html;
|
128 | }
|
129 |
|
130 | const unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
|
131 |
|
132 |
|
133 |
|
134 |
|
135 | function marked_esm_unescape(html) {
|
136 |
|
137 | return html.replace(unescapeTest, (_, n) => {
|
138 | n = n.toLowerCase();
|
139 | if (n === 'colon') return ':';
|
140 | if (n.charAt(0) === '#') {
|
141 | return n.charAt(1) === 'x'
|
142 | ? String.fromCharCode(parseInt(n.substring(2), 16))
|
143 | : String.fromCharCode(+n.substring(1));
|
144 | }
|
145 | return '';
|
146 | });
|
147 | }
|
148 |
|
149 | const caret = /(^|[^\[])\^/g;
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 | function edit(regex, opt) {
|
156 | regex = typeof regex === 'string' ? regex : regex.source;
|
157 | opt = opt || '';
|
158 | const obj = {
|
159 | replace: (name, val) => {
|
160 | val = val.source || val;
|
161 | val = val.replace(caret, '$1');
|
162 | regex = regex.replace(name, val);
|
163 | return obj;
|
164 | },
|
165 | getRegex: () => {
|
166 | return new RegExp(regex, opt);
|
167 | }
|
168 | };
|
169 | return obj;
|
170 | }
|
171 |
|
172 | const nonWordAndColonTest = /[^\w:]/g;
|
173 | const originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 | function cleanUrl(sanitize, base, href) {
|
181 | if (sanitize) {
|
182 | let prot;
|
183 | try {
|
184 | prot = decodeURIComponent(marked_esm_unescape(href))
|
185 | .replace(nonWordAndColonTest, '')
|
186 | .toLowerCase();
|
187 | } catch (e) {
|
188 | return null;
|
189 | }
|
190 | if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
|
191 | return null;
|
192 | }
|
193 | }
|
194 | if (base && !originIndependentUrl.test(href)) {
|
195 | href = resolveUrl(base, href);
|
196 | }
|
197 | try {
|
198 | href = encodeURI(href).replace(/%25/g, '%');
|
199 | } catch (e) {
|
200 | return null;
|
201 | }
|
202 | return href;
|
203 | }
|
204 |
|
205 | const baseUrls = {};
|
206 | const justDomain = /^[^:]+:\/*[^/]*$/;
|
207 | const protocol = /^([^:]+:)[\s\S]*$/;
|
208 | const domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 | function resolveUrl(base, href) {
|
215 | if (!baseUrls[' ' + base]) {
|
216 |
|
217 |
|
218 |
|
219 | if (justDomain.test(base)) {
|
220 | baseUrls[' ' + base] = base + '/';
|
221 | } else {
|
222 | baseUrls[' ' + base] = rtrim(base, '/', true);
|
223 | }
|
224 | }
|
225 | base = baseUrls[' ' + base];
|
226 | const relativeBase = base.indexOf(':') === -1;
|
227 |
|
228 | if (href.substring(0, 2) === '//') {
|
229 | if (relativeBase) {
|
230 | return href;
|
231 | }
|
232 | return base.replace(protocol, '$1') + href;
|
233 | } else if (href.charAt(0) === '/') {
|
234 | if (relativeBase) {
|
235 | return href;
|
236 | }
|
237 | return base.replace(domain, '$1') + href;
|
238 | } else {
|
239 | return base + href;
|
240 | }
|
241 | }
|
242 |
|
243 | const noopTest = { exec: function noopTest() {} };
|
244 |
|
245 | function merge(obj) {
|
246 | let i = 1,
|
247 | target,
|
248 | key;
|
249 |
|
250 | for (; i < arguments.length; i++) {
|
251 | target = arguments[i];
|
252 | for (key in target) {
|
253 | if (Object.prototype.hasOwnProperty.call(target, key)) {
|
254 | obj[key] = target[key];
|
255 | }
|
256 | }
|
257 | }
|
258 |
|
259 | return obj;
|
260 | }
|
261 |
|
262 | function splitCells(tableRow, count) {
|
263 |
|
264 |
|
265 | const row = tableRow.replace(/\|/g, (match, offset, str) => {
|
266 | let escaped = false,
|
267 | curr = offset;
|
268 | while (--curr >= 0 && str[curr] === '\\') escaped = !escaped;
|
269 | if (escaped) {
|
270 |
|
271 |
|
272 | return '|';
|
273 | } else {
|
274 |
|
275 | return ' |';
|
276 | }
|
277 | }),
|
278 | cells = row.split(/ \|/);
|
279 | let i = 0;
|
280 |
|
281 |
|
282 | if (!cells[0].trim()) { cells.shift(); }
|
283 | if (cells.length > 0 && !cells[cells.length - 1].trim()) { cells.pop(); }
|
284 |
|
285 | if (cells.length > count) {
|
286 | cells.splice(count);
|
287 | } else {
|
288 | while (cells.length < count) cells.push('');
|
289 | }
|
290 |
|
291 | for (; i < cells.length; i++) {
|
292 |
|
293 | cells[i] = cells[i].trim().replace(/\\\|/g, '|');
|
294 | }
|
295 | return cells;
|
296 | }
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 | function rtrim(str, c, invert) {
|
307 | const l = str.length;
|
308 | if (l === 0) {
|
309 | return '';
|
310 | }
|
311 |
|
312 |
|
313 | let suffLen = 0;
|
314 |
|
315 |
|
316 | while (suffLen < l) {
|
317 | const currChar = str.charAt(l - suffLen - 1);
|
318 | if (currChar === c && !invert) {
|
319 | suffLen++;
|
320 | } else if (currChar !== c && invert) {
|
321 | suffLen++;
|
322 | } else {
|
323 | break;
|
324 | }
|
325 | }
|
326 |
|
327 | return str.slice(0, l - suffLen);
|
328 | }
|
329 |
|
330 | function findClosingBracket(str, b) {
|
331 | if (str.indexOf(b[1]) === -1) {
|
332 | return -1;
|
333 | }
|
334 | const l = str.length;
|
335 | let level = 0,
|
336 | i = 0;
|
337 | for (; i < l; i++) {
|
338 | if (str[i] === '\\') {
|
339 | i++;
|
340 | } else if (str[i] === b[0]) {
|
341 | level++;
|
342 | } else if (str[i] === b[1]) {
|
343 | level--;
|
344 | if (level < 0) {
|
345 | return i;
|
346 | }
|
347 | }
|
348 | }
|
349 | return -1;
|
350 | }
|
351 |
|
352 | function checkSanitizeDeprecation(opt) {
|
353 | if (opt && opt.sanitize && !opt.silent) {
|
354 | console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
|
355 | }
|
356 | }
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 | function repeatString(pattern, count) {
|
364 | if (count < 1) {
|
365 | return '';
|
366 | }
|
367 | let result = '';
|
368 | while (count > 1) {
|
369 | if (count & 1) {
|
370 | result += pattern;
|
371 | }
|
372 | count >>= 1;
|
373 | pattern += pattern;
|
374 | }
|
375 | return result + pattern;
|
376 | }
|
377 |
|
378 | function outputLink(cap, link, raw, lexer) {
|
379 | const href = link.href;
|
380 | const title = link.title ? marked_esm_escape(link.title) : null;
|
381 | const text = cap[1].replace(/\\([\[\]])/g, '$1');
|
382 |
|
383 | if (cap[0].charAt(0) !== '!') {
|
384 | lexer.state.inLink = true;
|
385 | const token = {
|
386 | type: 'link',
|
387 | raw,
|
388 | href,
|
389 | title,
|
390 | text,
|
391 | tokens: lexer.inlineTokens(text)
|
392 | };
|
393 | lexer.state.inLink = false;
|
394 | return token;
|
395 | }
|
396 | return {
|
397 | type: 'image',
|
398 | raw,
|
399 | href,
|
400 | title,
|
401 | text: marked_esm_escape(text)
|
402 | };
|
403 | }
|
404 |
|
405 | function indentCodeCompensation(raw, text) {
|
406 | const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
|
407 |
|
408 | if (matchIndentToCode === null) {
|
409 | return text;
|
410 | }
|
411 |
|
412 | const indentToCode = matchIndentToCode[1];
|
413 |
|
414 | return text
|
415 | .split('\n')
|
416 | .map(node => {
|
417 | const matchIndentInNode = node.match(/^\s+/);
|
418 | if (matchIndentInNode === null) {
|
419 | return node;
|
420 | }
|
421 |
|
422 | const [indentInNode] = matchIndentInNode;
|
423 |
|
424 | if (indentInNode.length >= indentToCode.length) {
|
425 | return node.slice(indentToCode.length);
|
426 | }
|
427 |
|
428 | return node;
|
429 | })
|
430 | .join('\n');
|
431 | }
|
432 |
|
433 |
|
434 |
|
435 |
|
436 | class Tokenizer {
|
437 | constructor(options) {
|
438 | this.options = options || defaults;
|
439 | }
|
440 |
|
441 | space(src) {
|
442 | const cap = this.rules.block.newline.exec(src);
|
443 | if (cap && cap[0].length > 0) {
|
444 | return {
|
445 | type: 'space',
|
446 | raw: cap[0]
|
447 | };
|
448 | }
|
449 | }
|
450 |
|
451 | code(src) {
|
452 | const cap = this.rules.block.code.exec(src);
|
453 | if (cap) {
|
454 | const text = cap[0].replace(/^ {1,4}/gm, '');
|
455 | return {
|
456 | type: 'code',
|
457 | raw: cap[0],
|
458 | codeBlockStyle: 'indented',
|
459 | text: !this.options.pedantic
|
460 | ? rtrim(text, '\n')
|
461 | : text
|
462 | };
|
463 | }
|
464 | }
|
465 |
|
466 | fences(src) {
|
467 | const cap = this.rules.block.fences.exec(src);
|
468 | if (cap) {
|
469 | const raw = cap[0];
|
470 | const text = indentCodeCompensation(raw, cap[3] || '');
|
471 |
|
472 | return {
|
473 | type: 'code',
|
474 | raw,
|
475 | lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, '$1') : cap[2],
|
476 | text
|
477 | };
|
478 | }
|
479 | }
|
480 |
|
481 | heading(src) {
|
482 | const cap = this.rules.block.heading.exec(src);
|
483 | if (cap) {
|
484 | let text = cap[2].trim();
|
485 |
|
486 |
|
487 | if (/#$/.test(text)) {
|
488 | const trimmed = rtrim(text, '#');
|
489 | if (this.options.pedantic) {
|
490 | text = trimmed.trim();
|
491 | } else if (!trimmed || / $/.test(trimmed)) {
|
492 |
|
493 | text = trimmed.trim();
|
494 | }
|
495 | }
|
496 |
|
497 | return {
|
498 | type: 'heading',
|
499 | raw: cap[0],
|
500 | depth: cap[1].length,
|
501 | text,
|
502 | tokens: this.lexer.inline(text)
|
503 | };
|
504 | }
|
505 | }
|
506 |
|
507 | hr(src) {
|
508 | const cap = this.rules.block.hr.exec(src);
|
509 | if (cap) {
|
510 | return {
|
511 | type: 'hr',
|
512 | raw: cap[0]
|
513 | };
|
514 | }
|
515 | }
|
516 |
|
517 | blockquote(src) {
|
518 | const cap = this.rules.block.blockquote.exec(src);
|
519 | if (cap) {
|
520 | const text = cap[0].replace(/^ *>[ \t]?/gm, '');
|
521 | const top = this.lexer.state.top;
|
522 | this.lexer.state.top = true;
|
523 | const tokens = this.lexer.blockTokens(text);
|
524 | this.lexer.state.top = top;
|
525 | return {
|
526 | type: 'blockquote',
|
527 | raw: cap[0],
|
528 | tokens,
|
529 | text
|
530 | };
|
531 | }
|
532 | }
|
533 |
|
534 | list(src) {
|
535 | let cap = this.rules.block.list.exec(src);
|
536 | if (cap) {
|
537 | let raw, istask, ischecked, indent, i, blankLine, endsWithBlankLine,
|
538 | line, nextLine, rawLine, itemContents, endEarly;
|
539 |
|
540 | let bull = cap[1].trim();
|
541 | const isordered = bull.length > 1;
|
542 |
|
543 | const list = {
|
544 | type: 'list',
|
545 | raw: '',
|
546 | ordered: isordered,
|
547 | start: isordered ? +bull.slice(0, -1) : '',
|
548 | loose: false,
|
549 | items: []
|
550 | };
|
551 |
|
552 | bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
|
553 |
|
554 | if (this.options.pedantic) {
|
555 | bull = isordered ? bull : '[*+-]';
|
556 | }
|
557 |
|
558 |
|
559 | const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\t ][^\\n]*)?(?:\\n|$))`);
|
560 |
|
561 |
|
562 | while (src) {
|
563 | endEarly = false;
|
564 | if (!(cap = itemRegex.exec(src))) {
|
565 | break;
|
566 | }
|
567 |
|
568 | if (this.rules.block.hr.test(src)) {
|
569 | break;
|
570 | }
|
571 |
|
572 | raw = cap[0];
|
573 | src = src.substring(raw.length);
|
574 |
|
575 | line = cap[2].split('\n', 1)[0].replace(/^\t+/, (t) => ' '.repeat(3 * t.length));
|
576 | nextLine = src.split('\n', 1)[0];
|
577 |
|
578 | if (this.options.pedantic) {
|
579 | indent = 2;
|
580 | itemContents = line.trimLeft();
|
581 | } else {
|
582 | indent = cap[2].search(/[^ ]/);
|
583 | indent = indent > 4 ? 1 : indent;
|
584 | itemContents = line.slice(indent);
|
585 | indent += cap[1].length;
|
586 | }
|
587 |
|
588 | blankLine = false;
|
589 |
|
590 | if (!line && /^ *$/.test(nextLine)) {
|
591 | raw += nextLine + '\n';
|
592 | src = src.substring(nextLine.length + 1);
|
593 | endEarly = true;
|
594 | }
|
595 |
|
596 | if (!endEarly) {
|
597 | const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`);
|
598 | const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
|
599 | const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`);
|
600 | const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);
|
601 |
|
602 |
|
603 | while (src) {
|
604 | rawLine = src.split('\n', 1)[0];
|
605 | nextLine = rawLine;
|
606 |
|
607 |
|
608 | if (this.options.pedantic) {
|
609 | nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');
|
610 | }
|
611 |
|
612 |
|
613 | if (fencesBeginRegex.test(nextLine)) {
|
614 | break;
|
615 | }
|
616 |
|
617 |
|
618 | if (headingBeginRegex.test(nextLine)) {
|
619 | break;
|
620 | }
|
621 |
|
622 |
|
623 | if (nextBulletRegex.test(nextLine)) {
|
624 | break;
|
625 | }
|
626 |
|
627 |
|
628 | if (hrRegex.test(src)) {
|
629 | break;
|
630 | }
|
631 |
|
632 | if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) {
|
633 | itemContents += '\n' + nextLine.slice(indent);
|
634 | } else {
|
635 |
|
636 | if (blankLine) {
|
637 | break;
|
638 | }
|
639 |
|
640 |
|
641 | if (line.search(/[^ ]/) >= 4) {
|
642 | break;
|
643 | }
|
644 | if (fencesBeginRegex.test(line)) {
|
645 | break;
|
646 | }
|
647 | if (headingBeginRegex.test(line)) {
|
648 | break;
|
649 | }
|
650 | if (hrRegex.test(line)) {
|
651 | break;
|
652 | }
|
653 |
|
654 | itemContents += '\n' + nextLine;
|
655 | }
|
656 |
|
657 | if (!blankLine && !nextLine.trim()) {
|
658 | blankLine = true;
|
659 | }
|
660 |
|
661 | raw += rawLine + '\n';
|
662 | src = src.substring(rawLine.length + 1);
|
663 | line = nextLine.slice(indent);
|
664 | }
|
665 | }
|
666 |
|
667 | if (!list.loose) {
|
668 |
|
669 | if (endsWithBlankLine) {
|
670 | list.loose = true;
|
671 | } else if (/\n *\n *$/.test(raw)) {
|
672 | endsWithBlankLine = true;
|
673 | }
|
674 | }
|
675 |
|
676 |
|
677 | if (this.options.gfm) {
|
678 | istask = /^\[[ xX]\] /.exec(itemContents);
|
679 | if (istask) {
|
680 | ischecked = istask[0] !== '[ ] ';
|
681 | itemContents = itemContents.replace(/^\[[ xX]\] +/, '');
|
682 | }
|
683 | }
|
684 |
|
685 | list.items.push({
|
686 | type: 'list_item',
|
687 | raw,
|
688 | task: !!istask,
|
689 | checked: ischecked,
|
690 | loose: false,
|
691 | text: itemContents
|
692 | });
|
693 |
|
694 | list.raw += raw;
|
695 | }
|
696 |
|
697 |
|
698 | list.items[list.items.length - 1].raw = raw.trimRight();
|
699 | list.items[list.items.length - 1].text = itemContents.trimRight();
|
700 | list.raw = list.raw.trimRight();
|
701 |
|
702 | const l = list.items.length;
|
703 |
|
704 |
|
705 | for (i = 0; i < l; i++) {
|
706 | this.lexer.state.top = false;
|
707 | list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
|
708 |
|
709 | if (!list.loose) {
|
710 |
|
711 | const spacers = list.items[i].tokens.filter(t => t.type === 'space');
|
712 | const hasMultipleLineBreaks = spacers.length > 0 && spacers.some(t => /\n.*\n/.test(t.raw));
|
713 |
|
714 | list.loose = hasMultipleLineBreaks;
|
715 | }
|
716 | }
|
717 |
|
718 |
|
719 | if (list.loose) {
|
720 | for (i = 0; i < l; i++) {
|
721 | list.items[i].loose = true;
|
722 | }
|
723 | }
|
724 |
|
725 | return list;
|
726 | }
|
727 | }
|
728 |
|
729 | html(src) {
|
730 | const cap = this.rules.block.html.exec(src);
|
731 | if (cap) {
|
732 | const token = {
|
733 | type: 'html',
|
734 | raw: cap[0],
|
735 | pre: !this.options.sanitizer
|
736 | && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
|
737 | text: cap[0]
|
738 | };
|
739 | if (this.options.sanitize) {
|
740 | const text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : marked_esm_escape(cap[0]);
|
741 | token.type = 'paragraph';
|
742 | token.text = text;
|
743 | token.tokens = this.lexer.inline(text);
|
744 | }
|
745 | return token;
|
746 | }
|
747 | }
|
748 |
|
749 | def(src) {
|
750 | const cap = this.rules.block.def.exec(src);
|
751 | if (cap) {
|
752 | const tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
|
753 | const href = cap[2] ? cap[2].replace(/^<(.*)>$/, '$1').replace(this.rules.inline._escapes, '$1') : '';
|
754 | const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, '$1') : cap[3];
|
755 | return {
|
756 | type: 'def',
|
757 | tag,
|
758 | raw: cap[0],
|
759 | href,
|
760 | title
|
761 | };
|
762 | }
|
763 | }
|
764 |
|
765 | table(src) {
|
766 | const cap = this.rules.block.table.exec(src);
|
767 | if (cap) {
|
768 | const item = {
|
769 | type: 'table',
|
770 | header: splitCells(cap[1]).map(c => { return { text: c }; }),
|
771 | align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
772 | rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
|
773 | };
|
774 |
|
775 | if (item.header.length === item.align.length) {
|
776 | item.raw = cap[0];
|
777 |
|
778 | let l = item.align.length;
|
779 | let i, j, k, row;
|
780 | for (i = 0; i < l; i++) {
|
781 | if (/^ *-+: *$/.test(item.align[i])) {
|
782 | item.align[i] = 'right';
|
783 | } else if (/^ *:-+: *$/.test(item.align[i])) {
|
784 | item.align[i] = 'center';
|
785 | } else if (/^ *:-+ *$/.test(item.align[i])) {
|
786 | item.align[i] = 'left';
|
787 | } else {
|
788 | item.align[i] = null;
|
789 | }
|
790 | }
|
791 |
|
792 | l = item.rows.length;
|
793 | for (i = 0; i < l; i++) {
|
794 | item.rows[i] = splitCells(item.rows[i], item.header.length).map(c => { return { text: c }; });
|
795 | }
|
796 |
|
797 |
|
798 |
|
799 |
|
800 | l = item.header.length;
|
801 | for (j = 0; j < l; j++) {
|
802 | item.header[j].tokens = this.lexer.inline(item.header[j].text);
|
803 | }
|
804 |
|
805 |
|
806 | l = item.rows.length;
|
807 | for (j = 0; j < l; j++) {
|
808 | row = item.rows[j];
|
809 | for (k = 0; k < row.length; k++) {
|
810 | row[k].tokens = this.lexer.inline(row[k].text);
|
811 | }
|
812 | }
|
813 |
|
814 | return item;
|
815 | }
|
816 | }
|
817 | }
|
818 |
|
819 | lheading(src) {
|
820 | const cap = this.rules.block.lheading.exec(src);
|
821 | if (cap) {
|
822 | return {
|
823 | type: 'heading',
|
824 | raw: cap[0],
|
825 | depth: cap[2].charAt(0) === '=' ? 1 : 2,
|
826 | text: cap[1],
|
827 | tokens: this.lexer.inline(cap[1])
|
828 | };
|
829 | }
|
830 | }
|
831 |
|
832 | paragraph(src) {
|
833 | const cap = this.rules.block.paragraph.exec(src);
|
834 | if (cap) {
|
835 | const text = cap[1].charAt(cap[1].length - 1) === '\n'
|
836 | ? cap[1].slice(0, -1)
|
837 | : cap[1];
|
838 | return {
|
839 | type: 'paragraph',
|
840 | raw: cap[0],
|
841 | text,
|
842 | tokens: this.lexer.inline(text)
|
843 | };
|
844 | }
|
845 | }
|
846 |
|
847 | text(src) {
|
848 | const cap = this.rules.block.text.exec(src);
|
849 | if (cap) {
|
850 | return {
|
851 | type: 'text',
|
852 | raw: cap[0],
|
853 | text: cap[0],
|
854 | tokens: this.lexer.inline(cap[0])
|
855 | };
|
856 | }
|
857 | }
|
858 |
|
859 | escape(src) {
|
860 | const cap = this.rules.inline.escape.exec(src);
|
861 | if (cap) {
|
862 | return {
|
863 | type: 'escape',
|
864 | raw: cap[0],
|
865 | text: marked_esm_escape(cap[1])
|
866 | };
|
867 | }
|
868 | }
|
869 |
|
870 | tag(src) {
|
871 | const cap = this.rules.inline.tag.exec(src);
|
872 | if (cap) {
|
873 | if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
|
874 | this.lexer.state.inLink = true;
|
875 | } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
|
876 | this.lexer.state.inLink = false;
|
877 | }
|
878 | if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
879 | this.lexer.state.inRawBlock = true;
|
880 | } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
881 | this.lexer.state.inRawBlock = false;
|
882 | }
|
883 |
|
884 | return {
|
885 | type: this.options.sanitize
|
886 | ? 'text'
|
887 | : 'html',
|
888 | raw: cap[0],
|
889 | inLink: this.lexer.state.inLink,
|
890 | inRawBlock: this.lexer.state.inRawBlock,
|
891 | text: this.options.sanitize
|
892 | ? (this.options.sanitizer
|
893 | ? this.options.sanitizer(cap[0])
|
894 | : marked_esm_escape(cap[0]))
|
895 | : cap[0]
|
896 | };
|
897 | }
|
898 | }
|
899 |
|
900 | link(src) {
|
901 | const cap = this.rules.inline.link.exec(src);
|
902 | if (cap) {
|
903 | const trimmedUrl = cap[2].trim();
|
904 | if (!this.options.pedantic && /^</.test(trimmedUrl)) {
|
905 |
|
906 | if (!(/>$/.test(trimmedUrl))) {
|
907 | return;
|
908 | }
|
909 |
|
910 |
|
911 | const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
|
912 | if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
|
913 | return;
|
914 | }
|
915 | } else {
|
916 |
|
917 | const lastParenIndex = findClosingBracket(cap[2], '()');
|
918 | if (lastParenIndex > -1) {
|
919 | const start = cap[0].indexOf('!') === 0 ? 5 : 4;
|
920 | const linkLen = start + cap[1].length + lastParenIndex;
|
921 | cap[2] = cap[2].substring(0, lastParenIndex);
|
922 | cap[0] = cap[0].substring(0, linkLen).trim();
|
923 | cap[3] = '';
|
924 | }
|
925 | }
|
926 | let href = cap[2];
|
927 | let title = '';
|
928 | if (this.options.pedantic) {
|
929 |
|
930 | const link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
|
931 |
|
932 | if (link) {
|
933 | href = link[1];
|
934 | title = link[3];
|
935 | }
|
936 | } else {
|
937 | title = cap[3] ? cap[3].slice(1, -1) : '';
|
938 | }
|
939 |
|
940 | href = href.trim();
|
941 | if (/^</.test(href)) {
|
942 | if (this.options.pedantic && !(/>$/.test(trimmedUrl))) {
|
943 |
|
944 | href = href.slice(1);
|
945 | } else {
|
946 | href = href.slice(1, -1);
|
947 | }
|
948 | }
|
949 | return outputLink(cap, {
|
950 | href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
|
951 | title: title ? title.replace(this.rules.inline._escapes, '$1') : title
|
952 | }, cap[0], this.lexer);
|
953 | }
|
954 | }
|
955 |
|
956 | reflink(src, links) {
|
957 | let cap;
|
958 | if ((cap = this.rules.inline.reflink.exec(src))
|
959 | || (cap = this.rules.inline.nolink.exec(src))) {
|
960 | let link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
|
961 | link = links[link.toLowerCase()];
|
962 | if (!link) {
|
963 | const text = cap[0].charAt(0);
|
964 | return {
|
965 | type: 'text',
|
966 | raw: text,
|
967 | text
|
968 | };
|
969 | }
|
970 | return outputLink(cap, link, cap[0], this.lexer);
|
971 | }
|
972 | }
|
973 |
|
974 | emStrong(src, maskedSrc, prevChar = '') {
|
975 | let match = this.rules.inline.emStrong.lDelim.exec(src);
|
976 | if (!match) return;
|
977 |
|
978 |
|
979 | if (match[3] && prevChar.match(/[\p{L}\p{N}]/u)) return;
|
980 |
|
981 | const nextChar = match[1] || match[2] || '';
|
982 |
|
983 | if (!nextChar || (nextChar && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar)))) {
|
984 | const lLength = match[0].length - 1;
|
985 | let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
|
986 |
|
987 | const endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
|
988 | endReg.lastIndex = 0;
|
989 |
|
990 |
|
991 | maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
|
992 |
|
993 | while ((match = endReg.exec(maskedSrc)) != null) {
|
994 | rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
|
995 |
|
996 | if (!rDelim) continue;
|
997 |
|
998 | rLength = rDelim.length;
|
999 |
|
1000 | if (match[3] || match[4]) {
|
1001 | delimTotal += rLength;
|
1002 | continue;
|
1003 | } else if (match[5] || match[6]) {
|
1004 | if (lLength % 3 && !((lLength + rLength) % 3)) {
|
1005 | midDelimTotal += rLength;
|
1006 | continue;
|
1007 | }
|
1008 | }
|
1009 |
|
1010 | delimTotal -= rLength;
|
1011 |
|
1012 | if (delimTotal > 0) continue;
|
1013 |
|
1014 |
|
1015 | rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
|
1016 |
|
1017 | const raw = src.slice(0, lLength + match.index + (match[0].length - rDelim.length) + rLength);
|
1018 |
|
1019 |
|
1020 | if (Math.min(lLength, rLength) % 2) {
|
1021 | const text = raw.slice(1, -1);
|
1022 | return {
|
1023 | type: 'em',
|
1024 | raw,
|
1025 | text,
|
1026 | tokens: this.lexer.inlineTokens(text)
|
1027 | };
|
1028 | }
|
1029 |
|
1030 |
|
1031 | const text = raw.slice(2, -2);
|
1032 | return {
|
1033 | type: 'strong',
|
1034 | raw,
|
1035 | text,
|
1036 | tokens: this.lexer.inlineTokens(text)
|
1037 | };
|
1038 | }
|
1039 | }
|
1040 | }
|
1041 |
|
1042 | codespan(src) {
|
1043 | const cap = this.rules.inline.code.exec(src);
|
1044 | if (cap) {
|
1045 | let text = cap[2].replace(/\n/g, ' ');
|
1046 | const hasNonSpaceChars = /[^ ]/.test(text);
|
1047 | const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
|
1048 | if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
1049 | text = text.substring(1, text.length - 1);
|
1050 | }
|
1051 | text = marked_esm_escape(text, true);
|
1052 | return {
|
1053 | type: 'codespan',
|
1054 | raw: cap[0],
|
1055 | text
|
1056 | };
|
1057 | }
|
1058 | }
|
1059 |
|
1060 | br(src) {
|
1061 | const cap = this.rules.inline.br.exec(src);
|
1062 | if (cap) {
|
1063 | return {
|
1064 | type: 'br',
|
1065 | raw: cap[0]
|
1066 | };
|
1067 | }
|
1068 | }
|
1069 |
|
1070 | del(src) {
|
1071 | const cap = this.rules.inline.del.exec(src);
|
1072 | if (cap) {
|
1073 | return {
|
1074 | type: 'del',
|
1075 | raw: cap[0],
|
1076 | text: cap[2],
|
1077 | tokens: this.lexer.inlineTokens(cap[2])
|
1078 | };
|
1079 | }
|
1080 | }
|
1081 |
|
1082 | autolink(src, mangle) {
|
1083 | const cap = this.rules.inline.autolink.exec(src);
|
1084 | if (cap) {
|
1085 | let text, href;
|
1086 | if (cap[2] === '@') {
|
1087 | text = marked_esm_escape(this.options.mangle ? mangle(cap[1]) : cap[1]);
|
1088 | href = 'mailto:' + text;
|
1089 | } else {
|
1090 | text = marked_esm_escape(cap[1]);
|
1091 | href = text;
|
1092 | }
|
1093 |
|
1094 | return {
|
1095 | type: 'link',
|
1096 | raw: cap[0],
|
1097 | text,
|
1098 | href,
|
1099 | tokens: [
|
1100 | {
|
1101 | type: 'text',
|
1102 | raw: text,
|
1103 | text
|
1104 | }
|
1105 | ]
|
1106 | };
|
1107 | }
|
1108 | }
|
1109 |
|
1110 | url(src, mangle) {
|
1111 | let cap;
|
1112 | if (cap = this.rules.inline.url.exec(src)) {
|
1113 | let text, href;
|
1114 | if (cap[2] === '@') {
|
1115 | text = marked_esm_escape(this.options.mangle ? mangle(cap[0]) : cap[0]);
|
1116 | href = 'mailto:' + text;
|
1117 | } else {
|
1118 |
|
1119 | let prevCapZero;
|
1120 | do {
|
1121 | prevCapZero = cap[0];
|
1122 | cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
|
1123 | } while (prevCapZero !== cap[0]);
|
1124 | text = marked_esm_escape(cap[0]);
|
1125 | if (cap[1] === 'www.') {
|
1126 | href = 'http://' + cap[0];
|
1127 | } else {
|
1128 | href = cap[0];
|
1129 | }
|
1130 | }
|
1131 | return {
|
1132 | type: 'link',
|
1133 | raw: cap[0],
|
1134 | text,
|
1135 | href,
|
1136 | tokens: [
|
1137 | {
|
1138 | type: 'text',
|
1139 | raw: text,
|
1140 | text
|
1141 | }
|
1142 | ]
|
1143 | };
|
1144 | }
|
1145 | }
|
1146 |
|
1147 | inlineText(src, smartypants) {
|
1148 | const cap = this.rules.inline.text.exec(src);
|
1149 | if (cap) {
|
1150 | let text;
|
1151 | if (this.lexer.state.inRawBlock) {
|
1152 | text = this.options.sanitize ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) : marked_esm_escape(cap[0])) : cap[0];
|
1153 | } else {
|
1154 | text = marked_esm_escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
|
1155 | }
|
1156 | return {
|
1157 | type: 'text',
|
1158 | raw: cap[0],
|
1159 | text
|
1160 | };
|
1161 | }
|
1162 | }
|
1163 | }
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 | const block = {
|
1169 | newline: /^(?: *(?:\n|$))+/,
|
1170 | code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
|
1171 | fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
|
1172 | hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
|
1173 | heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
|
1174 | blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
|
1175 | list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
|
1176 | html: '^ {0,3}(?:'
|
1177 | + '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)'
|
1178 | + '|comment[^\\n]*(\\n+|$)'
|
1179 | + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)'
|
1180 | + '|<![A-Z][\\s\\S]*?(?:>\\n*|$)'
|
1181 | + '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)'
|
1182 | + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)'
|
1183 | + '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)'
|
1184 | + '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)'
|
1185 | + ')',
|
1186 | def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
|
1187 | table: noopTest,
|
1188 | lheading: /^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
1189 |
|
1190 |
|
1191 | _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
|
1192 | text: /^[^\n]+/
|
1193 | };
|
1194 |
|
1195 | block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
1196 | block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
|
1197 | block.def = edit(block.def)
|
1198 | .replace('label', block._label)
|
1199 | .replace('title', block._title)
|
1200 | .getRegex();
|
1201 |
|
1202 | block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
1203 | block.listItemStart = edit(/^( *)(bull) */)
|
1204 | .replace('bull', block.bullet)
|
1205 | .getRegex();
|
1206 |
|
1207 | block.list = edit(block.list)
|
1208 | .replace(/bull/g, block.bullet)
|
1209 | .replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))')
|
1210 | .replace('def', '\\n+(?=' + block.def.source + ')')
|
1211 | .getRegex();
|
1212 |
|
1213 | block._tag = 'address|article|aside|base|basefont|blockquote|body|caption'
|
1214 | + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'
|
1215 | + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'
|
1216 | + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
|
1217 | + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr'
|
1218 | + '|track|ul';
|
1219 | block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
|
1220 | block.html = edit(block.html, 'i')
|
1221 | .replace('comment', block._comment)
|
1222 | .replace('tag', block._tag)
|
1223 | .replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/)
|
1224 | .getRegex();
|
1225 |
|
1226 | block.paragraph = edit(block._paragraph)
|
1227 | .replace('hr', block.hr)
|
1228 | .replace('heading', ' {0,3}#{1,6} ')
|
1229 | .replace('|lheading', '')
|
1230 | .replace('|table', '')
|
1231 | .replace('blockquote', ' {0,3}>')
|
1232 | .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
1233 | .replace('list', ' {0,3}(?:[*+-]|1[.)]) ')
|
1234 | .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
|
1235 | .replace('tag', block._tag)
|
1236 | .getRegex();
|
1237 |
|
1238 | block.blockquote = edit(block.blockquote)
|
1239 | .replace('paragraph', block.paragraph)
|
1240 | .getRegex();
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 | block.normal = merge({}, block);
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 | block.gfm = merge({}, block.normal, {
|
1253 | table: '^ *([^\\n ].*\\|.*)\\n'
|
1254 | + ' {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?'
|
1255 | + '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)'
|
1256 | });
|
1257 |
|
1258 | block.gfm.table = edit(block.gfm.table)
|
1259 | .replace('hr', block.hr)
|
1260 | .replace('heading', ' {0,3}#{1,6} ')
|
1261 | .replace('blockquote', ' {0,3}>')
|
1262 | .replace('code', ' {4}[^\\n]')
|
1263 | .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
1264 | .replace('list', ' {0,3}(?:[*+-]|1[.)]) ')
|
1265 | .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
|
1266 | .replace('tag', block._tag)
|
1267 | .getRegex();
|
1268 |
|
1269 | block.gfm.paragraph = edit(block._paragraph)
|
1270 | .replace('hr', block.hr)
|
1271 | .replace('heading', ' {0,3}#{1,6} ')
|
1272 | .replace('|lheading', '')
|
1273 | .replace('table', block.gfm.table)
|
1274 | .replace('blockquote', ' {0,3}>')
|
1275 | .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
1276 | .replace('list', ' {0,3}(?:[*+-]|1[.)]) ')
|
1277 | .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
|
1278 | .replace('tag', block._tag)
|
1279 | .getRegex();
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 | block.pedantic = merge({}, block.normal, {
|
1285 | html: edit(
|
1286 | '^ *(?:comment *(?:\\n|\\s*$)'
|
1287 | + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)'
|
1288 | + '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))')
|
1289 | .replace('comment', block._comment)
|
1290 | .replace(/tag/g, '(?!(?:'
|
1291 | + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub'
|
1292 | + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)'
|
1293 | + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b')
|
1294 | .getRegex(),
|
1295 | def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
1296 | heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
1297 | fences: noopTest,
|
1298 | lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
1299 | paragraph: edit(block.normal._paragraph)
|
1300 | .replace('hr', block.hr)
|
1301 | .replace('heading', ' *#{1,6} *[^\n]')
|
1302 | .replace('lheading', block.lheading)
|
1303 | .replace('blockquote', ' {0,3}>')
|
1304 | .replace('|fences', '')
|
1305 | .replace('|list', '')
|
1306 | .replace('|html', '')
|
1307 | .getRegex()
|
1308 | });
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 | const inline = {
|
1314 | escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
|
1315 | autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
|
1316 | url: noopTest,
|
1317 | tag: '^comment'
|
1318 | + '|^</[a-zA-Z][\\w:-]*\\s*>'
|
1319 | + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>'
|
1320 | + '|^<\\?[\\s\\S]*?\\?>'
|
1321 | + '|^<![a-zA-Z]+\\s[\\s\\S]*?>'
|
1322 | + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>',
|
1323 | link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
|
1324 | reflink: /^!?\[(label)\]\[(ref)\]/,
|
1325 | nolink: /^!?\[(ref)\](?:\[\])?/,
|
1326 | reflinkSearch: 'reflink|nolink(?!\\()',
|
1327 | emStrong: {
|
1328 | lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
|
1329 |
|
1330 |
|
1331 | rDelimAst: /^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,
|
1332 | rDelimUnd: /^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/
|
1333 | },
|
1334 | code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
1335 | br: /^( {2,}|\\)\n(?!\s*$)/,
|
1336 | del: noopTest,
|
1337 | text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
1338 | punctuation: /^([\spunctuation])/
|
1339 | };
|
1340 |
|
1341 |
|
1342 |
|
1343 | inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
|
1344 | inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex();
|
1345 |
|
1346 |
|
1347 | inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
|
1348 |
|
1349 |
|
1350 | inline.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
|
1351 |
|
1352 | inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex();
|
1353 |
|
1354 | inline.emStrong.lDelim = edit(inline.emStrong.lDelim)
|
1355 | .replace(/punct/g, inline._punctuation)
|
1356 | .getRegex();
|
1357 |
|
1358 | inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, 'g')
|
1359 | .replace(/punct/g, inline._punctuation)
|
1360 | .getRegex();
|
1361 |
|
1362 | inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, 'g')
|
1363 | .replace(/punct/g, inline._punctuation)
|
1364 | .getRegex();
|
1365 |
|
1366 | inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
|
1367 |
|
1368 | inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
|
1369 | inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
|
1370 | inline.autolink = edit(inline.autolink)
|
1371 | .replace('scheme', inline._scheme)
|
1372 | .replace('email', inline._email)
|
1373 | .getRegex();
|
1374 |
|
1375 | inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
|
1376 |
|
1377 | inline.tag = edit(inline.tag)
|
1378 | .replace('comment', inline._comment)
|
1379 | .replace('attribute', inline._attribute)
|
1380 | .getRegex();
|
1381 |
|
1382 | inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
1383 | inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
|
1384 | inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
|
1385 |
|
1386 | inline.link = edit(inline.link)
|
1387 | .replace('label', inline._label)
|
1388 | .replace('href', inline._href)
|
1389 | .replace('title', inline._title)
|
1390 | .getRegex();
|
1391 |
|
1392 | inline.reflink = edit(inline.reflink)
|
1393 | .replace('label', inline._label)
|
1394 | .replace('ref', block._label)
|
1395 | .getRegex();
|
1396 |
|
1397 | inline.nolink = edit(inline.nolink)
|
1398 | .replace('ref', block._label)
|
1399 | .getRegex();
|
1400 |
|
1401 | inline.reflinkSearch = edit(inline.reflinkSearch, 'g')
|
1402 | .replace('reflink', inline.reflink)
|
1403 | .replace('nolink', inline.nolink)
|
1404 | .getRegex();
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 | inline.normal = merge({}, inline);
|
1411 |
|
1412 |
|
1413 |
|
1414 |
|
1415 |
|
1416 | inline.pedantic = merge({}, inline.normal, {
|
1417 | strong: {
|
1418 | start: /^__|\*\*/,
|
1419 | middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
1420 | endAst: /\*\*(?!\*)/g,
|
1421 | endUnd: /__(?!_)/g
|
1422 | },
|
1423 | em: {
|
1424 | start: /^_|\*/,
|
1425 | middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
|
1426 | endAst: /\*(?!\*)/g,
|
1427 | endUnd: /_(?!_)/g
|
1428 | },
|
1429 | link: edit(/^!?\[(label)\]\((.*?)\)/)
|
1430 | .replace('label', inline._label)
|
1431 | .getRegex(),
|
1432 | reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/)
|
1433 | .replace('label', inline._label)
|
1434 | .getRegex()
|
1435 | });
|
1436 |
|
1437 |
|
1438 |
|
1439 |
|
1440 |
|
1441 | inline.gfm = merge({}, inline.normal, {
|
1442 | escape: edit(inline.escape).replace('])', '~|])').getRegex(),
|
1443 | _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
|
1444 | url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
1445 | _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
1446 | del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
1447 | text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
1448 | });
|
1449 |
|
1450 | inline.gfm.url = edit(inline.gfm.url, 'i')
|
1451 | .replace('email', inline.gfm._extended_email)
|
1452 | .getRegex();
|
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 | inline.breaks = merge({}, inline.gfm, {
|
1458 | br: edit(inline.br).replace('{2,}', '*').getRegex(),
|
1459 | text: edit(inline.gfm.text)
|
1460 | .replace('\\b_', '\\b_| {2,}\\n')
|
1461 | .replace(/\{2,\}/g, '*')
|
1462 | .getRegex()
|
1463 | });
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 | function smartypants(text) {
|
1470 | return text
|
1471 |
|
1472 | .replace(/---/g, '\u2014')
|
1473 |
|
1474 | .replace(/--/g, '\u2013')
|
1475 |
|
1476 | .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018')
|
1477 |
|
1478 | .replace(/'/g, '\u2019')
|
1479 |
|
1480 | .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c')
|
1481 |
|
1482 | .replace(/"/g, '\u201d')
|
1483 |
|
1484 | .replace(/\.{3}/g, '\u2026');
|
1485 | }
|
1486 |
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 | function mangle(text) {
|
1492 | let out = '',
|
1493 | i,
|
1494 | ch;
|
1495 |
|
1496 | const l = text.length;
|
1497 | for (i = 0; i < l; i++) {
|
1498 | ch = text.charCodeAt(i);
|
1499 | if (Math.random() > 0.5) {
|
1500 | ch = 'x' + ch.toString(16);
|
1501 | }
|
1502 | out += '&#' + ch + ';';
|
1503 | }
|
1504 |
|
1505 | return out;
|
1506 | }
|
1507 |
|
1508 |
|
1509 |
|
1510 |
|
1511 | class Lexer {
|
1512 | constructor(options) {
|
1513 | this.tokens = [];
|
1514 | this.tokens.links = Object.create(null);
|
1515 | this.options = options || defaults;
|
1516 | this.options.tokenizer = this.options.tokenizer || new Tokenizer();
|
1517 | this.tokenizer = this.options.tokenizer;
|
1518 | this.tokenizer.options = this.options;
|
1519 | this.tokenizer.lexer = this;
|
1520 | this.inlineQueue = [];
|
1521 | this.state = {
|
1522 | inLink: false,
|
1523 | inRawBlock: false,
|
1524 | top: true
|
1525 | };
|
1526 |
|
1527 | const rules = {
|
1528 | block: block.normal,
|
1529 | inline: inline.normal
|
1530 | };
|
1531 |
|
1532 | if (this.options.pedantic) {
|
1533 | rules.block = block.pedantic;
|
1534 | rules.inline = inline.pedantic;
|
1535 | } else if (this.options.gfm) {
|
1536 | rules.block = block.gfm;
|
1537 | if (this.options.breaks) {
|
1538 | rules.inline = inline.breaks;
|
1539 | } else {
|
1540 | rules.inline = inline.gfm;
|
1541 | }
|
1542 | }
|
1543 | this.tokenizer.rules = rules;
|
1544 | }
|
1545 |
|
1546 | |
1547 |
|
1548 |
|
1549 | static get rules() {
|
1550 | return {
|
1551 | block,
|
1552 | inline
|
1553 | };
|
1554 | }
|
1555 |
|
1556 | |
1557 |
|
1558 |
|
1559 | static lex(src, options) {
|
1560 | const lexer = new Lexer(options);
|
1561 | return lexer.lex(src);
|
1562 | }
|
1563 |
|
1564 | |
1565 |
|
1566 |
|
1567 | static lexInline(src, options) {
|
1568 | const lexer = new Lexer(options);
|
1569 | return lexer.inlineTokens(src);
|
1570 | }
|
1571 |
|
1572 | |
1573 |
|
1574 |
|
1575 | lex(src) {
|
1576 | src = src
|
1577 | .replace(/\r\n|\r/g, '\n');
|
1578 |
|
1579 | this.blockTokens(src, this.tokens);
|
1580 |
|
1581 | let next;
|
1582 | while (next = this.inlineQueue.shift()) {
|
1583 | this.inlineTokens(next.src, next.tokens);
|
1584 | }
|
1585 |
|
1586 | return this.tokens;
|
1587 | }
|
1588 |
|
1589 | |
1590 |
|
1591 |
|
1592 | blockTokens(src, tokens = []) {
|
1593 | if (this.options.pedantic) {
|
1594 | src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
|
1595 | } else {
|
1596 | src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
|
1597 | return leading + ' '.repeat(tabs.length);
|
1598 | });
|
1599 | }
|
1600 |
|
1601 | let token, lastToken, cutSrc, lastParagraphClipped;
|
1602 |
|
1603 | while (src) {
|
1604 | if (this.options.extensions
|
1605 | && this.options.extensions.block
|
1606 | && this.options.extensions.block.some((extTokenizer) => {
|
1607 | if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
1608 | src = src.substring(token.raw.length);
|
1609 | tokens.push(token);
|
1610 | return true;
|
1611 | }
|
1612 | return false;
|
1613 | })) {
|
1614 | continue;
|
1615 | }
|
1616 |
|
1617 |
|
1618 | if (token = this.tokenizer.space(src)) {
|
1619 | src = src.substring(token.raw.length);
|
1620 | if (token.raw.length === 1 && tokens.length > 0) {
|
1621 |
|
1622 |
|
1623 | tokens[tokens.length - 1].raw += '\n';
|
1624 | } else {
|
1625 | tokens.push(token);
|
1626 | }
|
1627 | continue;
|
1628 | }
|
1629 |
|
1630 |
|
1631 | if (token = this.tokenizer.code(src)) {
|
1632 | src = src.substring(token.raw.length);
|
1633 | lastToken = tokens[tokens.length - 1];
|
1634 |
|
1635 | if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
|
1636 | lastToken.raw += '\n' + token.raw;
|
1637 | lastToken.text += '\n' + token.text;
|
1638 | this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
1639 | } else {
|
1640 | tokens.push(token);
|
1641 | }
|
1642 | continue;
|
1643 | }
|
1644 |
|
1645 |
|
1646 | if (token = this.tokenizer.fences(src)) {
|
1647 | src = src.substring(token.raw.length);
|
1648 | tokens.push(token);
|
1649 | continue;
|
1650 | }
|
1651 |
|
1652 |
|
1653 | if (token = this.tokenizer.heading(src)) {
|
1654 | src = src.substring(token.raw.length);
|
1655 | tokens.push(token);
|
1656 | continue;
|
1657 | }
|
1658 |
|
1659 |
|
1660 | if (token = this.tokenizer.hr(src)) {
|
1661 | src = src.substring(token.raw.length);
|
1662 | tokens.push(token);
|
1663 | continue;
|
1664 | }
|
1665 |
|
1666 |
|
1667 | if (token = this.tokenizer.blockquote(src)) {
|
1668 | src = src.substring(token.raw.length);
|
1669 | tokens.push(token);
|
1670 | continue;
|
1671 | }
|
1672 |
|
1673 |
|
1674 | if (token = this.tokenizer.list(src)) {
|
1675 | src = src.substring(token.raw.length);
|
1676 | tokens.push(token);
|
1677 | continue;
|
1678 | }
|
1679 |
|
1680 |
|
1681 | if (token = this.tokenizer.html(src)) {
|
1682 | src = src.substring(token.raw.length);
|
1683 | tokens.push(token);
|
1684 | continue;
|
1685 | }
|
1686 |
|
1687 |
|
1688 | if (token = this.tokenizer.def(src)) {
|
1689 | src = src.substring(token.raw.length);
|
1690 | lastToken = tokens[tokens.length - 1];
|
1691 | if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
|
1692 | lastToken.raw += '\n' + token.raw;
|
1693 | lastToken.text += '\n' + token.raw;
|
1694 | this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
1695 | } else if (!this.tokens.links[token.tag]) {
|
1696 | this.tokens.links[token.tag] = {
|
1697 | href: token.href,
|
1698 | title: token.title
|
1699 | };
|
1700 | }
|
1701 | continue;
|
1702 | }
|
1703 |
|
1704 |
|
1705 | if (token = this.tokenizer.table(src)) {
|
1706 | src = src.substring(token.raw.length);
|
1707 | tokens.push(token);
|
1708 | continue;
|
1709 | }
|
1710 |
|
1711 |
|
1712 | if (token = this.tokenizer.lheading(src)) {
|
1713 | src = src.substring(token.raw.length);
|
1714 | tokens.push(token);
|
1715 | continue;
|
1716 | }
|
1717 |
|
1718 |
|
1719 |
|
1720 | cutSrc = src;
|
1721 | if (this.options.extensions && this.options.extensions.startBlock) {
|
1722 | let startIndex = Infinity;
|
1723 | const tempSrc = src.slice(1);
|
1724 | let tempStart;
|
1725 | this.options.extensions.startBlock.forEach(function(getStartIndex) {
|
1726 | tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
1727 | if (typeof tempStart === 'number' && tempStart >= 0) { startIndex = Math.min(startIndex, tempStart); }
|
1728 | });
|
1729 | if (startIndex < Infinity && startIndex >= 0) {
|
1730 | cutSrc = src.substring(0, startIndex + 1);
|
1731 | }
|
1732 | }
|
1733 | if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
|
1734 | lastToken = tokens[tokens.length - 1];
|
1735 | if (lastParagraphClipped && lastToken.type === 'paragraph') {
|
1736 | lastToken.raw += '\n' + token.raw;
|
1737 | lastToken.text += '\n' + token.text;
|
1738 | this.inlineQueue.pop();
|
1739 | this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
1740 | } else {
|
1741 | tokens.push(token);
|
1742 | }
|
1743 | lastParagraphClipped = (cutSrc.length !== src.length);
|
1744 | src = src.substring(token.raw.length);
|
1745 | continue;
|
1746 | }
|
1747 |
|
1748 |
|
1749 | if (token = this.tokenizer.text(src)) {
|
1750 | src = src.substring(token.raw.length);
|
1751 | lastToken = tokens[tokens.length - 1];
|
1752 | if (lastToken && lastToken.type === 'text') {
|
1753 | lastToken.raw += '\n' + token.raw;
|
1754 | lastToken.text += '\n' + token.text;
|
1755 | this.inlineQueue.pop();
|
1756 | this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
1757 | } else {
|
1758 | tokens.push(token);
|
1759 | }
|
1760 | continue;
|
1761 | }
|
1762 |
|
1763 | if (src) {
|
1764 | const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
|
1765 | if (this.options.silent) {
|
1766 | console.error(errMsg);
|
1767 | break;
|
1768 | } else {
|
1769 | throw new Error(errMsg);
|
1770 | }
|
1771 | }
|
1772 | }
|
1773 |
|
1774 | this.state.top = true;
|
1775 | return tokens;
|
1776 | }
|
1777 |
|
1778 | inline(src, tokens = []) {
|
1779 | this.inlineQueue.push({ src, tokens });
|
1780 | return tokens;
|
1781 | }
|
1782 |
|
1783 | |
1784 |
|
1785 |
|
1786 | inlineTokens(src, tokens = []) {
|
1787 | let token, lastToken, cutSrc;
|
1788 |
|
1789 |
|
1790 | let maskedSrc = src;
|
1791 | let match;
|
1792 | let keepPrevChar, prevChar;
|
1793 |
|
1794 |
|
1795 | if (this.tokens.links) {
|
1796 | const links = Object.keys(this.tokens.links);
|
1797 | if (links.length > 0) {
|
1798 | while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
|
1799 | if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
|
1800 | maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
|
1801 | }
|
1802 | }
|
1803 | }
|
1804 | }
|
1805 |
|
1806 | while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
1807 | maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
1808 | }
|
1809 |
|
1810 |
|
1811 | while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
|
1812 | maskedSrc = maskedSrc.slice(0, match.index + match[0].length - 2) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
|
1813 | this.tokenizer.rules.inline.escapedEmSt.lastIndex--;
|
1814 | }
|
1815 |
|
1816 | while (src) {
|
1817 | if (!keepPrevChar) {
|
1818 | prevChar = '';
|
1819 | }
|
1820 | keepPrevChar = false;
|
1821 |
|
1822 |
|
1823 | if (this.options.extensions
|
1824 | && this.options.extensions.inline
|
1825 | && this.options.extensions.inline.some((extTokenizer) => {
|
1826 | if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
1827 | src = src.substring(token.raw.length);
|
1828 | tokens.push(token);
|
1829 | return true;
|
1830 | }
|
1831 | return false;
|
1832 | })) {
|
1833 | continue;
|
1834 | }
|
1835 |
|
1836 |
|
1837 | if (token = this.tokenizer.escape(src)) {
|
1838 | src = src.substring(token.raw.length);
|
1839 | tokens.push(token);
|
1840 | continue;
|
1841 | }
|
1842 |
|
1843 |
|
1844 | if (token = this.tokenizer.tag(src)) {
|
1845 | src = src.substring(token.raw.length);
|
1846 | lastToken = tokens[tokens.length - 1];
|
1847 | if (lastToken && token.type === 'text' && lastToken.type === 'text') {
|
1848 | lastToken.raw += token.raw;
|
1849 | lastToken.text += token.text;
|
1850 | } else {
|
1851 | tokens.push(token);
|
1852 | }
|
1853 | continue;
|
1854 | }
|
1855 |
|
1856 |
|
1857 | if (token = this.tokenizer.link(src)) {
|
1858 | src = src.substring(token.raw.length);
|
1859 | tokens.push(token);
|
1860 | continue;
|
1861 | }
|
1862 |
|
1863 |
|
1864 | if (token = this.tokenizer.reflink(src, this.tokens.links)) {
|
1865 | src = src.substring(token.raw.length);
|
1866 | lastToken = tokens[tokens.length - 1];
|
1867 | if (lastToken && token.type === 'text' && lastToken.type === 'text') {
|
1868 | lastToken.raw += token.raw;
|
1869 | lastToken.text += token.text;
|
1870 | } else {
|
1871 | tokens.push(token);
|
1872 | }
|
1873 | continue;
|
1874 | }
|
1875 |
|
1876 |
|
1877 | if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
|
1878 | src = src.substring(token.raw.length);
|
1879 | tokens.push(token);
|
1880 | continue;
|
1881 | }
|
1882 |
|
1883 |
|
1884 | if (token = this.tokenizer.codespan(src)) {
|
1885 | src = src.substring(token.raw.length);
|
1886 | tokens.push(token);
|
1887 | continue;
|
1888 | }
|
1889 |
|
1890 |
|
1891 | if (token = this.tokenizer.br(src)) {
|
1892 | src = src.substring(token.raw.length);
|
1893 | tokens.push(token);
|
1894 | continue;
|
1895 | }
|
1896 |
|
1897 |
|
1898 | if (token = this.tokenizer.del(src)) {
|
1899 | src = src.substring(token.raw.length);
|
1900 | tokens.push(token);
|
1901 | continue;
|
1902 | }
|
1903 |
|
1904 |
|
1905 | if (token = this.tokenizer.autolink(src, mangle)) {
|
1906 | src = src.substring(token.raw.length);
|
1907 | tokens.push(token);
|
1908 | continue;
|
1909 | }
|
1910 |
|
1911 |
|
1912 | if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
|
1913 | src = src.substring(token.raw.length);
|
1914 | tokens.push(token);
|
1915 | continue;
|
1916 | }
|
1917 |
|
1918 |
|
1919 |
|
1920 | cutSrc = src;
|
1921 | if (this.options.extensions && this.options.extensions.startInline) {
|
1922 | let startIndex = Infinity;
|
1923 | const tempSrc = src.slice(1);
|
1924 | let tempStart;
|
1925 | this.options.extensions.startInline.forEach(function(getStartIndex) {
|
1926 | tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
1927 | if (typeof tempStart === 'number' && tempStart >= 0) { startIndex = Math.min(startIndex, tempStart); }
|
1928 | });
|
1929 | if (startIndex < Infinity && startIndex >= 0) {
|
1930 | cutSrc = src.substring(0, startIndex + 1);
|
1931 | }
|
1932 | }
|
1933 | if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
|
1934 | src = src.substring(token.raw.length);
|
1935 | if (token.raw.slice(-1) !== '_') {
|
1936 | prevChar = token.raw.slice(-1);
|
1937 | }
|
1938 | keepPrevChar = true;
|
1939 | lastToken = tokens[tokens.length - 1];
|
1940 | if (lastToken && lastToken.type === 'text') {
|
1941 | lastToken.raw += token.raw;
|
1942 | lastToken.text += token.text;
|
1943 | } else {
|
1944 | tokens.push(token);
|
1945 | }
|
1946 | continue;
|
1947 | }
|
1948 |
|
1949 | if (src) {
|
1950 | const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
|
1951 | if (this.options.silent) {
|
1952 | console.error(errMsg);
|
1953 | break;
|
1954 | } else {
|
1955 | throw new Error(errMsg);
|
1956 | }
|
1957 | }
|
1958 | }
|
1959 |
|
1960 | return tokens;
|
1961 | }
|
1962 | }
|
1963 |
|
1964 |
|
1965 |
|
1966 |
|
1967 | class Renderer {
|
1968 | constructor(options) {
|
1969 | this.options = options || defaults;
|
1970 | }
|
1971 |
|
1972 | code(code, infostring, escaped) {
|
1973 | const lang = (infostring || '').match(/\S*/)[0];
|
1974 | if (this.options.highlight) {
|
1975 | const out = this.options.highlight(code, lang);
|
1976 | if (out != null && out !== code) {
|
1977 | escaped = true;
|
1978 | code = out;
|
1979 | }
|
1980 | }
|
1981 |
|
1982 | code = code.replace(/\n$/, '') + '\n';
|
1983 |
|
1984 | if (!lang) {
|
1985 | return '<pre><code>'
|
1986 | + (escaped ? code : marked_esm_escape(code, true))
|
1987 | + '</code></pre>\n';
|
1988 | }
|
1989 |
|
1990 | return '<pre><code class="'
|
1991 | + this.options.langPrefix
|
1992 | + marked_esm_escape(lang)
|
1993 | + '">'
|
1994 | + (escaped ? code : marked_esm_escape(code, true))
|
1995 | + '</code></pre>\n';
|
1996 | }
|
1997 |
|
1998 | |
1999 |
|
2000 |
|
2001 | blockquote(quote) {
|
2002 | return `<blockquote>\n${quote}</blockquote>\n`;
|
2003 | }
|
2004 |
|
2005 | html(html) {
|
2006 | return html;
|
2007 | }
|
2008 |
|
2009 | |
2010 |
|
2011 |
|
2012 |
|
2013 |
|
2014 |
|
2015 | heading(text, level, raw, slugger) {
|
2016 | if (this.options.headerIds) {
|
2017 | const id = this.options.headerPrefix + slugger.slug(raw);
|
2018 | return `<h${level} id="${id}">${text}</h${level}>\n`;
|
2019 | }
|
2020 |
|
2021 |
|
2022 | return `<h${level}>${text}</h${level}>\n`;
|
2023 | }
|
2024 |
|
2025 | hr() {
|
2026 | return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
|
2027 | }
|
2028 |
|
2029 | list(body, ordered, start) {
|
2030 | const type = ordered ? 'ol' : 'ul',
|
2031 | startatt = (ordered && start !== 1) ? (' start="' + start + '"') : '';
|
2032 | return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
|
2033 | }
|
2034 |
|
2035 | |
2036 |
|
2037 |
|
2038 | listitem(text) {
|
2039 | return `<li>${text}</li>\n`;
|
2040 | }
|
2041 |
|
2042 | checkbox(checked) {
|
2043 | return '<input '
|
2044 | + (checked ? 'checked="" ' : '')
|
2045 | + 'disabled="" type="checkbox"'
|
2046 | + (this.options.xhtml ? ' /' : '')
|
2047 | + '> ';
|
2048 | }
|
2049 |
|
2050 | |
2051 |
|
2052 |
|
2053 | paragraph(text) {
|
2054 | return `<p>${text}</p>\n`;
|
2055 | }
|
2056 |
|
2057 | |
2058 |
|
2059 |
|
2060 |
|
2061 | table(header, body) {
|
2062 | if (body) body = `<tbody>${body}</tbody>`;
|
2063 |
|
2064 | return '<table>\n'
|
2065 | + '<thead>\n'
|
2066 | + header
|
2067 | + '</thead>\n'
|
2068 | + body
|
2069 | + '</table>\n';
|
2070 | }
|
2071 |
|
2072 | |
2073 |
|
2074 |
|
2075 | tablerow(content) {
|
2076 | return `<tr>\n${content}</tr>\n`;
|
2077 | }
|
2078 |
|
2079 | tablecell(content, flags) {
|
2080 | const type = flags.header ? 'th' : 'td';
|
2081 | const tag = flags.align
|
2082 | ? `<${type} align="${flags.align}">`
|
2083 | : `<${type}>`;
|
2084 | return tag + content + `</${type}>\n`;
|
2085 | }
|
2086 |
|
2087 | |
2088 |
|
2089 |
|
2090 |
|
2091 | strong(text) {
|
2092 | return `<strong>${text}</strong>`;
|
2093 | }
|
2094 |
|
2095 | |
2096 |
|
2097 |
|
2098 | em(text) {
|
2099 | return `<em>${text}</em>`;
|
2100 | }
|
2101 |
|
2102 | |
2103 |
|
2104 |
|
2105 | codespan(text) {
|
2106 | return `<code>${text}</code>`;
|
2107 | }
|
2108 |
|
2109 | br() {
|
2110 | return this.options.xhtml ? '<br/>' : '<br>';
|
2111 | }
|
2112 |
|
2113 | |
2114 |
|
2115 |
|
2116 | del(text) {
|
2117 | return `<del>${text}</del>`;
|
2118 | }
|
2119 |
|
2120 | |
2121 |
|
2122 |
|
2123 |
|
2124 |
|
2125 | link(href, title, text) {
|
2126 | href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
2127 | if (href === null) {
|
2128 | return text;
|
2129 | }
|
2130 | let out = '<a href="' + href + '"';
|
2131 | if (title) {
|
2132 | out += ' title="' + title + '"';
|
2133 | }
|
2134 | out += '>' + text + '</a>';
|
2135 | return out;
|
2136 | }
|
2137 |
|
2138 | |
2139 |
|
2140 |
|
2141 |
|
2142 |
|
2143 | image(href, title, text) {
|
2144 | href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
2145 | if (href === null) {
|
2146 | return text;
|
2147 | }
|
2148 |
|
2149 | let out = `<img src="${href}" alt="${text}"`;
|
2150 | if (title) {
|
2151 | out += ` title="${title}"`;
|
2152 | }
|
2153 | out += this.options.xhtml ? '/>' : '>';
|
2154 | return out;
|
2155 | }
|
2156 |
|
2157 | text(text) {
|
2158 | return text;
|
2159 | }
|
2160 | }
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 | class TextRenderer {
|
2167 |
|
2168 | strong(text) {
|
2169 | return text;
|
2170 | }
|
2171 |
|
2172 | em(text) {
|
2173 | return text;
|
2174 | }
|
2175 |
|
2176 | codespan(text) {
|
2177 | return text;
|
2178 | }
|
2179 |
|
2180 | del(text) {
|
2181 | return text;
|
2182 | }
|
2183 |
|
2184 | html(text) {
|
2185 | return text;
|
2186 | }
|
2187 |
|
2188 | text(text) {
|
2189 | return text;
|
2190 | }
|
2191 |
|
2192 | link(href, title, text) {
|
2193 | return '' + text;
|
2194 | }
|
2195 |
|
2196 | image(href, title, text) {
|
2197 | return '' + text;
|
2198 | }
|
2199 |
|
2200 | br() {
|
2201 | return '';
|
2202 | }
|
2203 | }
|
2204 |
|
2205 |
|
2206 |
|
2207 |
|
2208 | class Slugger {
|
2209 | constructor() {
|
2210 | this.seen = {};
|
2211 | }
|
2212 |
|
2213 | |
2214 |
|
2215 |
|
2216 | serialize(value) {
|
2217 | return value
|
2218 | .toLowerCase()
|
2219 | .trim()
|
2220 |
|
2221 | .replace(/<[!\/a-z].*?>/ig, '')
|
2222 |
|
2223 | .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '')
|
2224 | .replace(/\s/g, '-');
|
2225 | }
|
2226 |
|
2227 | |
2228 |
|
2229 |
|
2230 |
|
2231 |
|
2232 | getNextSafeSlug(originalSlug, isDryRun) {
|
2233 | let slug = originalSlug;
|
2234 | let occurenceAccumulator = 0;
|
2235 | if (this.seen.hasOwnProperty(slug)) {
|
2236 | occurenceAccumulator = this.seen[originalSlug];
|
2237 | do {
|
2238 | occurenceAccumulator++;
|
2239 | slug = originalSlug + '-' + occurenceAccumulator;
|
2240 | } while (this.seen.hasOwnProperty(slug));
|
2241 | }
|
2242 | if (!isDryRun) {
|
2243 | this.seen[originalSlug] = occurenceAccumulator;
|
2244 | this.seen[slug] = 0;
|
2245 | }
|
2246 | return slug;
|
2247 | }
|
2248 |
|
2249 | |
2250 |
|
2251 |
|
2252 |
|
2253 |
|
2254 |
|
2255 | slug(value, options = {}) {
|
2256 | const slug = this.serialize(value);
|
2257 | return this.getNextSafeSlug(slug, options.dryrun);
|
2258 | }
|
2259 | }
|
2260 |
|
2261 |
|
2262 |
|
2263 |
|
2264 | class Parser {
|
2265 | constructor(options) {
|
2266 | this.options = options || defaults;
|
2267 | this.options.renderer = this.options.renderer || new Renderer();
|
2268 | this.renderer = this.options.renderer;
|
2269 | this.renderer.options = this.options;
|
2270 | this.textRenderer = new TextRenderer();
|
2271 | this.slugger = new Slugger();
|
2272 | }
|
2273 |
|
2274 | |
2275 |
|
2276 |
|
2277 | static parse(tokens, options) {
|
2278 | const parser = new Parser(options);
|
2279 | return parser.parse(tokens);
|
2280 | }
|
2281 |
|
2282 | |
2283 |
|
2284 |
|
2285 | static parseInline(tokens, options) {
|
2286 | const parser = new Parser(options);
|
2287 | return parser.parseInline(tokens);
|
2288 | }
|
2289 |
|
2290 | |
2291 |
|
2292 |
|
2293 | parse(tokens, top = true) {
|
2294 | let out = '',
|
2295 | i,
|
2296 | j,
|
2297 | k,
|
2298 | l2,
|
2299 | l3,
|
2300 | row,
|
2301 | cell,
|
2302 | header,
|
2303 | body,
|
2304 | token,
|
2305 | ordered,
|
2306 | start,
|
2307 | loose,
|
2308 | itemBody,
|
2309 | item,
|
2310 | checked,
|
2311 | task,
|
2312 | checkbox,
|
2313 | ret;
|
2314 |
|
2315 | const l = tokens.length;
|
2316 | for (i = 0; i < l; i++) {
|
2317 | token = tokens[i];
|
2318 |
|
2319 |
|
2320 | if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
|
2321 | ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
|
2322 | if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(token.type)) {
|
2323 | out += ret || '';
|
2324 | continue;
|
2325 | }
|
2326 | }
|
2327 |
|
2328 | switch (token.type) {
|
2329 | case 'space': {
|
2330 | continue;
|
2331 | }
|
2332 | case 'hr': {
|
2333 | out += this.renderer.hr();
|
2334 | continue;
|
2335 | }
|
2336 | case 'heading': {
|
2337 | out += this.renderer.heading(
|
2338 | this.parseInline(token.tokens),
|
2339 | token.depth,
|
2340 | marked_esm_unescape(this.parseInline(token.tokens, this.textRenderer)),
|
2341 | this.slugger);
|
2342 | continue;
|
2343 | }
|
2344 | case 'code': {
|
2345 | out += this.renderer.code(token.text,
|
2346 | token.lang,
|
2347 | token.escaped);
|
2348 | continue;
|
2349 | }
|
2350 | case 'table': {
|
2351 | header = '';
|
2352 |
|
2353 |
|
2354 | cell = '';
|
2355 | l2 = token.header.length;
|
2356 | for (j = 0; j < l2; j++) {
|
2357 | cell += this.renderer.tablecell(
|
2358 | this.parseInline(token.header[j].tokens),
|
2359 | { header: true, align: token.align[j] }
|
2360 | );
|
2361 | }
|
2362 | header += this.renderer.tablerow(cell);
|
2363 |
|
2364 | body = '';
|
2365 | l2 = token.rows.length;
|
2366 | for (j = 0; j < l2; j++) {
|
2367 | row = token.rows[j];
|
2368 |
|
2369 | cell = '';
|
2370 | l3 = row.length;
|
2371 | for (k = 0; k < l3; k++) {
|
2372 | cell += this.renderer.tablecell(
|
2373 | this.parseInline(row[k].tokens),
|
2374 | { header: false, align: token.align[k] }
|
2375 | );
|
2376 | }
|
2377 |
|
2378 | body += this.renderer.tablerow(cell);
|
2379 | }
|
2380 | out += this.renderer.table(header, body);
|
2381 | continue;
|
2382 | }
|
2383 | case 'blockquote': {
|
2384 | body = this.parse(token.tokens);
|
2385 | out += this.renderer.blockquote(body);
|
2386 | continue;
|
2387 | }
|
2388 | case 'list': {
|
2389 | ordered = token.ordered;
|
2390 | start = token.start;
|
2391 | loose = token.loose;
|
2392 | l2 = token.items.length;
|
2393 |
|
2394 | body = '';
|
2395 | for (j = 0; j < l2; j++) {
|
2396 | item = token.items[j];
|
2397 | checked = item.checked;
|
2398 | task = item.task;
|
2399 |
|
2400 | itemBody = '';
|
2401 | if (item.task) {
|
2402 | checkbox = this.renderer.checkbox(checked);
|
2403 | if (loose) {
|
2404 | if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
|
2405 | item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
|
2406 | if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
|
2407 | item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
|
2408 | }
|
2409 | } else {
|
2410 | item.tokens.unshift({
|
2411 | type: 'text',
|
2412 | text: checkbox
|
2413 | });
|
2414 | }
|
2415 | } else {
|
2416 | itemBody += checkbox;
|
2417 | }
|
2418 | }
|
2419 |
|
2420 | itemBody += this.parse(item.tokens, loose);
|
2421 | body += this.renderer.listitem(itemBody, task, checked);
|
2422 | }
|
2423 |
|
2424 | out += this.renderer.list(body, ordered, start);
|
2425 | continue;
|
2426 | }
|
2427 | case 'html': {
|
2428 |
|
2429 | out += this.renderer.html(token.text);
|
2430 | continue;
|
2431 | }
|
2432 | case 'paragraph': {
|
2433 | out += this.renderer.paragraph(this.parseInline(token.tokens));
|
2434 | continue;
|
2435 | }
|
2436 | case 'text': {
|
2437 | body = token.tokens ? this.parseInline(token.tokens) : token.text;
|
2438 | while (i + 1 < l && tokens[i + 1].type === 'text') {
|
2439 | token = tokens[++i];
|
2440 | body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text);
|
2441 | }
|
2442 | out += top ? this.renderer.paragraph(body) : body;
|
2443 | continue;
|
2444 | }
|
2445 |
|
2446 | default: {
|
2447 | const errMsg = 'Token with "' + token.type + '" type was not found.';
|
2448 | if (this.options.silent) {
|
2449 | console.error(errMsg);
|
2450 | return;
|
2451 | } else {
|
2452 | throw new Error(errMsg);
|
2453 | }
|
2454 | }
|
2455 | }
|
2456 | }
|
2457 |
|
2458 | return out;
|
2459 | }
|
2460 |
|
2461 | |
2462 |
|
2463 |
|
2464 | parseInline(tokens, renderer) {
|
2465 | renderer = renderer || this.renderer;
|
2466 | let out = '',
|
2467 | i,
|
2468 | token,
|
2469 | ret;
|
2470 |
|
2471 | const l = tokens.length;
|
2472 | for (i = 0; i < l; i++) {
|
2473 | token = tokens[i];
|
2474 |
|
2475 |
|
2476 | if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
|
2477 | ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
|
2478 | if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(token.type)) {
|
2479 | out += ret || '';
|
2480 | continue;
|
2481 | }
|
2482 | }
|
2483 |
|
2484 | switch (token.type) {
|
2485 | case 'escape': {
|
2486 | out += renderer.text(token.text);
|
2487 | break;
|
2488 | }
|
2489 | case 'html': {
|
2490 | out += renderer.html(token.text);
|
2491 | break;
|
2492 | }
|
2493 | case 'link': {
|
2494 | out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
|
2495 | break;
|
2496 | }
|
2497 | case 'image': {
|
2498 | out += renderer.image(token.href, token.title, token.text);
|
2499 | break;
|
2500 | }
|
2501 | case 'strong': {
|
2502 | out += renderer.strong(this.parseInline(token.tokens, renderer));
|
2503 | break;
|
2504 | }
|
2505 | case 'em': {
|
2506 | out += renderer.em(this.parseInline(token.tokens, renderer));
|
2507 | break;
|
2508 | }
|
2509 | case 'codespan': {
|
2510 | out += renderer.codespan(token.text);
|
2511 | break;
|
2512 | }
|
2513 | case 'br': {
|
2514 | out += renderer.br();
|
2515 | break;
|
2516 | }
|
2517 | case 'del': {
|
2518 | out += renderer.del(this.parseInline(token.tokens, renderer));
|
2519 | break;
|
2520 | }
|
2521 | case 'text': {
|
2522 | out += renderer.text(token.text);
|
2523 | break;
|
2524 | }
|
2525 | default: {
|
2526 | const errMsg = 'Token with "' + token.type + '" type was not found.';
|
2527 | if (this.options.silent) {
|
2528 | console.error(errMsg);
|
2529 | return;
|
2530 | } else {
|
2531 | throw new Error(errMsg);
|
2532 | }
|
2533 | }
|
2534 | }
|
2535 | }
|
2536 | return out;
|
2537 | }
|
2538 | }
|
2539 |
|
2540 |
|
2541 |
|
2542 |
|
2543 | function marked(src, opt, callback) {
|
2544 |
|
2545 | if (typeof src === 'undefined' || src === null) {
|
2546 | throw new Error('marked(): input parameter is undefined or null');
|
2547 | }
|
2548 | if (typeof src !== 'string') {
|
2549 | throw new Error('marked(): input parameter is of type '
|
2550 | + Object.prototype.toString.call(src) + ', string expected');
|
2551 | }
|
2552 |
|
2553 | if (typeof opt === 'function') {
|
2554 | callback = opt;
|
2555 | opt = null;
|
2556 | }
|
2557 |
|
2558 | opt = merge({}, marked.defaults, opt || {});
|
2559 | checkSanitizeDeprecation(opt);
|
2560 |
|
2561 | if (callback) {
|
2562 | const highlight = opt.highlight;
|
2563 | let tokens;
|
2564 |
|
2565 | try {
|
2566 | tokens = Lexer.lex(src, opt);
|
2567 | } catch (e) {
|
2568 | return callback(e);
|
2569 | }
|
2570 |
|
2571 | const done = function(err) {
|
2572 | let out;
|
2573 |
|
2574 | if (!err) {
|
2575 | try {
|
2576 | if (opt.walkTokens) {
|
2577 | marked.walkTokens(tokens, opt.walkTokens);
|
2578 | }
|
2579 | out = Parser.parse(tokens, opt);
|
2580 | } catch (e) {
|
2581 | err = e;
|
2582 | }
|
2583 | }
|
2584 |
|
2585 | opt.highlight = highlight;
|
2586 |
|
2587 | return err
|
2588 | ? callback(err)
|
2589 | : callback(null, out);
|
2590 | };
|
2591 |
|
2592 | if (!highlight || highlight.length < 3) {
|
2593 | return done();
|
2594 | }
|
2595 |
|
2596 | delete opt.highlight;
|
2597 |
|
2598 | if (!tokens.length) return done();
|
2599 |
|
2600 | let pending = 0;
|
2601 | marked.walkTokens(tokens, function(token) {
|
2602 | if (token.type === 'code') {
|
2603 | pending++;
|
2604 | setTimeout(() => {
|
2605 | highlight(token.text, token.lang, function(err, code) {
|
2606 | if (err) {
|
2607 | return done(err);
|
2608 | }
|
2609 | if (code != null && code !== token.text) {
|
2610 | token.text = code;
|
2611 | token.escaped = true;
|
2612 | }
|
2613 |
|
2614 | pending--;
|
2615 | if (pending === 0) {
|
2616 | done();
|
2617 | }
|
2618 | });
|
2619 | }, 0);
|
2620 | }
|
2621 | });
|
2622 |
|
2623 | if (pending === 0) {
|
2624 | done();
|
2625 | }
|
2626 |
|
2627 | return;
|
2628 | }
|
2629 |
|
2630 | function onError(e) {
|
2631 | e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
2632 | if (opt.silent) {
|
2633 | return '<p>An error occurred:</p><pre>'
|
2634 | + marked_esm_escape(e.message + '', true)
|
2635 | + '</pre>';
|
2636 | }
|
2637 | throw e;
|
2638 | }
|
2639 |
|
2640 | try {
|
2641 | const tokens = Lexer.lex(src, opt);
|
2642 | if (opt.walkTokens) {
|
2643 | if (opt.async) {
|
2644 | return Promise.all(marked.walkTokens(tokens, opt.walkTokens))
|
2645 | .then(() => {
|
2646 | return Parser.parse(tokens, opt);
|
2647 | })
|
2648 | .catch(onError);
|
2649 | }
|
2650 | marked.walkTokens(tokens, opt.walkTokens);
|
2651 | }
|
2652 | return Parser.parse(tokens, opt);
|
2653 | } catch (e) {
|
2654 | onError(e);
|
2655 | }
|
2656 | }
|
2657 |
|
2658 |
|
2659 |
|
2660 |
|
2661 |
|
2662 | marked.options =
|
2663 | marked.setOptions = function(opt) {
|
2664 | merge(marked.defaults, opt);
|
2665 | changeDefaults(marked.defaults);
|
2666 | return marked;
|
2667 | };
|
2668 |
|
2669 | marked.getDefaults = getDefaults;
|
2670 |
|
2671 | marked.defaults = defaults;
|
2672 |
|
2673 |
|
2674 |
|
2675 |
|
2676 |
|
2677 | marked.use = function(...args) {
|
2678 | const extensions = marked.defaults.extensions || { renderers: {}, childTokens: {} };
|
2679 |
|
2680 | args.forEach((pack) => {
|
2681 |
|
2682 | const opts = merge({}, pack);
|
2683 |
|
2684 |
|
2685 | opts.async = marked.defaults.async || opts.async;
|
2686 |
|
2687 |
|
2688 | if (pack.extensions) {
|
2689 | pack.extensions.forEach((ext) => {
|
2690 | if (!ext.name) {
|
2691 | throw new Error('extension name required');
|
2692 | }
|
2693 | if (ext.renderer) {
|
2694 | const prevRenderer = extensions.renderers[ext.name];
|
2695 | if (prevRenderer) {
|
2696 |
|
2697 | extensions.renderers[ext.name] = function(...args) {
|
2698 | let ret = ext.renderer.apply(this, args);
|
2699 | if (ret === false) {
|
2700 | ret = prevRenderer.apply(this, args);
|
2701 | }
|
2702 | return ret;
|
2703 | };
|
2704 | } else {
|
2705 | extensions.renderers[ext.name] = ext.renderer;
|
2706 | }
|
2707 | }
|
2708 | if (ext.tokenizer) {
|
2709 | if (!ext.level || (ext.level !== 'block' && ext.level !== 'inline')) {
|
2710 | throw new Error("extension level must be 'block' or 'inline'");
|
2711 | }
|
2712 | if (extensions[ext.level]) {
|
2713 | extensions[ext.level].unshift(ext.tokenizer);
|
2714 | } else {
|
2715 | extensions[ext.level] = [ext.tokenizer];
|
2716 | }
|
2717 | if (ext.start) {
|
2718 | if (ext.level === 'block') {
|
2719 | if (extensions.startBlock) {
|
2720 | extensions.startBlock.push(ext.start);
|
2721 | } else {
|
2722 | extensions.startBlock = [ext.start];
|
2723 | }
|
2724 | } else if (ext.level === 'inline') {
|
2725 | if (extensions.startInline) {
|
2726 | extensions.startInline.push(ext.start);
|
2727 | } else {
|
2728 | extensions.startInline = [ext.start];
|
2729 | }
|
2730 | }
|
2731 | }
|
2732 | }
|
2733 | if (ext.childTokens) {
|
2734 | extensions.childTokens[ext.name] = ext.childTokens;
|
2735 | }
|
2736 | });
|
2737 | opts.extensions = extensions;
|
2738 | }
|
2739 |
|
2740 |
|
2741 | if (pack.renderer) {
|
2742 | const renderer = marked.defaults.renderer || new Renderer();
|
2743 | for (const prop in pack.renderer) {
|
2744 | const prevRenderer = renderer[prop];
|
2745 |
|
2746 | renderer[prop] = (...args) => {
|
2747 | let ret = pack.renderer[prop].apply(renderer, args);
|
2748 | if (ret === false) {
|
2749 | ret = prevRenderer.apply(renderer, args);
|
2750 | }
|
2751 | return ret;
|
2752 | };
|
2753 | }
|
2754 | opts.renderer = renderer;
|
2755 | }
|
2756 | if (pack.tokenizer) {
|
2757 | const tokenizer = marked.defaults.tokenizer || new Tokenizer();
|
2758 | for (const prop in pack.tokenizer) {
|
2759 | const prevTokenizer = tokenizer[prop];
|
2760 |
|
2761 | tokenizer[prop] = (...args) => {
|
2762 | let ret = pack.tokenizer[prop].apply(tokenizer, args);
|
2763 | if (ret === false) {
|
2764 | ret = prevTokenizer.apply(tokenizer, args);
|
2765 | }
|
2766 | return ret;
|
2767 | };
|
2768 | }
|
2769 | opts.tokenizer = tokenizer;
|
2770 | }
|
2771 |
|
2772 |
|
2773 | if (pack.walkTokens) {
|
2774 | const walkTokens = marked.defaults.walkTokens;
|
2775 | opts.walkTokens = function(token) {
|
2776 | let values = [];
|
2777 | values.push(pack.walkTokens.call(this, token));
|
2778 | if (walkTokens) {
|
2779 | values = values.concat(walkTokens.call(this, token));
|
2780 | }
|
2781 | return values;
|
2782 | };
|
2783 | }
|
2784 |
|
2785 | marked.setOptions(opts);
|
2786 | });
|
2787 | };
|
2788 |
|
2789 |
|
2790 |
|
2791 |
|
2792 |
|
2793 | marked.walkTokens = function(tokens, callback) {
|
2794 | let values = [];
|
2795 | for (const token of tokens) {
|
2796 | values = values.concat(callback.call(marked, token));
|
2797 | switch (token.type) {
|
2798 | case 'table': {
|
2799 | for (const cell of token.header) {
|
2800 | values = values.concat(marked.walkTokens(cell.tokens, callback));
|
2801 | }
|
2802 | for (const row of token.rows) {
|
2803 | for (const cell of row) {
|
2804 | values = values.concat(marked.walkTokens(cell.tokens, callback));
|
2805 | }
|
2806 | }
|
2807 | break;
|
2808 | }
|
2809 | case 'list': {
|
2810 | values = values.concat(marked.walkTokens(token.items, callback));
|
2811 | break;
|
2812 | }
|
2813 | default: {
|
2814 | if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) {
|
2815 | marked.defaults.extensions.childTokens[token.type].forEach(function(childTokens) {
|
2816 | values = values.concat(marked.walkTokens(token[childTokens], callback));
|
2817 | });
|
2818 | } else if (token.tokens) {
|
2819 | values = values.concat(marked.walkTokens(token.tokens, callback));
|
2820 | }
|
2821 | }
|
2822 | }
|
2823 | }
|
2824 | return values;
|
2825 | };
|
2826 |
|
2827 |
|
2828 |
|
2829 |
|
2830 |
|
2831 | marked.parseInline = function(src, opt) {
|
2832 |
|
2833 | if (typeof src === 'undefined' || src === null) {
|
2834 | throw new Error('marked.parseInline(): input parameter is undefined or null');
|
2835 | }
|
2836 | if (typeof src !== 'string') {
|
2837 | throw new Error('marked.parseInline(): input parameter is of type '
|
2838 | + Object.prototype.toString.call(src) + ', string expected');
|
2839 | }
|
2840 |
|
2841 | opt = merge({}, marked.defaults, opt || {});
|
2842 | checkSanitizeDeprecation(opt);
|
2843 |
|
2844 | try {
|
2845 | const tokens = Lexer.lexInline(src, opt);
|
2846 | if (opt.walkTokens) {
|
2847 | marked.walkTokens(tokens, opt.walkTokens);
|
2848 | }
|
2849 | return Parser.parseInline(tokens, opt);
|
2850 | } catch (e) {
|
2851 | e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
2852 | if (opt.silent) {
|
2853 | return '<p>An error occurred:</p><pre>'
|
2854 | + marked_esm_escape(e.message + '', true)
|
2855 | + '</pre>';
|
2856 | }
|
2857 | throw e;
|
2858 | }
|
2859 | };
|
2860 |
|
2861 |
|
2862 |
|
2863 |
|
2864 | marked.Parser = Parser;
|
2865 | marked.parser = Parser.parse;
|
2866 | marked.Renderer = Renderer;
|
2867 | marked.TextRenderer = TextRenderer;
|
2868 | marked.Lexer = Lexer;
|
2869 | marked.lexer = Lexer.lex;
|
2870 | marked.Tokenizer = Tokenizer;
|
2871 | marked.Slugger = Slugger;
|
2872 | marked.parse = marked;
|
2873 |
|
2874 | const options = marked.options;
|
2875 | const setOptions = marked.setOptions;
|
2876 | const use = marked.use;
|
2877 | const walkTokens = marked.walkTokens;
|
2878 | const parseInline = marked.parseInline;
|
2879 | const parse = ( null && (marked));
|
2880 | const parser = Parser.parse;
|
2881 | const lexer = Lexer.lex;
|
2882 |
|
2883 |
|
2884 |
|
2885 |
|
2886 | var prism = __webpack_require__(660);
|
2887 | var prism_default = __webpack_require__.n(prism);
|
2888 |
|
2889 | var prism_css = __webpack_require__(251);
|
2890 |
|
2891 | var prism_yaml = __webpack_require__(358);
|
2892 |
|
2893 | var prism_go = __webpack_require__(46);
|
2894 |
|
2895 | var prism_java = __webpack_require__(503);
|
2896 |
|
2897 | var prism_json = __webpack_require__(277);
|
2898 |
|
2899 | var prism_bash = __webpack_require__(874);
|
2900 |
|
2901 | var prism_python = __webpack_require__(366);
|
2902 |
|
2903 | var prism_http = __webpack_require__(57);
|
2904 |
|
2905 | var prism_csharp = __webpack_require__(16);
|
2906 | ;
|
2907 |
|
2908 | const font_styles = (i`
|
2909 | .hover-bg:hover{
|
2910 | background: var(--bg3);
|
2911 | }
|
2912 | ::selection {
|
2913 | background: var(--selection-bg);
|
2914 | color: var(--selection-fg);
|
2915 | }
|
2916 | .regular-font{
|
2917 | font-family:var(--font-regular);
|
2918 | }
|
2919 | .mono-font {
|
2920 | font-family:var(--font-mono);
|
2921 | }
|
2922 | .title {
|
2923 | font-size: calc(var(--font-size-small) + 18px);
|
2924 | font-weight: normal
|
2925 | }
|
2926 | .sub-title{ font-size: 20px;}
|
2927 | .req-res-title {
|
2928 | font-family: var(--font-regular);
|
2929 | font-size: calc(var(--font-size-small) + 4px);
|
2930 | font-weight:bold;
|
2931 | margin-bottom:8px;
|
2932 | text-align:left;
|
2933 | }
|
2934 | .tiny-title {
|
2935 | font-size:calc(var(--font-size-small) + 1px);
|
2936 | font-weight:bold;
|
2937 | }
|
2938 | .regular-font-size { font-size: var(--font-size-regular); }
|
2939 | .small-font-size { font-size: var(--font-size-small); }
|
2940 | .upper { text-transform: uppercase; }
|
2941 | .primary-text{ color: var(--primary-color); }
|
2942 | .bold-text { font-weight:bold; }
|
2943 | .gray-text { color: var(--light-fg); }
|
2944 | .red-text {color: var(--red)}
|
2945 | .blue-text {color: var(--blue)}
|
2946 | .multiline {
|
2947 | overflow: scroll;
|
2948 | max-height: var(--resp-area-height, 400px);
|
2949 | color: var(--fg3);
|
2950 | }
|
2951 | .method-fg.put { color: var(--orange); }
|
2952 | .method-fg.post { color: var(--green); }
|
2953 | .method-fg.get { color: var(--blue); }
|
2954 | .method-fg.delete { color: var(--red); }
|
2955 | .method-fg.options,
|
2956 | .method-fg.head,
|
2957 | .method-fg.patch {
|
2958 | color: var(--yellow);
|
2959 | }
|
2960 |
|
2961 | h1{ font-family:var(--font-regular); font-size:28px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
2962 | h2{ font-family:var(--font-regular); font-size:24px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
2963 | h3{ font-family:var(--font-regular); font-size:18px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
2964 | h4{ font-family:var(--font-regular); font-size:16px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
2965 | h5{ font-family:var(--font-regular); font-size:14px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
2966 | h6{ font-family:var(--font-regular); font-size:14px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
2967 |
|
2968 | h1,h2,h3,h4,h5,h5{
|
2969 | margin-block-end: 0.2em;
|
2970 | }
|
2971 | p { margin-block-start: 0.5em; }
|
2972 | a { color: var(--blue); cursor:pointer; }
|
2973 | a.inactive-link {
|
2974 | color:var(--fg);
|
2975 | text-decoration: none;
|
2976 | cursor:text;
|
2977 | }
|
2978 |
|
2979 | code,
|
2980 | pre {
|
2981 | margin: 0px;
|
2982 | font-family: var(--font-mono);
|
2983 | font-size: calc(var(--font-size-mono) - 1px);
|
2984 | }
|
2985 |
|
2986 | .m-markdown,
|
2987 | .m-markdown-small {
|
2988 | display:block;
|
2989 | }
|
2990 |
|
2991 | .m-markdown p,
|
2992 | .m-markdown span {
|
2993 | font-size: var(--font-size-regular);
|
2994 | line-height:calc(var(--font-size-regular) + 8px);
|
2995 | }
|
2996 | .m-markdown li {
|
2997 | font-size: var(--font-size-regular);
|
2998 | line-height:calc(var(--font-size-regular) + 10px);
|
2999 | }
|
3000 |
|
3001 | .m-markdown-small p,
|
3002 | .m-markdown-small span,
|
3003 | .m-markdown-small li {
|
3004 | font-size: var(--font-size-small);
|
3005 | line-height: calc(var(--font-size-small) + 6px);
|
3006 | }
|
3007 | .m-markdown-small li {
|
3008 | line-height: calc(var(--font-size-small) + 8px);
|
3009 | }
|
3010 |
|
3011 | .m-markdown p:not(:first-child) {
|
3012 | margin-block-start: 24px;
|
3013 | }
|
3014 |
|
3015 | .m-markdown-small p:not(:first-child) {
|
3016 | margin-block-start: 12px;
|
3017 | }
|
3018 | .m-markdown-small p:first-child {
|
3019 | margin-block-start: 0;
|
3020 | }
|
3021 |
|
3022 | .m-markdown p,
|
3023 | .m-markdown-small p {
|
3024 | margin-block-end: 0
|
3025 | }
|
3026 |
|
3027 | .m-markdown code span {
|
3028 | font-size:var(--font-size-mono);
|
3029 | }
|
3030 |
|
3031 | .m-markdown-small code,
|
3032 | .m-markdown code {
|
3033 | padding: 1px 6px;
|
3034 | border-radius: 2px;
|
3035 | color: var(--inline-code-fg);
|
3036 | background-color: var(--bg3);
|
3037 | font-size: calc(var(--font-size-mono));
|
3038 | line-height: 1.2;
|
3039 | }
|
3040 |
|
3041 | .m-markdown-small code {
|
3042 | font-size: calc(var(--font-size-mono) - 1px);
|
3043 | }
|
3044 |
|
3045 | .m-markdown-small pre,
|
3046 | .m-markdown pre {
|
3047 | white-space: pre-wrap;
|
3048 | overflow-x: auto;
|
3049 | line-height: normal;
|
3050 | border-radius: 2px;
|
3051 | border: 1px solid var(--code-border-color);
|
3052 | }
|
3053 |
|
3054 | .m-markdown pre {
|
3055 | padding: 12px;
|
3056 | background-color: var(--code-bg);
|
3057 | color:var(--code-fg);
|
3058 | }
|
3059 |
|
3060 | .m-markdown-small pre {
|
3061 | margin-top: 4px;
|
3062 | padding: 2px 4px;
|
3063 | background-color: var(--bg3);
|
3064 | color: var(--fg2);
|
3065 | }
|
3066 |
|
3067 | .m-markdown-small pre code,
|
3068 | .m-markdown pre code {
|
3069 | border:none;
|
3070 | padding:0;
|
3071 | }
|
3072 |
|
3073 | .m-markdown pre code {
|
3074 | color: var(--code-fg);
|
3075 | background-color: var(--code-bg);
|
3076 | background-color: transparent;
|
3077 | }
|
3078 |
|
3079 | .m-markdown-small pre code {
|
3080 | color: var(--fg2);
|
3081 | background-color: var(--bg3);
|
3082 | }
|
3083 |
|
3084 | .m-markdown ul,
|
3085 | .m-markdown ol {
|
3086 | padding-inline-start: 30px;
|
3087 | }
|
3088 |
|
3089 | .m-markdown-small ul,
|
3090 | .m-markdown-small ol {
|
3091 | padding-inline-start: 20px;
|
3092 | }
|
3093 |
|
3094 | .m-markdown-small a,
|
3095 | .m-markdown a {
|
3096 | color:var(--blue);
|
3097 | }
|
3098 |
|
3099 | .m-markdown-small img,
|
3100 | .m-markdown img {
|
3101 | max-width: 100%;
|
3102 | }
|
3103 |
|
3104 | /* Markdown table */
|
3105 |
|
3106 | .m-markdown-small table,
|
3107 | .m-markdown table {
|
3108 | border-spacing: 0;
|
3109 | margin: 10px 0;
|
3110 | border-collapse: separate;
|
3111 | border: 1px solid var(--border-color);
|
3112 | border-radius: var(--border-radius);
|
3113 | font-size: calc(var(--font-size-small) + 1px);
|
3114 | line-height: calc(var(--font-size-small) + 4px);
|
3115 | max-width: 100%;
|
3116 | }
|
3117 |
|
3118 | .m-markdown-small table {
|
3119 | font-size: var(--font-size-small);
|
3120 | line-height: calc(var(--font-size-small) + 2px);
|
3121 | margin: 8px 0;
|
3122 | }
|
3123 |
|
3124 | .m-markdown-small td,
|
3125 | .m-markdown-small th,
|
3126 | .m-markdown td,
|
3127 | .m-markdown th {
|
3128 | vertical-align: top;
|
3129 | border-top: 1px solid var(--border-color);
|
3130 | line-height: calc(var(--font-size-small) + 4px);
|
3131 | }
|
3132 |
|
3133 | .m-markdown-small tr:first-child th,
|
3134 | .m-markdown tr:first-child th {
|
3135 | border-top: 0 none;
|
3136 | }
|
3137 |
|
3138 | .m-markdown th,
|
3139 | .m-markdown td {
|
3140 | padding: 10px 12px;
|
3141 | }
|
3142 |
|
3143 | .m-markdown-small th,
|
3144 | .m-markdown-small td {
|
3145 | padding: 8px 8px;
|
3146 | }
|
3147 |
|
3148 | .m-markdown th,
|
3149 | .m-markdown-small th {
|
3150 | font-weight: 600;
|
3151 | background-color: var(--bg2);
|
3152 | vertical-align: middle;
|
3153 | }
|
3154 |
|
3155 | .m-markdown-small table code {
|
3156 | font-size: calc(var(--font-size-mono) - 2px);
|
3157 | }
|
3158 |
|
3159 | .m-markdown table code {
|
3160 | font-size: calc(var(--font-size-mono) - 1px);
|
3161 | }
|
3162 |
|
3163 | .m-markdown blockquote,
|
3164 | .m-markdown-small blockquote {
|
3165 | margin-inline-start: 0;
|
3166 | margin-inline-end: 0;
|
3167 | border-left: 3px solid var(--border-color);
|
3168 | padding: 6px 0 6px 6px;
|
3169 | }
|
3170 | .m-markdown hr{
|
3171 | border: 1px solid var(--border-color);
|
3172 | }
|
3173 | `);
|
3174 | ;
|
3175 |
|
3176 |
|
3177 |
|
3178 | const input_styles = (i`
|
3179 | /* Button */
|
3180 | .m-btn {
|
3181 | border-radius: var(--border-radius);
|
3182 | font-weight: 600;
|
3183 | display: inline-block;
|
3184 | padding: 6px 16px;
|
3185 | font-size: var(--font-size-small);
|
3186 | outline: 0;
|
3187 | line-height: 1;
|
3188 | text-align: center;
|
3189 | white-space: nowrap;
|
3190 | border: 2px solid var(--primary-color);
|
3191 | background-color:transparent;
|
3192 | transition: background-color 0.2s;
|
3193 | user-select: none;
|
3194 | cursor: pointer;
|
3195 | box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
3196 | }
|
3197 | .m-btn.primary {
|
3198 | background-color: var(--primary-color);
|
3199 | color: var(--primary-color-invert);
|
3200 | }
|
3201 | .m-btn.thin-border { border-width: 1px; }
|
3202 | .m-btn.large { padding:8px 14px; }
|
3203 | .m-btn.small { padding:5px 12px; }
|
3204 | .m-btn.tiny { padding:5px 6px; }
|
3205 | .m-btn.circle { border-radius: 50%; }
|
3206 | .m-btn:hover {
|
3207 | background-color: var(--primary-color);
|
3208 | color: var(--primary-color-invert);
|
3209 | }
|
3210 | .m-btn.nav { border: 2px solid var(--nav-accent-color); }
|
3211 | .m-btn.nav:hover {
|
3212 | background-color: var(--nav-accent-color);
|
3213 | }
|
3214 | .m-btn:disabled{
|
3215 | background-color: var(--bg3);
|
3216 | color: var(--fg3);
|
3217 | border-color: var(--fg3);
|
3218 | cursor: not-allowed;
|
3219 | opacity: 0.4;
|
3220 | }
|
3221 | .toolbar-btn{
|
3222 | cursor: pointer;
|
3223 | padding: 4px;
|
3224 | margin:0 2px;
|
3225 | font-size: var(--font-size-small);
|
3226 | min-width: 50px;
|
3227 | color: var(--primary-color-invert);
|
3228 | border-radius: 2px;
|
3229 | border: none;
|
3230 | background-color: var(--primary-color);
|
3231 | }
|
3232 |
|
3233 | input, textarea, select, button, pre {
|
3234 | color:var(--fg);
|
3235 | outline: none;
|
3236 | background-color: var(--input-bg);
|
3237 | border: 1px solid var(--border-color);
|
3238 | border-radius: var(--border-radius);
|
3239 | }
|
3240 | button {
|
3241 | font-family: var(--font-regular);
|
3242 | }
|
3243 |
|
3244 | /* Form Inputs */
|
3245 | pre,
|
3246 | select,
|
3247 | textarea,
|
3248 | input[type="file"],
|
3249 | input[type="text"],
|
3250 | input[type="password"] {
|
3251 | font-family: var(--font-mono);
|
3252 | font-weight: 400;
|
3253 | font-size: var(--font-size-small);
|
3254 | transition: border .2s;
|
3255 | padding: 6px 5px;
|
3256 | }
|
3257 |
|
3258 | select {
|
3259 | font-family: var(--font-regular);
|
3260 | padding: 5px 30px 5px 5px;
|
3261 | 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");
|
3262 | background-position: calc(100% - 5px) center;
|
3263 | background-repeat: no-repeat;
|
3264 | background-size: 10px;
|
3265 | -webkit-appearance: none;
|
3266 | -moz-appearance: none;
|
3267 | appearance: none;
|
3268 | cursor: pointer;
|
3269 | }
|
3270 |
|
3271 | select:hover {
|
3272 | border-color: var(--primary-color);
|
3273 | }
|
3274 |
|
3275 | textarea::placeholder,
|
3276 | input[type="text"]::placeholder,
|
3277 | input[type="password"]::placeholder {
|
3278 | color: var(--placeholder-color);
|
3279 | opacity:1;
|
3280 | }
|
3281 |
|
3282 |
|
3283 | input[type="file"]{
|
3284 | font-family: var(--font-regular);
|
3285 | padding:2px;
|
3286 | cursor:pointer;
|
3287 | border: 1px solid var(--primary-color);
|
3288 | min-height: calc(var(--font-size-small) + 18px);
|
3289 | }
|
3290 |
|
3291 | input[type="file"]::-webkit-file-upload-button {
|
3292 | font-family: var(--font-regular);
|
3293 | font-size: var(--font-size-small);
|
3294 | outline: none;
|
3295 | cursor:pointer;
|
3296 | padding: 3px 8px;
|
3297 | border: 1px solid var(--primary-color);
|
3298 | background-color: var(--primary-color);
|
3299 | color: var(--primary-color-invert);
|
3300 | border-radius: var(--border-radius);;
|
3301 | -webkit-appearance: none;
|
3302 | }
|
3303 |
|
3304 | pre,
|
3305 | textarea {
|
3306 | scrollbar-width: thin;
|
3307 | scrollbar-color: var(--border-color) var(--input-bg);
|
3308 | }
|
3309 |
|
3310 | pre::-webkit-scrollbar,
|
3311 | textarea::-webkit-scrollbar {
|
3312 | width: 8px;
|
3313 | height: 8px;
|
3314 | }
|
3315 |
|
3316 | pre::-webkit-scrollbar-track,
|
3317 | textarea::-webkit-scrollbar-track {
|
3318 | background:var(--input-bg);
|
3319 | }
|
3320 |
|
3321 | pre::-webkit-scrollbar-thumb,
|
3322 | textarea::-webkit-scrollbar-thumb {
|
3323 | border-radius: 2px;
|
3324 | background-color: var(--border-color);
|
3325 | }
|
3326 |
|
3327 | .link {
|
3328 | font-size:var(--font-size-small);
|
3329 | text-decoration: underline;
|
3330 | color:var(--blue);
|
3331 | font-family:var(--font-mono);
|
3332 | margin-bottom:2px;
|
3333 | }
|
3334 |
|
3335 | /* Toggle Body */
|
3336 | input[type="checkbox"] {
|
3337 | appearance: none;
|
3338 | display: inline-block;
|
3339 | background-color: var(--light-bg);
|
3340 | border: 1px solid var(--light-bg);
|
3341 | border-radius: 9px;
|
3342 | cursor: pointer;
|
3343 | height: 18px;
|
3344 | position: relative;
|
3345 | transition: border .25s .15s, box-shadow .25s .3s, padding .25s;
|
3346 | min-width: 36px;
|
3347 | width: 36px;
|
3348 | vertical-align: top;
|
3349 | }
|
3350 | /* Toggle Thumb */
|
3351 | input[type="checkbox"]:after {
|
3352 | position: absolute;
|
3353 | background-color: var(--bg);
|
3354 | border: 1px solid var(--light-bg);
|
3355 | border-radius: 8px;
|
3356 | content: '';
|
3357 | top: 0px;
|
3358 | left: 0px;
|
3359 | right: 16px;
|
3360 | display: block;
|
3361 | height: 16px;
|
3362 | transition: border .25s .15s, left .25s .1s, right .15s .175s;
|
3363 | }
|
3364 |
|
3365 | /* Toggle Body - Checked */
|
3366 | input[type="checkbox"]:checked {
|
3367 | background-color: var(--green);
|
3368 | border-color: var(--green);
|
3369 | }
|
3370 | /* Toggle Thumb - Checked*/
|
3371 | input[type="checkbox"]:checked:after {
|
3372 | border: 1px solid var(--green);
|
3373 | left: 16px;
|
3374 | right: 1px;
|
3375 | transition: border .25s, left .15s .25s, right .25s .175s;
|
3376 | }`);
|
3377 | ;
|
3378 |
|
3379 | const flex_styles = (i`
|
3380 | .row, .col{
|
3381 | display:flex;
|
3382 | }
|
3383 | .row {
|
3384 | align-items:center;
|
3385 | flex-direction: row;
|
3386 | }
|
3387 | .col {
|
3388 | align-items:stretch;
|
3389 | flex-direction: column;
|
3390 | }
|
3391 | `);
|
3392 | ;
|
3393 |
|
3394 | const table_styles = (i`
|
3395 | .m-table {
|
3396 | border-spacing: 0;
|
3397 | border-collapse: separate;
|
3398 | border: 1px solid var(--light-border-color);
|
3399 | border-radius: var(--border-radius);
|
3400 | margin: 0;
|
3401 | max-width: 100%;
|
3402 | direction: ltr;
|
3403 | }
|
3404 | .m-table tr:first-child td,
|
3405 | .m-table tr:first-child th {
|
3406 | border-top: 0 none;
|
3407 | }
|
3408 | .m-table td,
|
3409 | .m-table th {
|
3410 | font-size: var(--font-size-small);
|
3411 | line-height: calc(var(--font-size-small) + 4px);
|
3412 | padding: 4px 5px 4px;
|
3413 | vertical-align: top;
|
3414 | }
|
3415 |
|
3416 | .m-table.padded-12 td,
|
3417 | .m-table.padded-12 th {
|
3418 | padding: 12px;
|
3419 | }
|
3420 |
|
3421 | .m-table td:not([align]),
|
3422 | .m-table th:not([align]) {
|
3423 | text-align: left;
|
3424 | }
|
3425 |
|
3426 | .m-table th {
|
3427 | color: var(--fg2);
|
3428 | font-size: var(--font-size-small);
|
3429 | line-height: calc(var(--font-size-small) + 18px);
|
3430 | font-weight: 600;
|
3431 | letter-spacing: normal;
|
3432 | background-color: var(--bg2);
|
3433 | vertical-align: bottom;
|
3434 | border-bottom: 1px solid var(--light-border-color);
|
3435 | }
|
3436 |
|
3437 | .m-table > tbody > tr > td,
|
3438 | .m-table > tr > td {
|
3439 | border-top: 1px solid var(--light-border-color);
|
3440 | text-overflow: ellipsis;
|
3441 | overflow: hidden;
|
3442 | }
|
3443 | .table-title {
|
3444 | font-size:var(--font-size-small);
|
3445 | font-weight:bold;
|
3446 | vertical-align: middle;
|
3447 | margin: 12px 0 4px 0;
|
3448 | }
|
3449 | `);
|
3450 | ;
|
3451 |
|
3452 | const endpoint_styles = (i`
|
3453 | .only-large-screen { display:none; }
|
3454 | .endpoint-head .path{
|
3455 | display: flex;
|
3456 | font-family:var(--font-mono);
|
3457 | font-size: var(--font-size-small);
|
3458 | align-items: center;
|
3459 | overflow-wrap: break-word;
|
3460 | word-break: break-all;
|
3461 | }
|
3462 |
|
3463 | .endpoint-head .descr {
|
3464 | font-size: var(--font-size-small);
|
3465 | color:var(--light-fg);
|
3466 | font-weight:400;
|
3467 | align-items: center;
|
3468 | overflow-wrap: break-word;
|
3469 | word-break: break-all;
|
3470 | display:none;
|
3471 | }
|
3472 |
|
3473 | .m-endpoint.expanded{margin-bottom:16px; }
|
3474 | .m-endpoint > .endpoint-head{
|
3475 | border-width:1px 1px 1px 5px;
|
3476 | border-style:solid;
|
3477 | border-color:transparent;
|
3478 | border-top-color:var(--light-border-color);
|
3479 | display:flex;
|
3480 | padding:6px 16px;
|
3481 | align-items: center;
|
3482 | cursor: pointer;
|
3483 | }
|
3484 | .m-endpoint > .endpoint-head.put:hover,
|
3485 | .m-endpoint > .endpoint-head.put.expanded{
|
3486 | border-color:var(--orange);
|
3487 | background-color:var(--light-orange);
|
3488 | }
|
3489 | .m-endpoint > .endpoint-head.post:hover,
|
3490 | .m-endpoint > .endpoint-head.post.expanded {
|
3491 | border-color:var(--green);
|
3492 | background-color:var(--light-green);
|
3493 | }
|
3494 | .m-endpoint > .endpoint-head.get:hover,
|
3495 | .m-endpoint > .endpoint-head.get.expanded {
|
3496 | border-color:var(--blue);
|
3497 | background-color:var(--light-blue);
|
3498 | }
|
3499 | .m-endpoint > .endpoint-head.delete:hover,
|
3500 | .m-endpoint > .endpoint-head.delete.expanded {
|
3501 | border-color:var(--red);
|
3502 | background-color:var(--light-red);
|
3503 | }
|
3504 |
|
3505 | .m-endpoint > .endpoint-head.head:hover,
|
3506 | .m-endpoint > .endpoint-head.head.expanded,
|
3507 | .m-endpoint > .endpoint-head.patch:hover,
|
3508 | .m-endpoint > .endpoint-head.patch.expanded,
|
3509 | .m-endpoint > .endpoint-head.options:hover,
|
3510 | .m-endpoint > .endpoint-head.options.expanded {
|
3511 | border-color:var(--yellow);
|
3512 | background-color:var(--light-yellow);
|
3513 | }
|
3514 |
|
3515 | .m-endpoint > .endpoint-head.deprecated:hover,
|
3516 | .m-endpoint > .endpoint-head.deprecated.expanded {
|
3517 | border-color:var(--border-color);
|
3518 | filter:opacity(0.6);
|
3519 | }
|
3520 |
|
3521 | .m-endpoint .endpoint-body {
|
3522 | flex-wrap:wrap;
|
3523 | padding:16px 0px 0 0px;
|
3524 | border-width:0px 1px 1px 5px;
|
3525 | border-style:solid;
|
3526 | box-shadow: 0px 4px 3px -3px rgba(0, 0, 0, 0.15);
|
3527 | }
|
3528 | .m-endpoint .endpoint-body.delete{ border-color:var(--red); }
|
3529 | .m-endpoint .endpoint-body.put{ border-color:var(--orange); }
|
3530 | .m-endpoint .endpoint-body.post{border-color:var(--green);}
|
3531 | .m-endpoint .endpoint-body.get{ border-color:var(--blue); }
|
3532 | .m-endpoint .endpoint-body.head,
|
3533 | .m-endpoint .endpoint-body.patch,
|
3534 | .m-endpoint .endpoint-body.options {
|
3535 | border-color:var(--yellow);
|
3536 | }
|
3537 |
|
3538 | .m-endpoint .endpoint-body.deprecated{
|
3539 | border-color:var(--border-color);
|
3540 | filter:opacity(0.6);
|
3541 | }
|
3542 |
|
3543 | .endpoint-head .deprecated{
|
3544 | color: var(--light-fg);
|
3545 | filter:opacity(0.6);
|
3546 | }
|
3547 |
|
3548 | .summary{
|
3549 | padding:8px 8px;
|
3550 | }
|
3551 | .summary .title{
|
3552 | font-size:calc(var(--font-size-regular) + 2px);
|
3553 | margin-bottom: 6px;
|
3554 | word-break: break-all;
|
3555 | }
|
3556 |
|
3557 | .endpoint-head .method{
|
3558 | padding:2px 5px;
|
3559 | vertical-align: middle;
|
3560 | font-size:var(--font-size-small);
|
3561 | height: calc(var(--font-size-small) + 16px);
|
3562 | line-height: calc(var(--font-size-small) + 8px);
|
3563 | width: 60px;
|
3564 | border-radius: 2px;
|
3565 | display:inline-block;
|
3566 | text-align: center;
|
3567 | font-weight: bold;
|
3568 | text-transform:uppercase;
|
3569 | margin-right:5px;
|
3570 | }
|
3571 | .endpoint-head .method.delete{ border: 2px solid var(--red);}
|
3572 | .endpoint-head .method.put{ border: 2px solid var(--orange); }
|
3573 | .endpoint-head .method.post{ border: 2px solid var(--green); }
|
3574 | .endpoint-head .method.get{ border: 2px solid var(--blue); }
|
3575 | .endpoint-head .method.get.deprecated{ border: 2px solid var(--border-color); }
|
3576 | .endpoint-head .method.head,
|
3577 | .endpoint-head .method.patch,
|
3578 | .endpoint-head .method.options {
|
3579 | border: 2px solid var(--yellow);
|
3580 | }
|
3581 |
|
3582 | .req-resp-container {
|
3583 | display: flex;
|
3584 | margin-top:16px;
|
3585 | align-items: stretch;
|
3586 | flex-wrap: wrap;
|
3587 | flex-direction: column;
|
3588 | border-top:1px solid var(--light-border-color);
|
3589 | }
|
3590 |
|
3591 | .view-mode-request,
|
3592 | api-response.view-mode {
|
3593 | flex:1;
|
3594 | min-height:100px;
|
3595 | padding:16px 8px;
|
3596 | overflow:hidden;
|
3597 | }
|
3598 | .view-mode-request {
|
3599 | border-width:0 0 1px 0;
|
3600 | border-style:dashed;
|
3601 | }
|
3602 |
|
3603 | .head .view-mode-request,
|
3604 | .patch .view-mode-request,
|
3605 | .options .view-mode-request {
|
3606 | border-color:var(--yellow);
|
3607 | }
|
3608 | .put .view-mode-request {
|
3609 | border-color:var(--orange);
|
3610 | }
|
3611 | .post .view-mode-request {
|
3612 | border-color:var(--green);
|
3613 | }
|
3614 | .get .view-mode-request {
|
3615 | border-color:var(--blue);
|
3616 | }
|
3617 | .delete .view-mode-request {
|
3618 | border-color:var(--red);
|
3619 | }
|
3620 |
|
3621 | @media only screen and (min-width: 1024px) {
|
3622 | .only-large-screen { display:block; }
|
3623 | .endpoint-head .path{
|
3624 | font-size: var(--font-size-regular);
|
3625 | }
|
3626 | .endpoint-head .descr{
|
3627 | display: flex;
|
3628 | }
|
3629 | .endpoint-head .m-markdown-small,
|
3630 | .descr .m-markdown-small{
|
3631 | display:block;
|
3632 | }
|
3633 | .req-resp-container{
|
3634 | flex-direction: var(--layout, row);
|
3635 | flex-wrap: nowrap;
|
3636 | }
|
3637 | api-response.view-mode {
|
3638 | padding:16px;
|
3639 | }
|
3640 | .view-mode-request.row-layout {
|
3641 | border-width:0 1px 0 0;
|
3642 | padding:16px;
|
3643 | }
|
3644 | .summary{
|
3645 | padding:8px 16px;
|
3646 | }
|
3647 | }
|
3648 | `);
|
3649 | ;
|
3650 |
|
3651 | const prism_styles = (i`
|
3652 | code[class*="language-"],
|
3653 | pre[class*="language-"] {
|
3654 | text-align: left;
|
3655 | white-space: pre;
|
3656 | word-spacing: normal;
|
3657 | word-break: normal;
|
3658 | word-wrap: normal;
|
3659 | line-height: 1.5;
|
3660 | tab-size: 2;
|
3661 |
|
3662 | -webkit-hyphens: none;
|
3663 | -moz-hyphens: none;
|
3664 | -ms-hyphens: none;
|
3665 | hyphens: none;
|
3666 | }
|
3667 |
|
3668 | /* Code blocks */
|
3669 | pre[class*="language-"] {
|
3670 | padding: 1em;
|
3671 | margin: .5em 0;
|
3672 | overflow: auto;
|
3673 | }
|
3674 |
|
3675 | /* Inline code */
|
3676 | :not(pre) > code[class*="language-"] {
|
3677 | white-space: normal;
|
3678 | }
|
3679 |
|
3680 | .token.comment,
|
3681 | .token.block-comment,
|
3682 | .token.prolog,
|
3683 | .token.doctype,
|
3684 | .token.cdata {
|
3685 | color: var(--light-fg)
|
3686 | }
|
3687 |
|
3688 | .token.punctuation {
|
3689 | color: var(--fg);
|
3690 | }
|
3691 |
|
3692 | .token.tag,
|
3693 | .token.attr-name,
|
3694 | .token.namespace,
|
3695 | .token.deleted {
|
3696 | color:var(--pink);
|
3697 | }
|
3698 |
|
3699 | .token.function-name {
|
3700 | color: var(--blue);
|
3701 | }
|
3702 |
|
3703 | .token.boolean,
|
3704 | .token.number,
|
3705 | .token.function {
|
3706 | color: var(--red);
|
3707 | }
|
3708 |
|
3709 | .token.property,
|
3710 | .token.class-name,
|
3711 | .token.constant,
|
3712 | .token.symbol {
|
3713 | color: var(--code-property-color);
|
3714 | }
|
3715 |
|
3716 | .token.selector,
|
3717 | .token.important,
|
3718 | .token.atrule,
|
3719 | .token.keyword,
|
3720 | .token.builtin {
|
3721 | color: var(--code-keyword-color);
|
3722 | }
|
3723 |
|
3724 | .token.string,
|
3725 | .token.char,
|
3726 | .token.attr-value,
|
3727 | .token.regex,
|
3728 | .token.variable {
|
3729 | color: var(--green);
|
3730 | }
|
3731 |
|
3732 | .token.operator,
|
3733 | .token.entity,
|
3734 | .token.url {
|
3735 | color: var(--code-operator-color);
|
3736 | }
|
3737 |
|
3738 | .token.important,
|
3739 | .token.bold {
|
3740 | font-weight: bold;
|
3741 | }
|
3742 | .token.italic {
|
3743 | font-style: italic;
|
3744 | }
|
3745 |
|
3746 | .token.entity {
|
3747 | cursor: help;
|
3748 | }
|
3749 |
|
3750 | .token.inserted {
|
3751 | color: green;
|
3752 | }
|
3753 | `);
|
3754 | ;
|
3755 |
|
3756 | const tab_styles = (i`
|
3757 | .tab-panel {
|
3758 | border: none;
|
3759 | }
|
3760 | .tab-buttons {
|
3761 | height:30px;
|
3762 | padding: 4px 4px 0 4px;
|
3763 | border-bottom: 1px solid var(--light-border-color) ;
|
3764 | align-items: stretch;
|
3765 | overflow-y: hidden;
|
3766 | overflow-x: auto;
|
3767 | scrollbar-width: thin;
|
3768 | }
|
3769 | .tab-buttons::-webkit-scrollbar {
|
3770 | height: 1px;
|
3771 | background-color: var(--border-color);
|
3772 | }
|
3773 | .tab-btn {
|
3774 | border: none;
|
3775 | border-bottom: 3px solid transparent;
|
3776 | color: var(--light-fg);
|
3777 | background-color: transparent;
|
3778 | white-space: nowrap;
|
3779 | cursor:pointer;
|
3780 | outline:none;
|
3781 | font-family:var(--font-regular);
|
3782 | font-size:var(--font-size-small);
|
3783 | margin-right:16px;
|
3784 | padding:1px;
|
3785 | }
|
3786 | .tab-btn.active {
|
3787 | border-bottom: 3px solid var(--primary-color);
|
3788 | font-weight:bold;
|
3789 | color:var(--primary-color);
|
3790 | }
|
3791 |
|
3792 | .tab-btn:hover {
|
3793 | color:var(--primary-color);
|
3794 | }
|
3795 | .tab-content {
|
3796 | margin:-1px 0 0 0;
|
3797 | position:relative;
|
3798 | min-height: 50px;
|
3799 | }
|
3800 | `);
|
3801 | ;
|
3802 |
|
3803 | const nav_styles = (i`
|
3804 | .nav-bar-info:focus-visible,
|
3805 | .nav-bar-tag:focus-visible,
|
3806 | .nav-bar-path:focus-visible {
|
3807 | outline: 1px solid;
|
3808 | box-shadow: none;
|
3809 | outline-offset: -4px;
|
3810 | }
|
3811 | .nav-bar-expand-all:focus-visible,
|
3812 | .nav-bar-collapse-all:focus-visible,
|
3813 | .nav-bar-tag-icon:focus-visible {
|
3814 | outline: 1px solid;
|
3815 | box-shadow: none;
|
3816 | outline-offset: 2px;
|
3817 | }
|
3818 | .nav-bar {
|
3819 | width:0;
|
3820 | height:100%;
|
3821 | overflow: hidden;
|
3822 | color:var(--nav-text-color);
|
3823 | background-color: var(--nav-bg-color);
|
3824 | background-blend-mode: multiply;
|
3825 | line-height: calc(var(--font-size-small) + 4px);
|
3826 | display:none;
|
3827 | position:relative;
|
3828 | flex-direction:column;
|
3829 | flex-wrap:nowrap;
|
3830 | word-break:break-word;
|
3831 | }
|
3832 | ::slotted([slot=nav-logo]){
|
3833 | padding:16px 16px 0 16px;
|
3834 | }
|
3835 | .nav-scroll {
|
3836 | overflow-x: hidden;
|
3837 | overflow-y: auto;
|
3838 | overflow-y: overlay;
|
3839 | scrollbar-width: thin;
|
3840 | scrollbar-color: var(--nav-hover-bg-color) transparent;
|
3841 | }
|
3842 |
|
3843 | .nav-bar-tag {
|
3844 | display: flex;
|
3845 | align-items: center;
|
3846 | justify-content: space-between;
|
3847 | flex-direction: row;
|
3848 | }
|
3849 | .nav-bar.read .nav-bar-tag-icon {
|
3850 | display:none;
|
3851 | }
|
3852 | .nav-bar-paths-under-tag {
|
3853 | overflow:hidden;
|
3854 | transition: max-height .2s ease-out, visibility .3s;
|
3855 | }
|
3856 | .collapsed .nav-bar-paths-under-tag {
|
3857 | visibility: hidden;
|
3858 | }
|
3859 |
|
3860 | .nav-bar-expand-all {
|
3861 | transform: rotate(90deg);
|
3862 | cursor:pointer;
|
3863 | margin-right:10px;
|
3864 | }
|
3865 | .nav-bar-collapse-all {
|
3866 | transform: rotate(270deg);
|
3867 | cursor:pointer;
|
3868 | }
|
3869 | .nav-bar-expand-all:hover, .nav-bar-collapse-all:hover {
|
3870 | color: var(--primary-color);
|
3871 | }
|
3872 |
|
3873 | .nav-bar-tag-icon {
|
3874 | color: var(--nav-text-color);
|
3875 | font-size: 20px;
|
3876 | }
|
3877 | .nav-bar-tag-icon:hover {
|
3878 | color:var(--nav-hover-text-color);
|
3879 | }
|
3880 | .nav-bar.focused .nav-bar-tag-and-paths.collapsed .nav-bar-tag-icon::after {
|
3881 | content: '⌵';
|
3882 | width:16px;
|
3883 | height:16px;
|
3884 | text-align: center;
|
3885 | display: inline-block;
|
3886 | transform: rotate(-90deg);
|
3887 | transition: transform 0.2s ease-out 0s;
|
3888 | }
|
3889 | .nav-bar.focused .nav-bar-tag-and-paths.expanded .nav-bar-tag-icon::after {
|
3890 | content: '⌵';
|
3891 | width:16px;
|
3892 | height:16px;
|
3893 | text-align: center;
|
3894 | display: inline-block;
|
3895 | transition: transform 0.2s ease-out 0s;
|
3896 | }
|
3897 | .nav-scroll::-webkit-scrollbar {
|
3898 | width: var(--scroll-bar-width, 8px);
|
3899 | }
|
3900 | .nav-scroll::-webkit-scrollbar-track {
|
3901 | background:transparent;
|
3902 | }
|
3903 | .nav-scroll::-webkit-scrollbar-thumb {
|
3904 | background-color: var(--nav-hover-bg-color);
|
3905 | }
|
3906 |
|
3907 | .nav-bar-tag {
|
3908 | font-size: var(--font-size-regular);
|
3909 | color: var(--nav-accent-color);
|
3910 | border-left:4px solid transparent;
|
3911 | font-weight:bold;
|
3912 | padding: 15px 15px 15px 10px;
|
3913 | text-transform: capitalize;
|
3914 | }
|
3915 |
|
3916 | .nav-bar-components,
|
3917 | .nav-bar-h1,
|
3918 | .nav-bar-h2,
|
3919 | .nav-bar-info,
|
3920 | .nav-bar-tag,
|
3921 | .nav-bar-path {
|
3922 | display:flex;
|
3923 | cursor: pointer;
|
3924 | width: 100%;
|
3925 | border: none;
|
3926 | border-radius:4px;
|
3927 | color: var(--nav-text-color);
|
3928 | background: transparent;
|
3929 | border-left:4px solid transparent;
|
3930 | }
|
3931 |
|
3932 | .nav-bar-h1,
|
3933 | .nav-bar-h2,
|
3934 | .nav-bar-path {
|
3935 | font-size: calc(var(--font-size-small) + 1px);
|
3936 | padding: var(--nav-item-padding);
|
3937 | }
|
3938 | .nav-bar-path.small-font {
|
3939 | font-size: var(--font-size-small);
|
3940 | }
|
3941 |
|
3942 | .nav-bar-info {
|
3943 | font-size: var(--font-size-regular);
|
3944 | padding: 16px 10px;
|
3945 | font-weight:bold;
|
3946 | }
|
3947 | .nav-bar-section {
|
3948 | display: flex;
|
3949 | flex-direction: row;
|
3950 | justify-content: space-between;
|
3951 | font-size: var(--font-size-small);
|
3952 | color: var(--nav-text-color);
|
3953 | padding: var(--nav-item-padding);
|
3954 | font-weight:bold;
|
3955 | }
|
3956 | .nav-bar-section.operations {
|
3957 | cursor:pointer;
|
3958 | }
|
3959 | .nav-bar-section.operations:hover {
|
3960 | color:var(--nav-hover-text-color);
|
3961 | background-color:var(--nav-hover-bg-color);
|
3962 | }
|
3963 |
|
3964 | .nav-bar-section:first-child {
|
3965 | display: none;
|
3966 | }
|
3967 | .nav-bar-h2 {margin-left:12px;}
|
3968 |
|
3969 | .nav-bar-h1.left-bar.active,
|
3970 | .nav-bar-h2.left-bar.active,
|
3971 | .nav-bar-info.left-bar.active,
|
3972 | .nav-bar-tag.left-bar.active,
|
3973 | .nav-bar-path.left-bar.active,
|
3974 | .nav-bar-section.left-bar.operations.active {
|
3975 | border-left:4px solid var(--nav-accent-color);
|
3976 | color:var(--nav-hover-text-color);
|
3977 | }
|
3978 |
|
3979 | .nav-bar-h1.colored-block.active,
|
3980 | .nav-bar-h2.colored-block.active,
|
3981 | .nav-bar-info.colored-block.active,
|
3982 | .nav-bar-tag.colored-block.active,
|
3983 | .nav-bar-path.colored-block.active,
|
3984 | .nav-bar-section.colored-block.operations.active {
|
3985 | background-color: var(--nav-accent-color);
|
3986 | color: var(--nav-accent-text-color);
|
3987 | border-radius: 0;
|
3988 | }
|
3989 |
|
3990 | .nav-bar-h1:hover,
|
3991 | .nav-bar-h2:hover,
|
3992 | .nav-bar-info:hover,
|
3993 | .nav-bar-tag:hover,
|
3994 | .nav-bar-path:hover {
|
3995 | color:var(--nav-hover-text-color);
|
3996 | background-color:var(--nav-hover-bg-color);
|
3997 | }
|
3998 | `);
|
3999 | ;
|
4000 |
|
4001 | const info_styles = (i`
|
4002 | #api-info {
|
4003 | font-size: calc(var(--font-size-regular) - 1px);
|
4004 | margin-top: 8px;
|
4005 | margin-left: -15px;
|
4006 | }
|
4007 |
|
4008 | #api-info span:before {
|
4009 | content: "|";
|
4010 | display: inline-block;
|
4011 | opacity: 0.5;
|
4012 | width: 15px;
|
4013 | text-align: center;
|
4014 | }
|
4015 | #api-info span:first-child:before {
|
4016 | content: "";
|
4017 | width: 0px;
|
4018 | }
|
4019 | `);
|
4020 | ;
|
4021 |
|
4022 |
|
4023 |
|
4024 |
|
4025 |
|
4026 |
|
4027 |
|
4028 | const custom_styles = (i`
|
4029 |
|
4030 | `);
|
4031 | ;
|
4032 |
|
4033 | function debounce(fn, delay) {
|
4034 | let timeoutID = null;
|
4035 | return (...args) => {
|
4036 | clearTimeout(timeoutID);
|
4037 | const that = this;
|
4038 | timeoutID = setTimeout(() => {
|
4039 | fn.apply(that, args);
|
4040 | }, delay);
|
4041 | };
|
4042 | }
|
4043 | const invalidCharsRegEx = /[\s#:?&={}]/g;
|
4044 | const rapidocApiKey = '_rapidoc_api_key';
|
4045 | function sleep(ms) {
|
4046 |
|
4047 | return new Promise(resolve => setTimeout(resolve, ms));
|
4048 | }
|
4049 | function copyToClipboard(data, e) {
|
4050 | const btnEl = e.target;
|
4051 | const textArea = document.createElement('textarea');
|
4052 | textArea.value = data;
|
4053 | textArea.style.position = 'fixed';
|
4054 | document.body.appendChild(textArea);
|
4055 | textArea.focus();
|
4056 | textArea.select();
|
4057 | try {
|
4058 | document.execCommand('copy');
|
4059 | btnEl.innerText = 'Copied';
|
4060 | setTimeout(() => {
|
4061 | btnEl.innerText = 'Copy';
|
4062 | }, 5000);
|
4063 | } catch (err) {
|
4064 | console.error('Unable to copy', err);
|
4065 | }
|
4066 |
|
4067 | document.body.removeChild(textArea);
|
4068 | }
|
4069 | function getBaseUrlFromUrl(url) {
|
4070 | const pathArray = url.split('/');
|
4071 | return `${pathArray[0]}//${pathArray[2]}`;
|
4072 | }
|
4073 | async function wait(ms) {
|
4074 | return new Promise(resolve => {
|
4075 | setTimeout(resolve, ms);
|
4076 | });
|
4077 | }
|
4078 | function componentIsInSearch(searchVal, component) {
|
4079 | return component.name.toLowerCase().includes(searchVal.toLowerCase());
|
4080 | }
|
4081 | function pathIsInSearch(searchVal, path, matchType = 'includes') {
|
4082 | if (matchType === 'includes') {
|
4083 | const stringToSearch = `${path.method} ${path.path} ${path.summary || path.description || ''} ${path.operationId || ''}`.toLowerCase();
|
4084 | return stringToSearch.includes(searchVal.toLowerCase());
|
4085 | }
|
4086 | const regex = new RegExp(searchVal, 'i');
|
4087 | return regex.test(`${path.method} ${path.path}`);
|
4088 | }
|
4089 | function schemaKeys(schemaProps, result = new Set()) {
|
4090 | if (!schemaProps) {
|
4091 | return result;
|
4092 | }
|
4093 | Object.keys(schemaProps).forEach(key => {
|
4094 | var _schemaProps$key$item;
|
4095 | result.add(key);
|
4096 | if (schemaProps[key].properties) {
|
4097 | schemaKeys(schemaProps[key].properties, result);
|
4098 | } else if ((_schemaProps$key$item = schemaProps[key].items) !== null && _schemaProps$key$item !== void 0 && _schemaProps$key$item.properties) {
|
4099 | var _schemaProps$key$item2;
|
4100 | schemaKeys((_schemaProps$key$item2 = schemaProps[key].items) === null || _schemaProps$key$item2 === void 0 ? void 0 : _schemaProps$key$item2.properties, result);
|
4101 | }
|
4102 | });
|
4103 | return result;
|
4104 | }
|
4105 | function advancedSearch(searchVal, allSpecTags, searchOptions = []) {
|
4106 | if (!searchVal.trim() || searchOptions.length === 0) {
|
4107 | return;
|
4108 | }
|
4109 | const pathsMatched = [];
|
4110 | allSpecTags.forEach(tag => {
|
4111 | tag.paths.forEach(path => {
|
4112 | let stringToSearch = '';
|
4113 | if (searchOptions.includes('search-api-path')) {
|
4114 | stringToSearch = path.path;
|
4115 | }
|
4116 | if (searchOptions.includes('search-api-descr')) {
|
4117 | stringToSearch = `${stringToSearch} ${path.summary || path.description || ''}`;
|
4118 | }
|
4119 | if (searchOptions.includes('search-api-params')) {
|
4120 | var _path$parameters;
|
4121 | stringToSearch = `${stringToSearch} ${((_path$parameters = path.parameters) === null || _path$parameters === void 0 ? void 0 : _path$parameters.map(v => v.name).join(' ')) || ''}`;
|
4122 | }
|
4123 | if (searchOptions.includes('search-api-request-body') && path.requestBody) {
|
4124 | let schemaKeySet = new Set();
|
4125 | for (const contentType in (_path$requestBody = path.requestBody) === null || _path$requestBody === void 0 ? void 0 : _path$requestBody.content) {
|
4126 | var _path$requestBody, _path$requestBody$con;
|
4127 | if ((_path$requestBody$con = path.requestBody.content[contentType].schema) !== null && _path$requestBody$con !== void 0 && _path$requestBody$con.properties) {
|
4128 | var _path$requestBody$con2;
|
4129 | schemaKeySet = schemaKeys((_path$requestBody$con2 = path.requestBody.content[contentType].schema) === null || _path$requestBody$con2 === void 0 ? void 0 : _path$requestBody$con2.properties);
|
4130 | }
|
4131 | stringToSearch = `${stringToSearch} ${[...schemaKeySet].join(' ')}`;
|
4132 | }
|
4133 | }
|
4134 | if (searchOptions.includes('search-api-resp-descr')) {
|
4135 | stringToSearch = `${stringToSearch} ${Object.values(path.responses).map(v => v.description || '').join(' ')}`;
|
4136 | }
|
4137 | if (stringToSearch.toLowerCase().includes(searchVal.trim().toLowerCase())) {
|
4138 | pathsMatched.push({
|
4139 | elementId: path.elementId,
|
4140 | method: path.method,
|
4141 | path: path.path,
|
4142 | summary: path.summary || path.description || '',
|
4143 | deprecated: path.deprecated
|
4144 | });
|
4145 | }
|
4146 | });
|
4147 | });
|
4148 | return pathsMatched;
|
4149 | }
|
4150 |
|
4151 |
|
4152 |
|
4153 |
|
4154 |
|
4155 |
|
4156 |
|
4157 |
|
4158 |
|
4159 |
|
4160 |
|
4161 |
|
4162 |
|
4163 |
|
4164 |
|
4165 |
|
4166 |
|
4167 |
|
4168 |
|
4169 |
|
4170 |
|
4171 |
|
4172 |
|
4173 |
|
4174 | function downloadResource(url, fileName) {
|
4175 | if (url) {
|
4176 | const a = document.createElement('a');
|
4177 | document.body.appendChild(a);
|
4178 | a.style = 'display: none';
|
4179 | a.href = url;
|
4180 | a.download = fileName;
|
4181 | a.click();
|
4182 | a.remove();
|
4183 | }
|
4184 | }
|
4185 | function viewResource(url) {
|
4186 | if (url) {
|
4187 | const a = document.createElement('a');
|
4188 | document.body.appendChild(a);
|
4189 | a.style = 'display: none';
|
4190 | a.href = url;
|
4191 | a.target = '_blank';
|
4192 | a.click();
|
4193 | a.remove();
|
4194 | }
|
4195 | }
|
4196 | ;
|
4197 | function openapi_parser_t(t9) {
|
4198 | return t9 && t9.t && Object.prototype.hasOwnProperty.call(t9, "default") ? t9.default : t9;
|
4199 | }
|
4200 | function openapi_parser_r(t9) {
|
4201 | var r2 = t9.default;
|
4202 | if ("function" == typeof r2) {
|
4203 | var e2 = function() {
|
4204 | return r2.apply(this, arguments);
|
4205 | };
|
4206 | e2.prototype = r2.prototype;
|
4207 | } else
|
4208 | e2 = {};
|
4209 | return Object.defineProperty(e2, "t", { value: true }), Object.keys(t9).forEach(function(r3) {
|
4210 | var n2 = Object.getOwnPropertyDescriptor(t9, r3);
|
4211 | Object.defineProperty(e2, r3, n2.get ? n2 : { enumerable: true, get: function() {
|
4212 | return t9[r3];
|
4213 | } });
|
4214 | }), e2;
|
4215 | }
|
4216 | var openapi_parser_e = { exports: {} }, openapi_parser_n = function(t9) {
|
4217 | return t9 && t9.Math == Math && t9;
|
4218 | }, openapi_parser_o = openapi_parser_n("object" == typeof globalThis && globalThis) || openapi_parser_n("object" == typeof window && window) || openapi_parser_n("object" == typeof self && self) || openapi_parser_n("object" == typeof openapi_parser_o && openapi_parser_o) || function() {
|
4219 | return this;
|
4220 | }() || Function("return this")(), openapi_parser_i = function(t9) {
|
4221 | try {
|
4222 | return !!t9();
|
4223 | } catch (t10) {
|
4224 | return true;
|
4225 | }
|
4226 | }, openapi_parser_u = !openapi_parser_i(function() {
|
4227 | var t9 = function() {
|
4228 | }.bind();
|
4229 | return "function" != typeof t9 || t9.hasOwnProperty("prototype");
|
4230 | }), openapi_parser_a = openapi_parser_u, openapi_parser_f = Function.prototype, openapi_parser_c = openapi_parser_f.apply, openapi_parser_s = openapi_parser_f.call, openapi_parser_l = "object" == typeof Reflect && Reflect.apply || (openapi_parser_a ? openapi_parser_s.bind(openapi_parser_c) : function() {
|
4231 | return openapi_parser_s.apply(openapi_parser_c, arguments);
|
4232 | }), openapi_parser_p = openapi_parser_u, openapi_parser_v = Function.prototype, openapi_parser_h = openapi_parser_v.bind, openapi_parser_d = openapi_parser_v.call, openapi_parser_y = openapi_parser_p && openapi_parser_h.bind(openapi_parser_d, openapi_parser_d), openapi_parser_b = openapi_parser_p ? function(t9) {
|
4233 | return t9 && openapi_parser_y(t9);
|
4234 | } : function(t9) {
|
4235 | return t9 && function() {
|
4236 | return openapi_parser_d.apply(t9, arguments);
|
4237 | };
|
4238 | }, openapi_parser_m = function(t9) {
|
4239 | return "function" == typeof t9;
|
4240 | }, openapi_parser_g = {}, openapi_parser_w = !openapi_parser_i(function() {
|
4241 | return 7 != Object.defineProperty({}, 1, { get: function() {
|
4242 | return 7;
|
4243 | } })[1];
|
4244 | }), j = openapi_parser_u, O = Function.prototype.call, openapi_parser_A = j ? O.bind(O) : function() {
|
4245 | return O.apply(O, arguments);
|
4246 | }, openapi_parser_S = {}, openapi_parser_x = {}.propertyIsEnumerable, openapi_parser_E = Object.getOwnPropertyDescriptor, openapi_parser_P = openapi_parser_E && !openapi_parser_x.call({ 1: 2 }, 1);
|
4247 | openapi_parser_S.f = openapi_parser_P ? function(t9) {
|
4248 | var r2 = openapi_parser_E(this, t9);
|
4249 | return !!r2 && r2.enumerable;
|
4250 | } : openapi_parser_x;
|
4251 | var openapi_parser_k, openapi_parser_, openapi_parser_I = function(t9, r2) {
|
4252 | return { enumerable: !(1 & t9), configurable: !(2 & t9), writable: !(4 & t9), value: r2 };
|
4253 | }, openapi_parser_T = openapi_parser_b, openapi_parser_R = openapi_parser_T({}.toString), F = openapi_parser_T("".slice), openapi_parser_N = function(t9) {
|
4254 | return F(openapi_parser_R(t9), 8, -1);
|
4255 | }, openapi_parser_M = openapi_parser_b, D = openapi_parser_i, U = openapi_parser_N, openapi_parser_L = openapi_parser_o.Object, openapi_parser_C = openapi_parser_M("".split), openapi_parser_$ = D(function() {
|
4256 | return !openapi_parser_L("z").propertyIsEnumerable(0);
|
4257 | }) ? function(t9) {
|
4258 | return "String" == U(t9) ? openapi_parser_C(t9, "") : openapi_parser_L(t9);
|
4259 | } : openapi_parser_L, B = openapi_parser_o.TypeError, q = function(t9) {
|
4260 | if (null == t9)
|
4261 | throw B("Can't call method on " + t9);
|
4262 | return t9;
|
4263 | }, G = openapi_parser_$, W = q, openapi_parser_z = function(t9) {
|
4264 | return G(W(t9));
|
4265 | }, J = openapi_parser_m, openapi_parser_H = function(t9) {
|
4266 | return "object" == typeof t9 ? null !== t9 : J(t9);
|
4267 | }, openapi_parser_V = {}, Y = openapi_parser_V, Q = openapi_parser_o, K = openapi_parser_m, X = function(t9) {
|
4268 | return K(t9) ? t9 : void 0;
|
4269 | }, openapi_parser_Z = function(t9, r2) {
|
4270 | return arguments.length < 2 ? X(Y[t9]) || X(Q[t9]) : Y[t9] && Y[t9][r2] || Q[t9] && Q[t9][r2];
|
4271 | }, tt = openapi_parser_b({}.isPrototypeOf), rt = openapi_parser_Z("navigator", "userAgent") || "", et = openapi_parser_o, nt = rt, ot = et.process, it = et.Deno, ut = ot && ot.versions || it && it.version, at = ut && ut.v8;
|
4272 | at && (openapi_parser_ = (openapi_parser_k = at.split("."))[0] > 0 && openapi_parser_k[0] < 4 ? 1 : +(openapi_parser_k[0] + openapi_parser_k[1])), !openapi_parser_ && nt && (!(openapi_parser_k = nt.match(/Edge\/(\d+)/)) || openapi_parser_k[1] >= 74) && (openapi_parser_k = nt.match(/Chrome\/(\d+)/)) && (openapi_parser_ = +openapi_parser_k[1]);
|
4273 | var ft = openapi_parser_, ct = ft, st = openapi_parser_i, lt = !!Object.getOwnPropertySymbols && !st(function() {
|
4274 | var t9 = Symbol();
|
4275 | return !String(t9) || !(Object(t9) instanceof Symbol) || !Symbol.sham && ct && ct < 41;
|
4276 | }), pt = lt && !Symbol.sham && "symbol" == typeof Symbol.iterator, vt = openapi_parser_Z, ht = openapi_parser_m, dt = tt, yt = pt, bt = openapi_parser_o.Object, mt = yt ? function(t9) {
|
4277 | return "symbol" == typeof t9;
|
4278 | } : function(t9) {
|
4279 | var r2 = vt("Symbol");
|
4280 | return ht(r2) && dt(r2.prototype, bt(t9));
|
4281 | }, gt = openapi_parser_o.String, wt = function(t9) {
|
4282 | try {
|
4283 | return gt(t9);
|
4284 | } catch (t10) {
|
4285 | return "Object";
|
4286 | }
|
4287 | }, jt = openapi_parser_m, Ot = wt, At = openapi_parser_o.TypeError, St = function(t9) {
|
4288 | if (jt(t9))
|
4289 | return t9;
|
4290 | throw At(Ot(t9) + " is not a function");
|
4291 | }, xt = St, Et = function(t9, r2) {
|
4292 | var e2 = t9[r2];
|
4293 | return null == e2 ? void 0 : xt(e2);
|
4294 | }, Pt = openapi_parser_A, kt = openapi_parser_m, _t = openapi_parser_H, It = openapi_parser_o.TypeError, Tt = { exports: {} }, Rt = openapi_parser_o, Ft = Object.defineProperty, Nt = function(t9, r2) {
|
4295 | try {
|
4296 | Ft(Rt, t9, { value: r2, configurable: true, writable: true });
|
4297 | } catch (e2) {
|
4298 | Rt[t9] = r2;
|
4299 | }
|
4300 | return r2;
|
4301 | }, Mt = openapi_parser_o["i"] || Nt("__core-js_shared__", {}), Dt = Mt;
|
4302 | (Tt.exports = function(t9, r2) {
|
4303 | return Dt[t9] || (Dt[t9] = void 0 !== r2 ? r2 : {});
|
4304 | })("versions", []).push({ version: "3.21.1", mode: "pure", copyright: "\xA9 2014-2022 Denis Pushkarev (zloirock.ru)", license: "https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE", source: "https://github.com/zloirock/core-js" });
|
4305 | var Ut = q, Lt = openapi_parser_o.Object, Ct = function(t9) {
|
4306 | return Lt(Ut(t9));
|
4307 | }, $t = Ct, Bt = openapi_parser_b({}.hasOwnProperty), qt = Object.hasOwn || function(t9, r2) {
|
4308 | return Bt($t(t9), r2);
|
4309 | }, Gt = openapi_parser_b, Wt = 0, zt = Math.random(), Jt = Gt(1 .toString), Ht = function(t9) {
|
4310 | return "Symbol(" + (void 0 === t9 ? "" : t9) + ")_" + Jt(++Wt + zt, 36);
|
4311 | }, Vt = openapi_parser_o, Yt = Tt.exports, Qt = qt, Kt = Ht, Xt = lt, Zt = pt, tr = Yt("wks"), rr = Vt.Symbol, er = rr && rr.for, nr = Zt ? rr : rr && rr.withoutSetter || Kt, or = function(t9) {
|
4312 | if (!Qt(tr, t9) || !Xt && "string" != typeof tr[t9]) {
|
4313 | var r2 = "Symbol." + t9;
|
4314 | Xt && Qt(rr, t9) ? tr[t9] = rr[t9] : tr[t9] = Zt && er ? er(r2) : nr(r2);
|
4315 | }
|
4316 | return tr[t9];
|
4317 | }, ir = openapi_parser_A, ur = openapi_parser_H, ar = mt, fr = Et, cr = function(t9, r2) {
|
4318 | var e2, n2;
|
4319 | if ("string" === r2 && kt(e2 = t9.toString) && !_t(n2 = Pt(e2, t9)))
|
4320 | return n2;
|
4321 | if (kt(e2 = t9.valueOf) && !_t(n2 = Pt(e2, t9)))
|
4322 | return n2;
|
4323 | if ("string" !== r2 && kt(e2 = t9.toString) && !_t(n2 = Pt(e2, t9)))
|
4324 | return n2;
|
4325 | throw It("Can't convert object to primitive value");
|
4326 | }, sr = or, lr = openapi_parser_o.TypeError, pr = sr("toPrimitive"), vr = function(t9, r2) {
|
4327 | if (!ur(t9) || ar(t9))
|
4328 | return t9;
|
4329 | var e2, n2 = fr(t9, pr);
|
4330 | if (n2) {
|
4331 | if (void 0 === r2 && (r2 = "default"), e2 = ir(n2, t9, r2), !ur(e2) || ar(e2))
|
4332 | return e2;
|
4333 | throw lr("Can't convert object to primitive value");
|
4334 | }
|
4335 | return void 0 === r2 && (r2 = "number"), cr(t9, r2);
|
4336 | }, hr = mt, dr = function(t9) {
|
4337 | var r2 = vr(t9, "string");
|
4338 | return hr(r2) ? r2 : r2 + "";
|
4339 | }, yr = openapi_parser_H, br = openapi_parser_o.document, mr = yr(br) && yr(br.createElement), gr = function(t9) {
|
4340 | return mr ? br.createElement(t9) : {};
|
4341 | }, wr = gr, jr = !openapi_parser_w && !openapi_parser_i(function() {
|
4342 | return 7 != Object.defineProperty(wr("div"), "a", { get: function() {
|
4343 | return 7;
|
4344 | } }).a;
|
4345 | }), Or = openapi_parser_w, Ar = openapi_parser_A, Sr = openapi_parser_S, xr = openapi_parser_I, Er = openapi_parser_z, Pr = dr, kr = qt, _r = jr, Ir = Object.getOwnPropertyDescriptor;
|
4346 | openapi_parser_g.f = Or ? Ir : function(t9, r2) {
|
4347 | if (t9 = Er(t9), r2 = Pr(r2), _r)
|
4348 | try {
|
4349 | return Ir(t9, r2);
|
4350 | } catch (t10) {
|
4351 | }
|
4352 | if (kr(t9, r2))
|
4353 | return xr(!Ar(Sr.f, t9, r2), t9[r2]);
|
4354 | };
|
4355 | var Tr = openapi_parser_i, Rr = openapi_parser_m, Fr = /#|\.prototype\./, Nr = function(t9, r2) {
|
4356 | var e2 = Dr[Mr(t9)];
|
4357 | return e2 == Lr || e2 != Ur && (Rr(r2) ? Tr(r2) : !!r2);
|
4358 | }, Mr = Nr.normalize = function(t9) {
|
4359 | return String(t9).replace(Fr, ".").toLowerCase();
|
4360 | }, Dr = Nr.data = {}, Ur = Nr.NATIVE = "N", Lr = Nr.POLYFILL = "P", Cr = Nr, $r = St, Br = openapi_parser_u, qr = openapi_parser_b(openapi_parser_b.bind), Gr = function(t9, r2) {
|
4361 | return $r(t9), void 0 === r2 ? t9 : Br ? qr(t9, r2) : function() {
|
4362 | return t9.apply(r2, arguments);
|
4363 | };
|
4364 | }, Wr = {}, zr = openapi_parser_w && openapi_parser_i(function() {
|
4365 | return 42 != Object.defineProperty(function() {
|
4366 | }, "prototype", { value: 42, writable: false }).prototype;
|
4367 | }), Jr = openapi_parser_o, Hr = openapi_parser_H, Vr = Jr.String, Yr = Jr.TypeError, Qr = function(t9) {
|
4368 | if (Hr(t9))
|
4369 | return t9;
|
4370 | throw Yr(Vr(t9) + " is not an object");
|
4371 | }, Kr = openapi_parser_w, Xr = jr, Zr = zr, te = Qr, re = dr, ee = openapi_parser_o.TypeError, ne = Object.defineProperty, oe = Object.getOwnPropertyDescriptor;
|
4372 | Wr.f = Kr ? Zr ? function(t9, r2, e2) {
|
4373 | if (te(t9), r2 = re(r2), te(e2), "function" == typeof t9 && "prototype" === r2 && "value" in e2 && "writable" in e2 && !e2.writable) {
|
4374 | var n2 = oe(t9, r2);
|
4375 | n2 && n2.writable && (t9[r2] = e2.value, e2 = { configurable: "configurable" in e2 ? e2.configurable : n2.configurable, enumerable: "enumerable" in e2 ? e2.enumerable : n2.enumerable, writable: false });
|
4376 | }
|
4377 | return ne(t9, r2, e2);
|
4378 | } : ne : function(t9, r2, e2) {
|
4379 | if (te(t9), r2 = re(r2), te(e2), Xr)
|
4380 | try {
|
4381 | return ne(t9, r2, e2);
|
4382 | } catch (t10) {
|
4383 | }
|
4384 | if ("get" in e2 || "set" in e2)
|
4385 | throw ee("Accessors not supported");
|
4386 | return "value" in e2 && (t9[r2] = e2.value), t9;
|
4387 | };
|
4388 | var ie = Wr, ue = openapi_parser_I, ae = openapi_parser_w ? function(t9, r2, e2) {
|
4389 | return ie.f(t9, r2, ue(1, e2));
|
4390 | } : function(t9, r2, e2) {
|
4391 | return t9[r2] = e2, t9;
|
4392 | }, fe = openapi_parser_o, ce = openapi_parser_l, se = openapi_parser_b, le = openapi_parser_m, pe = openapi_parser_g.f, ve = Cr, he = openapi_parser_V, de = Gr, ye = ae, be = qt, me = function(t9) {
|
4393 | var r2 = function(e2, n2, o2) {
|
4394 | if (this instanceof r2) {
|
4395 | switch (arguments.length) {
|
4396 | case 0:
|
4397 | return new t9();
|
4398 | case 1:
|
4399 | return new t9(e2);
|
4400 | case 2:
|
4401 | return new t9(e2, n2);
|
4402 | }
|
4403 | return new t9(e2, n2, o2);
|
4404 | }
|
4405 | return ce(t9, this, arguments);
|
4406 | };
|
4407 | return r2.prototype = t9.prototype, r2;
|
4408 | }, ge = function(t9, r2) {
|
4409 | var e2, n2, o2, i2, u2, a2, f2, c2, s2 = t9.target, l2 = t9.global, p2 = t9.stat, v2 = t9.proto, h2 = l2 ? fe : p2 ? fe[s2] : (fe[s2] || {}).prototype, d2 = l2 ? he : he[s2] || ye(he, s2, {})[s2], y2 = d2.prototype;
|
4410 | for (o2 in r2)
|
4411 | e2 = !ve(l2 ? o2 : s2 + (p2 ? "." : "#") + o2, t9.forced) && h2 && be(h2, o2), u2 = d2[o2], e2 && (a2 = t9.noTargetGet ? (c2 = pe(h2, o2)) && c2.value : h2[o2]), i2 = e2 && a2 ? a2 : r2[o2], e2 && typeof u2 == typeof i2 || (f2 = t9.bind && e2 ? de(i2, fe) : t9.wrap && e2 ? me(i2) : v2 && le(i2) ? se(i2) : i2, (t9.sham || i2 && i2.sham || u2 && u2.sham) && ye(f2, "sham", true), ye(d2, o2, f2), v2 && (be(he, n2 = s2 + "Prototype") || ye(he, n2, {}), ye(he[n2], o2, i2), t9.real && y2 && !y2[o2] && ye(y2, o2, i2)));
|
4412 | }, we = Math.ceil, je = Math.floor, Oe = function(t9) {
|
4413 | var r2 = +t9;
|
4414 | return r2 != r2 || 0 === r2 ? 0 : (r2 > 0 ? je : we)(r2);
|
4415 | }, Ae = Oe, Se = Math.max, xe = Math.min, Ee = function(t9, r2) {
|
4416 | var e2 = Ae(t9);
|
4417 | return e2 < 0 ? Se(e2 + r2, 0) : xe(e2, r2);
|
4418 | }, Pe = Oe, ke = Math.min, _e = function(t9) {
|
4419 | return t9 > 0 ? ke(Pe(t9), 9007199254740991) : 0;
|
4420 | }, Ie = _e, Te = function(t9) {
|
4421 | return Ie(t9.length);
|
4422 | }, Re = openapi_parser_z, Fe = Ee, Ne = Te, Me = function(t9) {
|
4423 | return function(r2, e2, n2) {
|
4424 | var o2, i2 = Re(r2), u2 = Ne(i2), a2 = Fe(n2, u2);
|
4425 | if (t9 && e2 != e2) {
|
4426 | for (; u2 > a2; )
|
4427 | if ((o2 = i2[a2++]) != o2)
|
4428 | return true;
|
4429 | } else
|
4430 | for (; u2 > a2; a2++)
|
4431 | if ((t9 || a2 in i2) && i2[a2] === e2)
|
4432 | return t9 || a2 || 0;
|
4433 | return !t9 && -1;
|
4434 | };
|
4435 | }, De = { includes: Me(true), indexOf: Me(false) }, Ue = {}, Le = qt, Ce = openapi_parser_z, $e = De.indexOf, Be = Ue, qe = openapi_parser_b([].push), Ge = function(t9, r2) {
|
4436 | var e2, n2 = Ce(t9), o2 = 0, i2 = [];
|
4437 | for (e2 in n2)
|
4438 | !Le(Be, e2) && Le(n2, e2) && qe(i2, e2);
|
4439 | for (; r2.length > o2; )
|
4440 | Le(n2, e2 = r2[o2++]) && (~$e(i2, e2) || qe(i2, e2));
|
4441 | return i2;
|
4442 | }, We = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"], ze = Ge, Je = We, He = Object.keys || function(t9) {
|
4443 | return ze(t9, Je);
|
4444 | }, Ve = Ct, Ye = He;
|
4445 | ge({ target: "Object", stat: true, forced: openapi_parser_i(function() {
|
4446 | Ye(1);
|
4447 | }) }, { keys: function(t9) {
|
4448 | return Ye(Ve(t9));
|
4449 | } });
|
4450 | var Qe = openapi_parser_V.Object.keys;
|
4451 | const Ke = openapi_parser_t(openapi_parser_e.exports = Qe);
|
4452 | var Xe = { exports: {} }, Ze = openapi_parser_N, tn = Array.isArray || function(t9) {
|
4453 | return "Array" == Ze(t9);
|
4454 | }, rn = {};
|
4455 | rn[or("toStringTag")] = "z";
|
4456 | var en = "[object z]" === String(rn), nn = openapi_parser_o, on = en, un = openapi_parser_m, an = openapi_parser_N, fn = or("toStringTag"), cn = nn.Object, sn = "Arguments" == an(function() {
|
4457 | return arguments;
|
4458 | }()), ln = on ? an : function(t9) {
|
4459 | var r2, e2, n2;
|
4460 | return void 0 === t9 ? "Undefined" : null === t9 ? "Null" : "string" == typeof (e2 = function(t10, r3) {
|
4461 | try {
|
4462 | return t10[r3];
|
4463 | } catch (t11) {
|
4464 | }
|
4465 | }(r2 = cn(t9), fn)) ? e2 : sn ? an(r2) : "Object" == (n2 = an(r2)) && un(r2.callee) ? "Arguments" : n2;
|
4466 | }, pn = ln, vn = openapi_parser_o.String, hn = function(t9) {
|
4467 | if ("Symbol" === pn(t9))
|
4468 | throw TypeError("Cannot convert a Symbol value to a string");
|
4469 | return vn(t9);
|
4470 | }, dn = {}, yn = openapi_parser_w, bn = zr, mn = Wr, gn = Qr, wn = openapi_parser_z, jn = He;
|
4471 | dn.f = yn && !bn ? Object.defineProperties : function(t9, r2) {
|
4472 | gn(t9);
|
4473 | for (var e2, n2 = wn(r2), o2 = jn(r2), i2 = o2.length, u2 = 0; i2 > u2; )
|
4474 | mn.f(t9, e2 = o2[u2++], n2[e2]);
|
4475 | return t9;
|
4476 | };
|
4477 | var On, An = openapi_parser_Z("document", "documentElement"), Sn = Tt.exports, xn = Ht, En = Sn("keys"), Pn = function(t9) {
|
4478 | return En[t9] || (En[t9] = xn(t9));
|
4479 | }, kn = Qr, _n = dn, In = We, Tn = Ue, Rn = An, Fn = gr, Nn = Pn("IE_PROTO"), Mn = function() {
|
4480 | }, Dn = function(t9) {
|
4481 | return "<script>" + t9 + "<\/script>";
|
4482 | }, Un = function(t9) {
|
4483 | t9.write(Dn("")), t9.close();
|
4484 | var r2 = t9.parentWindow.Object;
|
4485 | return t9 = null, r2;
|
4486 | }, Ln = function() {
|
4487 | try {
|
4488 | On = new ActiveXObject("htmlfile");
|
4489 | } catch (t10) {
|
4490 | }
|
4491 | var t9, r2;
|
4492 | Ln = "undefined" != typeof document ? document.domain && On ? Un(On) : ((r2 = Fn("iframe")).style.display = "none", Rn.appendChild(r2), r2.src = String("javascript:"), (t9 = r2.contentWindow.document).open(), t9.write(Dn("document.F=Object")), t9.close(), t9.F) : Un(On);
|
4493 | for (var e2 = In.length; e2--; )
|
4494 | delete Ln.prototype[In[e2]];
|
4495 | return Ln();
|
4496 | };
|
4497 | Tn[Nn] = true;
|
4498 | var Cn = Object.create || function(t9, r2) {
|
4499 | var e2;
|
4500 | return null !== t9 ? (Mn.prototype = kn(t9), e2 = new Mn(), Mn.prototype = null, e2[Nn] = t9) : e2 = Ln(), void 0 === r2 ? e2 : _n.f(e2, r2);
|
4501 | }, $n = {}, Bn = Ge, qn = We.concat("length", "prototype");
|
4502 | $n.f = Object.getOwnPropertyNames || function(t9) {
|
4503 | return Bn(t9, qn);
|
4504 | };
|
4505 | var Gn = {}, Wn = dr, zn = Wr, Jn = openapi_parser_I, Hn = function(t9, r2, e2) {
|
4506 | var n2 = Wn(r2);
|
4507 | n2 in t9 ? zn.f(t9, n2, Jn(0, e2)) : t9[n2] = e2;
|
4508 | }, Vn = Ee, Yn = Te, Qn = Hn, Kn = openapi_parser_o.Array, Xn = Math.max, Zn = function(t9, r2, e2) {
|
4509 | for (var n2 = Yn(t9), o2 = Vn(r2, n2), i2 = Vn(void 0 === e2 ? n2 : e2, n2), u2 = Kn(Xn(i2 - o2, 0)), a2 = 0; o2 < i2; o2++, a2++)
|
4510 | Qn(u2, a2, t9[o2]);
|
4511 | return u2.length = a2, u2;
|
4512 | }, to = openapi_parser_N, ro = openapi_parser_z, eo = $n.f, no = Zn, oo = "object" == typeof window && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
|
4513 | Gn.f = function(t9) {
|
4514 | return oo && "Window" == to(t9) ? function(t10) {
|
4515 | try {
|
4516 | return eo(t10);
|
4517 | } catch (t11) {
|
4518 | return no(oo);
|
4519 | }
|
4520 | }(t9) : eo(ro(t9));
|
4521 | };
|
4522 | var io = {};
|
4523 | io.f = Object.getOwnPropertySymbols;
|
4524 | var uo = openapi_parser_b([].slice), ao = ae, fo = function(t9, r2, e2, n2) {
|
4525 | n2 && n2.enumerable ? t9[r2] = e2 : ao(t9, r2, e2);
|
4526 | }, co = {}, so = or;
|
4527 | co.f = so;
|
4528 | var lo = openapi_parser_V, po = qt, vo = co, ho = Wr.f, yo = function(t9) {
|
4529 | var r2 = lo.Symbol || (lo.Symbol = {});
|
4530 | po(r2, t9) || ho(r2, t9, { value: vo.f(t9) });
|
4531 | }, bo = ln, mo = en ? {}.toString : function() {
|
4532 | return "[object " + bo(this) + "]";
|
4533 | }, go = en, wo = Wr.f, jo = ae, Oo = qt, Ao = mo, So = or("toStringTag"), xo = function(t9, r2, e2, n2) {
|
4534 | if (t9) {
|
4535 | var o2 = e2 ? t9 : t9.prototype;
|
4536 | Oo(o2, So) || wo(o2, So, { configurable: true, value: r2 }), n2 && !go && jo(o2, "toString", Ao);
|
4537 | }
|
4538 | }, Eo = openapi_parser_m, Po = Mt, ko = openapi_parser_b(Function.toString);
|
4539 | Eo(Po.inspectSource) || (Po.inspectSource = function(t9) {
|
4540 | return ko(t9);
|
4541 | });
|
4542 | var _o, Io, To, Ro = Po.inspectSource, Fo = openapi_parser_m, No = Ro, Mo = openapi_parser_o.WeakMap, Do = Fo(Mo) && /native code/.test(No(Mo)), Uo = Do, Lo = openapi_parser_o, Co = openapi_parser_b, $o = openapi_parser_H, Bo = ae, qo = qt, Go = Mt, Wo = Pn, zo = Ue, Jo = Lo.TypeError, Ho = Lo.WeakMap;
|
4543 | if (Uo || Go.state) {
|
4544 | var Vo = Go.state || (Go.state = new Ho()), Yo = Co(Vo.get), Qo = Co(Vo.has), Ko = Co(Vo.set);
|
4545 | _o = function(t9, r2) {
|
4546 | if (Qo(Vo, t9))
|
4547 | throw new Jo("Object already initialized");
|
4548 | return r2.facade = t9, Ko(Vo, t9, r2), r2;
|
4549 | }, Io = function(t9) {
|
4550 | return Yo(Vo, t9) || {};
|
4551 | }, To = function(t9) {
|
4552 | return Qo(Vo, t9);
|
4553 | };
|
4554 | } else {
|
4555 | var Xo = Wo("state");
|
4556 | zo[Xo] = true, _o = function(t9, r2) {
|
4557 | if (qo(t9, Xo))
|
4558 | throw new Jo("Object already initialized");
|
4559 | return r2.facade = t9, Bo(t9, Xo, r2), r2;
|
4560 | }, Io = function(t9) {
|
4561 | return qo(t9, Xo) ? t9[Xo] : {};
|
4562 | }, To = function(t9) {
|
4563 | return qo(t9, Xo);
|
4564 | };
|
4565 | }
|
4566 | var Zo = { set: _o, get: Io, has: To, enforce: function(t9) {
|
4567 | return To(t9) ? Io(t9) : _o(t9, {});
|
4568 | }, getterFor: function(t9) {
|
4569 | return function(r2) {
|
4570 | var e2;
|
4571 | if (!$o(r2) || (e2 = Io(r2)).type !== t9)
|
4572 | throw Jo("Incompatible receiver, " + t9 + " required");
|
4573 | return e2;
|
4574 | };
|
4575 | } }, ti = openapi_parser_b, ri = openapi_parser_i, ei = openapi_parser_m, ni = ln, oi = Ro, ii = function() {
|
4576 | }, ui = [], ai = openapi_parser_Z("Reflect", "construct"), fi = /^\s*(?:class|function)\b/, ci = ti(fi.exec), si = !fi.exec(ii), li = function(t9) {
|
4577 | if (!ei(t9))
|
4578 | return false;
|
4579 | try {
|
4580 | return ai(ii, ui, t9), true;
|
4581 | } catch (t10) {
|
4582 | return false;
|
4583 | }
|
4584 | }, pi = function(t9) {
|
4585 | if (!ei(t9))
|
4586 | return false;
|
4587 | switch (ni(t9)) {
|
4588 | case "AsyncFunction":
|
4589 | case "GeneratorFunction":
|
4590 | case "AsyncGeneratorFunction":
|
4591 | return false;
|
4592 | }
|
4593 | try {
|
4594 | return si || !!ci(fi, oi(t9));
|
4595 | } catch (t10) {
|
4596 | return true;
|
4597 | }
|
4598 | };
|
4599 | pi.sham = true;
|
4600 | var vi = !ai || ri(function() {
|
4601 | var t9;
|
4602 | return li(li.call) || !li(Object) || !li(function() {
|
4603 | t9 = true;
|
4604 | }) || t9;
|
4605 | }) ? pi : li, hi = openapi_parser_o, di = tn, yi = vi, bi = openapi_parser_H, mi = or("species"), gi = hi.Array, wi = function(t9) {
|
4606 | var r2;
|
4607 | return di(t9) && (r2 = t9.constructor, (yi(r2) && (r2 === gi || di(r2.prototype)) || bi(r2) && null === (r2 = r2[mi])) && (r2 = void 0)), void 0 === r2 ? gi : r2;
|
4608 | }, ji = function(t9, r2) {
|
4609 | return new (wi(t9))(0 === r2 ? 0 : r2);
|
4610 | }, Oi = Gr, Ai = openapi_parser_$, Si = Ct, xi = Te, Ei = ji, Pi = openapi_parser_b([].push), ki = function(t9) {
|
4611 | var r2 = 1 == t9, e2 = 2 == t9, n2 = 3 == t9, o2 = 4 == t9, i2 = 6 == t9, u2 = 7 == t9, a2 = 5 == t9 || i2;
|
4612 | return function(f2, c2, s2, l2) {
|
4613 | for (var p2, v2, h2 = Si(f2), d2 = Ai(h2), y2 = Oi(c2, s2), b2 = xi(d2), m2 = 0, g2 = l2 || Ei, w2 = r2 ? g2(f2, b2) : e2 || u2 ? g2(f2, 0) : void 0; b2 > m2; m2++)
|
4614 | if ((a2 || m2 in d2) && (v2 = y2(p2 = d2[m2], m2, h2), t9))
|
4615 | if (r2)
|
4616 | w2[m2] = v2;
|
4617 | else if (v2)
|
4618 | switch (t9) {
|
4619 | case 3:
|
4620 | return true;
|
4621 | case 5:
|
4622 | return p2;
|
4623 | case 6:
|
4624 | return m2;
|
4625 | case 2:
|
4626 | Pi(w2, p2);
|
4627 | }
|
4628 | else
|
4629 | switch (t9) {
|
4630 | case 4:
|
4631 | return false;
|
4632 | case 7:
|
4633 | Pi(w2, p2);
|
4634 | }
|
4635 | return i2 ? -1 : n2 || o2 ? o2 : w2;
|
4636 | };
|
4637 | }, _i = { forEach: ki(0), map: ki(1), filter: ki(2), some: ki(3), every: ki(4), find: ki(5), findIndex: ki(6), filterReject: ki(7) }, Ii = ge, Ti = openapi_parser_o, Ri = openapi_parser_Z, Fi = openapi_parser_l, Ni = openapi_parser_A, Mi = openapi_parser_b, Di = openapi_parser_w, Ui = lt, Li = openapi_parser_i, Ci = qt, $i = tn, Bi = openapi_parser_m, qi = openapi_parser_H, Gi = tt, Wi = mt, zi = Qr, Ji = Ct, Hi = openapi_parser_z, Vi = dr, Yi = hn, Qi = openapi_parser_I, Ki = Cn, Xi = He, Zi = $n, tu = Gn, ru = io, eu = openapi_parser_g, nu = Wr, ou = dn, iu = openapi_parser_S, uu = uo, au = fo, fu = Tt.exports, cu = Ue, su = Ht, lu = or, pu = co, vu = yo, hu = xo, du = Zo, yu = _i.forEach, bu = Pn("hidden"), mu = lu("toPrimitive"), gu = du.set, wu = du.getterFor("Symbol"), ju = Object.prototype, Ou = Ti.Symbol, Au = Ou && Ou.prototype, Su = Ti.TypeError, xu = Ti.QObject, Eu = Ri("JSON", "stringify"), Pu = eu.f, ku = nu.f, _u = tu.f, Iu = iu.f, Tu = Mi([].push), Ru = fu("symbols"), Fu = fu("op-symbols"), Nu = fu("string-to-symbol-registry"), Mu = fu("symbol-to-string-registry"), Du = fu("wks"), Uu = !xu || !xu.prototype || !xu.prototype.findChild, Lu = Di && Li(function() {
|
4638 | return 7 != Ki(ku({}, "a", { get: function() {
|
4639 | return ku(this, "a", { value: 7 }).a;
|
4640 | } })).a;
|
4641 | }) ? function(t9, r2, e2) {
|
4642 | var n2 = Pu(ju, r2);
|
4643 | n2 && delete ju[r2], ku(t9, r2, e2), n2 && t9 !== ju && ku(ju, r2, n2);
|
4644 | } : ku, Cu = function(t9, r2) {
|
4645 | var e2 = Ru[t9] = Ki(Au);
|
4646 | return gu(e2, { type: "Symbol", tag: t9, description: r2 }), Di || (e2.description = r2), e2;
|
4647 | }, $u = function(t9, r2, e2) {
|
4648 | t9 === ju && $u(Fu, r2, e2), zi(t9);
|
4649 | var n2 = Vi(r2);
|
4650 | return zi(e2), Ci(Ru, n2) ? (e2.enumerable ? (Ci(t9, bu) && t9[bu][n2] && (t9[bu][n2] = false), e2 = Ki(e2, { enumerable: Qi(0, false) })) : (Ci(t9, bu) || ku(t9, bu, Qi(1, {})), t9[bu][n2] = true), Lu(t9, n2, e2)) : ku(t9, n2, e2);
|
4651 | }, Bu = function(t9, r2) {
|
4652 | zi(t9);
|
4653 | var e2 = Hi(r2), n2 = Xi(e2).concat(zu(e2));
|
4654 | return yu(n2, function(r3) {
|
4655 | Di && !Ni(qu, e2, r3) || $u(t9, r3, e2[r3]);
|
4656 | }), t9;
|
4657 | }, qu = function(t9) {
|
4658 | var r2 = Vi(t9), e2 = Ni(Iu, this, r2);
|
4659 | return !(this === ju && Ci(Ru, r2) && !Ci(Fu, r2)) && (!(e2 || !Ci(this, r2) || !Ci(Ru, r2) || Ci(this, bu) && this[bu][r2]) || e2);
|
4660 | }, Gu = function(t9, r2) {
|
4661 | var e2 = Hi(t9), n2 = Vi(r2);
|
4662 | if (e2 !== ju || !Ci(Ru, n2) || Ci(Fu, n2)) {
|
4663 | var o2 = Pu(e2, n2);
|
4664 | return !o2 || !Ci(Ru, n2) || Ci(e2, bu) && e2[bu][n2] || (o2.enumerable = true), o2;
|
4665 | }
|
4666 | }, Wu = function(t9) {
|
4667 | var r2 = _u(Hi(t9)), e2 = [];
|
4668 | return yu(r2, function(t10) {
|
4669 | Ci(Ru, t10) || Ci(cu, t10) || Tu(e2, t10);
|
4670 | }), e2;
|
4671 | }, zu = function(t9) {
|
4672 | var r2 = t9 === ju, e2 = _u(r2 ? Fu : Hi(t9)), n2 = [];
|
4673 | return yu(e2, function(t10) {
|
4674 | !Ci(Ru, t10) || r2 && !Ci(ju, t10) || Tu(n2, Ru[t10]);
|
4675 | }), n2;
|
4676 | };
|
4677 | if (Ui || (au(Au = (Ou = function() {
|
4678 | if (Gi(Au, this))
|
4679 | throw Su("Symbol is not a constructor");
|
4680 | var t9 = arguments.length && void 0 !== arguments[0] ? Yi(arguments[0]) : void 0, r2 = su(t9), e2 = function(t10) {
|
4681 | this === ju && Ni(e2, Fu, t10), Ci(this, bu) && Ci(this[bu], r2) && (this[bu][r2] = false), Lu(this, r2, Qi(1, t10));
|
4682 | };
|
4683 | return Di && Uu && Lu(ju, r2, { configurable: true, set: e2 }), Cu(r2, t9);
|
4684 | }).prototype, "toString", function() {
|
4685 | return wu(this).tag;
|
4686 | }), au(Ou, "withoutSetter", function(t9) {
|
4687 | return Cu(su(t9), t9);
|
4688 | }), iu.f = qu, nu.f = $u, ou.f = Bu, eu.f = Gu, Zi.f = tu.f = Wu, ru.f = zu, pu.f = function(t9) {
|
4689 | return Cu(lu(t9), t9);
|
4690 | }, Di && ku(Au, "description", { configurable: true, get: function() {
|
4691 | return wu(this).description;
|
4692 | } })), Ii({ global: true, wrap: true, forced: !Ui, sham: !Ui }, { Symbol: Ou }), yu(Xi(Du), function(t9) {
|
4693 | vu(t9);
|
4694 | }), Ii({ target: "Symbol", stat: true, forced: !Ui }, { for: function(t9) {
|
4695 | var r2 = Yi(t9);
|
4696 | if (Ci(Nu, r2))
|
4697 | return Nu[r2];
|
4698 | var e2 = Ou(r2);
|
4699 | return Nu[r2] = e2, Mu[e2] = r2, e2;
|
4700 | }, keyFor: function(t9) {
|
4701 | if (!Wi(t9))
|
4702 | throw Su(t9 + " is not a symbol");
|
4703 | if (Ci(Mu, t9))
|
4704 | return Mu[t9];
|
4705 | }, useSetter: function() {
|
4706 | Uu = true;
|
4707 | }, useSimple: function() {
|
4708 | Uu = false;
|
4709 | } }), Ii({ target: "Object", stat: true, forced: !Ui, sham: !Di }, { create: function(t9, r2) {
|
4710 | return void 0 === r2 ? Ki(t9) : Bu(Ki(t9), r2);
|
4711 | }, defineProperty: $u, defineProperties: Bu, getOwnPropertyDescriptor: Gu }), Ii({ target: "Object", stat: true, forced: !Ui }, { getOwnPropertyNames: Wu, getOwnPropertySymbols: zu }), Ii({ target: "Object", stat: true, forced: Li(function() {
|
4712 | ru.f(1);
|
4713 | }) }, { getOwnPropertySymbols: function(t9) {
|
4714 | return ru.f(Ji(t9));
|
4715 | } }), Eu) {
|
4716 | var Ju = !Ui || Li(function() {
|
4717 | var t9 = Ou();
|
4718 | return "[null]" != Eu([t9]) || "{}" != Eu({ a: t9 }) || "{}" != Eu(Object(t9));
|
4719 | });
|
4720 | Ii({ target: "JSON", stat: true, forced: Ju }, { stringify: function(t9, r2, e2) {
|
4721 | var n2 = uu(arguments), o2 = r2;
|
4722 | if ((qi(r2) || void 0 !== t9) && !Wi(t9))
|
4723 | return $i(r2) || (r2 = function(t10, r3) {
|
4724 | if (Bi(o2) && (r3 = Ni(o2, this, t10, r3)), !Wi(r3))
|
4725 | return r3;
|
4726 | }), n2[1] = r2, Fi(Eu, null, n2);
|
4727 | } });
|
4728 | }
|
4729 | if (!Au[mu]) {
|
4730 | var Hu = Au.valueOf;
|
4731 | au(Au, mu, function(t9) {
|
4732 | return Ni(Hu, this);
|
4733 | });
|
4734 | }
|
4735 | hu(Ou, "Symbol"), cu[bu] = true;
|
4736 | var Vu = openapi_parser_V.Object.getOwnPropertySymbols;
|
4737 | const Yu = openapi_parser_t(Xe.exports = Vu);
|
4738 | var Qu = { exports: {} }, Ku = openapi_parser_i, Xu = ft, Zu = or("species"), ta = function(t9) {
|
4739 | return Xu >= 51 || !Ku(function() {
|
4740 | var r2 = [];
|
4741 | return (r2.constructor = {})[Zu] = function() {
|
4742 | return { foo: 1 };
|
4743 | }, 1 !== r2[t9](Boolean).foo;
|
4744 | });
|
4745 | }, ra = _i.filter;
|
4746 | ge({ target: "Array", proto: true, forced: !ta("filter") }, { filter: function(t9) {
|
4747 | return ra(this, t9, arguments.length > 1 ? arguments[1] : void 0);
|
4748 | } });
|
4749 | var ea = openapi_parser_V, na = function(t9) {
|
4750 | return ea[t9 + "Prototype"];
|
4751 | }, oa = na("Array").filter, ia = tt, ua = oa, aa = Array.prototype, fa = function(t9) {
|
4752 | var r2 = t9.filter;
|
4753 | return t9 === aa || ia(aa, t9) && r2 === aa.filter ? ua : r2;
|
4754 | };
|
4755 | const ca = openapi_parser_t(Qu.exports = fa);
|
4756 | var sa = { exports: {} }, la = { exports: {} }, pa = ge, va = openapi_parser_i, ha = openapi_parser_z, da = openapi_parser_g.f, ya = openapi_parser_w, ba = va(function() {
|
4757 | da(1);
|
4758 | });
|
4759 | pa({ target: "Object", stat: true, forced: !ya || ba, sham: !ya }, { getOwnPropertyDescriptor: function(t9, r2) {
|
4760 | return da(ha(t9), r2);
|
4761 | } });
|
4762 | var ma = openapi_parser_V.Object, ga = la.exports = function(t9, r2) {
|
4763 | return ma.getOwnPropertyDescriptor(t9, r2);
|
4764 | };
|
4765 | ma.getOwnPropertyDescriptor.sham && (ga.sham = true);
|
4766 | var wa = la.exports;
|
4767 | const ja = openapi_parser_t(sa.exports = wa);
|
4768 | var Oa, Aa, Sa, xa = { exports: {} }, Ea = {}, Pa = openapi_parser_w, ka = qt, _a = Function.prototype, Ia = Pa && Object.getOwnPropertyDescriptor, Ta = ka(_a, "name"), Ra = { EXISTS: Ta, PROPER: Ta && "something" === function() {
|
4769 | }.name, CONFIGURABLE: Ta && (!Pa || Pa && Ia(_a, "name").configurable) }, Fa = !openapi_parser_i(function() {
|
4770 | function t9() {
|
4771 | }
|
4772 | return t9.prototype.constructor = null, Object.getPrototypeOf(new t9()) !== t9.prototype;
|
4773 | }), Na = openapi_parser_o, Ma = qt, Da = openapi_parser_m, Ua = Ct, La = Fa, Ca = Pn("IE_PROTO"), $a = Na.Object, Ba = $a.prototype, qa = La ? $a.getPrototypeOf : function(t9) {
|
4774 | var r2 = Ua(t9);
|
4775 | if (Ma(r2, Ca))
|
4776 | return r2[Ca];
|
4777 | var e2 = r2.constructor;
|
4778 | return Da(e2) && r2 instanceof e2 ? e2.prototype : r2 instanceof $a ? Ba : null;
|
4779 | }, Ga = openapi_parser_i, Wa = openapi_parser_m, za = Cn, Ja = qa, Ha = fo, Va = or("iterator"), Ya = false;
|
4780 | [].keys && ("next" in (Sa = [].keys()) ? (Aa = Ja(Ja(Sa))) !== Object.prototype && (Oa = Aa) : Ya = true);
|
4781 | var Qa = null == Oa || Ga(function() {
|
4782 | var t9 = {};
|
4783 | return Oa[Va].call(t9) !== t9;
|
4784 | });
|
4785 | Wa((Oa = Qa ? {} : za(Oa))[Va]) || Ha(Oa, Va, function() {
|
4786 | return this;
|
4787 | });
|
4788 | var Ka = { IteratorPrototype: Oa, BUGGY_SAFARI_ITERATORS: Ya }, Xa = Ka.IteratorPrototype, Za = Cn, tf = openapi_parser_I, rf = xo, ef = Ea, nf = function() {
|
4789 | return this;
|
4790 | }, of = function(t9, r2, e2, n2) {
|
4791 | var o2 = r2 + " Iterator";
|
4792 | return t9.prototype = Za(Xa, { next: tf(+!n2, e2) }), rf(t9, o2, false, true), ef[o2] = nf, t9;
|
4793 | }, uf = openapi_parser_o, af = openapi_parser_m, ff = uf.String, cf = uf.TypeError, sf = openapi_parser_b, lf = Qr, pf = function(t9) {
|
4794 | if ("object" == typeof t9 || af(t9))
|
4795 | return t9;
|
4796 | throw cf("Can't set " + ff(t9) + " as a prototype");
|
4797 | }, vf = Object.setPrototypeOf || ("__proto__" in {} ? function() {
|
4798 | var t9, r2 = false, e2 = {};
|
4799 | try {
|
4800 | (t9 = sf(Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set))(e2, []), r2 = e2 instanceof Array;
|
4801 | } catch (t10) {
|
4802 | }
|
4803 | return function(e3, n2) {
|
4804 | return lf(e3), pf(n2), r2 ? t9(e3, n2) : e3.__proto__ = n2, e3;
|
4805 | };
|
4806 | }() : void 0), hf = ge, df = openapi_parser_A, yf = of, bf = qa, mf = xo, gf = fo, wf = Ea, jf = Ra.PROPER, Of = Ka.BUGGY_SAFARI_ITERATORS, Af = or("iterator"), Sf = function() {
|
4807 | return this;
|
4808 | }, xf = function(t9, r2, e2, n2, o2, i2, u2) {
|
4809 | yf(e2, r2, n2);
|
4810 | var a2, f2, c2, s2 = function(t10) {
|
4811 | if (t10 === o2 && d2)
|
4812 | return d2;
|
4813 | if (!Of && t10 in v2)
|
4814 | return v2[t10];
|
4815 | switch (t10) {
|
4816 | case "keys":
|
4817 | case "values":
|
4818 | case "entries":
|
4819 | return function() {
|
4820 | return new e2(this, t10);
|
4821 | };
|
4822 | }
|
4823 | return function() {
|
4824 | return new e2(this);
|
4825 | };
|
4826 | }, l2 = r2 + " Iterator", p2 = false, v2 = t9.prototype, h2 = v2[Af] || v2["@@iterator"] || o2 && v2[o2], d2 = !Of && h2 || s2(o2), y2 = "Array" == r2 && v2.entries || h2;
|
4827 | if (y2 && (a2 = bf(y2.call(new t9()))) !== Object.prototype && a2.next && (mf(a2, l2, true, true), wf[l2] = Sf), jf && "values" == o2 && h2 && "values" !== h2.name && (p2 = true, d2 = function() {
|
4828 | return df(h2, this);
|
4829 | }), o2)
|
4830 | if (f2 = { values: s2("values"), keys: i2 ? d2 : s2("keys"), entries: s2("entries") }, u2)
|
4831 | for (c2 in f2)
|
4832 | (Of || p2 || !(c2 in v2)) && gf(v2, c2, f2[c2]);
|
4833 | else
|
4834 | hf({ target: r2, proto: true, forced: Of || p2 }, f2);
|
4835 | return u2 && v2[Af] !== d2 && gf(v2, Af, d2, { name: o2 }), wf[r2] = d2, f2;
|
4836 | }, Ef = openapi_parser_z, Pf = Ea, kf = Zo;
|
4837 | Wr.f;
|
4838 | var _f = xf, If = kf.set, Tf = kf.getterFor("Array Iterator");
|
4839 | _f(Array, "Array", function(t9, r2) {
|
4840 | If(this, { type: "Array Iterator", target: Ef(t9), index: 0, kind: r2 });
|
4841 | }, function() {
|
4842 | var t9 = Tf(this), r2 = t9.target, e2 = t9.kind, n2 = t9.index++;
|
4843 | return !r2 || n2 >= r2.length ? (t9.target = void 0, { value: void 0, done: true }) : "keys" == e2 ? { value: n2, done: false } : "values" == e2 ? { value: r2[n2], done: false } : { value: [n2, r2[n2]], done: false };
|
4844 | }, "values"), Pf.Arguments = Pf.Array;
|
4845 | var Rf = { CSSRuleList: 0, CSSStyleDeclaration: 0, CSSValueList: 0, ClientRectList: 0, DOMRectList: 0, DOMStringList: 0, DOMTokenList: 1, DataTransferItemList: 0, FileList: 0, HTMLAllCollection: 0, HTMLCollection: 0, HTMLFormElement: 0, HTMLSelectElement: 0, MediaList: 0, MimeTypeArray: 0, NamedNodeMap: 0, NodeList: 1, PaintRequestList: 0, Plugin: 0, PluginArray: 0, SVGLengthList: 0, SVGNumberList: 0, SVGPathSegList: 0, SVGPointList: 0, SVGStringList: 0, SVGTransformList: 0, SourceBufferList: 0, StyleSheetList: 0, TextTrackCueList: 0, TextTrackList: 0, TouchList: 0 }, Ff = openapi_parser_o, Nf = ln, Mf = ae, Df = Ea, Uf = or("toStringTag");
|
4846 | for (var Lf in Rf) {
|
4847 | var Cf = Ff[Lf], $f = Cf && Cf.prototype;
|
4848 | $f && Nf($f) !== Uf && Mf($f, Uf, Lf), Df[Lf] = Df.Array;
|
4849 | }
|
4850 | var Bf = openapi_parser_i, qf = function(t9, r2) {
|
4851 | var e2 = [][t9];
|
4852 | return !!e2 && Bf(function() {
|
4853 | e2.call(null, r2 || function() {
|
4854 | return 1;
|
4855 | }, 1);
|
4856 | });
|
4857 | }, Gf = _i.forEach, Wf = qf("forEach") ? [].forEach : function(t9) {
|
4858 | return Gf(this, t9, arguments.length > 1 ? arguments[1] : void 0);
|
4859 | };
|
4860 | ge({ target: "Array", proto: true, forced: [].forEach != Wf }, { forEach: Wf });
|
4861 | var zf = na("Array").forEach, Jf = ln, Hf = qt, Vf = tt, Yf = zf, Qf = Array.prototype, Kf = { DOMTokenList: true, NodeList: true };
|
4862 | const Xf = openapi_parser_t(xa.exports = function(t9) {
|
4863 | var r2 = t9.forEach;
|
4864 | return t9 === Qf || Vf(Qf, t9) && r2 === Qf.forEach || Hf(Kf, Jf(t9)) ? Yf : r2;
|
4865 | });
|
4866 | var Zf = { exports: {} }, tc = openapi_parser_Z, rc = $n, ec = io, nc = Qr, oc = openapi_parser_b([].concat), ic = tc("Reflect", "ownKeys") || function(t9) {
|
4867 | var r2 = rc.f(nc(t9)), e2 = ec.f;
|
4868 | return e2 ? oc(r2, e2(t9)) : r2;
|
4869 | }, uc = ic, ac = openapi_parser_z, fc = openapi_parser_g, cc = Hn;
|
4870 | ge({ target: "Object", stat: true, sham: !openapi_parser_w }, { getOwnPropertyDescriptors: function(t9) {
|
4871 | for (var r2, e2, n2 = ac(t9), o2 = fc.f, i2 = uc(n2), u2 = {}, a2 = 0; i2.length > a2; )
|
4872 | void 0 !== (e2 = o2(n2, r2 = i2[a2++])) && cc(u2, r2, e2);
|
4873 | return u2;
|
4874 | } });
|
4875 | var sc = openapi_parser_V.Object.getOwnPropertyDescriptors;
|
4876 | const lc = openapi_parser_t(Zf.exports = sc);
|
4877 | var pc = { exports: {} }, vc = { exports: {} }, hc = ge, dc = openapi_parser_w, yc = dn.f;
|
4878 | hc({ target: "Object", stat: true, forced: Object.defineProperties !== yc, sham: !dc }, { defineProperties: yc });
|
4879 | var bc = openapi_parser_V.Object, mc = vc.exports = function(t9, r2) {
|
4880 | return bc.defineProperties(t9, r2);
|
4881 | };
|
4882 | bc.defineProperties.sham && (mc.sham = true);
|
4883 | var gc = vc.exports;
|
4884 | const wc = openapi_parser_t(pc.exports = gc);
|
4885 | var jc = { exports: {} }, Oc = { exports: {} }, Ac = ge, Sc = openapi_parser_w, xc = Wr.f;
|
4886 | Ac({ target: "Object", stat: true, forced: Object.defineProperty !== xc, sham: !Sc }, { defineProperty: xc });
|
4887 | var Ec = openapi_parser_V.Object, Pc = Oc.exports = function(t9, r2, e2) {
|
4888 | return Ec.defineProperty(t9, r2, e2);
|
4889 | };
|
4890 | Ec.defineProperty.sham && (Pc.sham = true);
|
4891 | var kc = Oc.exports;
|
4892 | const _c = openapi_parser_t(jc.exports = kc);
|
4893 | function Ic(t9, r2, e2) {
|
4894 | return r2 in t9 ? _c(t9, r2, { value: e2, enumerable: true, configurable: true, writable: true }) : t9[r2] = e2, t9;
|
4895 | }
|
4896 | function Tc(t9, r2) {
|
4897 | var e2 = Ke(t9);
|
4898 | if (Yu) {
|
4899 | var n2 = Yu(t9);
|
4900 | r2 && (n2 = ca(n2).call(n2, function(r3) {
|
4901 | return ja(t9, r3).enumerable;
|
4902 | })), e2.push.apply(e2, n2);
|
4903 | }
|
4904 | return e2;
|
4905 | }
|
4906 | function Rc(t9) {
|
4907 | for (var r2 = 1; r2 < arguments.length; r2++) {
|
4908 | var e2, n2, o2 = null != arguments[r2] ? arguments[r2] : {};
|
4909 | r2 % 2 ? Xf(e2 = Tc(Object(o2), true)).call(e2, function(r3) {
|
4910 | Ic(t9, r3, o2[r3]);
|
4911 | }) : lc ? wc(t9, lc(o2)) : Xf(n2 = Tc(Object(o2))).call(n2, function(r3) {
|
4912 | _c(t9, r3, ja(o2, r3));
|
4913 | });
|
4914 | }
|
4915 | return t9;
|
4916 | }
|
4917 | var Fc = { exports: {} }, Nc = openapi_parser_w, Mc = openapi_parser_b, Dc = openapi_parser_A, Uc = openapi_parser_i, Lc = He, Cc = io, $c = openapi_parser_S, Bc = Ct, qc = openapi_parser_$, Gc = Object.assign, Wc = Object.defineProperty, zc = Mc([].concat), Jc = !Gc || Uc(function() {
|
4918 | if (Nc && 1 !== Gc({ b: 1 }, Gc(Wc({}, "a", { enumerable: true, get: function() {
|
4919 | Wc(this, "b", { value: 3, enumerable: false });
|
4920 | } }), { b: 2 })).b)
|
4921 | return true;
|
4922 | var t9 = {}, r2 = {}, e2 = Symbol(), n2 = "abcdefghijklmnopqrst";
|
4923 | return t9[e2] = 7, n2.split("").forEach(function(t10) {
|
4924 | r2[t10] = t10;
|
4925 | }), 7 != Gc({}, t9)[e2] || Lc(Gc({}, r2)).join("") != n2;
|
4926 | }) ? function(t9, r2) {
|
4927 | for (var e2 = Bc(t9), n2 = arguments.length, o2 = 1, i2 = Cc.f, u2 = $c.f; n2 > o2; )
|
4928 | for (var a2, f2 = qc(arguments[o2++]), c2 = i2 ? zc(Lc(f2), i2(f2)) : Lc(f2), s2 = c2.length, l2 = 0; s2 > l2; )
|
4929 | a2 = c2[l2++], Nc && !Dc(u2, f2, a2) || (e2[a2] = f2[a2]);
|
4930 | return e2;
|
4931 | } : Gc, Hc = Jc;
|
4932 | ge({ target: "Object", stat: true, forced: Object.assign !== Hc }, { assign: Hc });
|
4933 | var Vc = openapi_parser_V.Object.assign;
|
4934 | const Yc = openapi_parser_t(Fc.exports = Vc);
|
4935 | var Qc = { exports: {} }, Kc = openapi_parser_H, Xc = openapi_parser_N, Zc = or("match"), ts = function(t9) {
|
4936 | var r2;
|
4937 | return Kc(t9) && (void 0 !== (r2 = t9[Zc]) ? !!r2 : "RegExp" == Xc(t9));
|
4938 | }, rs = openapi_parser_o.TypeError, es = function(t9) {
|
4939 | if (ts(t9))
|
4940 | throw rs("The method doesn't accept regular expressions");
|
4941 | return t9;
|
4942 | }, ns = or("match"), os = function(t9) {
|
4943 | var r2 = /./;
|
4944 | try {
|
4945 | "/./"[t9](r2);
|
4946 | } catch (e2) {
|
4947 | try {
|
4948 | return r2[ns] = false, "/./"[t9](r2);
|
4949 | } catch (t10) {
|
4950 | }
|
4951 | }
|
4952 | return false;
|
4953 | }, is = ge, us = openapi_parser_b, as = _e, fs = hn, cs = es, ss = q, ls = os, ps = us("".startsWith), vs = us("".slice), hs = Math.min;
|
4954 | is({ target: "String", proto: true, forced: !ls("startsWith") }, { startsWith: function(t9) {
|
4955 | var r2 = fs(ss(this));
|
4956 | cs(t9);
|
4957 | var e2 = as(hs(arguments.length > 1 ? arguments[1] : void 0, r2.length)), n2 = fs(t9);
|
4958 | return ps ? ps(r2, n2, e2) : vs(r2, e2, e2 + n2.length) === n2;
|
4959 | } });
|
4960 | var ds = na("String").startsWith, ys = tt, bs = ds, ms = String.prototype;
|
4961 | const gs = openapi_parser_t(Qc.exports = function(t9) {
|
4962 | var r2 = t9.startsWith;
|
4963 | return "string" == typeof t9 || t9 === ms || ys(ms, t9) && r2 === ms.startsWith ? bs : r2;
|
4964 | });
|
4965 | var ws = {}, js = { exports: {} };
|
4966 |
|
4967 | !function(t9, r2) {
|
4968 | !function(e2) {
|
4969 | var n2 = r2 && !r2.nodeType && r2, o2 = t9 && !t9.nodeType && t9, i2 = "object" == typeof global && global;
|
4970 | i2.global !== i2 && i2.window !== i2 && i2.self !== i2 || (e2 = i2);
|
4971 | var u2, a2, f2 = 2147483647, c2 = 36, s2 = /^xn--/, l2 = /[^\x20-\x7E]/, p2 = /[\x2E\u3002\uFF0E\uFF61]/g, v2 = { overflow: "Overflow: input needs wider integers to process", "not-basic": "Illegal input >= 0x80 (not a basic code point)", "invalid-input": "Invalid input" }, h2 = Math.floor, d2 = String.fromCharCode;
|
4972 | function y2(t10) {
|
4973 | throw RangeError(v2[t10]);
|
4974 | }
|
4975 | function b2(t10, r3) {
|
4976 | for (var e3 = t10.length, n3 = []; e3--; )
|
4977 | n3[e3] = r3(t10[e3]);
|
4978 | return n3;
|
4979 | }
|
4980 | function m2(t10, r3) {
|
4981 | var e3 = t10.split("@"), n3 = "";
|
4982 | return e3.length > 1 && (n3 = e3[0] + "@", t10 = e3[1]), n3 + b2((t10 = t10.replace(p2, ".")).split("."), r3).join(".");
|
4983 | }
|
4984 | function g2(t10) {
|
4985 | for (var r3, e3, n3 = [], o3 = 0, i3 = t10.length; o3 < i3; )
|
4986 | (r3 = t10.charCodeAt(o3++)) >= 55296 && r3 <= 56319 && o3 < i3 ? 56320 == (64512 & (e3 = t10.charCodeAt(o3++))) ? n3.push(((1023 & r3) << 10) + (1023 & e3) + 65536) : (n3.push(r3), o3--) : n3.push(r3);
|
4987 | return n3;
|
4988 | }
|
4989 | function w2(t10) {
|
4990 | return b2(t10, function(t11) {
|
4991 | var r3 = "";
|
4992 | return t11 > 65535 && (r3 += d2((t11 -= 65536) >>> 10 & 1023 | 55296), t11 = 56320 | 1023 & t11), r3 += d2(t11);
|
4993 | }).join("");
|
4994 | }
|
4995 | function j2(t10, r3) {
|
4996 | return t10 + 22 + 75 * (t10 < 26) - ((0 != r3) << 5);
|
4997 | }
|
4998 | function O2(t10, r3, e3) {
|
4999 | var n3 = 0;
|
5000 | for (t10 = e3 ? h2(t10 / 700) : t10 >> 1, t10 += h2(t10 / r3); t10 > 455; n3 += c2)
|
5001 | t10 = h2(t10 / 35);
|
5002 | return h2(n3 + 36 * t10 / (t10 + 38));
|
5003 | }
|
5004 | function A2(t10) {
|
5005 | var r3, e3, n3, o3, i3, u3, a3, s3, l3, p3, v3, d3 = [], b3 = t10.length, m3 = 0, g3 = 128, j3 = 72;
|
5006 | for ((e3 = t10.lastIndexOf("-")) < 0 && (e3 = 0), n3 = 0; n3 < e3; ++n3)
|
5007 | t10.charCodeAt(n3) >= 128 && y2("not-basic"), d3.push(t10.charCodeAt(n3));
|
5008 | for (o3 = e3 > 0 ? e3 + 1 : 0; o3 < b3; ) {
|
5009 | for (i3 = m3, u3 = 1, a3 = c2; o3 >= b3 && y2("invalid-input"), ((s3 = (v3 = t10.charCodeAt(o3++)) - 48 < 10 ? v3 - 22 : v3 - 65 < 26 ? v3 - 65 : v3 - 97 < 26 ? v3 - 97 : c2) >= c2 || s3 > h2((f2 - m3) / u3)) && y2("overflow"), m3 += s3 * u3, !(s3 < (l3 = a3 <= j3 ? 1 : a3 >= j3 + 26 ? 26 : a3 - j3)); a3 += c2)
|
5010 | u3 > h2(f2 / (p3 = c2 - l3)) && y2("overflow"), u3 *= p3;
|
5011 | j3 = O2(m3 - i3, r3 = d3.length + 1, 0 == i3), h2(m3 / r3) > f2 - g3 && y2("overflow"), g3 += h2(m3 / r3), m3 %= r3, d3.splice(m3++, 0, g3);
|
5012 | }
|
5013 | return w2(d3);
|
5014 | }
|
5015 | function S2(t10) {
|
5016 | var r3, e3, n3, o3, i3, u3, a3, s3, l3, p3, v3, b3, m3, w3, A3, S3 = [];
|
5017 | for (b3 = (t10 = g2(t10)).length, r3 = 128, e3 = 0, i3 = 72, u3 = 0; u3 < b3; ++u3)
|
5018 | (v3 = t10[u3]) < 128 && S3.push(d2(v3));
|
5019 | for (n3 = o3 = S3.length, o3 && S3.push("-"); n3 < b3; ) {
|
5020 | for (a3 = f2, u3 = 0; u3 < b3; ++u3)
|
5021 | (v3 = t10[u3]) >= r3 && v3 < a3 && (a3 = v3);
|
5022 | for (a3 - r3 > h2((f2 - e3) / (m3 = n3 + 1)) && y2("overflow"), e3 += (a3 - r3) * m3, r3 = a3, u3 = 0; u3 < b3; ++u3)
|
5023 | if ((v3 = t10[u3]) < r3 && ++e3 > f2 && y2("overflow"), v3 == r3) {
|
5024 | for (s3 = e3, l3 = c2; !(s3 < (p3 = l3 <= i3 ? 1 : l3 >= i3 + 26 ? 26 : l3 - i3)); l3 += c2)
|
5025 | A3 = s3 - p3, w3 = c2 - p3, S3.push(d2(j2(p3 + A3 % w3, 0))), s3 = h2(A3 / w3);
|
5026 | S3.push(d2(j2(s3, 0))), i3 = O2(e3, m3, n3 == o3), e3 = 0, ++n3;
|
5027 | }
|
5028 | ++e3, ++r3;
|
5029 | }
|
5030 | return S3.join("");
|
5031 | }
|
5032 | if (u2 = { version: "1.3.2", ucs2: { decode: g2, encode: w2 }, decode: A2, encode: S2, toASCII: function(t10) {
|
5033 | return m2(t10, function(t11) {
|
5034 | return l2.test(t11) ? "xn--" + S2(t11) : t11;
|
5035 | });
|
5036 | }, toUnicode: function(t10) {
|
5037 | return m2(t10, function(t11) {
|
5038 | return s2.test(t11) ? A2(t11.slice(4).toLowerCase()) : t11;
|
5039 | });
|
5040 | } }, n2 && o2)
|
5041 | if (t9.exports == n2)
|
5042 | o2.exports = u2;
|
5043 | else
|
5044 | for (a2 in u2)
|
5045 | u2.hasOwnProperty(a2) && (n2[a2] = u2[a2]);
|
5046 | else
|
5047 | e2.punycode = u2;
|
5048 | }(this);
|
5049 | }(js, js.exports);
|
5050 | var Os = {};
|
5051 | function As(t9, r2) {
|
5052 | return Object.prototype.hasOwnProperty.call(t9, r2);
|
5053 | }
|
5054 | var Ss = function(t9) {
|
5055 | switch (typeof t9) {
|
5056 | case "string":
|
5057 | return t9;
|
5058 | case "boolean":
|
5059 | return t9 ? "true" : "false";
|
5060 | case "number":
|
5061 | return isFinite(t9) ? t9 : "";
|
5062 | default:
|
5063 | return "";
|
5064 | }
|
5065 | };
|
5066 | Os.decode = Os.parse = function(t9, r2, e2, n2) {
|
5067 | r2 = r2 || "&", e2 = e2 || "=";
|
5068 | var o2 = {};
|
5069 | if ("string" != typeof t9 || 0 === t9.length)
|
5070 | return o2;
|
5071 | var i2 = /\+/g;
|
5072 | t9 = t9.split(r2);
|
5073 | var u2 = 1e3;
|
5074 | n2 && "number" == typeof n2.maxKeys && (u2 = n2.maxKeys);
|
5075 | var a2 = t9.length;
|
5076 | u2 > 0 && a2 > u2 && (a2 = u2);
|
5077 | for (var f2 = 0; f2 < a2; ++f2) {
|
5078 | var c2, s2, l2, p2, v2 = t9[f2].replace(i2, "%20"), h2 = v2.indexOf(e2);
|
5079 | h2 >= 0 ? (c2 = v2.substr(0, h2), s2 = v2.substr(h2 + 1)) : (c2 = v2, s2 = ""), l2 = decodeURIComponent(c2), p2 = decodeURIComponent(s2), As(o2, l2) ? Array.isArray(o2[l2]) ? o2[l2].push(p2) : o2[l2] = [o2[l2], p2] : o2[l2] = p2;
|
5080 | }
|
5081 | return o2;
|
5082 | }, Os.encode = Os.stringify = function(t9, r2, e2, n2) {
|
5083 | return r2 = r2 || "&", e2 = e2 || "=", null === t9 && (t9 = void 0), "object" == typeof t9 ? Object.keys(t9).map(function(n3) {
|
5084 | var o2 = encodeURIComponent(Ss(n3)) + e2;
|
5085 | return Array.isArray(t9[n3]) ? t9[n3].map(function(t10) {
|
5086 | return o2 + encodeURIComponent(Ss(t10));
|
5087 | }).join(r2) : o2 + encodeURIComponent(Ss(t9[n3]));
|
5088 | }).join(r2) : n2 ? encodeURIComponent(Ss(n2)) + e2 + encodeURIComponent(Ss(t9)) : "";
|
5089 | };
|
5090 | var xs = js.exports, Es = { isString: function(t9) {
|
5091 | return "string" == typeof t9;
|
5092 | }, isObject: function(t9) {
|
5093 | return "object" == typeof t9 && null !== t9;
|
5094 | }, isNull: function(t9) {
|
5095 | return null === t9;
|
5096 | }, isNullOrUndefined: function(t9) {
|
5097 | return null == t9;
|
5098 | } };
|
5099 | function Ps() {
|
5100 | this.protocol = null, this.slashes = null, this.auth = null, this.host = null, this.port = null, this.hostname = null, this.hash = null, this.search = null, this.query = null, this.pathname = null, this.path = null, this.href = null;
|
5101 | }
|
5102 | ws.parse = Bs, ws.resolve = function(t9, r2) {
|
5103 | return Bs(t9, false, true).resolve(r2);
|
5104 | }, ws.resolveObject = function(t9, r2) {
|
5105 | return t9 ? Bs(t9, false, true).resolveObject(r2) : r2;
|
5106 | }, ws.format = function(t9) {
|
5107 | Es.isString(t9) && (t9 = Bs(t9));
|
5108 | return t9 instanceof Ps ? t9.format() : Ps.prototype.format.call(t9);
|
5109 | }, ws.Url = Ps;
|
5110 | var ks = /^([a-z0-9.+-]+:)/i, _s = /:[0-9]*$/, Is = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, Ts = ["{", "}", "|", "\\", "^", "`"].concat(["<", ">", '"', "`", " ", "\r", "\n", " "]), Rs = ["'"].concat(Ts), Fs = ["%", "/", "?", ";", "#"].concat(Rs), Ns = ["/", "?", "#"], Ms = /^[+a-z0-9A-Z_-]{0,63}$/, Ds = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, Us = { javascript: true, "javascript:": true }, Ls = { javascript: true, "javascript:": true }, Cs = { http: true, https: true, ftp: true, gopher: true, file: true, "http:": true, "https:": true, "ftp:": true, "gopher:": true, "file:": true }, $s = Os;
|
5111 | function Bs(t9, r2, e2) {
|
5112 | if (t9 && Es.isObject(t9) && t9 instanceof Ps)
|
5113 | return t9;
|
5114 | var n2 = new Ps();
|
5115 | return n2.parse(t9, r2, e2), n2;
|
5116 | }
|
5117 | Ps.prototype.parse = function(t9, r2, e2) {
|
5118 | if (!Es.isString(t9))
|
5119 | throw new TypeError("Parameter 'url' must be a string, not " + typeof t9);
|
5120 | var n2 = t9.indexOf("?"), o2 = -1 !== n2 && n2 < t9.indexOf("#") ? "?" : "#", i2 = t9.split(o2);
|
5121 | i2[0] = i2[0].replace(/\\/g, "/");
|
5122 | var u2 = t9 = i2.join(o2);
|
5123 | if (u2 = u2.trim(), !e2 && 1 === t9.split("#").length) {
|
5124 | var a2 = Is.exec(u2);
|
5125 | if (a2)
|
5126 | return this.path = u2, this.href = u2, this.pathname = a2[1], a2[2] ? (this.search = a2[2], this.query = r2 ? $s.parse(this.search.substr(1)) : this.search.substr(1)) : r2 && (this.search = "", this.query = {}), this;
|
5127 | }
|
5128 | var f2 = ks.exec(u2);
|
5129 | if (f2) {
|
5130 | var c2 = (f2 = f2[0]).toLowerCase();
|
5131 | this.protocol = c2, u2 = u2.substr(f2.length);
|
5132 | }
|
5133 | if (e2 || f2 || u2.match(/^\/\/[^@\/]+@[^@\/]+/)) {
|
5134 | var s2 = "//" === u2.substr(0, 2);
|
5135 | !s2 || f2 && Ls[f2] || (u2 = u2.substr(2), this.slashes = true);
|
5136 | }
|
5137 | if (!Ls[f2] && (s2 || f2 && !Cs[f2])) {
|
5138 | for (var l2, p2, v2 = -1, h2 = 0; h2 < Ns.length; h2++) {
|
5139 | -1 !== (d2 = u2.indexOf(Ns[h2])) && (-1 === v2 || d2 < v2) && (v2 = d2);
|
5140 | }
|
5141 | -1 !== (p2 = -1 === v2 ? u2.lastIndexOf("@") : u2.lastIndexOf("@", v2)) && (l2 = u2.slice(0, p2), u2 = u2.slice(p2 + 1), this.auth = decodeURIComponent(l2)), v2 = -1;
|
5142 | for (h2 = 0; h2 < Fs.length; h2++) {
|
5143 | var d2;
|
5144 | -1 !== (d2 = u2.indexOf(Fs[h2])) && (-1 === v2 || d2 < v2) && (v2 = d2);
|
5145 | }
|
5146 | -1 === v2 && (v2 = u2.length), this.host = u2.slice(0, v2), u2 = u2.slice(v2), this.parseHost(), this.hostname = this.hostname || "";
|
5147 | var y2 = "[" === this.hostname[0] && "]" === this.hostname[this.hostname.length - 1];
|
5148 | if (!y2)
|
5149 | for (var b2 = this.hostname.split(/\./), m2 = (h2 = 0, b2.length); h2 < m2; h2++) {
|
5150 | var g2 = b2[h2];
|
5151 | if (g2 && !g2.match(Ms)) {
|
5152 | for (var w2 = "", j2 = 0, O2 = g2.length; j2 < O2; j2++)
|
5153 | g2.charCodeAt(j2) > 127 ? w2 += "x" : w2 += g2[j2];
|
5154 | if (!w2.match(Ms)) {
|
5155 | var A2 = b2.slice(0, h2), S2 = b2.slice(h2 + 1), x2 = g2.match(Ds);
|
5156 | x2 && (A2.push(x2[1]), S2.unshift(x2[2])), S2.length && (u2 = "/" + S2.join(".") + u2), this.hostname = A2.join(".");
|
5157 | break;
|
5158 | }
|
5159 | }
|
5160 | }
|
5161 | this.hostname.length > 255 ? this.hostname = "" : this.hostname = this.hostname.toLowerCase(), y2 || (this.hostname = xs.toASCII(this.hostname));
|
5162 | var E2 = this.port ? ":" + this.port : "", P2 = this.hostname || "";
|
5163 | this.host = P2 + E2, this.href += this.host, y2 && (this.hostname = this.hostname.substr(1, this.hostname.length - 2), "/" !== u2[0] && (u2 = "/" + u2));
|
5164 | }
|
5165 | if (!Us[c2])
|
5166 | for (h2 = 0, m2 = Rs.length; h2 < m2; h2++) {
|
5167 | var k2 = Rs[h2];
|
5168 | if (-1 !== u2.indexOf(k2)) {
|
5169 | var _2 = encodeURIComponent(k2);
|
5170 | _2 === k2 && (_2 = escape(k2)), u2 = u2.split(k2).join(_2);
|
5171 | }
|
5172 | }
|
5173 | var I2 = u2.indexOf("#");
|
5174 | -1 !== I2 && (this.hash = u2.substr(I2), u2 = u2.slice(0, I2));
|
5175 | var T2 = u2.indexOf("?");
|
5176 | if (-1 !== T2 ? (this.search = u2.substr(T2), this.query = u2.substr(T2 + 1), r2 && (this.query = $s.parse(this.query)), u2 = u2.slice(0, T2)) : r2 && (this.search = "", this.query = {}), u2 && (this.pathname = u2), Cs[c2] && this.hostname && !this.pathname && (this.pathname = "/"), this.pathname || this.search) {
|
5177 | E2 = this.pathname || "";
|
5178 | var R2 = this.search || "";
|
5179 | this.path = E2 + R2;
|
5180 | }
|
5181 | return this.href = this.format(), this;
|
5182 | }, Ps.prototype.format = function() {
|
5183 | var t9 = this.auth || "";
|
5184 | t9 && (t9 = (t9 = encodeURIComponent(t9)).replace(/%3A/i, ":"), t9 += "@");
|
5185 | var r2 = this.protocol || "", e2 = this.pathname || "", n2 = this.hash || "", o2 = false, i2 = "";
|
5186 | this.host ? o2 = t9 + this.host : this.hostname && (o2 = t9 + (-1 === this.hostname.indexOf(":") ? this.hostname : "[" + this.hostname + "]"), this.port && (o2 += ":" + this.port)), this.query && Es.isObject(this.query) && Object.keys(this.query).length && (i2 = $s.stringify(this.query));
|
5187 | var u2 = this.search || i2 && "?" + i2 || "";
|
5188 | return r2 && ":" !== r2.substr(-1) && (r2 += ":"), this.slashes || (!r2 || Cs[r2]) && false !== o2 ? (o2 = "//" + (o2 || ""), e2 && "/" !== e2.charAt(0) && (e2 = "/" + e2)) : o2 || (o2 = ""), n2 && "#" !== n2.charAt(0) && (n2 = "#" + n2), u2 && "?" !== u2.charAt(0) && (u2 = "?" + u2), e2 = e2.replace(/[?#]/g, function(t10) {
|
5189 | return encodeURIComponent(t10);
|
5190 | }), r2 + o2 + e2 + (u2 = u2.replace("#", "%23")) + n2;
|
5191 | }, Ps.prototype.resolve = function(t9) {
|
5192 | return this.resolveObject(Bs(t9, false, true)).format();
|
5193 | }, Ps.prototype.resolveObject = function(t9) {
|
5194 | if (Es.isString(t9)) {
|
5195 | var r2 = new Ps();
|
5196 | r2.parse(t9, false, true), t9 = r2;
|
5197 | }
|
5198 | for (var e2 = new Ps(), n2 = Object.keys(this), o2 = 0; o2 < n2.length; o2++) {
|
5199 | var i2 = n2[o2];
|
5200 | e2[i2] = this[i2];
|
5201 | }
|
5202 | if (e2.hash = t9.hash, "" === t9.href)
|
5203 | return e2.href = e2.format(), e2;
|
5204 | if (t9.slashes && !t9.protocol) {
|
5205 | for (var u2 = Object.keys(t9), a2 = 0; a2 < u2.length; a2++) {
|
5206 | var f2 = u2[a2];
|
5207 | "protocol" !== f2 && (e2[f2] = t9[f2]);
|
5208 | }
|
5209 | return Cs[e2.protocol] && e2.hostname && !e2.pathname && (e2.path = e2.pathname = "/"), e2.href = e2.format(), e2;
|
5210 | }
|
5211 | if (t9.protocol && t9.protocol !== e2.protocol) {
|
5212 | if (!Cs[t9.protocol]) {
|
5213 | for (var c2 = Object.keys(t9), s2 = 0; s2 < c2.length; s2++) {
|
5214 | var l2 = c2[s2];
|
5215 | e2[l2] = t9[l2];
|
5216 | }
|
5217 | return e2.href = e2.format(), e2;
|
5218 | }
|
5219 | if (e2.protocol = t9.protocol, t9.host || Ls[t9.protocol])
|
5220 | e2.pathname = t9.pathname;
|
5221 | else {
|
5222 | for (var p2 = (t9.pathname || "").split("/"); p2.length && !(t9.host = p2.shift()); )
|
5223 | ;
|
5224 | t9.host || (t9.host = ""), t9.hostname || (t9.hostname = ""), "" !== p2[0] && p2.unshift(""), p2.length < 2 && p2.unshift(""), e2.pathname = p2.join("/");
|
5225 | }
|
5226 | if (e2.search = t9.search, e2.query = t9.query, e2.host = t9.host || "", e2.auth = t9.auth, e2.hostname = t9.hostname || t9.host, e2.port = t9.port, e2.pathname || e2.search) {
|
5227 | var v2 = e2.pathname || "", h2 = e2.search || "";
|
5228 | e2.path = v2 + h2;
|
5229 | }
|
5230 | return e2.slashes = e2.slashes || t9.slashes, e2.href = e2.format(), e2;
|
5231 | }
|
5232 | var d2 = e2.pathname && "/" === e2.pathname.charAt(0), y2 = t9.host || t9.pathname && "/" === t9.pathname.charAt(0), b2 = y2 || d2 || e2.host && t9.pathname, m2 = b2, g2 = e2.pathname && e2.pathname.split("/") || [], w2 = (p2 = t9.pathname && t9.pathname.split("/") || [], e2.protocol && !Cs[e2.protocol]);
|
5233 | if (w2 && (e2.hostname = "", e2.port = null, e2.host && ("" === g2[0] ? g2[0] = e2.host : g2.unshift(e2.host)), e2.host = "", t9.protocol && (t9.hostname = null, t9.port = null, t9.host && ("" === p2[0] ? p2[0] = t9.host : p2.unshift(t9.host)), t9.host = null), b2 = b2 && ("" === p2[0] || "" === g2[0])), y2)
|
5234 | e2.host = t9.host || "" === t9.host ? t9.host : e2.host, e2.hostname = t9.hostname || "" === t9.hostname ? t9.hostname : e2.hostname, e2.search = t9.search, e2.query = t9.query, g2 = p2;
|
5235 | else if (p2.length)
|
5236 | g2 || (g2 = []), g2.pop(), g2 = g2.concat(p2), e2.search = t9.search, e2.query = t9.query;
|
5237 | else if (!Es.isNullOrUndefined(t9.search)) {
|
5238 | if (w2)
|
5239 | e2.hostname = e2.host = g2.shift(), (x2 = !!(e2.host && e2.host.indexOf("@") > 0) && e2.host.split("@")) && (e2.auth = x2.shift(), e2.host = e2.hostname = x2.shift());
|
5240 | return e2.search = t9.search, e2.query = t9.query, Es.isNull(e2.pathname) && Es.isNull(e2.search) || (e2.path = (e2.pathname ? e2.pathname : "") + (e2.search ? e2.search : "")), e2.href = e2.format(), e2;
|
5241 | }
|
5242 | if (!g2.length)
|
5243 | return e2.pathname = null, e2.search ? e2.path = "/" + e2.search : e2.path = null, e2.href = e2.format(), e2;
|
5244 | for (var j2 = g2.slice(-1)[0], O2 = (e2.host || t9.host || g2.length > 1) && ("." === j2 || ".." === j2) || "" === j2, A2 = 0, S2 = g2.length; S2 >= 0; S2--)
|
5245 | "." === (j2 = g2[S2]) ? g2.splice(S2, 1) : ".." === j2 ? (g2.splice(S2, 1), A2++) : A2 && (g2.splice(S2, 1), A2--);
|
5246 | if (!b2 && !m2)
|
5247 | for (; A2--; A2)
|
5248 | g2.unshift("..");
|
5249 | !b2 || "" === g2[0] || g2[0] && "/" === g2[0].charAt(0) || g2.unshift(""), O2 && "/" !== g2.join("/").substr(-1) && g2.push("");
|
5250 | var x2, E2 = "" === g2[0] || g2[0] && "/" === g2[0].charAt(0);
|
5251 | w2 && (e2.hostname = e2.host = E2 ? "" : g2.length ? g2.shift() : "", (x2 = !!(e2.host && e2.host.indexOf("@") > 0) && e2.host.split("@")) && (e2.auth = x2.shift(), e2.host = e2.hostname = x2.shift()));
|
5252 | return (b2 = b2 || e2.host && g2.length) && !E2 && g2.unshift(""), g2.length ? e2.pathname = g2.join("/") : (e2.pathname = null, e2.path = null), Es.isNull(e2.pathname) && Es.isNull(e2.search) || (e2.path = (e2.pathname ? e2.pathname : "") + (e2.search ? e2.search : "")), e2.auth = t9.auth || e2.auth, e2.slashes = e2.slashes || t9.slashes, e2.href = e2.format(), e2;
|
5253 | }, Ps.prototype.parseHost = function() {
|
5254 | var t9 = this.host, r2 = _s.exec(t9);
|
5255 | r2 && (":" !== (r2 = r2[0]) && (this.port = r2.substr(1)), t9 = t9.substr(0, t9.length - r2.length)), t9 && (this.hostname = t9);
|
5256 | };
|
5257 | var qs = { exports: {} }, Gs = ge, Ws = openapi_parser_o, zs = openapi_parser_i, Js = tn, Hs = openapi_parser_H, Vs = Ct, Ys = Te, Qs = Hn, Ks = ji, Xs = ta, Zs = ft, tl = or("isConcatSpreadable"), rl = Ws.TypeError, el = Zs >= 51 || !zs(function() {
|
5258 | var t9 = [];
|
5259 | return t9[tl] = false, t9.concat()[0] !== t9;
|
5260 | }), nl = Xs("concat"), ol = function(t9) {
|
5261 | if (!Hs(t9))
|
5262 | return false;
|
5263 | var r2 = t9[tl];
|
5264 | return void 0 !== r2 ? !!r2 : Js(t9);
|
5265 | };
|
5266 | Gs({ target: "Array", proto: true, forced: !el || !nl }, { concat: function(t9) {
|
5267 | var r2, e2, n2, o2, i2, u2 = Vs(this), a2 = Ks(u2, 0), f2 = 0;
|
5268 | for (r2 = -1, n2 = arguments.length; r2 < n2; r2++)
|
5269 | if (ol(i2 = -1 === r2 ? u2 : arguments[r2])) {
|
5270 | if (f2 + (o2 = Ys(i2)) > 9007199254740991)
|
5271 | throw rl("Maximum allowed index exceeded");
|
5272 | for (e2 = 0; e2 < o2; e2++, f2++)
|
5273 | e2 in i2 && Qs(a2, f2, i2[e2]);
|
5274 | } else {
|
5275 | if (f2 >= 9007199254740991)
|
5276 | throw rl("Maximum allowed index exceeded");
|
5277 | Qs(a2, f2++, i2);
|
5278 | }
|
5279 | return a2.length = f2, a2;
|
5280 | } }), yo("asyncIterator"), yo("hasInstance"), yo("isConcatSpreadable"), yo("iterator"), yo("match"), yo("matchAll"), yo("replace"), yo("search"), yo("species"), yo("split"), yo("toPrimitive"), yo("toStringTag"), yo("unscopables"), xo(openapi_parser_o.JSON, "JSON", true);
|
5281 | var il = openapi_parser_V.Symbol;
|
5282 | yo("asyncDispose"), yo("dispose"), yo("matcher"), yo("metadata"), yo("observable"), yo("patternMatch"), yo("replaceAll");
|
5283 | const ul = openapi_parser_t(qs.exports = il);
|
5284 | var al = { exports: {} }, fl = openapi_parser_b, cl = Oe, sl = hn, ll = q, pl = fl("".charAt), vl = fl("".charCodeAt), hl = fl("".slice), dl = function(t9) {
|
5285 | return function(r2, e2) {
|
5286 | var n2, o2, i2 = sl(ll(r2)), u2 = cl(e2), a2 = i2.length;
|
5287 | return u2 < 0 || u2 >= a2 ? t9 ? "" : void 0 : (n2 = vl(i2, u2)) < 55296 || n2 > 56319 || u2 + 1 === a2 || (o2 = vl(i2, u2 + 1)) < 56320 || o2 > 57343 ? t9 ? pl(i2, u2) : n2 : t9 ? hl(i2, u2, u2 + 2) : o2 - 56320 + (n2 - 55296 << 10) + 65536;
|
5288 | };
|
5289 | }, yl = { codeAt: dl(false), charAt: dl(true) }.charAt, bl = hn, ml = Zo, gl = xf, wl = ml.set, jl = ml.getterFor("String Iterator");
|
5290 | gl(String, "String", function(t9) {
|
5291 | wl(this, { type: "String Iterator", string: bl(t9), index: 0 });
|
5292 | }, function() {
|
5293 | var t9, r2 = jl(this), e2 = r2.string, n2 = r2.index;
|
5294 | return n2 >= e2.length ? { value: void 0, done: true } : (t9 = yl(e2, n2), r2.index += t9.length, { value: t9, done: false });
|
5295 | });
|
5296 | var Ol = ln, Al = Et, Sl = Ea, xl = or("iterator"), El = function(t9) {
|
5297 | if (null != t9)
|
5298 | return Al(t9, xl) || Al(t9, "@@iterator") || Sl[Ol(t9)];
|
5299 | };
|
5300 | const Pl = openapi_parser_t(al.exports = El);
|
5301 | var kl = { exports: {} };
|
5302 | ge({ target: "Array", stat: true }, { isArray: tn });
|
5303 | var _l = openapi_parser_V.Array.isArray;
|
5304 | const Il = openapi_parser_t(kl.exports = _l);
|
5305 | var Tl = { exports: {} }, Rl = ge, Fl = openapi_parser_o, Nl = tn, Ml = vi, Dl = openapi_parser_H, Ul = Ee, Ll = Te, Cl = openapi_parser_z, $l = Hn, Bl = or, ql = uo, Gl = ta("slice"), Wl = Bl("species"), zl = Fl.Array, Jl = Math.max;
|
5306 | Rl({ target: "Array", proto: true, forced: !Gl }, { slice: function(t9, r2) {
|
5307 | var e2, n2, o2, i2 = Cl(this), u2 = Ll(i2), a2 = Ul(t9, u2), f2 = Ul(void 0 === r2 ? u2 : r2, u2);
|
5308 | if (Nl(i2) && (e2 = i2.constructor, (Ml(e2) && (e2 === zl || Nl(e2.prototype)) || Dl(e2) && null === (e2 = e2[Wl])) && (e2 = void 0), e2 === zl || void 0 === e2))
|
5309 | return ql(i2, a2, f2);
|
5310 | for (n2 = new (void 0 === e2 ? zl : e2)(Jl(f2 - a2, 0)), o2 = 0; a2 < f2; a2++, o2++)
|
5311 | a2 in i2 && $l(n2, o2, i2[a2]);
|
5312 | return n2.length = o2, n2;
|
5313 | } });
|
5314 | var Hl = na("Array").slice, Vl = tt, Yl = Hl, Ql = Array.prototype, Kl = function(t9) {
|
5315 | var r2 = t9.slice;
|
5316 | return t9 === Ql || Vl(Ql, t9) && r2 === Ql.slice ? Yl : r2;
|
5317 | };
|
5318 | const Xl = openapi_parser_t(Tl.exports = Kl);
|
5319 | var Zl = { exports: {} }, tp = openapi_parser_A, rp = Qr, ep = Et, np = function(t9, r2, e2) {
|
5320 | var n2, o2;
|
5321 | rp(t9);
|
5322 | try {
|
5323 | if (!(n2 = ep(t9, "return"))) {
|
5324 | if ("throw" === r2)
|
5325 | throw e2;
|
5326 | return e2;
|
5327 | }
|
5328 | n2 = tp(n2, t9);
|
5329 | } catch (t10) {
|
5330 | o2 = true, n2 = t10;
|
5331 | }
|
5332 | if ("throw" === r2)
|
5333 | throw e2;
|
5334 | if (o2)
|
5335 | throw n2;
|
5336 | return rp(n2), e2;
|
5337 | }, op = Qr, ip = np, up = Ea, ap = or("iterator"), fp = Array.prototype, cp = function(t9) {
|
5338 | return void 0 !== t9 && (up.Array === t9 || fp[ap] === t9);
|
5339 | }, sp = openapi_parser_A, lp = St, pp = Qr, vp = wt, hp = El, dp = openapi_parser_o.TypeError, yp = function(t9, r2) {
|
5340 | var e2 = arguments.length < 2 ? hp(t9) : r2;
|
5341 | if (lp(e2))
|
5342 | return pp(sp(e2, t9));
|
5343 | throw dp(vp(t9) + " is not iterable");
|
5344 | }, bp = Gr, mp = openapi_parser_A, gp = Ct, wp = function(t9, r2, e2, n2) {
|
5345 | try {
|
5346 | return n2 ? r2(op(e2)[0], e2[1]) : r2(e2);
|
5347 | } catch (r3) {
|
5348 | ip(t9, "throw", r3);
|
5349 | }
|
5350 | }, jp = cp, Op = vi, Ap = Te, Sp = Hn, xp = yp, Ep = El, Pp = openapi_parser_o.Array, kp = or("iterator"), _p = false;
|
5351 | try {
|
5352 | var Ip = 0, Tp = { next: function() {
|
5353 | return { done: !!Ip++ };
|
5354 | }, return: function() {
|
5355 | _p = true;
|
5356 | } };
|
5357 | Tp[kp] = function() {
|
5358 | return this;
|
5359 | }, Array.from(Tp, function() {
|
5360 | throw 2;
|
5361 | });
|
5362 | } catch (t9) {
|
5363 | }
|
5364 | var Rp = function(t9, r2) {
|
5365 | if (!r2 && !_p)
|
5366 | return false;
|
5367 | var e2 = false;
|
5368 | try {
|
5369 | var n2 = {};
|
5370 | n2[kp] = function() {
|
5371 | return { next: function() {
|
5372 | return { done: e2 = true };
|
5373 | } };
|
5374 | }, t9(n2);
|
5375 | } catch (t10) {
|
5376 | }
|
5377 | return e2;
|
5378 | }, Fp = function(t9) {
|
5379 | var r2 = gp(t9), e2 = Op(this), n2 = arguments.length, o2 = n2 > 1 ? arguments[1] : void 0, i2 = void 0 !== o2;
|
5380 | i2 && (o2 = bp(o2, n2 > 2 ? arguments[2] : void 0));
|
5381 | var u2, a2, f2, c2, s2, l2, p2 = Ep(r2), v2 = 0;
|
5382 | if (!p2 || this == Pp && jp(p2))
|
5383 | for (u2 = Ap(r2), a2 = e2 ? new this(u2) : Pp(u2); u2 > v2; v2++)
|
5384 | l2 = i2 ? o2(r2[v2], v2) : r2[v2], Sp(a2, v2, l2);
|
5385 | else
|
5386 | for (s2 = (c2 = xp(r2, p2)).next, a2 = e2 ? new this() : []; !(f2 = mp(s2, c2)).done; v2++)
|
5387 | l2 = i2 ? wp(c2, o2, [f2.value, v2], true) : f2.value, Sp(a2, v2, l2);
|
5388 | return a2.length = v2, a2;
|
5389 | };
|
5390 | ge({ target: "Array", stat: true, forced: !Rp(function(t9) {
|
5391 | Array.from(t9);
|
5392 | }) }, { from: Fp });
|
5393 | var Np = openapi_parser_V.Array.from;
|
5394 | const Mp = openapi_parser_t(Zl.exports = Np);
|
5395 | function Dp(t9, r2) {
|
5396 | (null == r2 || r2 > t9.length) && (r2 = t9.length);
|
5397 | for (var e2 = 0, n2 = new Array(r2); e2 < r2; e2++)
|
5398 | n2[e2] = t9[e2];
|
5399 | return n2;
|
5400 | }
|
5401 | function Up(t9, r2) {
|
5402 | var e2;
|
5403 | if (t9) {
|
5404 | if ("string" == typeof t9)
|
5405 | return Dp(t9, r2);
|
5406 | var n2 = Xl(e2 = Object.prototype.toString.call(t9)).call(e2, 8, -1);
|
5407 | return "Object" === n2 && t9.constructor && (n2 = t9.constructor.name), "Map" === n2 || "Set" === n2 ? Mp(t9) : "Arguments" === n2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2) ? Dp(t9, r2) : void 0;
|
5408 | }
|
5409 | }
|
5410 | function Lp(t9, r2) {
|
5411 | var e2 = void 0 !== ul && Pl(t9) || t9["@@iterator"];
|
5412 | if (!e2) {
|
5413 | if (Il(t9) || (e2 = Up(t9)) || r2 && t9 && "number" == typeof t9.length) {
|
5414 | e2 && (t9 = e2);
|
5415 | var n2 = 0, o2 = function() {
|
5416 | };
|
5417 | return { s: o2, n: function() {
|
5418 | return n2 >= t9.length ? { done: true } : { done: false, value: t9[n2++] };
|
5419 | }, e: function(t10) {
|
5420 | throw t10;
|
5421 | }, f: o2 };
|
5422 | }
|
5423 | throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
5424 | }
|
5425 | var i2, u2 = true, a2 = false;
|
5426 | return { s: function() {
|
5427 | e2 = e2.call(t9);
|
5428 | }, n: function() {
|
5429 | var t10 = e2.next();
|
5430 | return u2 = t10.done, t10;
|
5431 | }, e: function(t10) {
|
5432 | a2 = true, i2 = t10;
|
5433 | }, f: function() {
|
5434 | try {
|
5435 | u2 || null == e2.return || e2.return();
|
5436 | } finally {
|
5437 | if (a2)
|
5438 | throw i2;
|
5439 | }
|
5440 | } };
|
5441 | }
|
5442 | var Cp = { exports: {} }, $p = co.f("iterator");
|
5443 | const Bp = openapi_parser_t(Cp.exports = $p);
|
5444 | function qp(t9) {
|
5445 | return qp = "function" == typeof ul && "symbol" == typeof Bp ? function(t10) {
|
5446 | return typeof t10;
|
5447 | } : function(t10) {
|
5448 | return t10 && "function" == typeof ul && t10.constructor === ul && t10 !== ul.prototype ? "symbol" : typeof t10;
|
5449 | }, qp(t9);
|
5450 | }
|
5451 | function Gp(t9, r2) {
|
5452 | return function(t10) {
|
5453 | if (Il(t10))
|
5454 | return t10;
|
5455 | }(t9) || function(t10, r3) {
|
5456 | var e2 = null == t10 ? null : void 0 !== ul && Pl(t10) || t10["@@iterator"];
|
5457 | if (null != e2) {
|
5458 | var n2, o2, i2 = [], u2 = true, a2 = false;
|
5459 | try {
|
5460 | for (e2 = e2.call(t10); !(u2 = (n2 = e2.next()).done) && (i2.push(n2.value), !r3 || i2.length !== r3); u2 = true)
|
5461 | ;
|
5462 | } catch (t11) {
|
5463 | a2 = true, o2 = t11;
|
5464 | } finally {
|
5465 | try {
|
5466 | u2 || null == e2.return || e2.return();
|
5467 | } finally {
|
5468 | if (a2)
|
5469 | throw o2;
|
5470 | }
|
5471 | }
|
5472 | return i2;
|
5473 | }
|
5474 | }(t9, r2) || Up(t9, r2) || function() {
|
5475 | throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
5476 | }();
|
5477 | }
|
5478 | var Wp = { exports: {} }, zp = qt, Jp = ic, Hp = openapi_parser_g, Vp = Wr, Yp = openapi_parser_b("".replace), Qp = String(Error("zxcasd").stack), Kp = /\n\s*at [^:]*:[^\n]*/, Xp = Kp.test(Qp), Zp = openapi_parser_H, tv = ae, rv = Gr, ev = openapi_parser_A, nv = Qr, ov = wt, iv = cp, uv = Te, av = tt, fv = yp, cv = El, sv = np, lv = openapi_parser_o.TypeError, pv = function(t9, r2) {
|
5479 | this.stopped = t9, this.result = r2;
|
5480 | }, vv = pv.prototype, hv = function(t9, r2, e2) {
|
5481 | var n2, o2, i2, u2, a2, f2, c2, s2 = e2 && e2.that, l2 = !(!e2 || !e2.AS_ENTRIES), p2 = !(!e2 || !e2.IS_ITERATOR), v2 = !(!e2 || !e2.INTERRUPTED), h2 = rv(r2, s2), d2 = function(t10) {
|
5482 | return n2 && sv(n2, "normal", t10), new pv(true, t10);
|
5483 | }, y2 = function(t10) {
|
5484 | return l2 ? (nv(t10), v2 ? h2(t10[0], t10[1], d2) : h2(t10[0], t10[1])) : v2 ? h2(t10, d2) : h2(t10);
|
5485 | };
|
5486 | if (p2)
|
5487 | n2 = t9;
|
5488 | else {
|
5489 | if (!(o2 = cv(t9)))
|
5490 | throw lv(ov(t9) + " is not iterable");
|
5491 | if (iv(o2)) {
|
5492 | for (i2 = 0, u2 = uv(t9); u2 > i2; i2++)
|
5493 | if ((a2 = y2(t9[i2])) && av(vv, a2))
|
5494 | return a2;
|
5495 | return new pv(false);
|
5496 | }
|
5497 | n2 = fv(t9, o2);
|
5498 | }
|
5499 | for (f2 = n2.next; !(c2 = ev(f2, n2)).done; ) {
|
5500 | try {
|
5501 | a2 = y2(c2.value);
|
5502 | } catch (t10) {
|
5503 | sv(n2, "throw", t10);
|
5504 | }
|
5505 | if ("object" == typeof a2 && a2 && av(vv, a2))
|
5506 | return a2;
|
5507 | }
|
5508 | return new pv(false);
|
5509 | }, dv = hn, yv = openapi_parser_I, bv = !openapi_parser_i(function() {
|
5510 | var t9 = Error("a");
|
5511 | return !("stack" in t9) || (Object.defineProperty(t9, "stack", yv(1, 7)), 7 !== t9.stack);
|
5512 | }), mv = ge, gv = openapi_parser_o, wv = tt, jv = qa, Ov = vf, Av = function(t9, r2, e2) {
|
5513 | for (var n2 = Jp(r2), o2 = Vp.f, i2 = Hp.f, u2 = 0; u2 < n2.length; u2++) {
|
5514 | var a2 = n2[u2];
|
5515 | zp(t9, a2) || e2 && zp(e2, a2) || o2(t9, a2, i2(r2, a2));
|
5516 | }
|
5517 | }, Sv = Cn, xv = ae, Ev = openapi_parser_I, Pv = function(t9, r2) {
|
5518 | if (Xp && "string" == typeof t9)
|
5519 | for (; r2--; )
|
5520 | t9 = Yp(t9, Kp, "");
|
5521 | return t9;
|
5522 | }, kv = function(t9, r2) {
|
5523 | Zp(r2) && "cause" in r2 && tv(t9, "cause", r2.cause);
|
5524 | }, _v = hv, Iv = function(t9, r2) {
|
5525 | return void 0 === t9 ? arguments.length < 2 ? "" : r2 : dv(t9);
|
5526 | }, Tv = bv, Rv = or("toStringTag"), Fv = gv.Error, Nv = [].push, Mv = function(t9, r2) {
|
5527 | var e2, n2 = arguments.length > 2 ? arguments[2] : void 0, o2 = wv(Dv, this);
|
5528 | Ov ? e2 = Ov(new Fv(), o2 ? jv(this) : Dv) : (e2 = o2 ? this : Sv(Dv), xv(e2, Rv, "Error")), void 0 !== r2 && xv(e2, "message", Iv(r2)), Tv && xv(e2, "stack", Pv(e2.stack, 1)), kv(e2, n2);
|
5529 | var i2 = [];
|
5530 | return _v(t9, Nv, { that: i2 }), xv(e2, "errors", i2), e2;
|
5531 | };
|
5532 | Ov ? Ov(Mv, Fv) : Av(Mv, Fv, { name: true });
|
5533 | var Dv = Mv.prototype = Sv(Fv.prototype, { constructor: Ev(1, Mv), message: Ev(1, ""), name: Ev(1, "AggregateError") });
|
5534 | mv({ global: true }, { AggregateError: Mv });
|
5535 | var Uv, Lv, Cv, $v, Bv = openapi_parser_o.Promise, qv = fo, Gv = function(t9, r2, e2) {
|
5536 | for (var n2 in r2)
|
5537 | e2 && e2.unsafe && t9[n2] ? t9[n2] = r2[n2] : qv(t9, n2, r2[n2], e2);
|
5538 | return t9;
|
5539 | }, Wv = openapi_parser_Z, zv = Wr, Jv = openapi_parser_w, Hv = or("species"), Vv = tt, Yv = openapi_parser_o.TypeError, Qv = function(t9, r2) {
|
5540 | if (Vv(r2, t9))
|
5541 | return t9;
|
5542 | throw Yv("Incorrect invocation");
|
5543 | }, Kv = vi, Xv = wt, Zv = openapi_parser_o.TypeError, th = Qr, rh = function(t9) {
|
5544 | if (Kv(t9))
|
5545 | return t9;
|
5546 | throw Zv(Xv(t9) + " is not a constructor");
|
5547 | }, eh = or("species"), nh = function(t9, r2) {
|
5548 | var e2, n2 = th(t9).constructor;
|
5549 | return void 0 === n2 || null == (e2 = th(n2)[eh]) ? r2 : rh(e2);
|
5550 | }, oh = openapi_parser_o.TypeError, ih = function(t9, r2) {
|
5551 | if (t9 < r2)
|
5552 | throw oh("Not enough arguments");
|
5553 | return t9;
|
5554 | }, uh = /(?:ipad|iphone|ipod).*applewebkit/i.test(rt), ah = "process" == openapi_parser_N(openapi_parser_o.process), fh = openapi_parser_o, ch = openapi_parser_l, sh = Gr, lh = openapi_parser_m, ph = qt, vh = openapi_parser_i, hh = An, dh = uo, yh = gr, bh = ih, mh = uh, gh = ah, wh = fh.setImmediate, jh = fh.clearImmediate, Oh = fh.process, Ah = fh.Dispatch, Sh = fh.Function, xh = fh.MessageChannel, Eh = fh.String, Ph = 0, kh = {};
|
5555 | try {
|
5556 | Uv = fh.location;
|
5557 | } catch (t9) {
|
5558 | }
|
5559 | var _h = function(t9) {
|
5560 | if (ph(kh, t9)) {
|
5561 | var r2 = kh[t9];
|
5562 | delete kh[t9], r2();
|
5563 | }
|
5564 | }, Ih = function(t9) {
|
5565 | return function() {
|
5566 | _h(t9);
|
5567 | };
|
5568 | }, Th = function(t9) {
|
5569 | _h(t9.data);
|
5570 | }, Rh = function(t9) {
|
5571 | fh.postMessage(Eh(t9), Uv.protocol + "//" + Uv.host);
|
5572 | };
|
5573 | wh && jh || (wh = function(t9) {
|
5574 | bh(arguments.length, 1);
|
5575 | var r2 = lh(t9) ? t9 : Sh(t9), e2 = dh(arguments, 1);
|
5576 | return kh[++Ph] = function() {
|
5577 | ch(r2, void 0, e2);
|
5578 | }, Lv(Ph), Ph;
|
5579 | }, jh = function(t9) {
|
5580 | delete kh[t9];
|
5581 | }, gh ? Lv = function(t9) {
|
5582 | Oh.nextTick(Ih(t9));
|
5583 | } : Ah && Ah.now ? Lv = function(t9) {
|
5584 | Ah.now(Ih(t9));
|
5585 | } : xh && !mh ? ($v = (Cv = new xh()).port2, Cv.port1.onmessage = Th, Lv = sh($v.postMessage, $v)) : fh.addEventListener && lh(fh.postMessage) && !fh.importScripts && Uv && "file:" !== Uv.protocol && !vh(Rh) ? (Lv = Rh, fh.addEventListener("message", Th, false)) : Lv = "onreadystatechange" in yh("script") ? function(t9) {
|
5586 | hh.appendChild(yh("script")).onreadystatechange = function() {
|
5587 | hh.removeChild(this), _h(t9);
|
5588 | };
|
5589 | } : function(t9) {
|
5590 | setTimeout(Ih(t9), 0);
|
5591 | });
|
5592 | var Fh, Nh, Mh, Dh, Uh, Lh, Ch, $h, Bh = { set: wh, clear: jh }, qh = openapi_parser_o, Gh = /ipad|iphone|ipod/i.test(rt) && void 0 !== qh.Pebble, Wh = /web0s(?!.*chrome)/i.test(rt), zh = openapi_parser_o, Jh = Gr, Hh = openapi_parser_g.f, Vh = Bh.set, Yh = uh, Qh = Gh, Kh = Wh, Xh = ah, Zh = zh.MutationObserver || zh.WebKitMutationObserver, td = zh.document, rd = zh.process, ed = zh.Promise, nd = Hh(zh, "queueMicrotask"), od = nd && nd.value;
|
5593 | od || (Fh = function() {
|
5594 | var t9, r2;
|
5595 | for (Xh && (t9 = rd.domain) && t9.exit(); Nh; ) {
|
5596 | r2 = Nh.fn, Nh = Nh.next;
|
5597 | try {
|
5598 | r2();
|
5599 | } catch (t10) {
|
5600 | throw Nh ? Dh() : Mh = void 0, t10;
|
5601 | }
|
5602 | }
|
5603 | Mh = void 0, t9 && t9.enter();
|
5604 | }, Yh || Xh || Kh || !Zh || !td ? !Qh && ed && ed.resolve ? ((Ch = ed.resolve(void 0)).constructor = ed, $h = Jh(Ch.then, Ch), Dh = function() {
|
5605 | $h(Fh);
|
5606 | }) : Xh ? Dh = function() {
|
5607 | rd.nextTick(Fh);
|
5608 | } : (Vh = Jh(Vh, zh), Dh = function() {
|
5609 | Vh(Fh);
|
5610 | }) : (Uh = true, Lh = td.createTextNode(""), new Zh(Fh).observe(Lh, { characterData: true }), Dh = function() {
|
5611 | Lh.data = Uh = !Uh;
|
5612 | }));
|
5613 | var id = od || function(t9) {
|
5614 | var r2 = { fn: t9, next: void 0 };
|
5615 | Mh && (Mh.next = r2), Nh || (Nh = r2, Dh()), Mh = r2;
|
5616 | }, ud = {}, ad = St, fd = function(t9) {
|
5617 | var r2, e2;
|
5618 | this.promise = new t9(function(t10, n2) {
|
5619 | if (void 0 !== r2 || void 0 !== e2)
|
5620 | throw TypeError("Bad Promise constructor");
|
5621 | r2 = t10, e2 = n2;
|
5622 | }), this.resolve = ad(r2), this.reject = ad(e2);
|
5623 | };
|
5624 | ud.f = function(t9) {
|
5625 | return new fd(t9);
|
5626 | };
|
5627 | var cd = Qr, sd = openapi_parser_H, ld = ud, pd = function(t9, r2) {
|
5628 | if (cd(t9), sd(r2) && r2.constructor === t9)
|
5629 | return r2;
|
5630 | var e2 = ld.f(t9);
|
5631 | return (0, e2.resolve)(r2), e2.promise;
|
5632 | }, vd = openapi_parser_o, hd = function(t9) {
|
5633 | try {
|
5634 | return { error: false, value: t9() };
|
5635 | } catch (t10) {
|
5636 | return { error: true, value: t10 };
|
5637 | }
|
5638 | }, dd = function() {
|
5639 | this.head = null, this.tail = null;
|
5640 | };
|
5641 | dd.prototype = { add: function(t9) {
|
5642 | var r2 = { item: t9, next: null };
|
5643 | this.head ? this.tail.next = r2 : this.head = r2, this.tail = r2;
|
5644 | }, get: function() {
|
5645 | var t9 = this.head;
|
5646 | if (t9)
|
5647 | return this.head = t9.next, this.tail === t9 && (this.tail = null), t9.item;
|
5648 | } };
|
5649 | var yd, bd, md, gd = "object" == typeof window, wd = ge, jd = openapi_parser_o, Od = openapi_parser_Z, Ad = openapi_parser_A, Sd = Bv, xd = Gv, Ed = xo, Pd = function(t9) {
|
5650 | var r2 = Wv(t9), e2 = zv.f;
|
5651 | Jv && r2 && !r2[Hv] && e2(r2, Hv, { configurable: true, get: function() {
|
5652 | return this;
|
5653 | } });
|
5654 | }, kd = St, _d = openapi_parser_m, Id = openapi_parser_H, Td = Qv, Rd = Ro, Fd = hv, Nd = Rp, Md = nh, Dd = Bh.set, Ud = id, Ld = pd, Cd = function(t9, r2) {
|
5655 | var e2 = vd.console;
|
5656 | e2 && e2.error && (1 == arguments.length ? e2.error(t9) : e2.error(t9, r2));
|
5657 | }, $d = ud, Bd = hd, qd = dd, Gd = Zo, Wd = Cr, zd = gd, Jd = ah, Hd = ft, Vd = or("species"), Yd = "Promise", Qd = Gd.getterFor(Yd), Kd = Gd.set, Xd = Gd.getterFor(Yd), Zd = Sd && Sd.prototype, ty = Sd, ry = Zd, ey = jd.TypeError, ny = jd.document, oy = jd.process, iy = $d.f, uy = iy, ay = !!(ny && ny.createEvent && jd.dispatchEvent), fy = _d(jd.PromiseRejectionEvent), cy = Wd(Yd, function() {
|
5658 | var t9 = Rd(ty), r2 = t9 !== String(ty);
|
5659 | if (!r2 && 66 === Hd)
|
5660 | return true;
|
5661 | if (!ry.finally)
|
5662 | return true;
|
5663 | if (Hd >= 51 && /native code/.test(t9))
|
5664 | return false;
|
5665 | var e2 = new ty(function(t10) {
|
5666 | t10(1);
|
5667 | }), n2 = function(t10) {
|
5668 | t10(function() {
|
5669 | }, function() {
|
5670 | });
|
5671 | };
|
5672 | return (e2.constructor = {})[Vd] = n2, !(e2.then(function() {
|
5673 | }) instanceof n2) || !r2 && zd && !fy;
|
5674 | }), sy = cy || !Nd(function(t9) {
|
5675 | ty.all(t9).catch(function() {
|
5676 | });
|
5677 | }), ly = function(t9) {
|
5678 | var r2;
|
5679 | return !(!Id(t9) || !_d(r2 = t9.then)) && r2;
|
5680 | }, py = function(t9, r2) {
|
5681 | var e2, n2, o2, i2 = r2.value, u2 = 1 == r2.state, a2 = u2 ? t9.ok : t9.fail, f2 = t9.resolve, c2 = t9.reject, s2 = t9.domain;
|
5682 | try {
|
5683 | a2 ? (u2 || (2 === r2.rejection && by(r2), r2.rejection = 1), true === a2 ? e2 = i2 : (s2 && s2.enter(), e2 = a2(i2), s2 && (s2.exit(), o2 = true)), e2 === t9.promise ? c2(ey("Promise-chain cycle")) : (n2 = ly(e2)) ? Ad(n2, e2, f2, c2) : f2(e2)) : c2(i2);
|
5684 | } catch (t10) {
|
5685 | s2 && !o2 && s2.exit(), c2(t10);
|
5686 | }
|
5687 | }, vy = function(t9, r2) {
|
5688 | t9.notified || (t9.notified = true, Ud(function() {
|
5689 | for (var e2, n2 = t9.reactions; e2 = n2.get(); )
|
5690 | py(e2, t9);
|
5691 | t9.notified = false, r2 && !t9.rejection && dy(t9);
|
5692 | }));
|
5693 | }, hy = function(t9, r2, e2) {
|
5694 | var n2, o2;
|
5695 | ay ? ((n2 = ny.createEvent("Event")).promise = r2, n2.reason = e2, n2.initEvent(t9, false, true), jd.dispatchEvent(n2)) : n2 = { promise: r2, reason: e2 }, !fy && (o2 = jd["on" + t9]) ? o2(n2) : "unhandledrejection" === t9 && Cd("Unhandled promise rejection", e2);
|
5696 | }, dy = function(t9) {
|
5697 | Ad(Dd, jd, function() {
|
5698 | var r2, e2 = t9.facade, n2 = t9.value;
|
5699 | if (yy(t9) && (r2 = Bd(function() {
|
5700 | Jd ? oy.emit("unhandledRejection", n2, e2) : hy("unhandledrejection", e2, n2);
|
5701 | }), t9.rejection = Jd || yy(t9) ? 2 : 1, r2.error))
|
5702 | throw r2.value;
|
5703 | });
|
5704 | }, yy = function(t9) {
|
5705 | return 1 !== t9.rejection && !t9.parent;
|
5706 | }, by = function(t9) {
|
5707 | Ad(Dd, jd, function() {
|
5708 | var r2 = t9.facade;
|
5709 | Jd ? oy.emit("rejectionHandled", r2) : hy("rejectionhandled", r2, t9.value);
|
5710 | });
|
5711 | }, my = function(t9, r2, e2) {
|
5712 | return function(n2) {
|
5713 | t9(r2, n2, e2);
|
5714 | };
|
5715 | }, gy = function(t9, r2, e2) {
|
5716 | t9.done || (t9.done = true, e2 && (t9 = e2), t9.value = r2, t9.state = 2, vy(t9, true));
|
5717 | }, wy = function(t9, r2, e2) {
|
5718 | if (!t9.done) {
|
5719 | t9.done = true, e2 && (t9 = e2);
|
5720 | try {
|
5721 | if (t9.facade === r2)
|
5722 | throw ey("Promise can't be resolved itself");
|
5723 | var n2 = ly(r2);
|
5724 | n2 ? Ud(function() {
|
5725 | var e3 = { done: false };
|
5726 | try {
|
5727 | Ad(n2, r2, my(wy, e3, t9), my(gy, e3, t9));
|
5728 | } catch (r3) {
|
5729 | gy(e3, r3, t9);
|
5730 | }
|
5731 | }) : (t9.value = r2, t9.state = 1, vy(t9, false));
|
5732 | } catch (r3) {
|
5733 | gy({ done: false }, r3, t9);
|
5734 | }
|
5735 | }
|
5736 | };
|
5737 | cy && (ry = (ty = function(t9) {
|
5738 | Td(this, ry), kd(t9), Ad(yd, this);
|
5739 | var r2 = Qd(this);
|
5740 | try {
|
5741 | t9(my(wy, r2), my(gy, r2));
|
5742 | } catch (t10) {
|
5743 | gy(r2, t10);
|
5744 | }
|
5745 | }).prototype, (yd = function(t9) {
|
5746 | Kd(this, { type: Yd, done: false, notified: false, parent: false, reactions: new qd(), rejection: false, state: 0, value: void 0 });
|
5747 | }).prototype = xd(ry, { then: function(t9, r2) {
|
5748 | var e2 = Xd(this), n2 = iy(Md(this, ty));
|
5749 | return e2.parent = true, n2.ok = !_d(t9) || t9, n2.fail = _d(r2) && r2, n2.domain = Jd ? oy.domain : void 0, 0 == e2.state ? e2.reactions.add(n2) : Ud(function() {
|
5750 | py(n2, e2);
|
5751 | }), n2.promise;
|
5752 | }, catch: function(t9) {
|
5753 | return this.then(void 0, t9);
|
5754 | } }), bd = function() {
|
5755 | var t9 = new yd(), r2 = Qd(t9);
|
5756 | this.promise = t9, this.resolve = my(wy, r2), this.reject = my(gy, r2);
|
5757 | }, $d.f = iy = function(t9) {
|
5758 | return t9 === ty || t9 === md ? new bd(t9) : uy(t9);
|
5759 | }), wd({ global: true, wrap: true, forced: cy }, { Promise: ty }), Ed(ty, Yd, false, true), Pd(Yd), md = Od(Yd), wd({ target: Yd, stat: true, forced: cy }, { reject: function(t9) {
|
5760 | var r2 = iy(this);
|
5761 | return Ad(r2.reject, void 0, t9), r2.promise;
|
5762 | } }), wd({ target: Yd, stat: true, forced: true }, { resolve: function(t9) {
|
5763 | return Ld(this === md ? ty : this, t9);
|
5764 | } }), wd({ target: Yd, stat: true, forced: sy }, { all: function(t9) {
|
5765 | var r2 = this, e2 = iy(r2), n2 = e2.resolve, o2 = e2.reject, i2 = Bd(function() {
|
5766 | var e3 = kd(r2.resolve), i3 = [], u2 = 0, a2 = 1;
|
5767 | Fd(t9, function(t10) {
|
5768 | var f2 = u2++, c2 = false;
|
5769 | a2++, Ad(e3, r2, t10).then(function(t11) {
|
5770 | c2 || (c2 = true, i3[f2] = t11, --a2 || n2(i3));
|
5771 | }, o2);
|
5772 | }), --a2 || n2(i3);
|
5773 | });
|
5774 | return i2.error && o2(i2.value), e2.promise;
|
5775 | }, race: function(t9) {
|
5776 | var r2 = this, e2 = iy(r2), n2 = e2.reject, o2 = Bd(function() {
|
5777 | var o3 = kd(r2.resolve);
|
5778 | Fd(t9, function(t10) {
|
5779 | Ad(o3, r2, t10).then(e2.resolve, n2);
|
5780 | });
|
5781 | });
|
5782 | return o2.error && n2(o2.value), e2.promise;
|
5783 | } });
|
5784 | var jy = openapi_parser_A, Oy = St, Ay = ud, Sy = hd, xy = hv;
|
5785 | ge({ target: "Promise", stat: true }, { allSettled: function(t9) {
|
5786 | var r2 = this, e2 = Ay.f(r2), n2 = e2.resolve, o2 = e2.reject, i2 = Sy(function() {
|
5787 | var e3 = Oy(r2.resolve), o3 = [], i3 = 0, u2 = 1;
|
5788 | xy(t9, function(t10) {
|
5789 | var a2 = i3++, f2 = false;
|
5790 | u2++, jy(e3, r2, t10).then(function(t11) {
|
5791 | f2 || (f2 = true, o3[a2] = { status: "fulfilled", value: t11 }, --u2 || n2(o3));
|
5792 | }, function(t11) {
|
5793 | f2 || (f2 = true, o3[a2] = { status: "rejected", reason: t11 }, --u2 || n2(o3));
|
5794 | });
|
5795 | }), --u2 || n2(o3);
|
5796 | });
|
5797 | return i2.error && o2(i2.value), e2.promise;
|
5798 | } });
|
5799 | var Ey = St, Py = openapi_parser_Z, ky = openapi_parser_A, _y = ud, Iy = hd, Ty = hv;
|
5800 | ge({ target: "Promise", stat: true }, { any: function(t9) {
|
5801 | var r2 = this, e2 = Py("AggregateError"), n2 = _y.f(r2), o2 = n2.resolve, i2 = n2.reject, u2 = Iy(function() {
|
5802 | var n3 = Ey(r2.resolve), u3 = [], a2 = 0, f2 = 1, c2 = false;
|
5803 | Ty(t9, function(t10) {
|
5804 | var s2 = a2++, l2 = false;
|
5805 | f2++, ky(n3, r2, t10).then(function(t11) {
|
5806 | l2 || c2 || (c2 = true, o2(t11));
|
5807 | }, function(t11) {
|
5808 | l2 || c2 || (l2 = true, u3[s2] = t11, --f2 || i2(new e2(u3, "No one promise resolved")));
|
5809 | });
|
5810 | }), --f2 || i2(new e2(u3, "No one promise resolved"));
|
5811 | });
|
5812 | return u2.error && i2(u2.value), n2.promise;
|
5813 | } });
|
5814 | var Ry = Bv, Fy = openapi_parser_Z, Ny = openapi_parser_m, My = nh, Dy = pd;
|
5815 | ge({ target: "Promise", proto: true, real: true, forced: !!Ry && openapi_parser_i(function() {
|
5816 | Ry.prototype.finally.call({ then: function() {
|
5817 | } }, function() {
|
5818 | });
|
5819 | }) }, { finally: function(t9) {
|
5820 | var r2 = My(this, Fy("Promise")), e2 = Ny(t9);
|
5821 | return this.then(e2 ? function(e3) {
|
5822 | return Dy(r2, t9()).then(function() {
|
5823 | return e3;
|
5824 | });
|
5825 | } : t9, e2 ? function(e3) {
|
5826 | return Dy(r2, t9()).then(function() {
|
5827 | throw e3;
|
5828 | });
|
5829 | } : t9);
|
5830 | } });
|
5831 | var Uy = openapi_parser_V.Promise, Ly = Uy, Cy = ud, $y = hd;
|
5832 | ge({ target: "Promise", stat: true, forced: true }, { try: function(t9) {
|
5833 | var r2 = Cy.f(this), e2 = $y(t9);
|
5834 | return (e2.error ? r2.reject : r2.resolve)(e2.value), r2.promise;
|
5835 | } });
|
5836 | const By = openapi_parser_t(Wp.exports = Ly);
|
5837 | function qy(t9, r2, e2, n2, o2, i2, u2) {
|
5838 | try {
|
5839 | var a2 = t9[i2](u2), f2 = a2.value;
|
5840 | } catch (t10) {
|
5841 | return void e2(t10);
|
5842 | }
|
5843 | a2.done ? r2(f2) : By.resolve(f2).then(n2, o2);
|
5844 | }
|
5845 | function Gy(t9) {
|
5846 | return function() {
|
5847 | var r2 = this, e2 = arguments;
|
5848 | return new By(function(n2, o2) {
|
5849 | var i2 = t9.apply(r2, e2);
|
5850 | function u2(t10) {
|
5851 | qy(i2, n2, o2, u2, a2, "next", t10);
|
5852 | }
|
5853 | function a2(t10) {
|
5854 | qy(i2, n2, o2, u2, a2, "throw", t10);
|
5855 | }
|
5856 | u2(void 0);
|
5857 | });
|
5858 | };
|
5859 | }
|
5860 | var Wy = { exports: {} }, zy = { exports: {} };
|
5861 | !function(t9) {
|
5862 | var r2 = function(t10) {
|
5863 | var r3, e2 = Object.prototype, n2 = e2.hasOwnProperty, o2 = "function" == typeof Symbol ? Symbol : {}, i2 = o2.iterator || "@@iterator", u2 = o2.asyncIterator || "@@asyncIterator", a2 = o2.toStringTag || "@@toStringTag";
|
5864 | function f2(t11, r4, e3) {
|
5865 | return Object.defineProperty(t11, r4, { value: e3, enumerable: true, configurable: true, writable: true }), t11[r4];
|
5866 | }
|
5867 | try {
|
5868 | f2({}, "");
|
5869 | } catch (t11) {
|
5870 | f2 = function(t12, r4, e3) {
|
5871 | return t12[r4] = e3;
|
5872 | };
|
5873 | }
|
5874 | function c2(t11, r4, e3, n3) {
|
5875 | var o3 = r4 && r4.prototype instanceof y2 ? r4 : y2, i3 = Object.create(o3.prototype), u3 = new k2(n3 || []);
|
5876 | return i3._invoke = function(t12, r5, e4) {
|
5877 | var n4 = l2;
|
5878 | return function(o4, i4) {
|
5879 | if (n4 === v2)
|
5880 | throw new Error("Generator is already running");
|
5881 | if (n4 === h2) {
|
5882 | if ("throw" === o4)
|
5883 | throw i4;
|
5884 | return I2();
|
5885 | }
|
5886 | for (e4.method = o4, e4.arg = i4; ; ) {
|
5887 | var u4 = e4.delegate;
|
5888 | if (u4) {
|
5889 | var a3 = x2(u4, e4);
|
5890 | if (a3) {
|
5891 | if (a3 === d2)
|
5892 | continue;
|
5893 | return a3;
|
5894 | }
|
5895 | }
|
5896 | if ("next" === e4.method)
|
5897 | e4.sent = e4._sent = e4.arg;
|
5898 | else if ("throw" === e4.method) {
|
5899 | if (n4 === l2)
|
5900 | throw n4 = h2, e4.arg;
|
5901 | e4.dispatchException(e4.arg);
|
5902 | } else
|
5903 | "return" === e4.method && e4.abrupt("return", e4.arg);
|
5904 | n4 = v2;
|
5905 | var f3 = s2(t12, r5, e4);
|
5906 | if ("normal" === f3.type) {
|
5907 | if (n4 = e4.done ? h2 : p2, f3.arg === d2)
|
5908 | continue;
|
5909 | return { value: f3.arg, done: e4.done };
|
5910 | }
|
5911 | "throw" === f3.type && (n4 = h2, e4.method = "throw", e4.arg = f3.arg);
|
5912 | }
|
5913 | };
|
5914 | }(t11, e3, u3), i3;
|
5915 | }
|
5916 | function s2(t11, r4, e3) {
|
5917 | try {
|
5918 | return { type: "normal", arg: t11.call(r4, e3) };
|
5919 | } catch (t12) {
|
5920 | return { type: "throw", arg: t12 };
|
5921 | }
|
5922 | }
|
5923 | t10.wrap = c2;
|
5924 | var l2 = "suspendedStart", p2 = "suspendedYield", v2 = "executing", h2 = "completed", d2 = {};
|
5925 | function y2() {
|
5926 | }
|
5927 | function b2() {
|
5928 | }
|
5929 | function m2() {
|
5930 | }
|
5931 | var g2 = {};
|
5932 | f2(g2, i2, function() {
|
5933 | return this;
|
5934 | });
|
5935 | var w2 = Object.getPrototypeOf, j2 = w2 && w2(w2(_2([])));
|
5936 | j2 && j2 !== e2 && n2.call(j2, i2) && (g2 = j2);
|
5937 | var O2 = m2.prototype = y2.prototype = Object.create(g2);
|
5938 | function A2(t11) {
|
5939 | ["next", "throw", "return"].forEach(function(r4) {
|
5940 | f2(t11, r4, function(t12) {
|
5941 | return this._invoke(r4, t12);
|
5942 | });
|
5943 | });
|
5944 | }
|
5945 | function S2(t11, r4) {
|
5946 | function e3(o4, i3, u3, a3) {
|
5947 | var f3 = s2(t11[o4], t11, i3);
|
5948 | if ("throw" !== f3.type) {
|
5949 | var c3 = f3.arg, l3 = c3.value;
|
5950 | return l3 && "object" == typeof l3 && n2.call(l3, "__await") ? r4.resolve(l3.u).then(function(t12) {
|
5951 | e3("next", t12, u3, a3);
|
5952 | }, function(t12) {
|
5953 | e3("throw", t12, u3, a3);
|
5954 | }) : r4.resolve(l3).then(function(t12) {
|
5955 | c3.value = t12, u3(c3);
|
5956 | }, function(t12) {
|
5957 | return e3("throw", t12, u3, a3);
|
5958 | });
|
5959 | }
|
5960 | a3(f3.arg);
|
5961 | }
|
5962 | var o3;
|
5963 | this._invoke = function(t12, n3) {
|
5964 | function i3() {
|
5965 | return new r4(function(r5, o4) {
|
5966 | e3(t12, n3, r5, o4);
|
5967 | });
|
5968 | }
|
5969 | return o3 = o3 ? o3.then(i3, i3) : i3();
|
5970 | };
|
5971 | }
|
5972 | function x2(t11, e3) {
|
5973 | var n3 = t11.iterator[e3.method];
|
5974 | if (n3 === r3) {
|
5975 | if (e3.delegate = null, "throw" === e3.method) {
|
5976 | if (t11.iterator.return && (e3.method = "return", e3.arg = r3, x2(t11, e3), "throw" === e3.method))
|
5977 | return d2;
|
5978 | e3.method = "throw", e3.arg = new TypeError("The iterator does not provide a 'throw' method");
|
5979 | }
|
5980 | return d2;
|
5981 | }
|
5982 | var o3 = s2(n3, t11.iterator, e3.arg);
|
5983 | if ("throw" === o3.type)
|
5984 | return e3.method = "throw", e3.arg = o3.arg, e3.delegate = null, d2;
|
5985 | var i3 = o3.arg;
|
5986 | return i3 ? i3.done ? (e3[t11.resultName] = i3.value, e3.next = t11.nextLoc, "return" !== e3.method && (e3.method = "next", e3.arg = r3), e3.delegate = null, d2) : i3 : (e3.method = "throw", e3.arg = new TypeError("iterator result is not an object"), e3.delegate = null, d2);
|
5987 | }
|
5988 | function E2(t11) {
|
5989 | var r4 = { tryLoc: t11[0] };
|
5990 | 1 in t11 && (r4.catchLoc = t11[1]), 2 in t11 && (r4.finallyLoc = t11[2], r4.afterLoc = t11[3]), this.tryEntries.push(r4);
|
5991 | }
|
5992 | function P2(t11) {
|
5993 | var r4 = t11.completion || {};
|
5994 | r4.type = "normal", delete r4.arg, t11.completion = r4;
|
5995 | }
|
5996 | function k2(t11) {
|
5997 | this.tryEntries = [{ tryLoc: "root" }], t11.forEach(E2, this), this.reset(true);
|
5998 | }
|
5999 | function _2(t11) {
|
6000 | if (t11) {
|
6001 | var e3 = t11[i2];
|
6002 | if (e3)
|
6003 | return e3.call(t11);
|
6004 | if ("function" == typeof t11.next)
|
6005 | return t11;
|
6006 | if (!isNaN(t11.length)) {
|
6007 | var o3 = -1, u3 = function e4() {
|
6008 | for (; ++o3 < t11.length; )
|
6009 | if (n2.call(t11, o3))
|
6010 | return e4.value = t11[o3], e4.done = false, e4;
|
6011 | return e4.value = r3, e4.done = true, e4;
|
6012 | };
|
6013 | return u3.next = u3;
|
6014 | }
|
6015 | }
|
6016 | return { next: I2 };
|
6017 | }
|
6018 | function I2() {
|
6019 | return { value: r3, done: true };
|
6020 | }
|
6021 | return b2.prototype = m2, f2(O2, "constructor", m2), f2(m2, "constructor", b2), b2.displayName = f2(m2, a2, "GeneratorFunction"), t10.isGeneratorFunction = function(t11) {
|
6022 | var r4 = "function" == typeof t11 && t11.constructor;
|
6023 | return !!r4 && (r4 === b2 || "GeneratorFunction" === (r4.displayName || r4.name));
|
6024 | }, t10.mark = function(t11) {
|
6025 | return Object.setPrototypeOf ? Object.setPrototypeOf(t11, m2) : (t11.__proto__ = m2, f2(t11, a2, "GeneratorFunction")), t11.prototype = Object.create(O2), t11;
|
6026 | }, t10.awrap = function(t11) {
|
6027 | return { u: t11 };
|
6028 | }, A2(S2.prototype), f2(S2.prototype, u2, function() {
|
6029 | return this;
|
6030 | }), t10.AsyncIterator = S2, t10.async = function(r4, e3, n3, o3, i3) {
|
6031 | void 0 === i3 && (i3 = Promise);
|
6032 | var u3 = new S2(c2(r4, e3, n3, o3), i3);
|
6033 | return t10.isGeneratorFunction(e3) ? u3 : u3.next().then(function(t11) {
|
6034 | return t11.done ? t11.value : u3.next();
|
6035 | });
|
6036 | }, A2(O2), f2(O2, a2, "Generator"), f2(O2, i2, function() {
|
6037 | return this;
|
6038 | }), f2(O2, "toString", function() {
|
6039 | return "[object Generator]";
|
6040 | }), t10.keys = function(t11) {
|
6041 | var r4 = [];
|
6042 | for (var e3 in t11)
|
6043 | r4.push(e3);
|
6044 | return r4.reverse(), function e4() {
|
6045 | for (; r4.length; ) {
|
6046 | var n3 = r4.pop();
|
6047 | if (n3 in t11)
|
6048 | return e4.value = n3, e4.done = false, e4;
|
6049 | }
|
6050 | return e4.done = true, e4;
|
6051 | };
|
6052 | }, t10.values = _2, k2.prototype = { constructor: k2, reset: function(t11) {
|
6053 | if (this.prev = 0, this.next = 0, this.sent = this._sent = r3, this.done = false, this.delegate = null, this.method = "next", this.arg = r3, this.tryEntries.forEach(P2), !t11)
|
6054 | for (var e3 in this)
|
6055 | "t" === e3.charAt(0) && n2.call(this, e3) && !isNaN(+e3.slice(1)) && (this[e3] = r3);
|
6056 | }, stop: function() {
|
6057 | this.done = true;
|
6058 | var t11 = this.tryEntries[0].completion;
|
6059 | if ("throw" === t11.type)
|
6060 | throw t11.arg;
|
6061 | return this.rval;
|
6062 | }, dispatchException: function(t11) {
|
6063 | if (this.done)
|
6064 | throw t11;
|
6065 | var e3 = this;
|
6066 | function o3(n3, o4) {
|
6067 | return a3.type = "throw", a3.arg = t11, e3.next = n3, o4 && (e3.method = "next", e3.arg = r3), !!o4;
|
6068 | }
|
6069 | for (var i3 = this.tryEntries.length - 1; i3 >= 0; --i3) {
|
6070 | var u3 = this.tryEntries[i3], a3 = u3.completion;
|
6071 | if ("root" === u3.tryLoc)
|
6072 | return o3("end");
|
6073 | if (u3.tryLoc <= this.prev) {
|
6074 | var f3 = n2.call(u3, "catchLoc"), c3 = n2.call(u3, "finallyLoc");
|
6075 | if (f3 && c3) {
|
6076 | if (this.prev < u3.catchLoc)
|
6077 | return o3(u3.catchLoc, true);
|
6078 | if (this.prev < u3.finallyLoc)
|
6079 | return o3(u3.finallyLoc);
|
6080 | } else if (f3) {
|
6081 | if (this.prev < u3.catchLoc)
|
6082 | return o3(u3.catchLoc, true);
|
6083 | } else {
|
6084 | if (!c3)
|
6085 | throw new Error("try statement without catch or finally");
|
6086 | if (this.prev < u3.finallyLoc)
|
6087 | return o3(u3.finallyLoc);
|
6088 | }
|
6089 | }
|
6090 | }
|
6091 | }, abrupt: function(t11, r4) {
|
6092 | for (var e3 = this.tryEntries.length - 1; e3 >= 0; --e3) {
|
6093 | var o3 = this.tryEntries[e3];
|
6094 | if (o3.tryLoc <= this.prev && n2.call(o3, "finallyLoc") && this.prev < o3.finallyLoc) {
|
6095 | var i3 = o3;
|
6096 | break;
|
6097 | }
|
6098 | }
|
6099 | i3 && ("break" === t11 || "continue" === t11) && i3.tryLoc <= r4 && r4 <= i3.finallyLoc && (i3 = null);
|
6100 | var u3 = i3 ? i3.completion : {};
|
6101 | return u3.type = t11, u3.arg = r4, i3 ? (this.method = "next", this.next = i3.finallyLoc, d2) : this.complete(u3);
|
6102 | }, complete: function(t11, r4) {
|
6103 | if ("throw" === t11.type)
|
6104 | throw t11.arg;
|
6105 | return "break" === t11.type || "continue" === t11.type ? this.next = t11.arg : "return" === t11.type ? (this.rval = this.arg = t11.arg, this.method = "return", this.next = "end") : "normal" === t11.type && r4 && (this.next = r4), d2;
|
6106 | }, finish: function(t11) {
|
6107 | for (var r4 = this.tryEntries.length - 1; r4 >= 0; --r4) {
|
6108 | var e3 = this.tryEntries[r4];
|
6109 | if (e3.finallyLoc === t11)
|
6110 | return this.complete(e3.completion, e3.afterLoc), P2(e3), d2;
|
6111 | }
|
6112 | }, catch: function(t11) {
|
6113 | for (var r4 = this.tryEntries.length - 1; r4 >= 0; --r4) {
|
6114 | var e3 = this.tryEntries[r4];
|
6115 | if (e3.tryLoc === t11) {
|
6116 | var n3 = e3.completion;
|
6117 | if ("throw" === n3.type) {
|
6118 | var o3 = n3.arg;
|
6119 | P2(e3);
|
6120 | }
|
6121 | return o3;
|
6122 | }
|
6123 | }
|
6124 | throw new Error("illegal catch attempt");
|
6125 | }, delegateYield: function(t11, e3, n3) {
|
6126 | return this.delegate = { iterator: _2(t11), resultName: e3, nextLoc: n3 }, "next" === this.method && (this.arg = r3), d2;
|
6127 | } }, t10;
|
6128 | }(t9.exports);
|
6129 | try {
|
6130 | regeneratorRuntime = r2;
|
6131 | } catch (t10) {
|
6132 | "object" == typeof globalThis ? globalThis.regeneratorRuntime = r2 : Function("r", "regeneratorRuntime = r")(r2);
|
6133 | }
|
6134 | }(zy);
|
6135 | const Jy = openapi_parser_t(Wy.exports = zy.exports);
|
6136 | var Hy = { exports: {} }, Vy = De.includes;
|
6137 | ge({ target: "Array", proto: true }, { includes: function(t9) {
|
6138 | return Vy(this, t9, arguments.length > 1 ? arguments[1] : void 0);
|
6139 | } });
|
6140 | var Yy = na("Array").includes, Qy = ge, Ky = es, Xy = q, Zy = hn, tb = os, rb = openapi_parser_b("".indexOf);
|
6141 | Qy({ target: "String", proto: true, forced: !tb("includes") }, { includes: function(t9) {
|
6142 | return !!~rb(Zy(Xy(this)), Zy(Ky(t9)), arguments.length > 1 ? arguments[1] : void 0);
|
6143 | } });
|
6144 | var eb = na("String").includes, nb = tt, ob = Yy, ib = eb, ub = Array.prototype, ab = String.prototype;
|
6145 | const fb = openapi_parser_t(Hy.exports = function(t9) {
|
6146 | var r2 = t9.includes;
|
6147 | return t9 === ub || nb(ub, t9) && r2 === ub.includes ? ob : "string" == typeof t9 || t9 === ab || nb(ab, t9) && r2 === ab.includes ? ib : r2;
|
6148 | });
|
6149 | var cb = { exports: {} }, sb = na("Array").entries, lb = ln, pb = qt, vb = tt, hb = sb, db = Array.prototype, yb = { DOMTokenList: true, NodeList: true };
|
6150 | const bb = openapi_parser_t(cb.exports = function(t9) {
|
6151 | var r2 = t9.entries;
|
6152 | return t9 === db || vb(db, t9) && r2 === db.entries || pb(yb, lb(t9)) ? hb : r2;
|
6153 | });
|
6154 | var mb = { exports: {} };
|
6155 | const gb = openapi_parser_t(mb.exports = Np);
|
6156 | var wb = { exports: {} }, jb = ge, Ob = openapi_parser_Z, Ab = openapi_parser_l, Sb = openapi_parser_b, xb = openapi_parser_i, Eb = openapi_parser_o.Array, Pb = Ob("JSON", "stringify"), kb = Sb(/./.exec), _b = Sb("".charAt), Ib = Sb("".charCodeAt), Tb = Sb("".replace), Rb = Sb(1 .toString), Fb = /[\uD800-\uDFFF]/g, Nb = /^[\uD800-\uDBFF]$/, Mb = /^[\uDC00-\uDFFF]$/, Db = function(t9, r2, e2) {
|
6157 | var n2 = _b(e2, r2 - 1), o2 = _b(e2, r2 + 1);
|
6158 | return kb(Nb, t9) && !kb(Mb, o2) || kb(Mb, t9) && !kb(Nb, n2) ? "\\u" + Rb(Ib(t9, 0), 16) : t9;
|
6159 | }, Ub = xb(function() {
|
6160 | return '"\\udf06\\ud834"' !== Pb("\uDF06\uD834") || '"\\udead"' !== Pb("\uDEAD");
|
6161 | });
|
6162 | Pb && jb({ target: "JSON", stat: true, forced: Ub }, { stringify: function(t9, r2, e2) {
|
6163 | for (var n2 = 0, o2 = arguments.length, i2 = Eb(o2); n2 < o2; n2++)
|
6164 | i2[n2] = arguments[n2];
|
6165 | var u2 = Ab(Pb, null, i2);
|
6166 | return "string" == typeof u2 ? Tb(u2, Fb, Db) : u2;
|
6167 | } });
|
6168 | var Lb = openapi_parser_V, Cb = openapi_parser_l;
|
6169 | Lb.JSON || (Lb.JSON = { stringify: JSON.stringify });
|
6170 | const $b = openapi_parser_t(wb.exports = function(t9, r2, e2) {
|
6171 | return Cb(Lb.JSON.stringify, null, arguments);
|
6172 | });
|
6173 | var Bb = { exports: {} }, qb = _i.map;
|
6174 | ge({ target: "Array", proto: true, forced: !ta("map") }, { map: function(t9) {
|
6175 | return qb(this, t9, arguments.length > 1 ? arguments[1] : void 0);
|
6176 | } });
|
6177 | var Gb = na("Array").map, Wb = tt, zb = Gb, Jb = Array.prototype;
|
6178 | const Hb = openapi_parser_t(Bb.exports = function(t9) {
|
6179 | var r2 = t9.map;
|
6180 | return t9 === Jb || Wb(Jb, t9) && r2 === Jb.map ? zb : r2;
|
6181 | });
|
6182 | var Vb = { exports: {} };
|
6183 | const Yb = openapi_parser_t(Vb.exports = Qe);
|
6184 | var Qb = { exports: {} }, Kb = na("Array").concat, Xb = tt, Zb = Kb, tm = Array.prototype;
|
6185 | const rm = openapi_parser_t(Qb.exports = function(t9) {
|
6186 | var r2 = t9.concat;
|
6187 | return t9 === tm || Xb(tm, t9) && r2 === tm.concat ? Zb : r2;
|
6188 | });
|
6189 | var em = { exports: {} }, nm = openapi_parser_w, om = openapi_parser_b, im = He, um = openapi_parser_z, am = om(openapi_parser_S.f), fm = om([].push), cm = function(t9) {
|
6190 | return function(r2) {
|
6191 | for (var e2, n2 = um(r2), o2 = im(n2), i2 = o2.length, u2 = 0, a2 = []; i2 > u2; )
|
6192 | e2 = o2[u2++], nm && !am(n2, e2) || fm(a2, t9 ? [e2, n2[e2]] : n2[e2]);
|
6193 | return a2;
|
6194 | };
|
6195 | }, sm = { entries: cm(true), values: cm(false) }.entries;
|
6196 | ge({ target: "Object", stat: true }, { entries: function(t9) {
|
6197 | return sm(t9);
|
6198 | } });
|
6199 | var lm = openapi_parser_V.Object.entries;
|
6200 | const pm = openapi_parser_t(em.exports = lm);
|
6201 | var vm = { exports: {} };
|
6202 | const hm = openapi_parser_t(vm.exports = fa);
|
6203 | !function() {
|
6204 | !function(t9) {
|
6205 | !function(r2) {
|
6206 | var e2 = "URLSearchParams" in t9, n2 = "Symbol" in t9 && "iterator" in Symbol, o2 = "FileReader" in t9 && "Blob" in t9 && function() {
|
6207 | try {
|
6208 | return new Blob(), true;
|
6209 | } catch (t10) {
|
6210 | return false;
|
6211 | }
|
6212 | }(), i2 = "FormData" in t9, u2 = "ArrayBuffer" in t9;
|
6213 | if (u2)
|
6214 | var a2 = ["[object Int8Array]", "[object Uint8Array]", "[object Uint8ClampedArray]", "[object Int16Array]", "[object Uint16Array]", "[object Int32Array]", "[object Uint32Array]", "[object Float32Array]", "[object Float64Array]"], f2 = ArrayBuffer.isView || function(t10) {
|
6215 | return t10 && a2.indexOf(Object.prototype.toString.call(t10)) > -1;
|
6216 | };
|
6217 | function c2(t10) {
|
6218 | if ("string" != typeof t10 && (t10 = String(t10)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t10))
|
6219 | throw new TypeError("Invalid character in header field name");
|
6220 | return t10.toLowerCase();
|
6221 | }
|
6222 | function s2(t10) {
|
6223 | return "string" != typeof t10 && (t10 = String(t10)), t10;
|
6224 | }
|
6225 | function l2(t10) {
|
6226 | var r3 = { next: function() {
|
6227 | var r4 = t10.shift();
|
6228 | return { done: void 0 === r4, value: r4 };
|
6229 | } };
|
6230 | return n2 && (r3[Symbol.iterator] = function() {
|
6231 | return r3;
|
6232 | }), r3;
|
6233 | }
|
6234 | function p2(t10) {
|
6235 | this.map = {}, t10 instanceof p2 ? t10.forEach(function(t11, r3) {
|
6236 | this.append(r3, t11);
|
6237 | }, this) : Array.isArray(t10) ? t10.forEach(function(t11) {
|
6238 | this.append(t11[0], t11[1]);
|
6239 | }, this) : t10 && Object.getOwnPropertyNames(t10).forEach(function(r3) {
|
6240 | this.append(r3, t10[r3]);
|
6241 | }, this);
|
6242 | }
|
6243 | function v2(t10) {
|
6244 | if (t10.bodyUsed)
|
6245 | return Promise.reject(new TypeError("Already read"));
|
6246 | t10.bodyUsed = true;
|
6247 | }
|
6248 | function h2(t10) {
|
6249 | return new Promise(function(r3, e3) {
|
6250 | t10.onload = function() {
|
6251 | r3(t10.result);
|
6252 | }, t10.onerror = function() {
|
6253 | e3(t10.error);
|
6254 | };
|
6255 | });
|
6256 | }
|
6257 | function d2(t10) {
|
6258 | var r3 = new FileReader(), e3 = h2(r3);
|
6259 | return r3.readAsArrayBuffer(t10), e3;
|
6260 | }
|
6261 | function y2(t10) {
|
6262 | if (t10.slice)
|
6263 | return t10.slice(0);
|
6264 | var r3 = new Uint8Array(t10.byteLength);
|
6265 | return r3.set(new Uint8Array(t10)), r3.buffer;
|
6266 | }
|
6267 | function b2() {
|
6268 | return this.bodyUsed = false, this._initBody = function(t10) {
|
6269 | var r3;
|
6270 | this._bodyInit = t10, t10 ? "string" == typeof t10 ? this._bodyText = t10 : o2 && Blob.prototype.isPrototypeOf(t10) ? this._bodyBlob = t10 : i2 && FormData.prototype.isPrototypeOf(t10) ? this._bodyFormData = t10 : e2 && URLSearchParams.prototype.isPrototypeOf(t10) ? this._bodyText = t10.toString() : u2 && o2 && ((r3 = t10) && DataView.prototype.isPrototypeOf(r3)) ? (this._bodyArrayBuffer = y2(t10.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : u2 && (ArrayBuffer.prototype.isPrototypeOf(t10) || f2(t10)) ? this._bodyArrayBuffer = y2(t10) : this._bodyText = t10 = Object.prototype.toString.call(t10) : this._bodyText = "", this.headers.get("content-type") || ("string" == typeof t10 ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : e2 && URLSearchParams.prototype.isPrototypeOf(t10) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
|
6271 | }, o2 && (this.blob = function() {
|
6272 | var t10 = v2(this);
|
6273 | if (t10)
|
6274 | return t10;
|
6275 | if (this._bodyBlob)
|
6276 | return Promise.resolve(this._bodyBlob);
|
6277 | if (this._bodyArrayBuffer)
|
6278 | return Promise.resolve(new Blob([this._bodyArrayBuffer]));
|
6279 | if (this._bodyFormData)
|
6280 | throw new Error("could not read FormData body as blob");
|
6281 | return Promise.resolve(new Blob([this._bodyText]));
|
6282 | }, this.arrayBuffer = function() {
|
6283 | return this._bodyArrayBuffer ? v2(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(d2);
|
6284 | }), this.text = function() {
|
6285 | var t10 = v2(this);
|
6286 | if (t10)
|
6287 | return t10;
|
6288 | if (this._bodyBlob)
|
6289 | return function(t11) {
|
6290 | var r3 = new FileReader(), e3 = h2(r3);
|
6291 | return r3.readAsText(t11), e3;
|
6292 | }(this._bodyBlob);
|
6293 | if (this._bodyArrayBuffer)
|
6294 | return Promise.resolve(function(t11) {
|
6295 | for (var r3 = new Uint8Array(t11), e3 = new Array(r3.length), n3 = 0; n3 < r3.length; n3++)
|
6296 | e3[n3] = String.fromCharCode(r3[n3]);
|
6297 | return e3.join("");
|
6298 | }(this._bodyArrayBuffer));
|
6299 | if (this._bodyFormData)
|
6300 | throw new Error("could not read FormData body as text");
|
6301 | return Promise.resolve(this._bodyText);
|
6302 | }, i2 && (this.formData = function() {
|
6303 | return this.text().then(w2);
|
6304 | }), this.json = function() {
|
6305 | return this.text().then(JSON.parse);
|
6306 | }, this;
|
6307 | }
|
6308 | p2.prototype.append = function(t10, r3) {
|
6309 | t10 = c2(t10), r3 = s2(r3);
|
6310 | var e3 = this.map[t10];
|
6311 | this.map[t10] = e3 ? e3 + ", " + r3 : r3;
|
6312 | }, p2.prototype.delete = function(t10) {
|
6313 | delete this.map[c2(t10)];
|
6314 | }, p2.prototype.get = function(t10) {
|
6315 | return t10 = c2(t10), this.has(t10) ? this.map[t10] : null;
|
6316 | }, p2.prototype.has = function(t10) {
|
6317 | return this.map.hasOwnProperty(c2(t10));
|
6318 | }, p2.prototype.set = function(t10, r3) {
|
6319 | this.map[c2(t10)] = s2(r3);
|
6320 | }, p2.prototype.forEach = function(t10, r3) {
|
6321 | for (var e3 in this.map)
|
6322 | this.map.hasOwnProperty(e3) && t10.call(r3, this.map[e3], e3, this);
|
6323 | }, p2.prototype.keys = function() {
|
6324 | var t10 = [];
|
6325 | return this.forEach(function(r3, e3) {
|
6326 | t10.push(e3);
|
6327 | }), l2(t10);
|
6328 | }, p2.prototype.values = function() {
|
6329 | var t10 = [];
|
6330 | return this.forEach(function(r3) {
|
6331 | t10.push(r3);
|
6332 | }), l2(t10);
|
6333 | }, p2.prototype.entries = function() {
|
6334 | var t10 = [];
|
6335 | return this.forEach(function(r3, e3) {
|
6336 | t10.push([e3, r3]);
|
6337 | }), l2(t10);
|
6338 | }, n2 && (p2.prototype[Symbol.iterator] = p2.prototype.entries);
|
6339 | var m2 = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
|
6340 | function g2(t10, r3) {
|
6341 | var e3 = (r3 = r3 || {}).body;
|
6342 | if (t10 instanceof g2) {
|
6343 | if (t10.bodyUsed)
|
6344 | throw new TypeError("Already read");
|
6345 | this.url = t10.url, this.credentials = t10.credentials, r3.headers || (this.headers = new p2(t10.headers)), this.method = t10.method, this.mode = t10.mode, this.signal = t10.signal, e3 || null == t10._bodyInit || (e3 = t10._bodyInit, t10.bodyUsed = true);
|
6346 | } else
|
6347 | this.url = String(t10);
|
6348 | if (this.credentials = r3.credentials || this.credentials || "same-origin", !r3.headers && this.headers || (this.headers = new p2(r3.headers)), this.method = function(t11) {
|
6349 | var r4 = t11.toUpperCase();
|
6350 | return m2.indexOf(r4) > -1 ? r4 : t11;
|
6351 | }(r3.method || this.method || "GET"), this.mode = r3.mode || this.mode || null, this.signal = r3.signal || this.signal, this.referrer = null, ("GET" === this.method || "HEAD" === this.method) && e3)
|
6352 | throw new TypeError("Body not allowed for GET or HEAD requests");
|
6353 | this._initBody(e3);
|
6354 | }
|
6355 | function w2(t10) {
|
6356 | var r3 = new FormData();
|
6357 | return t10.trim().split("&").forEach(function(t11) {
|
6358 | if (t11) {
|
6359 | var e3 = t11.split("="), n3 = e3.shift().replace(/\+/g, " "), o3 = e3.join("=").replace(/\+/g, " ");
|
6360 | r3.append(decodeURIComponent(n3), decodeURIComponent(o3));
|
6361 | }
|
6362 | }), r3;
|
6363 | }
|
6364 | function j2(t10, r3) {
|
6365 | r3 || (r3 = {}), this.type = "default", this.status = void 0 === r3.status ? 200 : r3.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in r3 ? r3.statusText : "OK", this.headers = new p2(r3.headers), this.url = r3.url || "", this._initBody(t10);
|
6366 | }
|
6367 | g2.prototype.clone = function() {
|
6368 | return new g2(this, { body: this._bodyInit });
|
6369 | }, b2.call(g2.prototype), b2.call(j2.prototype), j2.prototype.clone = function() {
|
6370 | return new j2(this._bodyInit, { status: this.status, statusText: this.statusText, headers: new p2(this.headers), url: this.url });
|
6371 | }, j2.error = function() {
|
6372 | var t10 = new j2(null, { status: 0, statusText: "" });
|
6373 | return t10.type = "error", t10;
|
6374 | };
|
6375 | var O2 = [301, 302, 303, 307, 308];
|
6376 | j2.redirect = function(t10, r3) {
|
6377 | if (-1 === O2.indexOf(r3))
|
6378 | throw new RangeError("Invalid status code");
|
6379 | return new j2(null, { status: r3, headers: { location: t10 } });
|
6380 | }, r2.DOMException = t9.DOMException;
|
6381 | try {
|
6382 | new r2.DOMException();
|
6383 | } catch (t10) {
|
6384 | r2.DOMException = function(t11, r3) {
|
6385 | this.message = t11, this.name = r3;
|
6386 | var e3 = Error(t11);
|
6387 | this.stack = e3.stack;
|
6388 | }, r2.DOMException.prototype = Object.create(Error.prototype), r2.DOMException.prototype.constructor = r2.DOMException;
|
6389 | }
|
6390 | function A2(t10, e3) {
|
6391 | return new Promise(function(n3, i3) {
|
6392 | var u3 = new g2(t10, e3);
|
6393 | if (u3.signal && u3.signal.aborted)
|
6394 | return i3(new r2.DOMException("Aborted", "AbortError"));
|
6395 | var a3 = new XMLHttpRequest();
|
6396 | function f3() {
|
6397 | a3.abort();
|
6398 | }
|
6399 | a3.onload = function() {
|
6400 | var t11, r3, e4 = { status: a3.status, statusText: a3.statusText, headers: (t11 = a3.getAllResponseHeaders() || "", r3 = new p2(), t11.replace(/\r?\n[\t ]+/g, " ").split(/\r?\n/).forEach(function(t12) {
|
6401 | var e5 = t12.split(":"), n4 = e5.shift().trim();
|
6402 | if (n4) {
|
6403 | var o4 = e5.join(":").trim();
|
6404 | r3.append(n4, o4);
|
6405 | }
|
6406 | }), r3) };
|
6407 | e4.url = "responseURL" in a3 ? a3.responseURL : e4.headers.get("X-Request-URL");
|
6408 | var o3 = "response" in a3 ? a3.response : a3.responseText;
|
6409 | n3(new j2(o3, e4));
|
6410 | }, a3.onerror = function() {
|
6411 | i3(new TypeError("Network request failed"));
|
6412 | }, a3.ontimeout = function() {
|
6413 | i3(new TypeError("Network request failed"));
|
6414 | }, a3.onabort = function() {
|
6415 | i3(new r2.DOMException("Aborted", "AbortError"));
|
6416 | }, a3.open(u3.method, u3.url, true), "include" === u3.credentials ? a3.withCredentials = true : "omit" === u3.credentials && (a3.withCredentials = false), "responseType" in a3 && o2 && (a3.responseType = "blob"), u3.headers.forEach(function(t11, r3) {
|
6417 | a3.setRequestHeader(r3, t11);
|
6418 | }), u3.signal && (u3.signal.addEventListener("abort", f3), a3.onreadystatechange = function() {
|
6419 | 4 === a3.readyState && u3.signal.removeEventListener("abort", f3);
|
6420 | }), a3.send(void 0 === u3._bodyInit ? null : u3._bodyInit);
|
6421 | });
|
6422 | }
|
6423 | A2.polyfill = true, t9.fetch || (t9.fetch = A2, t9.Headers = p2, t9.Request = g2, t9.Response = j2), r2.Headers = p2, r2.Request = g2, r2.Response = j2, r2.fetch = A2, Object.defineProperty(r2, "t", { value: true });
|
6424 | }({});
|
6425 | }("undefined" != typeof self ? self : this);
|
6426 | }();
|
6427 | var dm = "undefined" != typeof Symbol && Symbol, ym = function() {
|
6428 | if ("function" != typeof Symbol || "function" != typeof Object.getOwnPropertySymbols)
|
6429 | return false;
|
6430 | if ("symbol" == typeof Symbol.iterator)
|
6431 | return true;
|
6432 | var t9 = {}, r2 = Symbol("test"), e2 = Object(r2);
|
6433 | if ("string" == typeof r2)
|
6434 | return false;
|
6435 | if ("[object Symbol]" !== Object.prototype.toString.call(r2))
|
6436 | return false;
|
6437 | if ("[object Symbol]" !== Object.prototype.toString.call(e2))
|
6438 | return false;
|
6439 | for (r2 in t9[r2] = 42, t9)
|
6440 | return false;
|
6441 | if ("function" == typeof Object.keys && 0 !== Object.keys(t9).length)
|
6442 | return false;
|
6443 | if ("function" == typeof Object.getOwnPropertyNames && 0 !== Object.getOwnPropertyNames(t9).length)
|
6444 | return false;
|
6445 | var n2 = Object.getOwnPropertySymbols(t9);
|
6446 | if (1 !== n2.length || n2[0] !== r2)
|
6447 | return false;
|
6448 | if (!Object.prototype.propertyIsEnumerable.call(t9, r2))
|
6449 | return false;
|
6450 | if ("function" == typeof Object.getOwnPropertyDescriptor) {
|
6451 | var o2 = Object.getOwnPropertyDescriptor(t9, r2);
|
6452 | if (42 !== o2.value || true !== o2.enumerable)
|
6453 | return false;
|
6454 | }
|
6455 | return true;
|
6456 | }, bm = "Function.prototype.bind called on incompatible ", mm = Array.prototype.slice, gm = Object.prototype.toString, wm = function(t9) {
|
6457 | var r2 = this;
|
6458 | if ("function" != typeof r2 || "[object Function]" !== gm.call(r2))
|
6459 | throw new TypeError(bm + r2);
|
6460 | for (var e2, n2 = mm.call(arguments, 1), o2 = function() {
|
6461 | if (this instanceof e2) {
|
6462 | var o3 = r2.apply(this, n2.concat(mm.call(arguments)));
|
6463 | return Object(o3) === o3 ? o3 : this;
|
6464 | }
|
6465 | return r2.apply(t9, n2.concat(mm.call(arguments)));
|
6466 | }, i2 = Math.max(0, r2.length - n2.length), u2 = [], a2 = 0; a2 < i2; a2++)
|
6467 | u2.push("$" + a2);
|
6468 | if (e2 = Function("binder", "return function (" + u2.join(",") + "){ return binder.apply(this,arguments); }")(o2), r2.prototype) {
|
6469 | var f2 = function() {
|
6470 | };
|
6471 | f2.prototype = r2.prototype, e2.prototype = new f2(), f2.prototype = null;
|
6472 | }
|
6473 | return e2;
|
6474 | }, jm = Function.prototype.bind || wm, Om = jm.call(Function.call, Object.prototype.hasOwnProperty), Am = SyntaxError, Sm = Function, xm = TypeError, Em = function(t9) {
|
6475 | try {
|
6476 | return Sm('"use strict"; return (' + t9 + ").constructor;")();
|
6477 | } catch (t10) {
|
6478 | }
|
6479 | }, Pm = Object.getOwnPropertyDescriptor;
|
6480 | if (Pm)
|
6481 | try {
|
6482 | Pm({}, "");
|
6483 | } catch (t9) {
|
6484 | Pm = null;
|
6485 | }
|
6486 | var km = function() {
|
6487 | throw new xm();
|
6488 | }, _m = Pm ? function() {
|
6489 | try {
|
6490 | return km;
|
6491 | } catch (t9) {
|
6492 | try {
|
6493 | return Pm(arguments, "callee").get;
|
6494 | } catch (t10) {
|
6495 | return km;
|
6496 | }
|
6497 | }
|
6498 | }() : km, Im = "function" == typeof dm && "function" == typeof Symbol && "symbol" == typeof dm("foo") && "symbol" == typeof Symbol("bar") && ym(), Tm = Object.getPrototypeOf || function(t9) {
|
6499 | return t9.__proto__;
|
6500 | }, Rm = {}, Fm = "undefined" == typeof Uint8Array ? void 0 : Tm(Uint8Array), Nm = { "%AggregateError%": "undefined" == typeof AggregateError ? void 0 : AggregateError, "%Array%": Array, "%ArrayBuffer%": "undefined" == typeof ArrayBuffer ? void 0 : ArrayBuffer, "%ArrayIteratorPrototype%": Im ? Tm([][Symbol.iterator]()) : void 0, "%AsyncFromSyncIteratorPrototype%": void 0, "%AsyncFunction%": Rm, "%AsyncGenerator%": Rm, "%AsyncGeneratorFunction%": Rm, "%AsyncIteratorPrototype%": Rm, "%Atomics%": "undefined" == typeof Atomics ? void 0 : Atomics, "%BigInt%": "undefined" == typeof BigInt ? void 0 : BigInt, "%Boolean%": Boolean, "%DataView%": "undefined" == typeof DataView ? void 0 : DataView, "%Date%": Date, "%decodeURI%": decodeURI, "%decodeURIComponent%": decodeURIComponent, "%encodeURI%": encodeURI, "%encodeURIComponent%": encodeURIComponent, "%Error%": Error, "%eval%": eval, "%EvalError%": EvalError, "%Float32Array%": "undefined" == typeof Float32Array ? void 0 : Float32Array, "%Float64Array%": "undefined" == typeof Float64Array ? void 0 : Float64Array, "%FinalizationRegistry%": "undefined" == typeof FinalizationRegistry ? void 0 : FinalizationRegistry, "%Function%": Sm, "%GeneratorFunction%": Rm, "%Int8Array%": "undefined" == typeof Int8Array ? void 0 : Int8Array, "%Int16Array%": "undefined" == typeof Int16Array ? void 0 : Int16Array, "%Int32Array%": "undefined" == typeof Int32Array ? void 0 : Int32Array, "%isFinite%": isFinite, "%isNaN%": isNaN, "%IteratorPrototype%": Im ? Tm(Tm([][Symbol.iterator]())) : void 0, "%JSON%": "object" == typeof JSON ? JSON : void 0, "%Map%": "undefined" == typeof Map ? void 0 : Map, "%MapIteratorPrototype%": "undefined" != typeof Map && Im ? Tm(( new Map())[Symbol.iterator]()) : void 0, "%Math%": Math, "%Number%": Number, "%Object%": Object, "%parseFloat%": parseFloat, "%parseInt%": parseInt, "%Promise%": "undefined" == typeof Promise ? void 0 : Promise, "%Proxy%": "undefined" == typeof Proxy ? void 0 : Proxy, "%RangeError%": RangeError, "%ReferenceError%": ReferenceError, "%Reflect%": "undefined" == typeof Reflect ? void 0 : Reflect, "%RegExp%": RegExp, "%Set%": "undefined" == typeof Set ? void 0 : Set, "%SetIteratorPrototype%": "undefined" != typeof Set && Im ? Tm(( new Set())[Symbol.iterator]()) : void 0, "%SharedArrayBuffer%": "undefined" == typeof SharedArrayBuffer ? void 0 : SharedArrayBuffer, "%String%": String, "%StringIteratorPrototype%": Im ? Tm(""[Symbol.iterator]()) : void 0, "%Symbol%": Im ? Symbol : void 0, "%SyntaxError%": Am, "%ThrowTypeError%": _m, "%TypedArray%": Fm, "%TypeError%": xm, "%Uint8Array%": "undefined" == typeof Uint8Array ? void 0 : Uint8Array, "%Uint8ClampedArray%": "undefined" == typeof Uint8ClampedArray ? void 0 : Uint8ClampedArray, "%Uint16Array%": "undefined" == typeof Uint16Array ? void 0 : Uint16Array, "%Uint32Array%": "undefined" == typeof Uint32Array ? void 0 : Uint32Array, "%URIError%": URIError, "%WeakMap%": "undefined" == typeof WeakMap ? void 0 : WeakMap, "%WeakRef%": "undefined" == typeof WeakRef ? void 0 : WeakRef, "%WeakSet%": "undefined" == typeof WeakSet ? void 0 : WeakSet }, Mm = function t2(r2) {
|
6501 | var e2;
|
6502 | if ("%AsyncFunction%" === r2)
|
6503 | e2 = Em("async function () {}");
|
6504 | else if ("%GeneratorFunction%" === r2)
|
6505 | e2 = Em("function* () {}");
|
6506 | else if ("%AsyncGeneratorFunction%" === r2)
|
6507 | e2 = Em("async function* () {}");
|
6508 | else if ("%AsyncGenerator%" === r2) {
|
6509 | var n2 = t2("%AsyncGeneratorFunction%");
|
6510 | n2 && (e2 = n2.prototype);
|
6511 | } else if ("%AsyncIteratorPrototype%" === r2) {
|
6512 | var o2 = t2("%AsyncGenerator%");
|
6513 | o2 && (e2 = Tm(o2.prototype));
|
6514 | }
|
6515 | return Nm[r2] = e2, e2;
|
6516 | }, Dm = { "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], "%ArrayPrototype%": ["Array", "prototype"], "%ArrayProto_entries%": ["Array", "prototype", "entries"], "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], "%ArrayProto_keys%": ["Array", "prototype", "keys"], "%ArrayProto_values%": ["Array", "prototype", "values"], "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], "%BooleanPrototype%": ["Boolean", "prototype"], "%DataViewPrototype%": ["DataView", "prototype"], "%DatePrototype%": ["Date", "prototype"], "%ErrorPrototype%": ["Error", "prototype"], "%EvalErrorPrototype%": ["EvalError", "prototype"], "%Float32ArrayPrototype%": ["Float32Array", "prototype"], "%Float64ArrayPrototype%": ["Float64Array", "prototype"], "%FunctionPrototype%": ["Function", "prototype"], "%Generator%": ["GeneratorFunction", "prototype"], "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], "%Int8ArrayPrototype%": ["Int8Array", "prototype"], "%Int16ArrayPrototype%": ["Int16Array", "prototype"], "%Int32ArrayPrototype%": ["Int32Array", "prototype"], "%JSONParse%": ["JSON", "parse"], "%JSONStringify%": ["JSON", "stringify"], "%MapPrototype%": ["Map", "prototype"], "%NumberPrototype%": ["Number", "prototype"], "%ObjectPrototype%": ["Object", "prototype"], "%ObjProto_toString%": ["Object", "prototype", "toString"], "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], "%PromisePrototype%": ["Promise", "prototype"], "%PromiseProto_then%": ["Promise", "prototype", "then"], "%Promise_all%": ["Promise", "all"], "%Promise_reject%": ["Promise", "reject"], "%Promise_resolve%": ["Promise", "resolve"], "%RangeErrorPrototype%": ["RangeError", "prototype"], "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], "%RegExpPrototype%": ["RegExp", "prototype"], "%SetPrototype%": ["Set", "prototype"], "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], "%StringPrototype%": ["String", "prototype"], "%SymbolPrototype%": ["Symbol", "prototype"], "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], "%TypedArrayPrototype%": ["TypedArray", "prototype"], "%TypeErrorPrototype%": ["TypeError", "prototype"], "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], "%URIErrorPrototype%": ["URIError", "prototype"], "%WeakMapPrototype%": ["WeakMap", "prototype"], "%WeakSetPrototype%": ["WeakSet", "prototype"] }, Um = jm, Lm = Om, Cm = Um.call(Function.call, Array.prototype.concat), $m = Um.call(Function.apply, Array.prototype.splice), Bm = Um.call(Function.call, String.prototype.replace), qm = Um.call(Function.call, String.prototype.slice), Gm = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, Wm = /\\(\\)?/g, zm = function(t9) {
|
6517 | var r2 = qm(t9, 0, 1), e2 = qm(t9, -1);
|
6518 | if ("%" === r2 && "%" !== e2)
|
6519 | throw new Am("invalid intrinsic syntax, expected closing `%`");
|
6520 | if ("%" === e2 && "%" !== r2)
|
6521 | throw new Am("invalid intrinsic syntax, expected opening `%`");
|
6522 | var n2 = [];
|
6523 | return Bm(t9, Gm, function(t10, r3, e3, o2) {
|
6524 | n2[n2.length] = e3 ? Bm(o2, Wm, "$1") : r3 || t10;
|
6525 | }), n2;
|
6526 | }, Jm = function(t9, r2) {
|
6527 | var e2, n2 = t9;
|
6528 | if (Lm(Dm, n2) && (n2 = "%" + (e2 = Dm[n2])[0] + "%"), Lm(Nm, n2)) {
|
6529 | var o2 = Nm[n2];
|
6530 | if (o2 === Rm && (o2 = Mm(n2)), void 0 === o2 && !r2)
|
6531 | throw new xm("intrinsic " + t9 + " exists, but is not available. Please file an issue!");
|
6532 | return { alias: e2, name: n2, value: o2 };
|
6533 | }
|
6534 | throw new Am("intrinsic " + t9 + " does not exist!");
|
6535 | }, Hm = function(t9, r2) {
|
6536 | if ("string" != typeof t9 || 0 === t9.length)
|
6537 | throw new xm("intrinsic name must be a non-empty string");
|
6538 | if (arguments.length > 1 && "boolean" != typeof r2)
|
6539 | throw new xm('"allowMissing" argument must be a boolean');
|
6540 | var e2 = zm(t9), n2 = e2.length > 0 ? e2[0] : "", o2 = Jm("%" + n2 + "%", r2), i2 = o2.name, u2 = o2.value, a2 = false, f2 = o2.alias;
|
6541 | f2 && (n2 = f2[0], $m(e2, Cm([0, 1], f2)));
|
6542 | for (var c2 = 1, s2 = true; c2 < e2.length; c2 += 1) {
|
6543 | var l2 = e2[c2], p2 = qm(l2, 0, 1), v2 = qm(l2, -1);
|
6544 | if (('"' === p2 || "'" === p2 || "`" === p2 || '"' === v2 || "'" === v2 || "`" === v2) && p2 !== v2)
|
6545 | throw new Am("property names with quotes must have matching quotes");
|
6546 | if ("constructor" !== l2 && s2 || (a2 = true), Lm(Nm, i2 = "%" + (n2 += "." + l2) + "%"))
|
6547 | u2 = Nm[i2];
|
6548 | else if (null != u2) {
|
6549 | if (!(l2 in u2)) {
|
6550 | if (!r2)
|
6551 | throw new xm("base intrinsic for " + t9 + " exists, but the property is not available.");
|
6552 | return;
|
6553 | }
|
6554 | if (Pm && c2 + 1 >= e2.length) {
|
6555 | var h2 = Pm(u2, l2);
|
6556 | u2 = (s2 = !!h2) && "get" in h2 && !("originalValue" in h2.get) ? h2.get : u2[l2];
|
6557 | } else
|
6558 | s2 = Lm(u2, l2), u2 = u2[l2];
|
6559 | s2 && !a2 && (Nm[i2] = u2);
|
6560 | }
|
6561 | }
|
6562 | return u2;
|
6563 | }, Vm = { exports: {} };
|
6564 | !function(t9) {
|
6565 | var r2 = jm, e2 = Hm, n2 = e2("%Function.prototype.apply%"), o2 = e2("%Function.prototype.call%"), i2 = e2("%Reflect.apply%", true) || r2.call(o2, n2), u2 = e2("%Object.getOwnPropertyDescriptor%", true), a2 = e2("%Object.defineProperty%", true), f2 = e2("%Math.max%");
|
6566 | if (a2)
|
6567 | try {
|
6568 | a2({}, "a", { value: 1 });
|
6569 | } catch (t10) {
|
6570 | a2 = null;
|
6571 | }
|
6572 | t9.exports = function(t10) {
|
6573 | var e3 = i2(r2, o2, arguments);
|
6574 | if (u2 && a2) {
|
6575 | var n3 = u2(e3, "length");
|
6576 | n3.configurable && a2(e3, "length", { value: 1 + f2(0, t10.length - (arguments.length - 1)) });
|
6577 | }
|
6578 | return e3;
|
6579 | };
|
6580 | var c2 = function() {
|
6581 | return i2(r2, n2, arguments);
|
6582 | };
|
6583 | a2 ? a2(t9.exports, "apply", { value: c2 }) : t9.exports.apply = c2;
|
6584 | }(Vm);
|
6585 | var Ym = Hm, Qm = Vm.exports, Km = Qm(Ym("String.prototype.indexOf"));
|
6586 | const Xm = openapi_parser_r(Object.freeze(Object.defineProperty({ __proto__: null, default: {} }, Symbol.toStringTag, { value: "Module" })));
|
6587 | var Zm = "function" == typeof Map && Map.prototype, tg = Object.getOwnPropertyDescriptor && Zm ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, rg = Zm && tg && "function" == typeof tg.get ? tg.get : null, eg = Zm && Map.prototype.forEach, ng = "function" == typeof Set && Set.prototype, og = Object.getOwnPropertyDescriptor && ng ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, ig = ng && og && "function" == typeof og.get ? og.get : null, ug = ng && Set.prototype.forEach, ag = "function" == typeof WeakMap && WeakMap.prototype ? WeakMap.prototype.has : null, fg = "function" == typeof WeakSet && WeakSet.prototype ? WeakSet.prototype.has : null, cg = "function" == typeof WeakRef && WeakRef.prototype ? WeakRef.prototype.deref : null, sg = Boolean.prototype.valueOf, lg = Object.prototype.toString, pg = Function.prototype.toString, vg = String.prototype.match, hg = String.prototype.slice, dg = String.prototype.replace, yg = String.prototype.toUpperCase, bg = String.prototype.toLowerCase, mg = RegExp.prototype.test, gg = Array.prototype.concat, wg = Array.prototype.join, jg = Array.prototype.slice, Og = Math.floor, Ag = "function" == typeof BigInt ? BigInt.prototype.valueOf : null, Sg = Object.getOwnPropertySymbols, xg = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? Symbol.prototype.toString : null, Eg = "function" == typeof Symbol && "object" == typeof Symbol.iterator, Pg = "function" == typeof Symbol && Symbol.toStringTag && (typeof Symbol.toStringTag === Eg || "symbol") ? Symbol.toStringTag : null, kg = Object.prototype.propertyIsEnumerable, _g = ("function" == typeof Reflect ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(t9) {
|
6588 | return t9.__proto__;
|
6589 | } : null);
|
6590 | function Ig(t9, r2) {
|
6591 | if (t9 === 1 / 0 || t9 === -1 / 0 || t9 != t9 || t9 && t9 > -1e3 && t9 < 1e3 || mg.call(/e/, r2))
|
6592 | return r2;
|
6593 | var e2 = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
|
6594 | if ("number" == typeof t9) {
|
6595 | var n2 = t9 < 0 ? -Og(-t9) : Og(t9);
|
6596 | if (n2 !== t9) {
|
6597 | var o2 = String(n2), i2 = hg.call(r2, o2.length + 1);
|
6598 | return dg.call(o2, e2, "$&_") + "." + dg.call(dg.call(i2, /([0-9]{3})/g, "$&_"), /_$/, "");
|
6599 | }
|
6600 | }
|
6601 | return dg.call(r2, e2, "$&_");
|
6602 | }
|
6603 | var Tg = Xm.custom, Rg = Tg && Dg(Tg) ? Tg : null;
|
6604 | function Fg(t9, r2, e2) {
|
6605 | var n2 = "double" === (e2.quoteStyle || r2) ? '"' : "'";
|
6606 | return n2 + t9 + n2;
|
6607 | }
|
6608 | function Ng(t9) {
|
6609 | return dg.call(String(t9), /"/g, """);
|
6610 | }
|
6611 | function Mg(t9) {
|
6612 | return !("[object Array]" !== Cg(t9) || Pg && "object" == typeof t9 && Pg in t9);
|
6613 | }
|
6614 | function Dg(t9) {
|
6615 | if (Eg)
|
6616 | return t9 && "object" == typeof t9 && t9 instanceof Symbol;
|
6617 | if ("symbol" == typeof t9)
|
6618 | return true;
|
6619 | if (!t9 || "object" != typeof t9 || !xg)
|
6620 | return false;
|
6621 | try {
|
6622 | return xg.call(t9), true;
|
6623 | } catch (t10) {
|
6624 | }
|
6625 | return false;
|
6626 | }
|
6627 | var Ug = Object.prototype.hasOwnProperty || function(t9) {
|
6628 | return t9 in this;
|
6629 | };
|
6630 | function Lg(t9, r2) {
|
6631 | return Ug.call(t9, r2);
|
6632 | }
|
6633 | function Cg(t9) {
|
6634 | return lg.call(t9);
|
6635 | }
|
6636 | function $g(t9, r2) {
|
6637 | if (t9.indexOf)
|
6638 | return t9.indexOf(r2);
|
6639 | for (var e2 = 0, n2 = t9.length; e2 < n2; e2++)
|
6640 | if (t9[e2] === r2)
|
6641 | return e2;
|
6642 | return -1;
|
6643 | }
|
6644 | function Bg(t9, r2) {
|
6645 | if (t9.length > r2.maxStringLength) {
|
6646 | var e2 = t9.length - r2.maxStringLength, n2 = "... " + e2 + " more character" + (e2 > 1 ? "s" : "");
|
6647 | return Bg(hg.call(t9, 0, r2.maxStringLength), r2) + n2;
|
6648 | }
|
6649 | return Fg(dg.call(dg.call(t9, /(['\\])/g, "\\$1"), /[\x00-\x1f]/g, qg), "single", r2);
|
6650 | }
|
6651 | function qg(t9) {
|
6652 | var r2 = t9.charCodeAt(0), e2 = { 8: "b", 9: "t", 10: "n", 12: "f", 13: "r" }[r2];
|
6653 | return e2 ? "\\" + e2 : "\\x" + (r2 < 16 ? "0" : "") + yg.call(r2.toString(16));
|
6654 | }
|
6655 | function Gg(t9) {
|
6656 | return "Object(" + t9 + ")";
|
6657 | }
|
6658 | function Wg(t9) {
|
6659 | return t9 + " { ? }";
|
6660 | }
|
6661 | function zg(t9, r2, e2, n2) {
|
6662 | return t9 + " (" + r2 + ") {" + (n2 ? Jg(e2, n2) : wg.call(e2, ", ")) + "}";
|
6663 | }
|
6664 | function Jg(t9, r2) {
|
6665 | if (0 === t9.length)
|
6666 | return "";
|
6667 | var e2 = "\n" + r2.prev + r2.base;
|
6668 | return e2 + wg.call(t9, "," + e2) + "\n" + r2.prev;
|
6669 | }
|
6670 | function Hg(t9, r2) {
|
6671 | var e2 = Mg(t9), n2 = [];
|
6672 | if (e2) {
|
6673 | n2.length = t9.length;
|
6674 | for (var o2 = 0; o2 < t9.length; o2++)
|
6675 | n2[o2] = Lg(t9, o2) ? r2(t9[o2], t9) : "";
|
6676 | }
|
6677 | var i2, u2 = "function" == typeof Sg ? Sg(t9) : [];
|
6678 | if (Eg) {
|
6679 | i2 = {};
|
6680 | for (var a2 = 0; a2 < u2.length; a2++)
|
6681 | i2["$" + u2[a2]] = u2[a2];
|
6682 | }
|
6683 | for (var f2 in t9)
|
6684 | Lg(t9, f2) && (e2 && String(Number(f2)) === f2 && f2 < t9.length || Eg && i2["$" + f2] instanceof Symbol || (mg.call(/[^\w$]/, f2) ? n2.push(r2(f2, t9) + ": " + r2(t9[f2], t9)) : n2.push(f2 + ": " + r2(t9[f2], t9))));
|
6685 | if ("function" == typeof Sg)
|
6686 | for (var c2 = 0; c2 < u2.length; c2++)
|
6687 | kg.call(t9, u2[c2]) && n2.push("[" + r2(u2[c2]) + "]: " + r2(t9[u2[c2]], t9));
|
6688 | return n2;
|
6689 | }
|
6690 | var Vg = Hm, Yg = function(t9, r2) {
|
6691 | var e2 = Ym(t9, !!r2);
|
6692 | return "function" == typeof e2 && Km(t9, ".prototype.") > -1 ? Qm(e2) : e2;
|
6693 | }, Qg = function t3(r2, e2, n2, o2) {
|
6694 | var i2 = e2 || {};
|
6695 | if (Lg(i2, "quoteStyle") && "single" !== i2.quoteStyle && "double" !== i2.quoteStyle)
|
6696 | throw new TypeError('option "quoteStyle" must be "single" or "double"');
|
6697 | if (Lg(i2, "maxStringLength") && ("number" == typeof i2.maxStringLength ? i2.maxStringLength < 0 && i2.maxStringLength !== 1 / 0 : null !== i2.maxStringLength))
|
6698 | throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
|
6699 | var u2 = !Lg(i2, "customInspect") || i2.customInspect;
|
6700 | if ("boolean" != typeof u2 && "symbol" !== u2)
|
6701 | throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
|
6702 | if (Lg(i2, "indent") && null !== i2.indent && " " !== i2.indent && !(parseInt(i2.indent, 10) === i2.indent && i2.indent > 0))
|
6703 | throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
|
6704 | if (Lg(i2, "numericSeparator") && "boolean" != typeof i2.numericSeparator)
|
6705 | throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
|
6706 | var a2 = i2.numericSeparator;
|
6707 | if (void 0 === r2)
|
6708 | return "undefined";
|
6709 | if (null === r2)
|
6710 | return "null";
|
6711 | if ("boolean" == typeof r2)
|
6712 | return r2 ? "true" : "false";
|
6713 | if ("string" == typeof r2)
|
6714 | return Bg(r2, i2);
|
6715 | if ("number" == typeof r2) {
|
6716 | if (0 === r2)
|
6717 | return 1 / 0 / r2 > 0 ? "0" : "-0";
|
6718 | var f2 = String(r2);
|
6719 | return a2 ? Ig(r2, f2) : f2;
|
6720 | }
|
6721 | if ("bigint" == typeof r2) {
|
6722 | var c2 = String(r2) + "n";
|
6723 | return a2 ? Ig(r2, c2) : c2;
|
6724 | }
|
6725 | var s2 = void 0 === i2.depth ? 5 : i2.depth;
|
6726 | if (void 0 === n2 && (n2 = 0), n2 >= s2 && s2 > 0 && "object" == typeof r2)
|
6727 | return Mg(r2) ? "[Array]" : "[Object]";
|
6728 | var l2 = function(t9, r3) {
|
6729 | var e3;
|
6730 | if (" " === t9.indent)
|
6731 | e3 = " ";
|
6732 | else {
|
6733 | if (!("number" == typeof t9.indent && t9.indent > 0))
|
6734 | return null;
|
6735 | e3 = wg.call(Array(t9.indent + 1), " ");
|
6736 | }
|
6737 | return { base: e3, prev: wg.call(Array(r3 + 1), e3) };
|
6738 | }(i2, n2);
|
6739 | if (void 0 === o2)
|
6740 | o2 = [];
|
6741 | else if ($g(o2, r2) >= 0)
|
6742 | return "[Circular]";
|
6743 | function p2(r3, e3, u3) {
|
6744 | if (e3 && (o2 = jg.call(o2)).push(e3), u3) {
|
6745 | var a3 = { depth: i2.depth };
|
6746 | return Lg(i2, "quoteStyle") && (a3.quoteStyle = i2.quoteStyle), t3(r3, a3, n2 + 1, o2);
|
6747 | }
|
6748 | return t3(r3, i2, n2 + 1, o2);
|
6749 | }
|
6750 | if ("function" == typeof r2) {
|
6751 | var v2 = function(t9) {
|
6752 | if (t9.name)
|
6753 | return t9.name;
|
6754 | var r3 = vg.call(pg.call(t9), /^function\s*([\w$]+)/);
|
6755 | if (r3)
|
6756 | return r3[1];
|
6757 | return null;
|
6758 | }(r2), h2 = Hg(r2, p2);
|
6759 | return "[Function" + (v2 ? ": " + v2 : " (anonymous)") + "]" + (h2.length > 0 ? " { " + wg.call(h2, ", ") + " }" : "");
|
6760 | }
|
6761 | if (Dg(r2)) {
|
6762 | var d2 = Eg ? dg.call(String(r2), /^(Symbol\(.*\))_[^)]*$/, "$1") : xg.call(r2);
|
6763 | return "object" != typeof r2 || Eg ? d2 : Gg(d2);
|
6764 | }
|
6765 | if (function(t9) {
|
6766 | if (!t9 || "object" != typeof t9)
|
6767 | return false;
|
6768 | if ("undefined" != typeof HTMLElement && t9 instanceof HTMLElement)
|
6769 | return true;
|
6770 | return "string" == typeof t9.nodeName && "function" == typeof t9.getAttribute;
|
6771 | }(r2)) {
|
6772 | for (var y2 = "<" + bg.call(String(r2.nodeName)), b2 = r2.attributes || [], m2 = 0; m2 < b2.length; m2++)
|
6773 | y2 += " " + b2[m2].name + "=" + Fg(Ng(b2[m2].value), "double", i2);
|
6774 | return y2 += ">", r2.childNodes && r2.childNodes.length && (y2 += "..."), y2 += "</" + bg.call(String(r2.nodeName)) + ">";
|
6775 | }
|
6776 | if (Mg(r2)) {
|
6777 | if (0 === r2.length)
|
6778 | return "[]";
|
6779 | var g2 = Hg(r2, p2);
|
6780 | return l2 && !function(t9) {
|
6781 | for (var r3 = 0; r3 < t9.length; r3++)
|
6782 | if ($g(t9[r3], "\n") >= 0)
|
6783 | return false;
|
6784 | return true;
|
6785 | }(g2) ? "[" + Jg(g2, l2) + "]" : "[ " + wg.call(g2, ", ") + " ]";
|
6786 | }
|
6787 | if (function(t9) {
|
6788 | return !("[object Error]" !== Cg(t9) || Pg && "object" == typeof t9 && Pg in t9);
|
6789 | }(r2)) {
|
6790 | var w2 = Hg(r2, p2);
|
6791 | return "cause" in r2 && !kg.call(r2, "cause") ? "{ [" + String(r2) + "] " + wg.call(gg.call("[cause]: " + p2(r2.cause), w2), ", ") + " }" : 0 === w2.length ? "[" + String(r2) + "]" : "{ [" + String(r2) + "] " + wg.call(w2, ", ") + " }";
|
6792 | }
|
6793 | if ("object" == typeof r2 && u2) {
|
6794 | if (Rg && "function" == typeof r2[Rg])
|
6795 | return r2[Rg]();
|
6796 | if ("symbol" !== u2 && "function" == typeof r2.inspect)
|
6797 | return r2.inspect();
|
6798 | }
|
6799 | if (function(t9) {
|
6800 | if (!rg || !t9 || "object" != typeof t9)
|
6801 | return false;
|
6802 | try {
|
6803 | rg.call(t9);
|
6804 | try {
|
6805 | ig.call(t9);
|
6806 | } catch (t10) {
|
6807 | return true;
|
6808 | }
|
6809 | return t9 instanceof Map;
|
6810 | } catch (t10) {
|
6811 | }
|
6812 | return false;
|
6813 | }(r2)) {
|
6814 | var j2 = [];
|
6815 | return eg.call(r2, function(t9, e3) {
|
6816 | j2.push(p2(e3, r2, true) + " => " + p2(t9, r2));
|
6817 | }), zg("Map", rg.call(r2), j2, l2);
|
6818 | }
|
6819 | if (function(t9) {
|
6820 | if (!ig || !t9 || "object" != typeof t9)
|
6821 | return false;
|
6822 | try {
|
6823 | ig.call(t9);
|
6824 | try {
|
6825 | rg.call(t9);
|
6826 | } catch (t10) {
|
6827 | return true;
|
6828 | }
|
6829 | return t9 instanceof Set;
|
6830 | } catch (t10) {
|
6831 | }
|
6832 | return false;
|
6833 | }(r2)) {
|
6834 | var O2 = [];
|
6835 | return ug.call(r2, function(t9) {
|
6836 | O2.push(p2(t9, r2));
|
6837 | }), zg("Set", ig.call(r2), O2, l2);
|
6838 | }
|
6839 | if (function(t9) {
|
6840 | if (!ag || !t9 || "object" != typeof t9)
|
6841 | return false;
|
6842 | try {
|
6843 | ag.call(t9, ag);
|
6844 | try {
|
6845 | fg.call(t9, fg);
|
6846 | } catch (t10) {
|
6847 | return true;
|
6848 | }
|
6849 | return t9 instanceof WeakMap;
|
6850 | } catch (t10) {
|
6851 | }
|
6852 | return false;
|
6853 | }(r2))
|
6854 | return Wg("WeakMap");
|
6855 | if (function(t9) {
|
6856 | if (!fg || !t9 || "object" != typeof t9)
|
6857 | return false;
|
6858 | try {
|
6859 | fg.call(t9, fg);
|
6860 | try {
|
6861 | ag.call(t9, ag);
|
6862 | } catch (t10) {
|
6863 | return true;
|
6864 | }
|
6865 | return t9 instanceof WeakSet;
|
6866 | } catch (t10) {
|
6867 | }
|
6868 | return false;
|
6869 | }(r2))
|
6870 | return Wg("WeakSet");
|
6871 | if (function(t9) {
|
6872 | if (!cg || !t9 || "object" != typeof t9)
|
6873 | return false;
|
6874 | try {
|
6875 | return cg.call(t9), true;
|
6876 | } catch (t10) {
|
6877 | }
|
6878 | return false;
|
6879 | }(r2))
|
6880 | return Wg("WeakRef");
|
6881 | if (function(t9) {
|
6882 | return !("[object Number]" !== Cg(t9) || Pg && "object" == typeof t9 && Pg in t9);
|
6883 | }(r2))
|
6884 | return Gg(p2(Number(r2)));
|
6885 | if (function(t9) {
|
6886 | if (!t9 || "object" != typeof t9 || !Ag)
|
6887 | return false;
|
6888 | try {
|
6889 | return Ag.call(t9), true;
|
6890 | } catch (t10) {
|
6891 | }
|
6892 | return false;
|
6893 | }(r2))
|
6894 | return Gg(p2(Ag.call(r2)));
|
6895 | if (function(t9) {
|
6896 | return !("[object Boolean]" !== Cg(t9) || Pg && "object" == typeof t9 && Pg in t9);
|
6897 | }(r2))
|
6898 | return Gg(sg.call(r2));
|
6899 | if (function(t9) {
|
6900 | return !("[object String]" !== Cg(t9) || Pg && "object" == typeof t9 && Pg in t9);
|
6901 | }(r2))
|
6902 | return Gg(p2(String(r2)));
|
6903 | if (!function(t9) {
|
6904 | return !("[object Date]" !== Cg(t9) || Pg && "object" == typeof t9 && Pg in t9);
|
6905 | }(r2) && !function(t9) {
|
6906 | return !("[object RegExp]" !== Cg(t9) || Pg && "object" == typeof t9 && Pg in t9);
|
6907 | }(r2)) {
|
6908 | var A2 = Hg(r2, p2), S2 = _g ? _g(r2) === Object.prototype : r2 instanceof Object || r2.constructor === Object, x2 = r2 instanceof Object ? "" : "null prototype", E2 = !S2 && Pg && Object(r2) === r2 && Pg in r2 ? hg.call(Cg(r2), 8, -1) : x2 ? "Object" : "", P2 = (S2 || "function" != typeof r2.constructor ? "" : r2.constructor.name ? r2.constructor.name + " " : "") + (E2 || x2 ? "[" + wg.call(gg.call([], E2 || [], x2 || []), ": ") + "] " : "");
|
6909 | return 0 === A2.length ? P2 + "{}" : l2 ? P2 + "{" + Jg(A2, l2) + "}" : P2 + "{ " + wg.call(A2, ", ") + " }";
|
6910 | }
|
6911 | return String(r2);
|
6912 | }, Kg = Vg("%TypeError%"), Xg = Vg("%WeakMap%", true), Zg = Vg("%Map%", true), tw = Yg("WeakMap.prototype.get", true), rw = Yg("WeakMap.prototype.set", true), ew = Yg("WeakMap.prototype.has", true), nw = Yg("Map.prototype.get", true), ow = Yg("Map.prototype.set", true), iw = Yg("Map.prototype.has", true), uw = function(t9, r2) {
|
6913 | for (var e2, n2 = t9; null !== (e2 = n2.next); n2 = e2)
|
6914 | if (e2.key === r2)
|
6915 | return n2.next = e2.next, e2.next = t9.next, t9.next = e2, e2;
|
6916 | }, aw = String.prototype.replace, fw = /%20/g, cw = "RFC3986", sw = { default: cw, formatters: { RFC1738: function(t9) {
|
6917 | return aw.call(t9, fw, "+");
|
6918 | }, RFC3986: function(t9) {
|
6919 | return String(t9);
|
6920 | } }, RFC1738: "RFC1738", RFC3986: cw }, lw = sw, pw = Object.prototype.hasOwnProperty, vw = Array.isArray, hw = function() {
|
6921 | for (var t9 = [], r2 = 0; r2 < 256; ++r2)
|
6922 | t9.push("%" + ((r2 < 16 ? "0" : "") + r2.toString(16)).toUpperCase());
|
6923 | return t9;
|
6924 | }(), dw = function(t9, r2) {
|
6925 | for (var e2 = r2 && r2.plainObjects ? Object.create(null) : {}, n2 = 0; n2 < t9.length; ++n2)
|
6926 | void 0 !== t9[n2] && (e2[n2] = t9[n2]);
|
6927 | return e2;
|
6928 | }, yw = { arrayToObject: dw, assign: function(t9, r2) {
|
6929 | return Object.keys(r2).reduce(function(t10, e2) {
|
6930 | return t10[e2] = r2[e2], t10;
|
6931 | }, t9);
|
6932 | }, combine: function(t9, r2) {
|
6933 | return [].concat(t9, r2);
|
6934 | }, compact: function(t9) {
|
6935 | for (var r2 = [{ obj: { o: t9 }, prop: "o" }], e2 = [], n2 = 0; n2 < r2.length; ++n2)
|
6936 | for (var o2 = r2[n2], i2 = o2.obj[o2.prop], u2 = Object.keys(i2), a2 = 0; a2 < u2.length; ++a2) {
|
6937 | var f2 = u2[a2], c2 = i2[f2];
|
6938 | "object" == typeof c2 && null !== c2 && -1 === e2.indexOf(c2) && (r2.push({ obj: i2, prop: f2 }), e2.push(c2));
|
6939 | }
|
6940 | return function(t10) {
|
6941 | for (; t10.length > 1; ) {
|
6942 | var r3 = t10.pop(), e3 = r3.obj[r3.prop];
|
6943 | if (vw(e3)) {
|
6944 | for (var n3 = [], o3 = 0; o3 < e3.length; ++o3)
|
6945 | void 0 !== e3[o3] && n3.push(e3[o3]);
|
6946 | r3.obj[r3.prop] = n3;
|
6947 | }
|
6948 | }
|
6949 | }(r2), t9;
|
6950 | }, decode: function(t9, r2, e2) {
|
6951 | var n2 = t9.replace(/\+/g, " ");
|
6952 | if ("iso-8859-1" === e2)
|
6953 | return n2.replace(/%[0-9a-f]{2}/gi, unescape);
|
6954 | try {
|
6955 | return decodeURIComponent(n2);
|
6956 | } catch (t10) {
|
6957 | return n2;
|
6958 | }
|
6959 | }, encode: function(t9, r2, e2, n2, o2) {
|
6960 | if (0 === t9.length)
|
6961 | return t9;
|
6962 | var i2 = t9;
|
6963 | if ("symbol" == typeof t9 ? i2 = Symbol.prototype.toString.call(t9) : "string" != typeof t9 && (i2 = String(t9)), "iso-8859-1" === e2)
|
6964 | return escape(i2).replace(/%u[0-9a-f]{4}/gi, function(t10) {
|
6965 | return "%26%23" + parseInt(t10.slice(2), 16) + "%3B";
|
6966 | });
|
6967 | for (var u2 = "", a2 = 0; a2 < i2.length; ++a2) {
|
6968 | var f2 = i2.charCodeAt(a2);
|
6969 | 45 === f2 || 46 === f2 || 95 === f2 || 126 === f2 || f2 >= 48 && f2 <= 57 || f2 >= 65 && f2 <= 90 || f2 >= 97 && f2 <= 122 || o2 === lw.RFC1738 && (40 === f2 || 41 === f2) ? u2 += i2.charAt(a2) : f2 < 128 ? u2 += hw[f2] : f2 < 2048 ? u2 += hw[192 | f2 >> 6] + hw[128 | 63 & f2] : f2 < 55296 || f2 >= 57344 ? u2 += hw[224 | f2 >> 12] + hw[128 | f2 >> 6 & 63] + hw[128 | 63 & f2] : (a2 += 1, f2 = 65536 + ((1023 & f2) << 10 | 1023 & i2.charCodeAt(a2)), u2 += hw[240 | f2 >> 18] + hw[128 | f2 >> 12 & 63] + hw[128 | f2 >> 6 & 63] + hw[128 | 63 & f2]);
|
6970 | }
|
6971 | return u2;
|
6972 | }, isBuffer: function(t9) {
|
6973 | return !(!t9 || "object" != typeof t9) && !!(t9.constructor && t9.constructor.isBuffer && t9.constructor.isBuffer(t9));
|
6974 | }, isRegExp: function(t9) {
|
6975 | return "[object RegExp]" === Object.prototype.toString.call(t9);
|
6976 | }, maybeMap: function(t9, r2) {
|
6977 | if (vw(t9)) {
|
6978 | for (var e2 = [], n2 = 0; n2 < t9.length; n2 += 1)
|
6979 | e2.push(r2(t9[n2]));
|
6980 | return e2;
|
6981 | }
|
6982 | return r2(t9);
|
6983 | }, merge: function t4(r2, e2, n2) {
|
6984 | if (!e2)
|
6985 | return r2;
|
6986 | if ("object" != typeof e2) {
|
6987 | if (vw(r2))
|
6988 | r2.push(e2);
|
6989 | else {
|
6990 | if (!r2 || "object" != typeof r2)
|
6991 | return [r2, e2];
|
6992 | (n2 && (n2.plainObjects || n2.allowPrototypes) || !pw.call(Object.prototype, e2)) && (r2[e2] = true);
|
6993 | }
|
6994 | return r2;
|
6995 | }
|
6996 | if (!r2 || "object" != typeof r2)
|
6997 | return [r2].concat(e2);
|
6998 | var o2 = r2;
|
6999 | return vw(r2) && !vw(e2) && (o2 = dw(r2, n2)), vw(r2) && vw(e2) ? (e2.forEach(function(e3, o3) {
|
7000 | if (pw.call(r2, o3)) {
|
7001 | var i2 = r2[o3];
|
7002 | i2 && "object" == typeof i2 && e3 && "object" == typeof e3 ? r2[o3] = t4(i2, e3, n2) : r2.push(e3);
|
7003 | } else
|
7004 | r2[o3] = e3;
|
7005 | }), r2) : Object.keys(e2).reduce(function(r3, o3) {
|
7006 | var i2 = e2[o3];
|
7007 | return pw.call(r3, o3) ? r3[o3] = t4(r3[o3], i2, n2) : r3[o3] = i2, r3;
|
7008 | }, o2);
|
7009 | } }, bw = function() {
|
7010 | var t9, r2, e2, n2 = { assert: function(t10) {
|
7011 | if (!n2.has(t10))
|
7012 | throw new Kg("Side channel does not contain " + Qg(t10));
|
7013 | }, get: function(n3) {
|
7014 | if (Xg && n3 && ("object" == typeof n3 || "function" == typeof n3)) {
|
7015 | if (t9)
|
7016 | return tw(t9, n3);
|
7017 | } else if (Zg) {
|
7018 | if (r2)
|
7019 | return nw(r2, n3);
|
7020 | } else if (e2)
|
7021 | return function(t10, r3) {
|
7022 | var e3 = uw(t10, r3);
|
7023 | return e3 && e3.value;
|
7024 | }(e2, n3);
|
7025 | }, has: function(n3) {
|
7026 | if (Xg && n3 && ("object" == typeof n3 || "function" == typeof n3)) {
|
7027 | if (t9)
|
7028 | return ew(t9, n3);
|
7029 | } else if (Zg) {
|
7030 | if (r2)
|
7031 | return iw(r2, n3);
|
7032 | } else if (e2)
|
7033 | return function(t10, r3) {
|
7034 | return !!uw(t10, r3);
|
7035 | }(e2, n3);
|
7036 | return false;
|
7037 | }, set: function(n3, o2) {
|
7038 | Xg && n3 && ("object" == typeof n3 || "function" == typeof n3) ? (t9 || (t9 = new Xg()), rw(t9, n3, o2)) : Zg ? (r2 || (r2 = new Zg()), ow(r2, n3, o2)) : (e2 || (e2 = { key: {}, next: null }), function(t10, r3, e3) {
|
7039 | var n4 = uw(t10, r3);
|
7040 | n4 ? n4.value = e3 : t10.next = { key: r3, next: t10.next, value: e3 };
|
7041 | }(e2, n3, o2));
|
7042 | } };
|
7043 | return n2;
|
7044 | }, mw = yw, gw = sw, ww = Object.prototype.hasOwnProperty, jw = { brackets: function(t9) {
|
7045 | return t9 + "[]";
|
7046 | }, comma: "comma", indices: function(t9, r2) {
|
7047 | return t9 + "[" + r2 + "]";
|
7048 | }, repeat: function(t9) {
|
7049 | return t9;
|
7050 | } }, Ow = Array.isArray, Aw = String.prototype.split, Sw = Array.prototype.push, xw = function(t9, r2) {
|
7051 | Sw.apply(t9, Ow(r2) ? r2 : [r2]);
|
7052 | }, Ew = Date.prototype.toISOString, Pw = gw.default, kw = { addQueryPrefix: false, allowDots: false, charset: "utf-8", charsetSentinel: false, delimiter: "&", encode: true, encoder: mw.encode, encodeValuesOnly: false, format: Pw, formatter: gw.formatters[Pw], indices: false, serializeDate: function(t9) {
|
7053 | return Ew.call(t9);
|
7054 | }, skipNulls: false, strictNullHandling: false }, _w = {}, Iw = function t5(r2, e2, n2, o2, i2, u2, a2, f2, c2, s2, l2, p2, v2, h2, d2) {
|
7055 | for (var y2, b2 = r2, m2 = d2, g2 = 0, w2 = false; void 0 !== (m2 = m2.get(_w)) && !w2; ) {
|
7056 | var j2 = m2.get(r2);
|
7057 | if (g2 += 1, void 0 !== j2) {
|
7058 | if (j2 === g2)
|
7059 | throw new RangeError("Cyclic object value");
|
7060 | w2 = true;
|
7061 | }
|
7062 | void 0 === m2.get(_w) && (g2 = 0);
|
7063 | }
|
7064 | if ("function" == typeof a2 ? b2 = a2(e2, b2) : b2 instanceof Date ? b2 = s2(b2) : "comma" === n2 && Ow(b2) && (b2 = mw.maybeMap(b2, function(t9) {
|
7065 | return t9 instanceof Date ? s2(t9) : t9;
|
7066 | })), null === b2) {
|
7067 | if (o2)
|
7068 | return u2 && !v2 ? u2(e2, kw.encoder, h2, "key", l2) : e2;
|
7069 | b2 = "";
|
7070 | }
|
7071 | if ("string" == typeof (y2 = b2) || "number" == typeof y2 || "boolean" == typeof y2 || "symbol" == typeof y2 || "bigint" == typeof y2 || mw.isBuffer(b2)) {
|
7072 | if (u2) {
|
7073 | var O2 = v2 ? e2 : u2(e2, kw.encoder, h2, "key", l2);
|
7074 | if ("comma" === n2 && v2) {
|
7075 | for (var A2 = Aw.call(String(b2), ","), S2 = "", x2 = 0; x2 < A2.length; ++x2)
|
7076 | S2 += (0 === x2 ? "" : ",") + p2(u2(A2[x2], kw.encoder, h2, "value", l2));
|
7077 | return [p2(O2) + "=" + S2];
|
7078 | }
|
7079 | return [p2(O2) + "=" + p2(u2(b2, kw.encoder, h2, "value", l2))];
|
7080 | }
|
7081 | return [p2(e2) + "=" + p2(String(b2))];
|
7082 | }
|
7083 | var E2, P2 = [];
|
7084 | if (void 0 === b2)
|
7085 | return P2;
|
7086 | if ("comma" === n2 && Ow(b2))
|
7087 | E2 = [{ value: b2.length > 0 ? b2.join(",") || null : void 0 }];
|
7088 | else if (Ow(a2))
|
7089 | E2 = a2;
|
7090 | else {
|
7091 | var k2 = Object.keys(b2);
|
7092 | E2 = f2 ? k2.sort(f2) : k2;
|
7093 | }
|
7094 | for (var _2 = 0; _2 < E2.length; ++_2) {
|
7095 | var I2 = E2[_2], T2 = "object" == typeof I2 && void 0 !== I2.value ? I2.value : b2[I2];
|
7096 | if (!i2 || null !== T2) {
|
7097 | var R2 = Ow(b2) ? "function" == typeof n2 ? n2(e2, I2) : e2 : e2 + (c2 ? "." + I2 : "[" + I2 + "]");
|
7098 | d2.set(r2, g2);
|
7099 | var F2 = bw();
|
7100 | F2.set(_w, d2), xw(P2, t5(T2, R2, n2, o2, i2, u2, a2, f2, c2, s2, l2, p2, v2, h2, F2));
|
7101 | }
|
7102 | }
|
7103 | return P2;
|
7104 | }, Tw = yw, Rw = Object.prototype.hasOwnProperty, Fw = Array.isArray, Nw = { allowDots: false, allowPrototypes: false, allowSparse: false, arrayLimit: 20, charset: "utf-8", charsetSentinel: false, comma: false, decoder: Tw.decode, delimiter: "&", depth: 5, ignoreQueryPrefix: false, interpretNumericEntities: false, parameterLimit: 1e3, parseArrays: true, plainObjects: false, strictNullHandling: false }, Mw = function(t9) {
|
7105 | return t9.replace(/&#(\d+);/g, function(t10, r2) {
|
7106 | return String.fromCharCode(parseInt(r2, 10));
|
7107 | });
|
7108 | }, Dw = function(t9, r2) {
|
7109 | return t9 && "string" == typeof t9 && r2.comma && t9.indexOf(",") > -1 ? t9.split(",") : t9;
|
7110 | }, Uw = function(t9, r2, e2, n2) {
|
7111 | if (t9) {
|
7112 | var o2 = e2.allowDots ? t9.replace(/\.([^.[]+)/g, "[$1]") : t9, i2 = /(\[[^[\]]*])/g, u2 = e2.depth > 0 && /(\[[^[\]]*])/.exec(o2), a2 = u2 ? o2.slice(0, u2.index) : o2, f2 = [];
|
7113 | if (a2) {
|
7114 | if (!e2.plainObjects && Rw.call(Object.prototype, a2) && !e2.allowPrototypes)
|
7115 | return;
|
7116 | f2.push(a2);
|
7117 | }
|
7118 | for (var c2 = 0; e2.depth > 0 && null !== (u2 = i2.exec(o2)) && c2 < e2.depth; ) {
|
7119 | if (c2 += 1, !e2.plainObjects && Rw.call(Object.prototype, u2[1].slice(1, -1)) && !e2.allowPrototypes)
|
7120 | return;
|
7121 | f2.push(u2[1]);
|
7122 | }
|
7123 | return u2 && f2.push("[" + o2.slice(u2.index) + "]"), function(t10, r3, e3, n3) {
|
7124 | for (var o3 = n3 ? r3 : Dw(r3, e3), i3 = t10.length - 1; i3 >= 0; --i3) {
|
7125 | var u3, a3 = t10[i3];
|
7126 | if ("[]" === a3 && e3.parseArrays)
|
7127 | u3 = [].concat(o3);
|
7128 | else {
|
7129 | u3 = e3.plainObjects ? Object.create(null) : {};
|
7130 | var f3 = "[" === a3.charAt(0) && "]" === a3.charAt(a3.length - 1) ? a3.slice(1, -1) : a3, c3 = parseInt(f3, 10);
|
7131 | e3.parseArrays || "" !== f3 ? !isNaN(c3) && a3 !== f3 && String(c3) === f3 && c3 >= 0 && e3.parseArrays && c3 <= e3.arrayLimit ? (u3 = [])[c3] = o3 : "__proto__" !== f3 && (u3[f3] = o3) : u3 = { 0: o3 };
|
7132 | }
|
7133 | o3 = u3;
|
7134 | }
|
7135 | return o3;
|
7136 | }(f2, r2, e2, n2);
|
7137 | }
|
7138 | }, Lw = function(t9, r2) {
|
7139 | var e2, n2 = t9, o2 = function(t10) {
|
7140 | if (!t10)
|
7141 | return kw;
|
7142 | if (null !== t10.encoder && void 0 !== t10.encoder && "function" != typeof t10.encoder)
|
7143 | throw new TypeError("Encoder has to be a function.");
|
7144 | var r3 = t10.charset || kw.charset;
|
7145 | if (void 0 !== t10.charset && "utf-8" !== t10.charset && "iso-8859-1" !== t10.charset)
|
7146 | throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
|
7147 | var e3 = gw.default;
|
7148 | if (void 0 !== t10.format) {
|
7149 | if (!ww.call(gw.formatters, t10.format))
|
7150 | throw new TypeError("Unknown format option provided.");
|
7151 | e3 = t10.format;
|
7152 | }
|
7153 | var n3 = gw.formatters[e3], o3 = kw.filter;
|
7154 | return ("function" == typeof t10.filter || Ow(t10.filter)) && (o3 = t10.filter), { addQueryPrefix: "boolean" == typeof t10.addQueryPrefix ? t10.addQueryPrefix : kw.addQueryPrefix, allowDots: void 0 === t10.allowDots ? kw.allowDots : !!t10.allowDots, charset: r3, charsetSentinel: "boolean" == typeof t10.charsetSentinel ? t10.charsetSentinel : kw.charsetSentinel, delimiter: void 0 === t10.delimiter ? kw.delimiter : t10.delimiter, encode: "boolean" == typeof t10.encode ? t10.encode : kw.encode, encoder: "function" == typeof t10.encoder ? t10.encoder : kw.encoder, encodeValuesOnly: "boolean" == typeof t10.encodeValuesOnly ? t10.encodeValuesOnly : kw.encodeValuesOnly, filter: o3, format: e3, formatter: n3, serializeDate: "function" == typeof t10.serializeDate ? t10.serializeDate : kw.serializeDate, skipNulls: "boolean" == typeof t10.skipNulls ? t10.skipNulls : kw.skipNulls, sort: "function" == typeof t10.sort ? t10.sort : null, strictNullHandling: "boolean" == typeof t10.strictNullHandling ? t10.strictNullHandling : kw.strictNullHandling };
|
7155 | }(r2);
|
7156 | "function" == typeof o2.filter ? n2 = (0, o2.filter)("", n2) : Ow(o2.filter) && (e2 = o2.filter);
|
7157 | var i2, u2 = [];
|
7158 | if ("object" != typeof n2 || null === n2)
|
7159 | return "";
|
7160 | i2 = r2 && r2.arrayFormat in jw ? r2.arrayFormat : r2 && "indices" in r2 ? r2.indices ? "indices" : "repeat" : "indices";
|
7161 | var a2 = jw[i2];
|
7162 | e2 || (e2 = Object.keys(n2)), o2.sort && e2.sort(o2.sort);
|
7163 | for (var f2 = bw(), c2 = 0; c2 < e2.length; ++c2) {
|
7164 | var s2 = e2[c2];
|
7165 | o2.skipNulls && null === n2[s2] || xw(u2, Iw(n2[s2], s2, a2, o2.strictNullHandling, o2.skipNulls, o2.encode ? o2.encoder : null, o2.filter, o2.sort, o2.allowDots, o2.serializeDate, o2.format, o2.formatter, o2.encodeValuesOnly, o2.charset, f2));
|
7166 | }
|
7167 | var l2 = u2.join(o2.delimiter), p2 = true === o2.addQueryPrefix ? "?" : "";
|
7168 | return o2.charsetSentinel && ("iso-8859-1" === o2.charset ? p2 += "utf8=%26%2310003%3B&" : p2 += "utf8=%E2%9C%93&"), l2.length > 0 ? p2 + l2 : "";
|
7169 | }, Cw = function(t9, r2) {
|
7170 | var e2 = function(t10) {
|
7171 | if (!t10)
|
7172 | return Nw;
|
7173 | if (null !== t10.decoder && void 0 !== t10.decoder && "function" != typeof t10.decoder)
|
7174 | throw new TypeError("Decoder has to be a function.");
|
7175 | if (void 0 !== t10.charset && "utf-8" !== t10.charset && "iso-8859-1" !== t10.charset)
|
7176 | throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
|
7177 | var r3 = void 0 === t10.charset ? Nw.charset : t10.charset;
|
7178 | return { allowDots: void 0 === t10.allowDots ? Nw.allowDots : !!t10.allowDots, allowPrototypes: "boolean" == typeof t10.allowPrototypes ? t10.allowPrototypes : Nw.allowPrototypes, allowSparse: "boolean" == typeof t10.allowSparse ? t10.allowSparse : Nw.allowSparse, arrayLimit: "number" == typeof t10.arrayLimit ? t10.arrayLimit : Nw.arrayLimit, charset: r3, charsetSentinel: "boolean" == typeof t10.charsetSentinel ? t10.charsetSentinel : Nw.charsetSentinel, comma: "boolean" == typeof t10.comma ? t10.comma : Nw.comma, decoder: "function" == typeof t10.decoder ? t10.decoder : Nw.decoder, delimiter: "string" == typeof t10.delimiter || Tw.isRegExp(t10.delimiter) ? t10.delimiter : Nw.delimiter, depth: "number" == typeof t10.depth || false === t10.depth ? +t10.depth : Nw.depth, ignoreQueryPrefix: true === t10.ignoreQueryPrefix, interpretNumericEntities: "boolean" == typeof t10.interpretNumericEntities ? t10.interpretNumericEntities : Nw.interpretNumericEntities, parameterLimit: "number" == typeof t10.parameterLimit ? t10.parameterLimit : Nw.parameterLimit, parseArrays: false !== t10.parseArrays, plainObjects: "boolean" == typeof t10.plainObjects ? t10.plainObjects : Nw.plainObjects, strictNullHandling: "boolean" == typeof t10.strictNullHandling ? t10.strictNullHandling : Nw.strictNullHandling };
|
7179 | }(r2);
|
7180 | if ("" === t9 || null == t9)
|
7181 | return e2.plainObjects ? Object.create(null) : {};
|
7182 | for (var n2 = "string" == typeof t9 ? function(t10, r3) {
|
7183 | var e3, n3 = {}, o3 = r3.ignoreQueryPrefix ? t10.replace(/^\?/, "") : t10, i3 = r3.parameterLimit === 1 / 0 ? void 0 : r3.parameterLimit, u3 = o3.split(r3.delimiter, i3), a3 = -1, f3 = r3.charset;
|
7184 | if (r3.charsetSentinel)
|
7185 | for (e3 = 0; e3 < u3.length; ++e3)
|
7186 | 0 === u3[e3].indexOf("utf8=") && ("utf8=%E2%9C%93" === u3[e3] ? f3 = "utf-8" : "utf8=%26%2310003%3B" === u3[e3] && (f3 = "iso-8859-1"), a3 = e3, e3 = u3.length);
|
7187 | for (e3 = 0; e3 < u3.length; ++e3)
|
7188 | if (e3 !== a3) {
|
7189 | var c2, s2, l2 = u3[e3], p2 = l2.indexOf("]="), v2 = -1 === p2 ? l2.indexOf("=") : p2 + 1;
|
7190 | -1 === v2 ? (c2 = r3.decoder(l2, Nw.decoder, f3, "key"), s2 = r3.strictNullHandling ? null : "") : (c2 = r3.decoder(l2.slice(0, v2), Nw.decoder, f3, "key"), s2 = Tw.maybeMap(Dw(l2.slice(v2 + 1), r3), function(t11) {
|
7191 | return r3.decoder(t11, Nw.decoder, f3, "value");
|
7192 | })), s2 && r3.interpretNumericEntities && "iso-8859-1" === f3 && (s2 = Mw(s2)), l2.indexOf("[]=") > -1 && (s2 = Fw(s2) ? [s2] : s2), Rw.call(n3, c2) ? n3[c2] = Tw.combine(n3[c2], s2) : n3[c2] = s2;
|
7193 | }
|
7194 | return n3;
|
7195 | }(t9, e2) : t9, o2 = e2.plainObjects ? Object.create(null) : {}, i2 = Object.keys(n2), u2 = 0; u2 < i2.length; ++u2) {
|
7196 | var a2 = i2[u2], f2 = Uw(a2, n2[a2], e2, "string" == typeof t9);
|
7197 | o2 = Tw.merge(o2, f2, e2);
|
7198 | }
|
7199 | return true === e2.allowSparse ? o2 : Tw.compact(o2);
|
7200 | }, $w = { formats: sw, parse: Cw, stringify: Lw };
|
7201 |
|
7202 | function Bw(t9) {
|
7203 | return null == t9;
|
7204 | }
|
7205 | var qw = function(t9, r2) {
|
7206 | var e2, n2, o2, i2;
|
7207 | if (r2)
|
7208 | for (e2 = 0, n2 = (i2 = Object.keys(r2)).length; e2 < n2; e2 += 1)
|
7209 | t9[o2 = i2[e2]] = r2[o2];
|
7210 | return t9;
|
7211 | }, Gw = { isNothing: Bw, isObject: function(t9) {
|
7212 | return "object" == typeof t9 && null !== t9;
|
7213 | }, toArray: function(t9) {
|
7214 | return Array.isArray(t9) ? t9 : Bw(t9) ? [] : [t9];
|
7215 | }, repeat: function(t9, r2) {
|
7216 | var e2, n2 = "";
|
7217 | for (e2 = 0; e2 < r2; e2 += 1)
|
7218 | n2 += t9;
|
7219 | return n2;
|
7220 | }, isNegativeZero: function(t9) {
|
7221 | return 0 === t9 && Number.NEGATIVE_INFINITY === 1 / t9;
|
7222 | }, extend: qw };
|
7223 | function Ww(t9, r2) {
|
7224 | var e2 = "", n2 = t9.reason || "(unknown reason)";
|
7225 | return t9.mark ? (t9.mark.name && (e2 += 'in "' + t9.mark.name + '" '), e2 += "(" + (t9.mark.line + 1) + ":" + (t9.mark.column + 1) + ")", !r2 && t9.mark.snippet && (e2 += "\n\n" + t9.mark.snippet), n2 + " " + e2) : n2;
|
7226 | }
|
7227 | function zw(t9, r2) {
|
7228 | Error.call(this), this.name = "YAMLException", this.reason = t9, this.mark = r2, this.message = Ww(this, false), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack || "";
|
7229 | }
|
7230 | zw.prototype = Object.create(Error.prototype), zw.prototype.constructor = zw, zw.prototype.toString = function(t9) {
|
7231 | return this.name + ": " + Ww(this, t9);
|
7232 | };
|
7233 | var Jw = zw;
|
7234 | function Hw(t9, r2, e2, n2, o2) {
|
7235 | var i2 = "", u2 = "", a2 = Math.floor(o2 / 2) - 1;
|
7236 | return n2 - r2 > a2 && (r2 = n2 - a2 + (i2 = " ... ").length), e2 - n2 > a2 && (e2 = n2 + a2 - (u2 = " ...").length), { str: i2 + t9.slice(r2, e2).replace(/\t/g, "\u2192") + u2, pos: n2 - r2 + i2.length };
|
7237 | }
|
7238 | function Vw(t9, r2) {
|
7239 | return Gw.repeat(" ", r2 - t9.length) + t9;
|
7240 | }
|
7241 | var Yw = function(t9, r2) {
|
7242 | if (r2 = Object.create(r2 || null), !t9.buffer)
|
7243 | return null;
|
7244 | r2.maxLength || (r2.maxLength = 79), "number" != typeof r2.indent && (r2.indent = 1), "number" != typeof r2.linesBefore && (r2.linesBefore = 3), "number" != typeof r2.linesAfter && (r2.linesAfter = 2);
|
7245 | for (var e2, n2 = /\r?\n|\r|\0/g, o2 = [0], i2 = [], u2 = -1; e2 = n2.exec(t9.buffer); )
|
7246 | i2.push(e2.index), o2.push(e2.index + e2[0].length), t9.position <= e2.index && u2 < 0 && (u2 = o2.length - 2);
|
7247 | u2 < 0 && (u2 = o2.length - 1);
|
7248 | var a2, f2, c2 = "", s2 = Math.min(t9.line + r2.linesAfter, i2.length).toString().length, l2 = r2.maxLength - (r2.indent + s2 + 3);
|
7249 | for (a2 = 1; a2 <= r2.linesBefore && !(u2 - a2 < 0); a2++)
|
7250 | f2 = Hw(t9.buffer, o2[u2 - a2], i2[u2 - a2], t9.position - (o2[u2] - o2[u2 - a2]), l2), c2 = Gw.repeat(" ", r2.indent) + Vw((t9.line - a2 + 1).toString(), s2) + " | " + f2.str + "\n" + c2;
|
7251 | for (f2 = Hw(t9.buffer, o2[u2], i2[u2], t9.position, l2), c2 += Gw.repeat(" ", r2.indent) + Vw((t9.line + 1).toString(), s2) + " | " + f2.str + "\n", c2 += Gw.repeat("-", r2.indent + s2 + 3 + f2.pos) + "^\n", a2 = 1; a2 <= r2.linesAfter && !(u2 + a2 >= i2.length); a2++)
|
7252 | f2 = Hw(t9.buffer, o2[u2 + a2], i2[u2 + a2], t9.position - (o2[u2] - o2[u2 + a2]), l2), c2 += Gw.repeat(" ", r2.indent) + Vw((t9.line + a2 + 1).toString(), s2) + " | " + f2.str + "\n";
|
7253 | return c2.replace(/\n$/, "");
|
7254 | }, Qw = ["kind", "multi", "resolve", "construct", "instanceOf", "predicate", "represent", "representName", "defaultStyle", "styleAliases"], Kw = ["scalar", "sequence", "mapping"];
|
7255 | var Xw = function(t9, r2) {
|
7256 | if (r2 = r2 || {}, Object.keys(r2).forEach(function(r3) {
|
7257 | if (-1 === Qw.indexOf(r3))
|
7258 | throw new Jw('Unknown option "' + r3 + '" is met in definition of "' + t9 + '" YAML type.');
|
7259 | }), this.options = r2, this.tag = t9, this.kind = r2.kind || null, this.resolve = r2.resolve || function() {
|
7260 | return true;
|
7261 | }, this.construct = r2.construct || function(t10) {
|
7262 | return t10;
|
7263 | }, this.instanceOf = r2.instanceOf || null, this.predicate = r2.predicate || null, this.represent = r2.represent || null, this.representName = r2.representName || null, this.defaultStyle = r2.defaultStyle || null, this.multi = r2.multi || false, this.styleAliases = function(t10) {
|
7264 | var r3 = {};
|
7265 | return null !== t10 && Object.keys(t10).forEach(function(e2) {
|
7266 | t10[e2].forEach(function(t11) {
|
7267 | r3[String(t11)] = e2;
|
7268 | });
|
7269 | }), r3;
|
7270 | }(r2.styleAliases || null), -1 === Kw.indexOf(this.kind))
|
7271 | throw new Jw('Unknown kind "' + this.kind + '" is specified for "' + t9 + '" YAML type.');
|
7272 | };
|
7273 | function Zw(t9, r2) {
|
7274 | var e2 = [];
|
7275 | return t9[r2].forEach(function(t10) {
|
7276 | var r3 = e2.length;
|
7277 | e2.forEach(function(e3, n2) {
|
7278 | e3.tag === t10.tag && e3.kind === t10.kind && e3.multi === t10.multi && (r3 = n2);
|
7279 | }), e2[r3] = t10;
|
7280 | }), e2;
|
7281 | }
|
7282 | function tj(t9) {
|
7283 | return this.extend(t9);
|
7284 | }
|
7285 | tj.prototype.extend = function(t9) {
|
7286 | var r2 = [], e2 = [];
|
7287 | if (t9 instanceof Xw)
|
7288 | e2.push(t9);
|
7289 | else if (Array.isArray(t9))
|
7290 | e2 = e2.concat(t9);
|
7291 | else {
|
7292 | if (!t9 || !Array.isArray(t9.implicit) && !Array.isArray(t9.explicit))
|
7293 | throw new Jw("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
7294 | t9.implicit && (r2 = r2.concat(t9.implicit)), t9.explicit && (e2 = e2.concat(t9.explicit));
|
7295 | }
|
7296 | r2.forEach(function(t10) {
|
7297 | if (!(t10 instanceof Xw))
|
7298 | throw new Jw("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
7299 | if (t10.loadKind && "scalar" !== t10.loadKind)
|
7300 | throw new Jw("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
7301 | if (t10.multi)
|
7302 | throw new Jw("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
7303 | }), e2.forEach(function(t10) {
|
7304 | if (!(t10 instanceof Xw))
|
7305 | throw new Jw("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
7306 | });
|
7307 | var n2 = Object.create(tj.prototype);
|
7308 | return n2.implicit = (this.implicit || []).concat(r2), n2.explicit = (this.explicit || []).concat(e2), n2.compiledImplicit = Zw(n2, "implicit"), n2.compiledExplicit = Zw(n2, "explicit"), n2.compiledTypeMap = function() {
|
7309 | var t10, r3, e3 = { scalar: {}, sequence: {}, mapping: {}, fallback: {}, multi: { scalar: [], sequence: [], mapping: [], fallback: [] } };
|
7310 | function n3(t11) {
|
7311 | t11.multi ? (e3.multi[t11.kind].push(t11), e3.multi.fallback.push(t11)) : e3[t11.kind][t11.tag] = e3.fallback[t11.tag] = t11;
|
7312 | }
|
7313 | for (t10 = 0, r3 = arguments.length; t10 < r3; t10 += 1)
|
7314 | arguments[t10].forEach(n3);
|
7315 | return e3;
|
7316 | }(n2.compiledImplicit, n2.compiledExplicit), n2;
|
7317 | };
|
7318 | var rj = tj, ej = new Xw("tag:yaml.org,2002:str", { kind: "scalar", construct: function(t9) {
|
7319 | return null !== t9 ? t9 : "";
|
7320 | } }), nj = new Xw("tag:yaml.org,2002:seq", { kind: "sequence", construct: function(t9) {
|
7321 | return null !== t9 ? t9 : [];
|
7322 | } }), oj = new Xw("tag:yaml.org,2002:map", { kind: "mapping", construct: function(t9) {
|
7323 | return null !== t9 ? t9 : {};
|
7324 | } }), ij = new rj({ explicit: [ej, nj, oj] });
|
7325 | var uj = new Xw("tag:yaml.org,2002:null", { kind: "scalar", resolve: function(t9) {
|
7326 | if (null === t9)
|
7327 | return true;
|
7328 | var r2 = t9.length;
|
7329 | return 1 === r2 && "~" === t9 || 4 === r2 && ("null" === t9 || "Null" === t9 || "NULL" === t9);
|
7330 | }, construct: function() {
|
7331 | return null;
|
7332 | }, predicate: function(t9) {
|
7333 | return null === t9;
|
7334 | }, represent: { canonical: function() {
|
7335 | return "~";
|
7336 | }, lowercase: function() {
|
7337 | return "null";
|
7338 | }, uppercase: function() {
|
7339 | return "NULL";
|
7340 | }, camelcase: function() {
|
7341 | return "Null";
|
7342 | }, empty: function() {
|
7343 | return "";
|
7344 | } }, defaultStyle: "lowercase" });
|
7345 | var aj = new Xw("tag:yaml.org,2002:bool", { kind: "scalar", resolve: function(t9) {
|
7346 | if (null === t9)
|
7347 | return false;
|
7348 | var r2 = t9.length;
|
7349 | return 4 === r2 && ("true" === t9 || "True" === t9 || "TRUE" === t9) || 5 === r2 && ("false" === t9 || "False" === t9 || "FALSE" === t9);
|
7350 | }, construct: function(t9) {
|
7351 | return "true" === t9 || "True" === t9 || "TRUE" === t9;
|
7352 | }, predicate: function(t9) {
|
7353 | return "[object Boolean]" === Object.prototype.toString.call(t9);
|
7354 | }, represent: { lowercase: function(t9) {
|
7355 | return t9 ? "true" : "false";
|
7356 | }, uppercase: function(t9) {
|
7357 | return t9 ? "TRUE" : "FALSE";
|
7358 | }, camelcase: function(t9) {
|
7359 | return t9 ? "True" : "False";
|
7360 | } }, defaultStyle: "lowercase" });
|
7361 | function fj(t9) {
|
7362 | return 48 <= t9 && t9 <= 55;
|
7363 | }
|
7364 | function cj(t9) {
|
7365 | return 48 <= t9 && t9 <= 57;
|
7366 | }
|
7367 | var sj = new Xw("tag:yaml.org,2002:int", { kind: "scalar", resolve: function(t9) {
|
7368 | if (null === t9)
|
7369 | return false;
|
7370 | var r2, e2, n2 = t9.length, o2 = 0, i2 = false;
|
7371 | if (!n2)
|
7372 | return false;
|
7373 | if ("-" !== (r2 = t9[o2]) && "+" !== r2 || (r2 = t9[++o2]), "0" === r2) {
|
7374 | if (o2 + 1 === n2)
|
7375 | return true;
|
7376 | if ("b" === (r2 = t9[++o2])) {
|
7377 | for (o2++; o2 < n2; o2++)
|
7378 | if ("_" !== (r2 = t9[o2])) {
|
7379 | if ("0" !== r2 && "1" !== r2)
|
7380 | return false;
|
7381 | i2 = true;
|
7382 | }
|
7383 | return i2 && "_" !== r2;
|
7384 | }
|
7385 | if ("x" === r2) {
|
7386 | for (o2++; o2 < n2; o2++)
|
7387 | if ("_" !== (r2 = t9[o2])) {
|
7388 | if (!(48 <= (e2 = t9.charCodeAt(o2)) && e2 <= 57 || 65 <= e2 && e2 <= 70 || 97 <= e2 && e2 <= 102))
|
7389 | return false;
|
7390 | i2 = true;
|
7391 | }
|
7392 | return i2 && "_" !== r2;
|
7393 | }
|
7394 | if ("o" === r2) {
|
7395 | for (o2++; o2 < n2; o2++)
|
7396 | if ("_" !== (r2 = t9[o2])) {
|
7397 | if (!fj(t9.charCodeAt(o2)))
|
7398 | return false;
|
7399 | i2 = true;
|
7400 | }
|
7401 | return i2 && "_" !== r2;
|
7402 | }
|
7403 | }
|
7404 | if ("_" === r2)
|
7405 | return false;
|
7406 | for (; o2 < n2; o2++)
|
7407 | if ("_" !== (r2 = t9[o2])) {
|
7408 | if (!cj(t9.charCodeAt(o2)))
|
7409 | return false;
|
7410 | i2 = true;
|
7411 | }
|
7412 | return !(!i2 || "_" === r2);
|
7413 | }, construct: function(t9) {
|
7414 | var r2, e2 = t9, n2 = 1;
|
7415 | if (-1 !== e2.indexOf("_") && (e2 = e2.replace(/_/g, "")), "-" !== (r2 = e2[0]) && "+" !== r2 || ("-" === r2 && (n2 = -1), r2 = (e2 = e2.slice(1))[0]), "0" === e2)
|
7416 | return 0;
|
7417 | if ("0" === r2) {
|
7418 | if ("b" === e2[1])
|
7419 | return n2 * parseInt(e2.slice(2), 2);
|
7420 | if ("x" === e2[1])
|
7421 | return n2 * parseInt(e2.slice(2), 16);
|
7422 | if ("o" === e2[1])
|
7423 | return n2 * parseInt(e2.slice(2), 8);
|
7424 | }
|
7425 | return n2 * parseInt(e2, 10);
|
7426 | }, predicate: function(t9) {
|
7427 | return "[object Number]" === Object.prototype.toString.call(t9) && t9 % 1 == 0 && !Gw.isNegativeZero(t9);
|
7428 | }, represent: { binary: function(t9) {
|
7429 | return t9 >= 0 ? "0b" + t9.toString(2) : "-0b" + t9.toString(2).slice(1);
|
7430 | }, octal: function(t9) {
|
7431 | return t9 >= 0 ? "0o" + t9.toString(8) : "-0o" + t9.toString(8).slice(1);
|
7432 | }, decimal: function(t9) {
|
7433 | return t9.toString(10);
|
7434 | }, hexadecimal: function(t9) {
|
7435 | return t9 >= 0 ? "0x" + t9.toString(16).toUpperCase() : "-0x" + t9.toString(16).toUpperCase().slice(1);
|
7436 | } }, defaultStyle: "decimal", styleAliases: { binary: [2, "bin"], octal: [8, "oct"], decimal: [10, "dec"], hexadecimal: [16, "hex"] } }), lj = new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
7437 | var pj = /^[-+]?[0-9]+e/;
|
7438 | var vj = new Xw("tag:yaml.org,2002:float", { kind: "scalar", resolve: function(t9) {
|
7439 | return null !== t9 && !(!lj.test(t9) || "_" === t9[t9.length - 1]);
|
7440 | }, construct: function(t9) {
|
7441 | var r2, e2;
|
7442 | return e2 = "-" === (r2 = t9.replace(/_/g, "").toLowerCase())[0] ? -1 : 1, "+-".indexOf(r2[0]) >= 0 && (r2 = r2.slice(1)), ".inf" === r2 ? 1 === e2 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY : ".nan" === r2 ? NaN : e2 * parseFloat(r2, 10);
|
7443 | }, predicate: function(t9) {
|
7444 | return "[object Number]" === Object.prototype.toString.call(t9) && (t9 % 1 != 0 || Gw.isNegativeZero(t9));
|
7445 | }, represent: function(t9, r2) {
|
7446 | var e2;
|
7447 | if (isNaN(t9))
|
7448 | switch (r2) {
|
7449 | case "lowercase":
|
7450 | return ".nan";
|
7451 | case "uppercase":
|
7452 | return ".NAN";
|
7453 | case "camelcase":
|
7454 | return ".NaN";
|
7455 | }
|
7456 | else if (Number.POSITIVE_INFINITY === t9)
|
7457 | switch (r2) {
|
7458 | case "lowercase":
|
7459 | return ".inf";
|
7460 | case "uppercase":
|
7461 | return ".INF";
|
7462 | case "camelcase":
|
7463 | return ".Inf";
|
7464 | }
|
7465 | else if (Number.NEGATIVE_INFINITY === t9)
|
7466 | switch (r2) {
|
7467 | case "lowercase":
|
7468 | return "-.inf";
|
7469 | case "uppercase":
|
7470 | return "-.INF";
|
7471 | case "camelcase":
|
7472 | return "-.Inf";
|
7473 | }
|
7474 | else if (Gw.isNegativeZero(t9))
|
7475 | return "-0.0";
|
7476 | return e2 = t9.toString(10), pj.test(e2) ? e2.replace("e", ".e") : e2;
|
7477 | }, defaultStyle: "lowercase" }), hj = ij.extend({ implicit: [uj, aj, sj, vj] }), dj = hj, yj = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"), bj = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
|
7478 | var mj = new Xw("tag:yaml.org,2002:timestamp", { kind: "scalar", resolve: function(t9) {
|
7479 | return null !== t9 && (null !== yj.exec(t9) || null !== bj.exec(t9));
|
7480 | }, construct: function(t9) {
|
7481 | var r2, e2, n2, o2, i2, u2, a2, f2, c2 = 0, s2 = null;
|
7482 | if (null === (r2 = yj.exec(t9)) && (r2 = bj.exec(t9)), null === r2)
|
7483 | throw new Error("Date resolve error");
|
7484 | if (e2 = +r2[1], n2 = +r2[2] - 1, o2 = +r2[3], !r2[4])
|
7485 | return new Date(Date.UTC(e2, n2, o2));
|
7486 | if (i2 = +r2[4], u2 = +r2[5], a2 = +r2[6], r2[7]) {
|
7487 | for (c2 = r2[7].slice(0, 3); c2.length < 3; )
|
7488 | c2 += "0";
|
7489 | c2 = +c2;
|
7490 | }
|
7491 | return r2[9] && (s2 = 6e4 * (60 * +r2[10] + +(r2[11] || 0)), "-" === r2[9] && (s2 = -s2)), f2 = new Date(Date.UTC(e2, n2, o2, i2, u2, a2, c2)), s2 && f2.setTime(f2.getTime() - s2), f2;
|
7492 | }, instanceOf: Date, represent: function(t9) {
|
7493 | return t9.toISOString();
|
7494 | } });
|
7495 | var gj = new Xw("tag:yaml.org,2002:merge", { kind: "scalar", resolve: function(t9) {
|
7496 | return "<<" === t9 || null === t9;
|
7497 | } }), wj = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
7498 | var jj = new Xw("tag:yaml.org,2002:binary", { kind: "scalar", resolve: function(t9) {
|
7499 | if (null === t9)
|
7500 | return false;
|
7501 | var r2, e2, n2 = 0, o2 = t9.length, i2 = wj;
|
7502 | for (e2 = 0; e2 < o2; e2++)
|
7503 | if (!((r2 = i2.indexOf(t9.charAt(e2))) > 64)) {
|
7504 | if (r2 < 0)
|
7505 | return false;
|
7506 | n2 += 6;
|
7507 | }
|
7508 | return n2 % 8 == 0;
|
7509 | }, construct: function(t9) {
|
7510 | var r2, e2, n2 = t9.replace(/[\r\n=]/g, ""), o2 = n2.length, i2 = wj, u2 = 0, a2 = [];
|
7511 | for (r2 = 0; r2 < o2; r2++)
|
7512 | r2 % 4 == 0 && r2 && (a2.push(u2 >> 16 & 255), a2.push(u2 >> 8 & 255), a2.push(255 & u2)), u2 = u2 << 6 | i2.indexOf(n2.charAt(r2));
|
7513 | return 0 === (e2 = o2 % 4 * 6) ? (a2.push(u2 >> 16 & 255), a2.push(u2 >> 8 & 255), a2.push(255 & u2)) : 18 === e2 ? (a2.push(u2 >> 10 & 255), a2.push(u2 >> 2 & 255)) : 12 === e2 && a2.push(u2 >> 4 & 255), new Uint8Array(a2);
|
7514 | }, predicate: function(t9) {
|
7515 | return "[object Uint8Array]" === Object.prototype.toString.call(t9);
|
7516 | }, represent: function(t9) {
|
7517 | var r2, e2, n2 = "", o2 = 0, i2 = t9.length, u2 = wj;
|
7518 | for (r2 = 0; r2 < i2; r2++)
|
7519 | r2 % 3 == 0 && r2 && (n2 += u2[o2 >> 18 & 63], n2 += u2[o2 >> 12 & 63], n2 += u2[o2 >> 6 & 63], n2 += u2[63 & o2]), o2 = (o2 << 8) + t9[r2];
|
7520 | return 0 === (e2 = i2 % 3) ? (n2 += u2[o2 >> 18 & 63], n2 += u2[o2 >> 12 & 63], n2 += u2[o2 >> 6 & 63], n2 += u2[63 & o2]) : 2 === e2 ? (n2 += u2[o2 >> 10 & 63], n2 += u2[o2 >> 4 & 63], n2 += u2[o2 << 2 & 63], n2 += u2[64]) : 1 === e2 && (n2 += u2[o2 >> 2 & 63], n2 += u2[o2 << 4 & 63], n2 += u2[64], n2 += u2[64]), n2;
|
7521 | } }), Oj = Object.prototype.hasOwnProperty, Aj = Object.prototype.toString;
|
7522 | var Sj = new Xw("tag:yaml.org,2002:omap", { kind: "sequence", resolve: function(t9) {
|
7523 | if (null === t9)
|
7524 | return true;
|
7525 | var r2, e2, n2, o2, i2, u2 = [], a2 = t9;
|
7526 | for (r2 = 0, e2 = a2.length; r2 < e2; r2 += 1) {
|
7527 | if (n2 = a2[r2], i2 = false, "[object Object]" !== Aj.call(n2))
|
7528 | return false;
|
7529 | for (o2 in n2)
|
7530 | if (Oj.call(n2, o2)) {
|
7531 | if (i2)
|
7532 | return false;
|
7533 | i2 = true;
|
7534 | }
|
7535 | if (!i2)
|
7536 | return false;
|
7537 | if (-1 !== u2.indexOf(o2))
|
7538 | return false;
|
7539 | u2.push(o2);
|
7540 | }
|
7541 | return true;
|
7542 | }, construct: function(t9) {
|
7543 | return null !== t9 ? t9 : [];
|
7544 | } }), xj = Object.prototype.toString;
|
7545 | var Ej = new Xw("tag:yaml.org,2002:pairs", { kind: "sequence", resolve: function(t9) {
|
7546 | if (null === t9)
|
7547 | return true;
|
7548 | var r2, e2, n2, o2, i2, u2 = t9;
|
7549 | for (i2 = new Array(u2.length), r2 = 0, e2 = u2.length; r2 < e2; r2 += 1) {
|
7550 | if (n2 = u2[r2], "[object Object]" !== xj.call(n2))
|
7551 | return false;
|
7552 | if (1 !== (o2 = Object.keys(n2)).length)
|
7553 | return false;
|
7554 | i2[r2] = [o2[0], n2[o2[0]]];
|
7555 | }
|
7556 | return true;
|
7557 | }, construct: function(t9) {
|
7558 | if (null === t9)
|
7559 | return [];
|
7560 | var r2, e2, n2, o2, i2, u2 = t9;
|
7561 | for (i2 = new Array(u2.length), r2 = 0, e2 = u2.length; r2 < e2; r2 += 1)
|
7562 | n2 = u2[r2], o2 = Object.keys(n2), i2[r2] = [o2[0], n2[o2[0]]];
|
7563 | return i2;
|
7564 | } }), Pj = Object.prototype.hasOwnProperty;
|
7565 | var kj = new Xw("tag:yaml.org,2002:set", { kind: "mapping", resolve: function(t9) {
|
7566 | if (null === t9)
|
7567 | return true;
|
7568 | var r2, e2 = t9;
|
7569 | for (r2 in e2)
|
7570 | if (Pj.call(e2, r2) && null !== e2[r2])
|
7571 | return false;
|
7572 | return true;
|
7573 | }, construct: function(t9) {
|
7574 | return null !== t9 ? t9 : {};
|
7575 | } }), _j = dj.extend({ implicit: [mj, gj], explicit: [jj, Sj, Ej, kj] }), Ij = Object.prototype.hasOwnProperty, Tj = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/, Rj = /[\x85\u2028\u2029]/, Fj = /[,\[\]\{\}]/, Nj = /^(?:!|!!|![a-z\-]+!)$/i, Mj = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
7576 | function Dj(t9) {
|
7577 | return Object.prototype.toString.call(t9);
|
7578 | }
|
7579 | function Uj(t9) {
|
7580 | return 10 === t9 || 13 === t9;
|
7581 | }
|
7582 | function Lj(t9) {
|
7583 | return 9 === t9 || 32 === t9;
|
7584 | }
|
7585 | function Cj(t9) {
|
7586 | return 9 === t9 || 32 === t9 || 10 === t9 || 13 === t9;
|
7587 | }
|
7588 | function $j(t9) {
|
7589 | return 44 === t9 || 91 === t9 || 93 === t9 || 123 === t9 || 125 === t9;
|
7590 | }
|
7591 | function Bj(t9) {
|
7592 | var r2;
|
7593 | return 48 <= t9 && t9 <= 57 ? t9 - 48 : 97 <= (r2 = 32 | t9) && r2 <= 102 ? r2 - 97 + 10 : -1;
|
7594 | }
|
7595 | function qj(t9) {
|
7596 | return 48 === t9 ? "\0" : 97 === t9 ? "\x07" : 98 === t9 ? "\b" : 116 === t9 || 9 === t9 ? " " : 110 === t9 ? "\n" : 118 === t9 ? "\v" : 102 === t9 ? "\f" : 114 === t9 ? "\r" : 101 === t9 ? "\x1B" : 32 === t9 ? " " : 34 === t9 ? '"' : 47 === t9 ? "/" : 92 === t9 ? "\\" : 78 === t9 ? "\x85" : 95 === t9 ? "\xA0" : 76 === t9 ? "\u2028" : 80 === t9 ? "\u2029" : "";
|
7597 | }
|
7598 | function Gj(t9) {
|
7599 | return t9 <= 65535 ? String.fromCharCode(t9) : String.fromCharCode(55296 + (t9 - 65536 >> 10), 56320 + (t9 - 65536 & 1023));
|
7600 | }
|
7601 | for (var Wj = new Array(256), zj = new Array(256), Jj = 0; Jj < 256; Jj++)
|
7602 | Wj[Jj] = qj(Jj) ? 1 : 0, zj[Jj] = qj(Jj);
|
7603 | function Hj(t9, r2) {
|
7604 | this.input = t9, this.filename = r2.filename || null, this.schema = r2.schema || _j, this.onWarning = r2.onWarning || null, this.legacy = r2.legacy || false, this.json = r2.json || false, this.listener = r2.listener || null, this.implicitTypes = this.schema.compiledImplicit, this.typeMap = this.schema.compiledTypeMap, this.length = t9.length, this.position = 0, this.line = 0, this.lineStart = 0, this.lineIndent = 0, this.firstTabInLine = -1, this.documents = [];
|
7605 | }
|
7606 | function Vj(t9, r2) {
|
7607 | var e2 = { name: t9.filename, buffer: t9.input.slice(0, -1), position: t9.position, line: t9.line, column: t9.position - t9.lineStart };
|
7608 | return e2.snippet = Yw(e2), new Jw(r2, e2);
|
7609 | }
|
7610 | function Yj(t9, r2) {
|
7611 | throw Vj(t9, r2);
|
7612 | }
|
7613 | function Qj(t9, r2) {
|
7614 | t9.onWarning && t9.onWarning.call(null, Vj(t9, r2));
|
7615 | }
|
7616 | var Kj = { YAML: function(t9, r2, e2) {
|
7617 | var n2, o2, i2;
|
7618 | null !== t9.version && Yj(t9, "duplication of %YAML directive"), 1 !== e2.length && Yj(t9, "YAML directive accepts exactly one argument"), null === (n2 = /^([0-9]+)\.([0-9]+)$/.exec(e2[0])) && Yj(t9, "ill-formed argument of the YAML directive"), o2 = parseInt(n2[1], 10), i2 = parseInt(n2[2], 10), 1 !== o2 && Yj(t9, "unacceptable YAML version of the document"), t9.version = e2[0], t9.checkLineBreaks = i2 < 2, 1 !== i2 && 2 !== i2 && Qj(t9, "unsupported YAML version of the document");
|
7619 | }, TAG: function(t9, r2, e2) {
|
7620 | var n2, o2;
|
7621 | 2 !== e2.length && Yj(t9, "TAG directive accepts exactly two arguments"), n2 = e2[0], o2 = e2[1], Nj.test(n2) || Yj(t9, "ill-formed tag handle (first argument) of the TAG directive"), Ij.call(t9.tagMap, n2) && Yj(t9, 'there is a previously declared suffix for "' + n2 + '" tag handle'), Mj.test(o2) || Yj(t9, "ill-formed tag prefix (second argument) of the TAG directive");
|
7622 | try {
|
7623 | o2 = decodeURIComponent(o2);
|
7624 | } catch (r3) {
|
7625 | Yj(t9, "tag prefix is malformed: " + o2);
|
7626 | }
|
7627 | t9.tagMap[n2] = o2;
|
7628 | } };
|
7629 | function Xj(t9, r2, e2, n2) {
|
7630 | var o2, i2, u2, a2;
|
7631 | if (r2 < e2) {
|
7632 | if (a2 = t9.input.slice(r2, e2), n2)
|
7633 | for (o2 = 0, i2 = a2.length; o2 < i2; o2 += 1)
|
7634 | 9 === (u2 = a2.charCodeAt(o2)) || 32 <= u2 && u2 <= 1114111 || Yj(t9, "expected valid JSON character");
|
7635 | else
|
7636 | Tj.test(a2) && Yj(t9, "the stream contains non-printable characters");
|
7637 | t9.result += a2;
|
7638 | }
|
7639 | }
|
7640 | function Zj(t9, r2, e2, n2) {
|
7641 | var o2, i2, u2, a2;
|
7642 | for (Gw.isObject(e2) || Yj(t9, "cannot merge mappings; the provided source object is unacceptable"), u2 = 0, a2 = (o2 = Object.keys(e2)).length; u2 < a2; u2 += 1)
|
7643 | i2 = o2[u2], Ij.call(r2, i2) || (r2[i2] = e2[i2], n2[i2] = true);
|
7644 | }
|
7645 | function tO(t9, r2, e2, n2, o2, i2, u2, a2, f2) {
|
7646 | var c2, s2;
|
7647 | if (Array.isArray(o2))
|
7648 | for (c2 = 0, s2 = (o2 = Array.prototype.slice.call(o2)).length; c2 < s2; c2 += 1)
|
7649 | Array.isArray(o2[c2]) && Yj(t9, "nested arrays are not supported inside keys"), "object" == typeof o2 && "[object Object]" === Dj(o2[c2]) && (o2[c2] = "[object Object]");
|
7650 | if ("object" == typeof o2 && "[object Object]" === Dj(o2) && (o2 = "[object Object]"), o2 = String(o2), null === r2 && (r2 = {}), "tag:yaml.org,2002:merge" === n2)
|
7651 | if (Array.isArray(i2))
|
7652 | for (c2 = 0, s2 = i2.length; c2 < s2; c2 += 1)
|
7653 | Zj(t9, r2, i2[c2], e2);
|
7654 | else
|
7655 | Zj(t9, r2, i2, e2);
|
7656 | else
|
7657 | t9.json || Ij.call(e2, o2) || !Ij.call(r2, o2) || (t9.line = u2 || t9.line, t9.lineStart = a2 || t9.lineStart, t9.position = f2 || t9.position, Yj(t9, "duplicated mapping key")), "__proto__" === o2 ? Object.defineProperty(r2, o2, { configurable: true, enumerable: true, writable: true, value: i2 }) : r2[o2] = i2, delete e2[o2];
|
7658 | return r2;
|
7659 | }
|
7660 | function rO(t9) {
|
7661 | var r2;
|
7662 | 10 === (r2 = t9.input.charCodeAt(t9.position)) ? t9.position++ : 13 === r2 ? (t9.position++, 10 === t9.input.charCodeAt(t9.position) && t9.position++) : Yj(t9, "a line break is expected"), t9.line += 1, t9.lineStart = t9.position, t9.firstTabInLine = -1;
|
7663 | }
|
7664 | function eO(t9, r2, e2) {
|
7665 | for (var n2 = 0, o2 = t9.input.charCodeAt(t9.position); 0 !== o2; ) {
|
7666 | for (; Lj(o2); )
|
7667 | 9 === o2 && -1 === t9.firstTabInLine && (t9.firstTabInLine = t9.position), o2 = t9.input.charCodeAt(++t9.position);
|
7668 | if (r2 && 35 === o2)
|
7669 | do {
|
7670 | o2 = t9.input.charCodeAt(++t9.position);
|
7671 | } while (10 !== o2 && 13 !== o2 && 0 !== o2);
|
7672 | if (!Uj(o2))
|
7673 | break;
|
7674 | for (rO(t9), o2 = t9.input.charCodeAt(t9.position), n2++, t9.lineIndent = 0; 32 === o2; )
|
7675 | t9.lineIndent++, o2 = t9.input.charCodeAt(++t9.position);
|
7676 | }
|
7677 | return -1 !== e2 && 0 !== n2 && t9.lineIndent < e2 && Qj(t9, "deficient indentation"), n2;
|
7678 | }
|
7679 | function nO(t9) {
|
7680 | var r2, e2 = t9.position;
|
7681 | return !(45 !== (r2 = t9.input.charCodeAt(e2)) && 46 !== r2 || r2 !== t9.input.charCodeAt(e2 + 1) || r2 !== t9.input.charCodeAt(e2 + 2) || (e2 += 3, 0 !== (r2 = t9.input.charCodeAt(e2)) && !Cj(r2)));
|
7682 | }
|
7683 | function oO(t9, r2) {
|
7684 | 1 === r2 ? t9.result += " " : r2 > 1 && (t9.result += Gw.repeat("\n", r2 - 1));
|
7685 | }
|
7686 | function iO(t9, r2) {
|
7687 | var e2, n2, o2 = t9.tag, i2 = t9.anchor, u2 = [], a2 = false;
|
7688 | if (-1 !== t9.firstTabInLine)
|
7689 | return false;
|
7690 | for (null !== t9.anchor && (t9.anchorMap[t9.anchor] = u2), n2 = t9.input.charCodeAt(t9.position); 0 !== n2 && (-1 !== t9.firstTabInLine && (t9.position = t9.firstTabInLine, Yj(t9, "tab characters must not be used in indentation")), 45 === n2) && Cj(t9.input.charCodeAt(t9.position + 1)); )
|
7691 | if (a2 = true, t9.position++, eO(t9, true, -1) && t9.lineIndent <= r2)
|
7692 | u2.push(null), n2 = t9.input.charCodeAt(t9.position);
|
7693 | else if (e2 = t9.line, fO(t9, r2, 3, false, true), u2.push(t9.result), eO(t9, true, -1), n2 = t9.input.charCodeAt(t9.position), (t9.line === e2 || t9.lineIndent > r2) && 0 !== n2)
|
7694 | Yj(t9, "bad indentation of a sequence entry");
|
7695 | else if (t9.lineIndent < r2)
|
7696 | break;
|
7697 | return !!a2 && (t9.tag = o2, t9.anchor = i2, t9.kind = "sequence", t9.result = u2, true);
|
7698 | }
|
7699 | function uO(t9) {
|
7700 | var r2, e2, n2, o2, i2 = false, u2 = false;
|
7701 | if (33 !== (o2 = t9.input.charCodeAt(t9.position)))
|
7702 | return false;
|
7703 | if (null !== t9.tag && Yj(t9, "duplication of a tag property"), 60 === (o2 = t9.input.charCodeAt(++t9.position)) ? (i2 = true, o2 = t9.input.charCodeAt(++t9.position)) : 33 === o2 ? (u2 = true, e2 = "!!", o2 = t9.input.charCodeAt(++t9.position)) : e2 = "!", r2 = t9.position, i2) {
|
7704 | do {
|
7705 | o2 = t9.input.charCodeAt(++t9.position);
|
7706 | } while (0 !== o2 && 62 !== o2);
|
7707 | t9.position < t9.length ? (n2 = t9.input.slice(r2, t9.position), o2 = t9.input.charCodeAt(++t9.position)) : Yj(t9, "unexpected end of the stream within a verbatim tag");
|
7708 | } else {
|
7709 | for (; 0 !== o2 && !Cj(o2); )
|
7710 | 33 === o2 && (u2 ? Yj(t9, "tag suffix cannot contain exclamation marks") : (e2 = t9.input.slice(r2 - 1, t9.position + 1), Nj.test(e2) || Yj(t9, "named tag handle cannot contain such characters"), u2 = true, r2 = t9.position + 1)), o2 = t9.input.charCodeAt(++t9.position);
|
7711 | n2 = t9.input.slice(r2, t9.position), Fj.test(n2) && Yj(t9, "tag suffix cannot contain flow indicator characters");
|
7712 | }
|
7713 | n2 && !Mj.test(n2) && Yj(t9, "tag name cannot contain such characters: " + n2);
|
7714 | try {
|
7715 | n2 = decodeURIComponent(n2);
|
7716 | } catch (r3) {
|
7717 | Yj(t9, "tag name is malformed: " + n2);
|
7718 | }
|
7719 | return i2 ? t9.tag = n2 : Ij.call(t9.tagMap, e2) ? t9.tag = t9.tagMap[e2] + n2 : "!" === e2 ? t9.tag = "!" + n2 : "!!" === e2 ? t9.tag = "tag:yaml.org,2002:" + n2 : Yj(t9, 'undeclared tag handle "' + e2 + '"'), true;
|
7720 | }
|
7721 | function aO(t9) {
|
7722 | var r2, e2;
|
7723 | if (38 !== (e2 = t9.input.charCodeAt(t9.position)))
|
7724 | return false;
|
7725 | for (null !== t9.anchor && Yj(t9, "duplication of an anchor property"), e2 = t9.input.charCodeAt(++t9.position), r2 = t9.position; 0 !== e2 && !Cj(e2) && !$j(e2); )
|
7726 | e2 = t9.input.charCodeAt(++t9.position);
|
7727 | return t9.position === r2 && Yj(t9, "name of an anchor node must contain at least one character"), t9.anchor = t9.input.slice(r2, t9.position), true;
|
7728 | }
|
7729 | function fO(t9, r2, e2, n2, o2) {
|
7730 | var i2, u2, a2, f2, c2, s2, l2, p2, v2, h2 = 1, d2 = false, y2 = false;
|
7731 | if (null !== t9.listener && t9.listener("open", t9), t9.tag = null, t9.anchor = null, t9.kind = null, t9.result = null, i2 = u2 = a2 = 4 === e2 || 3 === e2, n2 && eO(t9, true, -1) && (d2 = true, t9.lineIndent > r2 ? h2 = 1 : t9.lineIndent === r2 ? h2 = 0 : t9.lineIndent < r2 && (h2 = -1)), 1 === h2)
|
7732 | for (; uO(t9) || aO(t9); )
|
7733 | eO(t9, true, -1) ? (d2 = true, a2 = i2, t9.lineIndent > r2 ? h2 = 1 : t9.lineIndent === r2 ? h2 = 0 : t9.lineIndent < r2 && (h2 = -1)) : a2 = false;
|
7734 | if (a2 && (a2 = d2 || o2), 1 !== h2 && 4 !== e2 || (p2 = 1 === e2 || 2 === e2 ? r2 : r2 + 1, v2 = t9.position - t9.lineStart, 1 === h2 ? a2 && (iO(t9, v2) || function(t10, r3, e3) {
|
7735 | var n3, o3, i3, u3, a3, f3, c3, s3 = t10.tag, l3 = t10.anchor, p3 = {}, v3 = Object.create(null), h3 = null, d3 = null, y3 = null, b2 = false, m2 = false;
|
7736 | if (-1 !== t10.firstTabInLine)
|
7737 | return false;
|
7738 | for (null !== t10.anchor && (t10.anchorMap[t10.anchor] = p3), c3 = t10.input.charCodeAt(t10.position); 0 !== c3; ) {
|
7739 | if (b2 || -1 === t10.firstTabInLine || (t10.position = t10.firstTabInLine, Yj(t10, "tab characters must not be used in indentation")), n3 = t10.input.charCodeAt(t10.position + 1), i3 = t10.line, 63 !== c3 && 58 !== c3 || !Cj(n3)) {
|
7740 | if (u3 = t10.line, a3 = t10.lineStart, f3 = t10.position, !fO(t10, e3, 2, false, true))
|
7741 | break;
|
7742 | if (t10.line === i3) {
|
7743 | for (c3 = t10.input.charCodeAt(t10.position); Lj(c3); )
|
7744 | c3 = t10.input.charCodeAt(++t10.position);
|
7745 | if (58 === c3)
|
7746 | Cj(c3 = t10.input.charCodeAt(++t10.position)) || Yj(t10, "a whitespace character is expected after the key-value separator within a block mapping"), b2 && (tO(t10, p3, v3, h3, d3, null, u3, a3, f3), h3 = d3 = y3 = null), m2 = true, b2 = false, o3 = false, h3 = t10.tag, d3 = t10.result;
|
7747 | else {
|
7748 | if (!m2)
|
7749 | return t10.tag = s3, t10.anchor = l3, true;
|
7750 | Yj(t10, "can not read an implicit mapping pair; a colon is missed");
|
7751 | }
|
7752 | } else {
|
7753 | if (!m2)
|
7754 | return t10.tag = s3, t10.anchor = l3, true;
|
7755 | Yj(t10, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
7756 | }
|
7757 | } else
|
7758 | 63 === c3 ? (b2 && (tO(t10, p3, v3, h3, d3, null, u3, a3, f3), h3 = d3 = y3 = null), m2 = true, b2 = true, o3 = true) : b2 ? (b2 = false, o3 = true) : Yj(t10, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"), t10.position += 1, c3 = n3;
|
7759 | if ((t10.line === i3 || t10.lineIndent > r3) && (b2 && (u3 = t10.line, a3 = t10.lineStart, f3 = t10.position), fO(t10, r3, 4, true, o3) && (b2 ? d3 = t10.result : y3 = t10.result), b2 || (tO(t10, p3, v3, h3, d3, y3, u3, a3, f3), h3 = d3 = y3 = null), eO(t10, true, -1), c3 = t10.input.charCodeAt(t10.position)), (t10.line === i3 || t10.lineIndent > r3) && 0 !== c3)
|
7760 | Yj(t10, "bad indentation of a mapping entry");
|
7761 | else if (t10.lineIndent < r3)
|
7762 | break;
|
7763 | }
|
7764 | return b2 && tO(t10, p3, v3, h3, d3, null, u3, a3, f3), m2 && (t10.tag = s3, t10.anchor = l3, t10.kind = "mapping", t10.result = p3), m2;
|
7765 | }(t9, v2, p2)) || function(t10, r3) {
|
7766 | var e3, n3, o3, i3, u3, a3, f3, c3, s3, l3, p3, v3, h3 = true, d3 = t10.tag, y3 = t10.anchor, b2 = Object.create(null);
|
7767 | if (91 === (v3 = t10.input.charCodeAt(t10.position)))
|
7768 | u3 = 93, c3 = false, i3 = [];
|
7769 | else {
|
7770 | if (123 !== v3)
|
7771 | return false;
|
7772 | u3 = 125, c3 = true, i3 = {};
|
7773 | }
|
7774 | for (null !== t10.anchor && (t10.anchorMap[t10.anchor] = i3), v3 = t10.input.charCodeAt(++t10.position); 0 !== v3; ) {
|
7775 | if (eO(t10, true, r3), (v3 = t10.input.charCodeAt(t10.position)) === u3)
|
7776 | return t10.position++, t10.tag = d3, t10.anchor = y3, t10.kind = c3 ? "mapping" : "sequence", t10.result = i3, true;
|
7777 | h3 ? 44 === v3 && Yj(t10, "expected the node content, but found ','") : Yj(t10, "missed comma between flow collection entries"), p3 = null, a3 = f3 = false, 63 === v3 && Cj(t10.input.charCodeAt(t10.position + 1)) && (a3 = f3 = true, t10.position++, eO(t10, true, r3)), e3 = t10.line, n3 = t10.lineStart, o3 = t10.position, fO(t10, r3, 1, false, true), l3 = t10.tag, s3 = t10.result, eO(t10, true, r3), v3 = t10.input.charCodeAt(t10.position), !f3 && t10.line !== e3 || 58 !== v3 || (a3 = true, v3 = t10.input.charCodeAt(++t10.position), eO(t10, true, r3), fO(t10, r3, 1, false, true), p3 = t10.result), c3 ? tO(t10, i3, b2, l3, s3, p3, e3, n3, o3) : a3 ? i3.push(tO(t10, null, b2, l3, s3, p3, e3, n3, o3)) : i3.push(s3), eO(t10, true, r3), 44 === (v3 = t10.input.charCodeAt(t10.position)) ? (h3 = true, v3 = t10.input.charCodeAt(++t10.position)) : h3 = false;
|
7778 | }
|
7779 | Yj(t10, "unexpected end of the stream within a flow collection");
|
7780 | }(t9, p2) ? y2 = true : (u2 && function(t10, r3) {
|
7781 | var e3, n3, o3, i3, u3, a3 = 1, f3 = false, c3 = false, s3 = r3, l3 = 0, p3 = false;
|
7782 | if (124 === (i3 = t10.input.charCodeAt(t10.position)))
|
7783 | n3 = false;
|
7784 | else {
|
7785 | if (62 !== i3)
|
7786 | return false;
|
7787 | n3 = true;
|
7788 | }
|
7789 | for (t10.kind = "scalar", t10.result = ""; 0 !== i3; )
|
7790 | if (43 === (i3 = t10.input.charCodeAt(++t10.position)) || 45 === i3)
|
7791 | 1 === a3 ? a3 = 43 === i3 ? 3 : 2 : Yj(t10, "repeat of a chomping mode identifier");
|
7792 | else {
|
7793 | if (!((o3 = 48 <= (u3 = i3) && u3 <= 57 ? u3 - 48 : -1) >= 0))
|
7794 | break;
|
7795 | 0 === o3 ? Yj(t10, "bad explicit indentation width of a block scalar; it cannot be less than one") : c3 ? Yj(t10, "repeat of an indentation width identifier") : (s3 = r3 + o3 - 1, c3 = true);
|
7796 | }
|
7797 | if (Lj(i3)) {
|
7798 | do {
|
7799 | i3 = t10.input.charCodeAt(++t10.position);
|
7800 | } while (Lj(i3));
|
7801 | if (35 === i3)
|
7802 | do {
|
7803 | i3 = t10.input.charCodeAt(++t10.position);
|
7804 | } while (!Uj(i3) && 0 !== i3);
|
7805 | }
|
7806 | for (; 0 !== i3; ) {
|
7807 | for (rO(t10), t10.lineIndent = 0, i3 = t10.input.charCodeAt(t10.position); (!c3 || t10.lineIndent < s3) && 32 === i3; )
|
7808 | t10.lineIndent++, i3 = t10.input.charCodeAt(++t10.position);
|
7809 | if (!c3 && t10.lineIndent > s3 && (s3 = t10.lineIndent), Uj(i3))
|
7810 | l3++;
|
7811 | else {
|
7812 | if (t10.lineIndent < s3) {
|
7813 | 3 === a3 ? t10.result += Gw.repeat("\n", f3 ? 1 + l3 : l3) : 1 === a3 && f3 && (t10.result += "\n");
|
7814 | break;
|
7815 | }
|
7816 | for (n3 ? Lj(i3) ? (p3 = true, t10.result += Gw.repeat("\n", f3 ? 1 + l3 : l3)) : p3 ? (p3 = false, t10.result += Gw.repeat("\n", l3 + 1)) : 0 === l3 ? f3 && (t10.result += " ") : t10.result += Gw.repeat("\n", l3) : t10.result += Gw.repeat("\n", f3 ? 1 + l3 : l3), f3 = true, c3 = true, l3 = 0, e3 = t10.position; !Uj(i3) && 0 !== i3; )
|
7817 | i3 = t10.input.charCodeAt(++t10.position);
|
7818 | Xj(t10, e3, t10.position, false);
|
7819 | }
|
7820 | }
|
7821 | return true;
|
7822 | }(t9, p2) || function(t10, r3) {
|
7823 | var e3, n3, o3;
|
7824 | if (39 !== (e3 = t10.input.charCodeAt(t10.position)))
|
7825 | return false;
|
7826 | for (t10.kind = "scalar", t10.result = "", t10.position++, n3 = o3 = t10.position; 0 !== (e3 = t10.input.charCodeAt(t10.position)); )
|
7827 | if (39 === e3) {
|
7828 | if (Xj(t10, n3, t10.position, true), 39 !== (e3 = t10.input.charCodeAt(++t10.position)))
|
7829 | return true;
|
7830 | n3 = t10.position, t10.position++, o3 = t10.position;
|
7831 | } else
|
7832 | Uj(e3) ? (Xj(t10, n3, o3, true), oO(t10, eO(t10, false, r3)), n3 = o3 = t10.position) : t10.position === t10.lineStart && nO(t10) ? Yj(t10, "unexpected end of the document within a single quoted scalar") : (t10.position++, o3 = t10.position);
|
7833 | Yj(t10, "unexpected end of the stream within a single quoted scalar");
|
7834 | }(t9, p2) || function(t10, r3) {
|
7835 | var e3, n3, o3, i3, u3, a3, f3;
|
7836 | if (34 !== (a3 = t10.input.charCodeAt(t10.position)))
|
7837 | return false;
|
7838 | for (t10.kind = "scalar", t10.result = "", t10.position++, e3 = n3 = t10.position; 0 !== (a3 = t10.input.charCodeAt(t10.position)); ) {
|
7839 | if (34 === a3)
|
7840 | return Xj(t10, e3, t10.position, true), t10.position++, true;
|
7841 | if (92 === a3) {
|
7842 | if (Xj(t10, e3, t10.position, true), Uj(a3 = t10.input.charCodeAt(++t10.position)))
|
7843 | eO(t10, false, r3);
|
7844 | else if (a3 < 256 && Wj[a3])
|
7845 | t10.result += zj[a3], t10.position++;
|
7846 | else if ((u3 = 120 === (f3 = a3) ? 2 : 117 === f3 ? 4 : 85 === f3 ? 8 : 0) > 0) {
|
7847 | for (o3 = u3, i3 = 0; o3 > 0; o3--)
|
7848 | (u3 = Bj(a3 = t10.input.charCodeAt(++t10.position))) >= 0 ? i3 = (i3 << 4) + u3 : Yj(t10, "expected hexadecimal character");
|
7849 | t10.result += Gj(i3), t10.position++;
|
7850 | } else
|
7851 | Yj(t10, "unknown escape sequence");
|
7852 | e3 = n3 = t10.position;
|
7853 | } else
|
7854 | Uj(a3) ? (Xj(t10, e3, n3, true), oO(t10, eO(t10, false, r3)), e3 = n3 = t10.position) : t10.position === t10.lineStart && nO(t10) ? Yj(t10, "unexpected end of the document within a double quoted scalar") : (t10.position++, n3 = t10.position);
|
7855 | }
|
7856 | Yj(t10, "unexpected end of the stream within a double quoted scalar");
|
7857 | }(t9, p2) ? y2 = true : !function(t10) {
|
7858 | var r3, e3, n3;
|
7859 | if (42 !== (n3 = t10.input.charCodeAt(t10.position)))
|
7860 | return false;
|
7861 | for (n3 = t10.input.charCodeAt(++t10.position), r3 = t10.position; 0 !== n3 && !Cj(n3) && !$j(n3); )
|
7862 | n3 = t10.input.charCodeAt(++t10.position);
|
7863 | return t10.position === r3 && Yj(t10, "name of an alias node must contain at least one character"), e3 = t10.input.slice(r3, t10.position), Ij.call(t10.anchorMap, e3) || Yj(t10, 'unidentified alias "' + e3 + '"'), t10.result = t10.anchorMap[e3], eO(t10, true, -1), true;
|
7864 | }(t9) ? function(t10, r3, e3) {
|
7865 | var n3, o3, i3, u3, a3, f3, c3, s3, l3 = t10.kind, p3 = t10.result;
|
7866 | if (Cj(s3 = t10.input.charCodeAt(t10.position)) || $j(s3) || 35 === s3 || 38 === s3 || 42 === s3 || 33 === s3 || 124 === s3 || 62 === s3 || 39 === s3 || 34 === s3 || 37 === s3 || 64 === s3 || 96 === s3)
|
7867 | return false;
|
7868 | if ((63 === s3 || 45 === s3) && (Cj(n3 = t10.input.charCodeAt(t10.position + 1)) || e3 && $j(n3)))
|
7869 | return false;
|
7870 | for (t10.kind = "scalar", t10.result = "", o3 = i3 = t10.position, u3 = false; 0 !== s3; ) {
|
7871 | if (58 === s3) {
|
7872 | if (Cj(n3 = t10.input.charCodeAt(t10.position + 1)) || e3 && $j(n3))
|
7873 | break;
|
7874 | } else if (35 === s3) {
|
7875 | if (Cj(t10.input.charCodeAt(t10.position - 1)))
|
7876 | break;
|
7877 | } else {
|
7878 | if (t10.position === t10.lineStart && nO(t10) || e3 && $j(s3))
|
7879 | break;
|
7880 | if (Uj(s3)) {
|
7881 | if (a3 = t10.line, f3 = t10.lineStart, c3 = t10.lineIndent, eO(t10, false, -1), t10.lineIndent >= r3) {
|
7882 | u3 = true, s3 = t10.input.charCodeAt(t10.position);
|
7883 | continue;
|
7884 | }
|
7885 | t10.position = i3, t10.line = a3, t10.lineStart = f3, t10.lineIndent = c3;
|
7886 | break;
|
7887 | }
|
7888 | }
|
7889 | u3 && (Xj(t10, o3, i3, false), oO(t10, t10.line - a3), o3 = i3 = t10.position, u3 = false), Lj(s3) || (i3 = t10.position + 1), s3 = t10.input.charCodeAt(++t10.position);
|
7890 | }
|
7891 | return Xj(t10, o3, i3, false), !!t10.result || (t10.kind = l3, t10.result = p3, false);
|
7892 | }(t9, p2, 1 === e2) && (y2 = true, null === t9.tag && (t9.tag = "?")) : (y2 = true, null === t9.tag && null === t9.anchor || Yj(t9, "alias node should not have any properties")), null !== t9.anchor && (t9.anchorMap[t9.anchor] = t9.result)) : 0 === h2 && (y2 = a2 && iO(t9, v2))), null === t9.tag)
|
7893 | null !== t9.anchor && (t9.anchorMap[t9.anchor] = t9.result);
|
7894 | else if ("?" === t9.tag) {
|
7895 | for (null !== t9.result && "scalar" !== t9.kind && Yj(t9, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + t9.kind + '"'), f2 = 0, c2 = t9.implicitTypes.length; f2 < c2; f2 += 1)
|
7896 | if ((l2 = t9.implicitTypes[f2]).resolve(t9.result)) {
|
7897 | t9.result = l2.construct(t9.result), t9.tag = l2.tag, null !== t9.anchor && (t9.anchorMap[t9.anchor] = t9.result);
|
7898 | break;
|
7899 | }
|
7900 | } else if ("!" !== t9.tag) {
|
7901 | if (Ij.call(t9.typeMap[t9.kind || "fallback"], t9.tag))
|
7902 | l2 = t9.typeMap[t9.kind || "fallback"][t9.tag];
|
7903 | else
|
7904 | for (l2 = null, f2 = 0, c2 = (s2 = t9.typeMap.multi[t9.kind || "fallback"]).length; f2 < c2; f2 += 1)
|
7905 | if (t9.tag.slice(0, s2[f2].tag.length) === s2[f2].tag) {
|
7906 | l2 = s2[f2];
|
7907 | break;
|
7908 | }
|
7909 | l2 || Yj(t9, "unknown tag !<" + t9.tag + ">"), null !== t9.result && l2.kind !== t9.kind && Yj(t9, "unacceptable node kind for !<" + t9.tag + '> tag; it should be "' + l2.kind + '", not "' + t9.kind + '"'), l2.resolve(t9.result, t9.tag) ? (t9.result = l2.construct(t9.result, t9.tag), null !== t9.anchor && (t9.anchorMap[t9.anchor] = t9.result)) : Yj(t9, "cannot resolve a node with !<" + t9.tag + "> explicit tag");
|
7910 | }
|
7911 | return null !== t9.listener && t9.listener("close", t9), null !== t9.tag || null !== t9.anchor || y2;
|
7912 | }
|
7913 | function cO(t9) {
|
7914 | var r2, e2, n2, o2, i2 = t9.position, u2 = false;
|
7915 | for (t9.version = null, t9.checkLineBreaks = t9.legacy, t9.tagMap = Object.create(null), t9.anchorMap = Object.create(null); 0 !== (o2 = t9.input.charCodeAt(t9.position)) && (eO(t9, true, -1), o2 = t9.input.charCodeAt(t9.position), !(t9.lineIndent > 0 || 37 !== o2)); ) {
|
7916 | for (u2 = true, o2 = t9.input.charCodeAt(++t9.position), r2 = t9.position; 0 !== o2 && !Cj(o2); )
|
7917 | o2 = t9.input.charCodeAt(++t9.position);
|
7918 | for (n2 = [], (e2 = t9.input.slice(r2, t9.position)).length < 1 && Yj(t9, "directive name must not be less than one character in length"); 0 !== o2; ) {
|
7919 | for (; Lj(o2); )
|
7920 | o2 = t9.input.charCodeAt(++t9.position);
|
7921 | if (35 === o2) {
|
7922 | do {
|
7923 | o2 = t9.input.charCodeAt(++t9.position);
|
7924 | } while (0 !== o2 && !Uj(o2));
|
7925 | break;
|
7926 | }
|
7927 | if (Uj(o2))
|
7928 | break;
|
7929 | for (r2 = t9.position; 0 !== o2 && !Cj(o2); )
|
7930 | o2 = t9.input.charCodeAt(++t9.position);
|
7931 | n2.push(t9.input.slice(r2, t9.position));
|
7932 | }
|
7933 | 0 !== o2 && rO(t9), Ij.call(Kj, e2) ? Kj[e2](t9, e2, n2) : Qj(t9, 'unknown document directive "' + e2 + '"');
|
7934 | }
|
7935 | eO(t9, true, -1), 0 === t9.lineIndent && 45 === t9.input.charCodeAt(t9.position) && 45 === t9.input.charCodeAt(t9.position + 1) && 45 === t9.input.charCodeAt(t9.position + 2) ? (t9.position += 3, eO(t9, true, -1)) : u2 && Yj(t9, "directives end mark is expected"), fO(t9, t9.lineIndent - 1, 4, false, true), eO(t9, true, -1), t9.checkLineBreaks && Rj.test(t9.input.slice(i2, t9.position)) && Qj(t9, "non-ASCII line breaks are interpreted as content"), t9.documents.push(t9.result), t9.position === t9.lineStart && nO(t9) ? 46 === t9.input.charCodeAt(t9.position) && (t9.position += 3, eO(t9, true, -1)) : t9.position < t9.length - 1 && Yj(t9, "end of the stream or a document separator is expected");
|
7936 | }
|
7937 | function sO(t9, r2) {
|
7938 | r2 = r2 || {}, 0 !== (t9 = String(t9)).length && (10 !== t9.charCodeAt(t9.length - 1) && 13 !== t9.charCodeAt(t9.length - 1) && (t9 += "\n"), 65279 === t9.charCodeAt(0) && (t9 = t9.slice(1)));
|
7939 | var e2 = new Hj(t9, r2), n2 = t9.indexOf("\0");
|
7940 | for (-1 !== n2 && (e2.position = n2, Yj(e2, "null byte is not allowed in input")), e2.input += "\0"; 32 === e2.input.charCodeAt(e2.position); )
|
7941 | e2.lineIndent += 1, e2.position += 1;
|
7942 | for (; e2.position < e2.length - 1; )
|
7943 | cO(e2);
|
7944 | return e2.documents;
|
7945 | }
|
7946 | var lO = function(t9, r2, e2) {
|
7947 | null !== r2 && "object" == typeof r2 && void 0 === e2 && (e2 = r2, r2 = null);
|
7948 | var n2 = sO(t9, e2);
|
7949 | if ("function" != typeof r2)
|
7950 | return n2;
|
7951 | for (var o2 = 0, i2 = n2.length; o2 < i2; o2 += 1)
|
7952 | r2(n2[o2]);
|
7953 | }, pO = { loadAll: lO, load: function(t9, r2) {
|
7954 | var e2 = sO(t9, r2);
|
7955 | if (0 !== e2.length) {
|
7956 | if (1 === e2.length)
|
7957 | return e2[0];
|
7958 | throw new Jw("expected a single document in the stream, but found more");
|
7959 | }
|
7960 | } }, vO = Object.prototype.toString, hO = Object.prototype.hasOwnProperty, dO = { 0: "\\0", 7: "\\a", 8: "\\b", 9: "\\t", 10: "\\n", 11: "\\v", 12: "\\f", 13: "\\r", 27: "\\e", 34: '\\"', 92: "\\\\", 133: "\\N", 160: "\\_", 8232: "\\L", 8233: "\\P" }, yO = ["y", "Y", "yes", "Yes", "YES", "on", "On", "ON", "n", "N", "no", "No", "NO", "off", "Off", "OFF"], bO = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
7961 | function mO(t9) {
|
7962 | var r2, e2, n2;
|
7963 | if (r2 = t9.toString(16).toUpperCase(), t9 <= 255)
|
7964 | e2 = "x", n2 = 2;
|
7965 | else if (t9 <= 65535)
|
7966 | e2 = "u", n2 = 4;
|
7967 | else {
|
7968 | if (!(t9 <= 4294967295))
|
7969 | throw new Jw("code point within a string may not be greater than 0xFFFFFFFF");
|
7970 | e2 = "U", n2 = 8;
|
7971 | }
|
7972 | return "\\" + e2 + Gw.repeat("0", n2 - r2.length) + r2;
|
7973 | }
|
7974 | function gO(t9) {
|
7975 | this.schema = t9.schema || _j, this.indent = Math.max(1, t9.indent || 2), this.noArrayIndent = t9.noArrayIndent || false, this.skipInvalid = t9.skipInvalid || false, this.flowLevel = Gw.isNothing(t9.flowLevel) ? -1 : t9.flowLevel, this.styleMap = function(t10, r2) {
|
7976 | var e2, n2, o2, i2, u2, a2, f2;
|
7977 | if (null === r2)
|
7978 | return {};
|
7979 | for (e2 = {}, o2 = 0, i2 = (n2 = Object.keys(r2)).length; o2 < i2; o2 += 1)
|
7980 | u2 = n2[o2], a2 = String(r2[u2]), "!!" === u2.slice(0, 2) && (u2 = "tag:yaml.org,2002:" + u2.slice(2)), (f2 = t10.compiledTypeMap.fallback[u2]) && hO.call(f2.styleAliases, a2) && (a2 = f2.styleAliases[a2]), e2[u2] = a2;
|
7981 | return e2;
|
7982 | }(this.schema, t9.styles || null), this.sortKeys = t9.sortKeys || false, this.lineWidth = t9.lineWidth || 80, this.noRefs = t9.noRefs || false, this.noCompatMode = t9.noCompatMode || false, this.condenseFlow = t9.condenseFlow || false, this.quotingType = '"' === t9.quotingType ? 2 : 1, this.forceQuotes = t9.forceQuotes || false, this.replacer = "function" == typeof t9.replacer ? t9.replacer : null, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null;
|
7983 | }
|
7984 | function wO(t9, r2) {
|
7985 | for (var e2, n2 = Gw.repeat(" ", r2), o2 = 0, i2 = -1, u2 = "", a2 = t9.length; o2 < a2; )
|
7986 | -1 === (i2 = t9.indexOf("\n", o2)) ? (e2 = t9.slice(o2), o2 = a2) : (e2 = t9.slice(o2, i2 + 1), o2 = i2 + 1), e2.length && "\n" !== e2 && (u2 += n2), u2 += e2;
|
7987 | return u2;
|
7988 | }
|
7989 | function jO(t9, r2) {
|
7990 | return "\n" + Gw.repeat(" ", t9.indent * r2);
|
7991 | }
|
7992 | function OO(t9) {
|
7993 | return 32 === t9 || 9 === t9;
|
7994 | }
|
7995 | function AO(t9) {
|
7996 | return 32 <= t9 && t9 <= 126 || 161 <= t9 && t9 <= 55295 && 8232 !== t9 && 8233 !== t9 || 57344 <= t9 && t9 <= 65533 && 65279 !== t9 || 65536 <= t9 && t9 <= 1114111;
|
7997 | }
|
7998 | function SO(t9) {
|
7999 | return AO(t9) && 65279 !== t9 && 13 !== t9 && 10 !== t9;
|
8000 | }
|
8001 | function xO(t9, r2, e2) {
|
8002 | var n2 = SO(t9), o2 = n2 && !OO(t9);
|
8003 | return (e2 ? n2 : n2 && 44 !== t9 && 91 !== t9 && 93 !== t9 && 123 !== t9 && 125 !== t9) && 35 !== t9 && !(58 === r2 && !o2) || SO(r2) && !OO(r2) && 35 === t9 || 58 === r2 && o2;
|
8004 | }
|
8005 | function EO(t9, r2) {
|
8006 | var e2, n2 = t9.charCodeAt(r2);
|
8007 | return n2 >= 55296 && n2 <= 56319 && r2 + 1 < t9.length && (e2 = t9.charCodeAt(r2 + 1)) >= 56320 && e2 <= 57343 ? 1024 * (n2 - 55296) + e2 - 56320 + 65536 : n2;
|
8008 | }
|
8009 | function PO(t9) {
|
8010 | return /^\n* /.test(t9);
|
8011 | }
|
8012 | function kO(t9, r2, e2, n2, o2, i2, u2, a2) {
|
8013 | var f2, c2, s2 = 0, l2 = null, p2 = false, v2 = false, h2 = -1 !== n2, d2 = -1, y2 = AO(c2 = EO(t9, 0)) && 65279 !== c2 && !OO(c2) && 45 !== c2 && 63 !== c2 && 58 !== c2 && 44 !== c2 && 91 !== c2 && 93 !== c2 && 123 !== c2 && 125 !== c2 && 35 !== c2 && 38 !== c2 && 42 !== c2 && 33 !== c2 && 124 !== c2 && 61 !== c2 && 62 !== c2 && 39 !== c2 && 34 !== c2 && 37 !== c2 && 64 !== c2 && 96 !== c2 && function(t10) {
|
8014 | return !OO(t10) && 58 !== t10;
|
8015 | }(EO(t9, t9.length - 1));
|
8016 | if (r2 || u2)
|
8017 | for (f2 = 0; f2 < t9.length; s2 >= 65536 ? f2 += 2 : f2++) {
|
8018 | if (!AO(s2 = EO(t9, f2)))
|
8019 | return 5;
|
8020 | y2 = y2 && xO(s2, l2, a2), l2 = s2;
|
8021 | }
|
8022 | else {
|
8023 | for (f2 = 0; f2 < t9.length; s2 >= 65536 ? f2 += 2 : f2++) {
|
8024 | if (10 === (s2 = EO(t9, f2)))
|
8025 | p2 = true, h2 && (v2 = v2 || f2 - d2 - 1 > n2 && " " !== t9[d2 + 1], d2 = f2);
|
8026 | else if (!AO(s2))
|
8027 | return 5;
|
8028 | y2 = y2 && xO(s2, l2, a2), l2 = s2;
|
8029 | }
|
8030 | v2 = v2 || h2 && f2 - d2 - 1 > n2 && " " !== t9[d2 + 1];
|
8031 | }
|
8032 | return p2 || v2 ? e2 > 9 && PO(t9) ? 5 : u2 ? 2 === i2 ? 5 : 2 : v2 ? 4 : 3 : !y2 || u2 || o2(t9) ? 2 === i2 ? 5 : 2 : 1;
|
8033 | }
|
8034 | function _O(t9, r2, e2, n2, o2) {
|
8035 | t9.dump = function() {
|
8036 | if (0 === r2.length)
|
8037 | return 2 === t9.quotingType ? '""' : "''";
|
8038 | if (!t9.noCompatMode && (-1 !== yO.indexOf(r2) || bO.test(r2)))
|
8039 | return 2 === t9.quotingType ? '"' + r2 + '"' : "'" + r2 + "'";
|
8040 | var i2 = t9.indent * Math.max(1, e2), u2 = -1 === t9.lineWidth ? -1 : Math.max(Math.min(t9.lineWidth, 40), t9.lineWidth - i2), a2 = n2 || t9.flowLevel > -1 && e2 >= t9.flowLevel;
|
8041 | switch (kO(r2, a2, t9.indent, u2, function(r3) {
|
8042 | return function(t10, r4) {
|
8043 | var e3, n3;
|
8044 | for (e3 = 0, n3 = t10.implicitTypes.length; e3 < n3; e3 += 1)
|
8045 | if (t10.implicitTypes[e3].resolve(r4))
|
8046 | return true;
|
8047 | return false;
|
8048 | }(t9, r3);
|
8049 | }, t9.quotingType, t9.forceQuotes && !n2, o2)) {
|
8050 | case 1:
|
8051 | return r2;
|
8052 | case 2:
|
8053 | return "'" + r2.replace(/'/g, "''") + "'";
|
8054 | case 3:
|
8055 | return "|" + IO(r2, t9.indent) + TO(wO(r2, i2));
|
8056 | case 4:
|
8057 | return ">" + IO(r2, t9.indent) + TO(wO(function(t10, r3) {
|
8058 | var e3, n3, o3 = /(\n+)([^\n]*)/g, i3 = (a3 = t10.indexOf("\n"), a3 = -1 !== a3 ? a3 : t10.length, o3.lastIndex = a3, RO(t10.slice(0, a3), r3)), u3 = "\n" === t10[0] || " " === t10[0];
|
8059 | var a3;
|
8060 | for (; n3 = o3.exec(t10); ) {
|
8061 | var f2 = n3[1], c2 = n3[2];
|
8062 | e3 = " " === c2[0], i3 += f2 + (u3 || e3 || "" === c2 ? "" : "\n") + RO(c2, r3), u3 = e3;
|
8063 | }
|
8064 | return i3;
|
8065 | }(r2, u2), i2));
|
8066 | case 5:
|
8067 | return '"' + function(t10) {
|
8068 | for (var r3, e3 = "", n3 = 0, o3 = 0; o3 < t10.length; n3 >= 65536 ? o3 += 2 : o3++)
|
8069 | n3 = EO(t10, o3), !(r3 = dO[n3]) && AO(n3) ? (e3 += t10[o3], n3 >= 65536 && (e3 += t10[o3 + 1])) : e3 += r3 || mO(n3);
|
8070 | return e3;
|
8071 | }(r2) + '"';
|
8072 | default:
|
8073 | throw new Jw("impossible error: invalid scalar style");
|
8074 | }
|
8075 | }();
|
8076 | }
|
8077 | function IO(t9, r2) {
|
8078 | var e2 = PO(t9) ? String(r2) : "", n2 = "\n" === t9[t9.length - 1];
|
8079 | return e2 + (n2 && ("\n" === t9[t9.length - 2] || "\n" === t9) ? "+" : n2 ? "" : "-") + "\n";
|
8080 | }
|
8081 | function TO(t9) {
|
8082 | return "\n" === t9[t9.length - 1] ? t9.slice(0, -1) : t9;
|
8083 | }
|
8084 | function RO(t9, r2) {
|
8085 | if ("" === t9 || " " === t9[0])
|
8086 | return t9;
|
8087 | for (var e2, n2, o2 = / [^ ]/g, i2 = 0, u2 = 0, a2 = 0, f2 = ""; e2 = o2.exec(t9); )
|
8088 | (a2 = e2.index) - i2 > r2 && (n2 = u2 > i2 ? u2 : a2, f2 += "\n" + t9.slice(i2, n2), i2 = n2 + 1), u2 = a2;
|
8089 | return f2 += "\n", t9.length - i2 > r2 && u2 > i2 ? f2 += t9.slice(i2, u2) + "\n" + t9.slice(u2 + 1) : f2 += t9.slice(i2), f2.slice(1);
|
8090 | }
|
8091 | function FO(t9, r2, e2, n2) {
|
8092 | var o2, i2, u2, a2 = "", f2 = t9.tag;
|
8093 | for (o2 = 0, i2 = e2.length; o2 < i2; o2 += 1)
|
8094 | u2 = e2[o2], t9.replacer && (u2 = t9.replacer.call(e2, String(o2), u2)), (MO(t9, r2 + 1, u2, true, true, false, true) || void 0 === u2 && MO(t9, r2 + 1, null, true, true, false, true)) && (n2 && "" === a2 || (a2 += jO(t9, r2)), t9.dump && 10 === t9.dump.charCodeAt(0) ? a2 += "-" : a2 += "- ", a2 += t9.dump);
|
8095 | t9.tag = f2, t9.dump = a2 || "[]";
|
8096 | }
|
8097 | function NO(t9, r2, e2) {
|
8098 | var n2, o2, i2, u2, a2, f2;
|
8099 | for (i2 = 0, u2 = (o2 = e2 ? t9.explicitTypes : t9.implicitTypes).length; i2 < u2; i2 += 1)
|
8100 | if (((a2 = o2[i2]).instanceOf || a2.predicate) && (!a2.instanceOf || "object" == typeof r2 && r2 instanceof a2.instanceOf) && (!a2.predicate || a2.predicate(r2))) {
|
8101 | if (e2 ? a2.multi && a2.representName ? t9.tag = a2.representName(r2) : t9.tag = a2.tag : t9.tag = "?", a2.represent) {
|
8102 | if (f2 = t9.styleMap[a2.tag] || a2.defaultStyle, "[object Function]" === vO.call(a2.represent))
|
8103 | n2 = a2.represent(r2, f2);
|
8104 | else {
|
8105 | if (!hO.call(a2.represent, f2))
|
8106 | throw new Jw("!<" + a2.tag + '> tag resolver accepts not "' + f2 + '" style');
|
8107 | n2 = a2.represent[f2](r2, f2);
|
8108 | }
|
8109 | t9.dump = n2;
|
8110 | }
|
8111 | return true;
|
8112 | }
|
8113 | return false;
|
8114 | }
|
8115 | function MO(t9, r2, e2, n2, o2, i2, u2) {
|
8116 | t9.tag = null, t9.dump = e2, NO(t9, e2, false) || NO(t9, e2, true);
|
8117 | var a2, f2 = vO.call(t9.dump), c2 = n2;
|
8118 | n2 && (n2 = t9.flowLevel < 0 || t9.flowLevel > r2);
|
8119 | var s2, l2, p2 = "[object Object]" === f2 || "[object Array]" === f2;
|
8120 | if (p2 && (l2 = -1 !== (s2 = t9.duplicates.indexOf(e2))), (null !== t9.tag && "?" !== t9.tag || l2 || 2 !== t9.indent && r2 > 0) && (o2 = false), l2 && t9.usedDuplicates[s2])
|
8121 | t9.dump = "*ref_" + s2;
|
8122 | else {
|
8123 | if (p2 && l2 && !t9.usedDuplicates[s2] && (t9.usedDuplicates[s2] = true), "[object Object]" === f2)
|
8124 | n2 && 0 !== Object.keys(t9.dump).length ? (!function(t10, r3, e3, n3) {
|
8125 | var o3, i3, u3, a3, f3, c3, s3 = "", l3 = t10.tag, p3 = Object.keys(e3);
|
8126 | if (true === t10.sortKeys)
|
8127 | p3.sort();
|
8128 | else if ("function" == typeof t10.sortKeys)
|
8129 | p3.sort(t10.sortKeys);
|
8130 | else if (t10.sortKeys)
|
8131 | throw new Jw("sortKeys must be a boolean or a function");
|
8132 | for (o3 = 0, i3 = p3.length; o3 < i3; o3 += 1)
|
8133 | c3 = "", n3 && "" === s3 || (c3 += jO(t10, r3)), a3 = e3[u3 = p3[o3]], t10.replacer && (a3 = t10.replacer.call(e3, u3, a3)), MO(t10, r3 + 1, u3, true, true, true) && ((f3 = null !== t10.tag && "?" !== t10.tag || t10.dump && t10.dump.length > 1024) && (t10.dump && 10 === t10.dump.charCodeAt(0) ? c3 += "?" : c3 += "? "), c3 += t10.dump, f3 && (c3 += jO(t10, r3)), MO(t10, r3 + 1, a3, true, f3) && (t10.dump && 10 === t10.dump.charCodeAt(0) ? c3 += ":" : c3 += ": ", s3 += c3 += t10.dump));
|
8134 | t10.tag = l3, t10.dump = s3 || "{}";
|
8135 | }(t9, r2, t9.dump, o2), l2 && (t9.dump = "&ref_" + s2 + t9.dump)) : (!function(t10, r3, e3) {
|
8136 | var n3, o3, i3, u3, a3, f3 = "", c3 = t10.tag, s3 = Object.keys(e3);
|
8137 | for (n3 = 0, o3 = s3.length; n3 < o3; n3 += 1)
|
8138 | a3 = "", "" !== f3 && (a3 += ", "), t10.condenseFlow && (a3 += '"'), u3 = e3[i3 = s3[n3]], t10.replacer && (u3 = t10.replacer.call(e3, i3, u3)), MO(t10, r3, i3, false, false) && (t10.dump.length > 1024 && (a3 += "? "), a3 += t10.dump + (t10.condenseFlow ? '"' : "") + ":" + (t10.condenseFlow ? "" : " "), MO(t10, r3, u3, false, false) && (f3 += a3 += t10.dump));
|
8139 | t10.tag = c3, t10.dump = "{" + f3 + "}";
|
8140 | }(t9, r2, t9.dump), l2 && (t9.dump = "&ref_" + s2 + " " + t9.dump));
|
8141 | else if ("[object Array]" === f2)
|
8142 | n2 && 0 !== t9.dump.length ? (t9.noArrayIndent && !u2 && r2 > 0 ? FO(t9, r2 - 1, t9.dump, o2) : FO(t9, r2, t9.dump, o2), l2 && (t9.dump = "&ref_" + s2 + t9.dump)) : (!function(t10, r3, e3) {
|
8143 | var n3, o3, i3, u3 = "", a3 = t10.tag;
|
8144 | for (n3 = 0, o3 = e3.length; n3 < o3; n3 += 1)
|
8145 | i3 = e3[n3], t10.replacer && (i3 = t10.replacer.call(e3, String(n3), i3)), (MO(t10, r3, i3, false, false) || void 0 === i3 && MO(t10, r3, null, false, false)) && ("" !== u3 && (u3 += "," + (t10.condenseFlow ? "" : " ")), u3 += t10.dump);
|
8146 | t10.tag = a3, t10.dump = "[" + u3 + "]";
|
8147 | }(t9, r2, t9.dump), l2 && (t9.dump = "&ref_" + s2 + " " + t9.dump));
|
8148 | else {
|
8149 | if ("[object String]" !== f2) {
|
8150 | if ("[object Undefined]" === f2)
|
8151 | return false;
|
8152 | if (t9.skipInvalid)
|
8153 | return false;
|
8154 | throw new Jw("unacceptable kind of an object to dump " + f2);
|
8155 | }
|
8156 | "?" !== t9.tag && _O(t9, t9.dump, r2, i2, c2);
|
8157 | }
|
8158 | null !== t9.tag && "?" !== t9.tag && (a2 = encodeURI("!" === t9.tag[0] ? t9.tag.slice(1) : t9.tag).replace(/!/g, "%21"), a2 = "!" === t9.tag[0] ? "!" + a2 : "tag:yaml.org,2002:" === a2.slice(0, 18) ? "!!" + a2.slice(18) : "!<" + a2 + ">", t9.dump = a2 + " " + t9.dump);
|
8159 | }
|
8160 | return true;
|
8161 | }
|
8162 | function DO(t9, r2) {
|
8163 | var e2, n2, o2 = [], i2 = [];
|
8164 | for (UO(t9, o2, i2), e2 = 0, n2 = i2.length; e2 < n2; e2 += 1)
|
8165 | r2.duplicates.push(o2[i2[e2]]);
|
8166 | r2.usedDuplicates = new Array(n2);
|
8167 | }
|
8168 | function UO(t9, r2, e2) {
|
8169 | var n2, o2, i2;
|
8170 | if (null !== t9 && "object" == typeof t9)
|
8171 | if (-1 !== (o2 = r2.indexOf(t9)))
|
8172 | -1 === e2.indexOf(o2) && e2.push(o2);
|
8173 | else if (r2.push(t9), Array.isArray(t9))
|
8174 | for (o2 = 0, i2 = t9.length; o2 < i2; o2 += 1)
|
8175 | UO(t9[o2], r2, e2);
|
8176 | else
|
8177 | for (o2 = 0, i2 = (n2 = Object.keys(t9)).length; o2 < i2; o2 += 1)
|
8178 | UO(t9[n2[o2]], r2, e2);
|
8179 | }
|
8180 | function LO(t9, r2) {
|
8181 | return function() {
|
8182 | throw new Error("Function yaml." + t9 + " is removed in js-yaml 4. Use yaml." + r2 + " instead, which is now safe by default.");
|
8183 | };
|
8184 | }
|
8185 | var CO = { Type: Xw, Schema: rj, FAILSAFE_SCHEMA: ij, JSON_SCHEMA: hj, CORE_SCHEMA: dj, DEFAULT_SCHEMA: _j, load: pO.load, loadAll: pO.loadAll, dump: { dump: function(t9, r2) {
|
8186 | var e2 = new gO(r2 = r2 || {});
|
8187 | e2.noRefs || DO(t9, e2);
|
8188 | var n2 = t9;
|
8189 | return e2.replacer && (n2 = e2.replacer.call({ "": n2 }, "", n2)), MO(e2, 0, n2, true, true) ? e2.dump + "\n" : "";
|
8190 | } }.dump, YAMLException: Jw, types: { binary: jj, float: vj, map: oj, null: uj, pairs: Ej, set: kj, timestamp: mj, bool: aj, int: sj, merge: gj, omap: Sj, seq: nj, str: ej }, safeLoad: LO("safeLoad", "load"), safeLoadAll: LO("safeLoadAll", "loadAll"), safeDump: LO("safeDump", "dump") };
|
8191 | const $O = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : window, { FormData: BO, Blob: qO, File: GO } = $O;
|
8192 | function WO(t9) {
|
8193 | return function(t10) {
|
8194 | if (Il(t10))
|
8195 | return Dp(t10);
|
8196 | }(t9) || function(t10) {
|
8197 | if (void 0 !== ul && null != Pl(t10) || null != t10["@@iterator"])
|
8198 | return Mp(t10);
|
8199 | }(t9) || Up(t9) || function() {
|
8200 | throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
8201 | }();
|
8202 | }
|
8203 | var zO = { exports: {} };
|
8204 | const JO = openapi_parser_t(zO.exports = Kl);
|
8205 | var HO = function(t9) {
|
8206 | return ":/?#[]@!$&'()*+,;=".indexOf(t9) > -1;
|
8207 | }, VO = function(t9) {
|
8208 | return /^[a-z0-9\-._~]+$/i.test(t9);
|
8209 | };
|
8210 | function YO(t9) {
|
8211 | var r2, e2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, n2 = e2.escape, o2 = arguments.length > 2 ? arguments[2] : void 0;
|
8212 | return "number" == typeof t9 && (t9 = t9.toString()), "string" == typeof t9 && t9.length && n2 ? o2 ? JSON.parse(t9) : Hb(r2 = WO(t9)).call(r2, function(t10) {
|
8213 | var r3, e3;
|
8214 | if (VO(t10))
|
8215 | return t10;
|
8216 | if (HO(t10) && "unsafe" === n2)
|
8217 | return t10;
|
8218 | var o3 = new TextEncoder();
|
8219 | return Hb(r3 = Hb(e3 = gb(o3.encode(t10))).call(e3, function(t11) {
|
8220 | var r4;
|
8221 | return JO(r4 = "0".concat(t11.toString(16).toUpperCase())).call(r4, -2);
|
8222 | })).call(r3, function(t11) {
|
8223 | return "%".concat(t11);
|
8224 | }).join("");
|
8225 | }).join("") : t9;
|
8226 | }
|
8227 | function QO(t9) {
|
8228 | var r2 = t9.value;
|
8229 | return Array.isArray(r2) ? function(t10) {
|
8230 | var r3 = t10.key, e2 = t10.value, n2 = t10.style, o2 = t10.explode, i2 = t10.escape, u2 = function(t11) {
|
8231 | return YO(t11, { escape: i2 });
|
8232 | };
|
8233 | if ("simple" === n2)
|
8234 | return Hb(e2).call(e2, function(t11) {
|
8235 | return u2(t11);
|
8236 | }).join(",");
|
8237 | if ("label" === n2)
|
8238 | return ".".concat(Hb(e2).call(e2, function(t11) {
|
8239 | return u2(t11);
|
8240 | }).join("."));
|
8241 | if ("matrix" === n2)
|
8242 | return Hb(e2).call(e2, function(t11) {
|
8243 | return u2(t11);
|
8244 | }).reduce(function(t11, e3) {
|
8245 | var n3, i3, u3;
|
8246 | return !t11 || o2 ? rm(i3 = rm(u3 = "".concat(t11 || "", ";")).call(u3, r3, "=")).call(i3, e3) : rm(n3 = "".concat(t11, ",")).call(n3, e3);
|
8247 | }, "");
|
8248 | if ("form" === n2) {
|
8249 | var a2 = o2 ? "&".concat(r3, "=") : ",";
|
8250 | return Hb(e2).call(e2, function(t11) {
|
8251 | return u2(t11);
|
8252 | }).join(a2);
|
8253 | }
|
8254 | if ("spaceDelimited" === n2) {
|
8255 | var f2 = o2 ? "".concat(r3, "=") : "";
|
8256 | return Hb(e2).call(e2, function(t11) {
|
8257 | return u2(t11);
|
8258 | }).join(" ".concat(f2));
|
8259 | }
|
8260 | if ("pipeDelimited" === n2) {
|
8261 | var c2 = o2 ? "".concat(r3, "=") : "";
|
8262 | return Hb(e2).call(e2, function(t11) {
|
8263 | return u2(t11);
|
8264 | }).join("|".concat(c2));
|
8265 | }
|
8266 | return;
|
8267 | }(t9) : "object" === qp(r2) ? function(t10) {
|
8268 | var r3 = t10.key, e2 = t10.value, n2 = t10.style, o2 = t10.explode, i2 = t10.escape, u2 = function(t11) {
|
8269 | return YO(t11, { escape: i2 });
|
8270 | }, a2 = Yb(e2);
|
8271 | if ("simple" === n2)
|
8272 | return a2.reduce(function(t11, r4) {
|
8273 | var n3, i3, a3, f2 = u2(e2[r4]), c2 = o2 ? "=" : ",", s2 = t11 ? "".concat(t11, ",") : "";
|
8274 | return rm(n3 = rm(i3 = rm(a3 = "".concat(s2)).call(a3, r4)).call(i3, c2)).call(n3, f2);
|
8275 | }, "");
|
8276 | if ("label" === n2)
|
8277 | return a2.reduce(function(t11, r4) {
|
8278 | var n3, i3, a3, f2 = u2(e2[r4]), c2 = o2 ? "=" : ".", s2 = t11 ? "".concat(t11, ".") : ".";
|
8279 | return rm(n3 = rm(i3 = rm(a3 = "".concat(s2)).call(a3, r4)).call(i3, c2)).call(n3, f2);
|
8280 | }, "");
|
8281 | if ("matrix" === n2 && o2)
|
8282 | return a2.reduce(function(t11, r4) {
|
8283 | var n3, o3, i3 = u2(e2[r4]), a3 = t11 ? "".concat(t11, ";") : ";";
|
8284 | return rm(n3 = rm(o3 = "".concat(a3)).call(o3, r4, "=")).call(n3, i3);
|
8285 | }, "");
|
8286 | if ("matrix" === n2)
|
8287 | return a2.reduce(function(t11, n3) {
|
8288 | var o3, i3, a3 = u2(e2[n3]), f2 = t11 ? "".concat(t11, ",") : ";".concat(r3, "=");
|
8289 | return rm(o3 = rm(i3 = "".concat(f2)).call(i3, n3, ",")).call(o3, a3);
|
8290 | }, "");
|
8291 | if ("form" === n2)
|
8292 | return a2.reduce(function(t11, r4) {
|
8293 | var n3, i3, a3, f2, c2 = u2(e2[r4]), s2 = t11 ? rm(n3 = "".concat(t11)).call(n3, o2 ? "&" : ",") : "", l2 = o2 ? "=" : ",";
|
8294 | return rm(i3 = rm(a3 = rm(f2 = "".concat(s2)).call(f2, r4)).call(a3, l2)).call(i3, c2);
|
8295 | }, "");
|
8296 | return;
|
8297 | }(t9) : function(t10) {
|
8298 | var r3, e2 = t10.key, n2 = t10.value, o2 = t10.style, i2 = t10.escape, u2 = function(t11) {
|
8299 | return YO(t11, { escape: i2 });
|
8300 | };
|
8301 | if ("simple" === o2)
|
8302 | return u2(n2);
|
8303 | if ("label" === o2)
|
8304 | return ".".concat(u2(n2));
|
8305 | if ("matrix" === o2)
|
8306 | return rm(r3 = ";".concat(e2, "=")).call(r3, u2(n2));
|
8307 | if ("form" === o2)
|
8308 | return u2(n2);
|
8309 | if ("deepObject" === o2)
|
8310 | return u2(n2);
|
8311 | return;
|
8312 | }(t9);
|
8313 | }
|
8314 | var KO = function(t9, r2) {
|
8315 | r2.body = t9;
|
8316 | }, XO = { serializeRes: nA, mergeInQueryOrForm: hA };
|
8317 | function ZO(t9) {
|
8318 | return tA.apply(this, arguments);
|
8319 | }
|
8320 | function tA() {
|
8321 | return tA = Gy(Jy.mark(function t9(r2) {
|
8322 | var e2, n2, o2, i2, u2, a2 = arguments;
|
8323 | return Jy.wrap(function(t10) {
|
8324 | for (; ; )
|
8325 | switch (t10.prev = t10.next) {
|
8326 | case 0:
|
8327 | if (e2 = a2.length > 1 && void 0 !== a2[1] ? a2[1] : {}, "object" === qp(r2) && (r2 = (e2 = r2).url), e2.headers = e2.headers || {}, XO.mergeInQueryOrForm(e2), e2.headers && Yb(e2.headers).forEach(function(t11) {
|
8328 | var r3 = e2.headers[t11];
|
8329 | "string" == typeof r3 && (e2.headers[t11] = r3.replace(/\n+/g, " "));
|
8330 | }), !e2.requestInterceptor) {
|
8331 | t10.next = 12;
|
8332 | break;
|
8333 | }
|
8334 | return t10.next = 8, e2.requestInterceptor(e2);
|
8335 | case 8:
|
8336 | if (t10.t0 = t10.sent, t10.t0) {
|
8337 | t10.next = 11;
|
8338 | break;
|
8339 | }
|
8340 | t10.t0 = e2;
|
8341 | case 11:
|
8342 | e2 = t10.t0;
|
8343 | case 12:
|
8344 | return n2 = e2.headers["content-type"] || e2.headers["Content-Type"], /multipart\/form-data/i.test(n2) && e2.body instanceof BO && (delete e2.headers["content-type"], delete e2.headers["Content-Type"]), t10.prev = 14, t10.next = 17, (e2.userFetch || fetch)(e2.url, e2);
|
8345 | case 17:
|
8346 | return o2 = t10.sent, t10.next = 20, XO.serializeRes(o2, r2, e2);
|
8347 | case 20:
|
8348 | if (o2 = t10.sent, !e2.responseInterceptor) {
|
8349 | t10.next = 28;
|
8350 | break;
|
8351 | }
|
8352 | return t10.next = 24, e2.responseInterceptor(o2);
|
8353 | case 24:
|
8354 | if (t10.t1 = t10.sent, t10.t1) {
|
8355 | t10.next = 27;
|
8356 | break;
|
8357 | }
|
8358 | t10.t1 = o2;
|
8359 | case 27:
|
8360 | o2 = t10.t1;
|
8361 | case 28:
|
8362 | t10.next = 39;
|
8363 | break;
|
8364 | case 30:
|
8365 | if (t10.prev = 30, t10.t2 = t10.catch(14), o2) {
|
8366 | t10.next = 34;
|
8367 | break;
|
8368 | }
|
8369 | throw t10.t2;
|
8370 | case 34:
|
8371 | throw (i2 = new Error(o2.statusText || "response status is ".concat(o2.status))).status = o2.status, i2.statusCode = o2.status, i2.responseError = t10.t2, i2;
|
8372 | case 39:
|
8373 | if (o2.ok) {
|
8374 | t10.next = 45;
|
8375 | break;
|
8376 | }
|
8377 | throw (u2 = new Error(o2.statusText || "response status is ".concat(o2.status))).status = o2.status, u2.statusCode = o2.status, u2.response = o2, u2;
|
8378 | case 45:
|
8379 | return t10.abrupt("return", o2);
|
8380 | case 46:
|
8381 | case "end":
|
8382 | return t10.stop();
|
8383 | }
|
8384 | }, t9, null, [[14, 30]]);
|
8385 | })), tA.apply(this, arguments);
|
8386 | }
|
8387 | var rA = function() {
|
8388 | var t9 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "";
|
8389 | return /(json|xml|yaml|text)\b/.test(t9);
|
8390 | };
|
8391 | function eA(t9, r2) {
|
8392 | return r2 && (0 === r2.indexOf("application/json") || r2.indexOf("+json") > 0) ? JSON.parse(t9) : CO.load(t9);
|
8393 | }
|
8394 | function nA(t9, r2) {
|
8395 | var e2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, n2 = e2.loadSpec, o2 = void 0 !== n2 && n2, i2 = { ok: t9.ok, url: t9.url || r2, status: t9.status, statusText: t9.statusText, headers: iA(t9.headers) }, u2 = i2.headers["content-type"], a2 = o2 || rA(u2), f2 = a2 ? t9.text : t9.blob || t9.buffer;
|
8396 | return f2.call(t9).then(function(t10) {
|
8397 | if (i2.text = t10, i2.data = t10, a2)
|
8398 | try {
|
8399 | var r3 = eA(t10, u2);
|
8400 | i2.body = r3, i2.obj = r3;
|
8401 | } catch (t11) {
|
8402 | i2.parseError = t11;
|
8403 | }
|
8404 | return i2;
|
8405 | });
|
8406 | }
|
8407 | function oA(t9) {
|
8408 | return fb(t9).call(t9, ", ") ? t9.split(", ") : t9;
|
8409 | }
|
8410 | function iA() {
|
8411 | var t9 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
8412 | return "function" != typeof bb(t9) ? {} : gb(bb(t9).call(t9)).reduce(function(t10, r2) {
|
8413 | var e2 = Gp(r2, 2), n2 = e2[0], o2 = e2[1];
|
8414 | return t10[n2] = oA(o2), t10;
|
8415 | }, {});
|
8416 | }
|
8417 | function uA(t9, r2) {
|
8418 | return r2 || "undefined" == typeof navigator || (r2 = navigator), r2 && "ReactNative" === r2.product ? !(!t9 || "object" !== qp(t9) || "string" != typeof t9.uri) : void 0 !== GO && t9 instanceof GO || (void 0 !== qO && t9 instanceof qO || (!!ArrayBuffer.isView(t9) || null !== t9 && "object" === qp(t9) && "function" == typeof t9.pipe));
|
8419 | }
|
8420 | function aA(t9, r2) {
|
8421 | return Array.isArray(t9) && t9.some(function(t10) {
|
8422 | return uA(t10, r2);
|
8423 | });
|
8424 | }
|
8425 | var fA = { form: ",", spaceDelimited: "%20", pipeDelimited: "|" }, cA = { csv: ",", ssv: "%20", tsv: "%09", pipes: "|" };
|
8426 | function sA(t9, r2) {
|
8427 | var e2 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], n2 = r2.collectionFormat, o2 = r2.allowEmptyValue, i2 = r2.serializationOption, u2 = r2.encoding, a2 = "object" !== qp(r2) || Array.isArray(r2) ? r2 : r2.value, f2 = e2 ? function(t10) {
|
8428 | return t10.toString();
|
8429 | } : function(t10) {
|
8430 | return encodeURIComponent(t10);
|
8431 | }, c2 = f2(t9);
|
8432 | if (void 0 === a2 && o2)
|
8433 | return [[c2, ""]];
|
8434 | if (uA(a2) || aA(a2))
|
8435 | return [[c2, a2]];
|
8436 | if (i2)
|
8437 | return lA(t9, a2, e2, i2);
|
8438 | if (u2) {
|
8439 | if ([qp(u2.style), qp(u2.explode), qp(u2.allowReserved)].some(function(t10) {
|
8440 | return "undefined" !== t10;
|
8441 | })) {
|
8442 | var s2 = u2.style, l2 = u2.explode, p2 = u2.allowReserved;
|
8443 | return lA(t9, a2, e2, { style: s2, explode: l2, allowReserved: p2 });
|
8444 | }
|
8445 | if (u2.contentType) {
|
8446 | if ("application/json" === u2.contentType) {
|
8447 | var v2 = "string" == typeof a2 ? a2 : $b(a2);
|
8448 | return [[c2, f2(v2)]];
|
8449 | }
|
8450 | return [[c2, f2(a2.toString())]];
|
8451 | }
|
8452 | return "object" !== qp(a2) ? [[c2, f2(a2)]] : Array.isArray(a2) && a2.every(function(t10) {
|
8453 | return "object" !== qp(t10);
|
8454 | }) ? [[c2, Hb(a2).call(a2, f2).join(",")]] : [[c2, f2($b(a2))]];
|
8455 | }
|
8456 | return "object" !== qp(a2) ? [[c2, f2(a2)]] : Array.isArray(a2) ? "multi" === n2 ? [[c2, Hb(a2).call(a2, f2)]] : [[c2, Hb(a2).call(a2, f2).join(cA[n2 || "csv"])]] : [[c2, ""]];
|
8457 | }
|
8458 | function lA(t9, r2, e2, n2) {
|
8459 | var o2, i2, u2, a2 = n2.style || "form", f2 = void 0 === n2.explode ? "form" === a2 : n2.explode, c2 = !e2 && (n2 && n2.allowReserved ? "unsafe" : "reserved"), s2 = function(t10) {
|
8460 | return YO(t10, { escape: c2 });
|
8461 | }, l2 = e2 ? function(t10) {
|
8462 | return t10;
|
8463 | } : function(t10) {
|
8464 | return YO(t10, { escape: c2 });
|
8465 | };
|
8466 | return "object" !== qp(r2) ? [[l2(t9), s2(r2)]] : Array.isArray(r2) ? f2 ? [[l2(t9), Hb(r2).call(r2, s2)]] : [[l2(t9), Hb(r2).call(r2, s2).join(fA[a2])]] : "deepObject" === a2 ? Hb(i2 = Yb(r2)).call(i2, function(e3) {
|
8467 | var n3;
|
8468 | return [l2(rm(n3 = "".concat(t9, "[")).call(n3, e3, "]")), s2(r2[e3])];
|
8469 | }) : f2 ? Hb(u2 = Yb(r2)).call(u2, function(t10) {
|
8470 | return [l2(t10), s2(r2[t10])];
|
8471 | }) : [[l2(t9), Hb(o2 = Yb(r2)).call(o2, function(t10) {
|
8472 | var e3;
|
8473 | return [rm(e3 = "".concat(l2(t10), ",")).call(e3, s2(r2[t10]))];
|
8474 | }).join(",")]];
|
8475 | }
|
8476 | function pA(t9) {
|
8477 | return pm(t9).reduce(function(t10, r2) {
|
8478 | var e2, n2 = Gp(r2, 2), o2 = Lp(sA(n2[0], n2[1], true));
|
8479 | try {
|
8480 | for (o2.s(); !(e2 = o2.n()).done; ) {
|
8481 | var i2 = Gp(e2.value, 2), u2 = i2[0], a2 = i2[1];
|
8482 | if (Array.isArray(a2)) {
|
8483 | var f2, c2 = Lp(a2);
|
8484 | try {
|
8485 | for (c2.s(); !(f2 = c2.n()).done; ) {
|
8486 | var s2 = f2.value;
|
8487 | if (ArrayBuffer.isView(s2)) {
|
8488 | var l2 = new qO([s2]);
|
8489 | t10.append(u2, l2);
|
8490 | } else
|
8491 | t10.append(u2, s2);
|
8492 | }
|
8493 | } catch (t11) {
|
8494 | c2.e(t11);
|
8495 | } finally {
|
8496 | c2.f();
|
8497 | }
|
8498 | } else if (ArrayBuffer.isView(a2)) {
|
8499 | var p2 = new qO([a2]);
|
8500 | t10.append(u2, p2);
|
8501 | } else
|
8502 | t10.append(u2, a2);
|
8503 | }
|
8504 | } catch (t11) {
|
8505 | o2.e(t11);
|
8506 | } finally {
|
8507 | o2.f();
|
8508 | }
|
8509 | return t10;
|
8510 | }, new BO());
|
8511 | }
|
8512 | function vA(t9) {
|
8513 | var r2 = Yb(t9).reduce(function(r3, e2) {
|
8514 | var n2, o2 = Lp(sA(e2, t9[e2]));
|
8515 | try {
|
8516 | for (o2.s(); !(n2 = o2.n()).done; ) {
|
8517 | var i2 = Gp(n2.value, 2), u2 = i2[0], a2 = i2[1];
|
8518 | r3[u2] = a2;
|
8519 | }
|
8520 | } catch (t10) {
|
8521 | o2.e(t10);
|
8522 | } finally {
|
8523 | o2.f();
|
8524 | }
|
8525 | return r3;
|
8526 | }, {});
|
8527 | return $w.stringify(r2, { encode: false, indices: false }) || "";
|
8528 | }
|
8529 | function hA() {
|
8530 | var t9 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, r2 = t9.url, e2 = void 0 === r2 ? "" : r2, n2 = t9.query, o2 = t9.form, i2 = function() {
|
8531 | for (var t10 = arguments.length, r3 = new Array(t10), e3 = 0; e3 < t10; e3++)
|
8532 | r3[e3] = arguments[e3];
|
8533 | var n3 = hm(r3).call(r3, function(t11) {
|
8534 | return t11;
|
8535 | }).join("&");
|
8536 | return n3 ? "?".concat(n3) : "";
|
8537 | };
|
8538 | if (o2) {
|
8539 | var u2 = Yb(o2).some(function(t10) {
|
8540 | var r3 = o2[t10].value;
|
8541 | return uA(r3) || aA(r3);
|
8542 | }), a2 = t9.headers["content-type"] || t9.headers["Content-Type"];
|
8543 | if (u2 || /multipart\/form-data/i.test(a2)) {
|
8544 | var f2 = pA(t9.form);
|
8545 | KO(f2, t9);
|
8546 | } else
|
8547 | t9.body = vA(o2);
|
8548 | delete t9.form;
|
8549 | }
|
8550 | if (n2) {
|
8551 | var c2 = e2.split("?"), s2 = Gp(c2, 2), l2 = s2[0], p2 = s2[1], v2 = "";
|
8552 | if (p2) {
|
8553 | var h2 = $w.parse(p2), d2 = Yb(n2);
|
8554 | d2.forEach(function(t10) {
|
8555 | return delete h2[t10];
|
8556 | }), v2 = $w.stringify(h2, { encode: true });
|
8557 | }
|
8558 | var y2 = i2(v2, vA(n2));
|
8559 | t9.url = l2 + y2, delete t9.query;
|
8560 | }
|
8561 | return t9;
|
8562 | }
|
8563 | function dA(t9, r2) {
|
8564 | if (!(t9 instanceof r2))
|
8565 | throw new TypeError("Cannot call a class as a function");
|
8566 | }
|
8567 | function yA(t9, r2) {
|
8568 | for (var e2 = 0; e2 < r2.length; e2++) {
|
8569 | var n2 = r2[e2];
|
8570 | n2.enumerable = n2.enumerable || false, n2.configurable = true, "value" in n2 && (n2.writable = true), _c(t9, n2.key, n2);
|
8571 | }
|
8572 | }
|
8573 | function bA(t9, r2, e2) {
|
8574 | return r2 && yA(t9.prototype, r2), e2 && yA(t9, e2), _c(t9, "prototype", { writable: false }), t9;
|
8575 | }
|
8576 | var mA = { exports: {} }, gA = ge, wA = _i.find, jA = true;
|
8577 | "find" in [] && Array(1).find(function() {
|
8578 | jA = false;
|
8579 | }), gA({ target: "Array", proto: true, forced: jA }, { find: function(t9) {
|
8580 | return wA(this, t9, arguments.length > 1 ? arguments[1] : void 0);
|
8581 | } });
|
8582 | var OA = na("Array").find, AA = tt, SA = OA, xA = Array.prototype;
|
8583 | const EA = openapi_parser_t(mA.exports = function(t9) {
|
8584 | var r2 = t9.find;
|
8585 | return t9 === xA || AA(xA, t9) && r2 === xA.find ? SA : r2;
|
8586 | });
|
8587 | var PA = { exports: {} };
|
8588 | const kA = openapi_parser_t(PA.exports = Uy);
|
8589 | var _A = { exports: {} }, IA = ge, TA = openapi_parser_o, RA = Ee, FA = Oe, NA = Te, MA = Ct, DA = ji, UA = Hn, LA = ta("splice"), CA = TA.TypeError, $A = Math.max, BA = Math.min;
|
8590 | IA({ target: "Array", proto: true, forced: !LA }, { splice: function(t9, r2) {
|
8591 | var e2, n2, o2, i2, u2, a2, f2 = MA(this), c2 = NA(f2), s2 = RA(t9, c2), l2 = arguments.length;
|
8592 | if (0 === l2 ? e2 = n2 = 0 : 1 === l2 ? (e2 = 0, n2 = c2 - s2) : (e2 = l2 - 2, n2 = BA($A(FA(r2), 0), c2 - s2)), c2 + e2 - n2 > 9007199254740991)
|
8593 | throw CA("Maximum allowed length exceeded");
|
8594 | for (o2 = DA(f2, n2), i2 = 0; i2 < n2; i2++)
|
8595 | (u2 = s2 + i2) in f2 && UA(o2, i2, f2[u2]);
|
8596 | if (o2.length = n2, e2 < n2) {
|
8597 | for (i2 = s2; i2 < c2 - n2; i2++)
|
8598 | a2 = i2 + e2, (u2 = i2 + n2) in f2 ? f2[a2] = f2[u2] : delete f2[a2];
|
8599 | for (i2 = c2; i2 > c2 - n2 + e2; i2--)
|
8600 | delete f2[i2 - 1];
|
8601 | } else if (e2 > n2)
|
8602 | for (i2 = c2 - n2; i2 > s2; i2--)
|
8603 | a2 = i2 + e2 - 1, (u2 = i2 + n2 - 1) in f2 ? f2[a2] = f2[u2] : delete f2[a2];
|
8604 | for (i2 = 0; i2 < e2; i2++)
|
8605 | f2[i2 + s2] = arguments[i2 + 2];
|
8606 | return f2.length = c2 - n2 + e2, o2;
|
8607 | } });
|
8608 | var qA = na("Array").splice, GA = tt, WA = qA, zA = Array.prototype;
|
8609 | const JA = openapi_parser_t(_A.exports = function(t9) {
|
8610 | var r2 = t9.splice;
|
8611 | return t9 === zA || GA(zA, t9) && r2 === zA.splice ? WA : r2;
|
8612 | });
|
8613 |
|
8614 |
|
8615 |
|
8616 |
|
8617 |
|
8618 | var HA, VA = globalThis && globalThis.__extends || (HA = function(t9, r2) {
|
8619 | return HA = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t10, r3) {
|
8620 | t10.__proto__ = r3;
|
8621 | } || function(t10, r3) {
|
8622 | for (var e2 in r3)
|
8623 | r3.hasOwnProperty(e2) && (t10[e2] = r3[e2]);
|
8624 | }, HA(t9, r2);
|
8625 | }, function(t9, r2) {
|
8626 | function e2() {
|
8627 | this.constructor = t9;
|
8628 | }
|
8629 | HA(t9, r2), t9.prototype = null === r2 ? Object.create(r2) : (e2.prototype = r2.prototype, new e2());
|
8630 | }), YA = Object.prototype.hasOwnProperty;
|
8631 | function QA(t9, r2) {
|
8632 | return YA.call(t9, r2);
|
8633 | }
|
8634 | function KA(t9) {
|
8635 | if (Array.isArray(t9)) {
|
8636 | for (var r2 = new Array(t9.length), e2 = 0; e2 < r2.length; e2++)
|
8637 | r2[e2] = "" + e2;
|
8638 | return r2;
|
8639 | }
|
8640 | if (Object.keys)
|
8641 | return Object.keys(t9);
|
8642 | r2 = [];
|
8643 | for (var n2 in t9)
|
8644 | QA(t9, n2) && r2.push(n2);
|
8645 | return r2;
|
8646 | }
|
8647 | function XA(t9) {
|
8648 | switch (typeof t9) {
|
8649 | case "object":
|
8650 | return JSON.parse(JSON.stringify(t9));
|
8651 | case "undefined":
|
8652 | return null;
|
8653 | default:
|
8654 | return t9;
|
8655 | }
|
8656 | }
|
8657 | function ZA(t9) {
|
8658 | for (var r2, e2 = 0, n2 = t9.length; e2 < n2; ) {
|
8659 | if (!((r2 = t9.charCodeAt(e2)) >= 48 && r2 <= 57))
|
8660 | return false;
|
8661 | e2++;
|
8662 | }
|
8663 | return true;
|
8664 | }
|
8665 | function tS(t9) {
|
8666 | return -1 === t9.indexOf("/") && -1 === t9.indexOf("~") ? t9 : t9.replace(/~/g, "~0").replace(/\//g, "~1");
|
8667 | }
|
8668 | function rS(t9) {
|
8669 | return t9.replace(/~1/g, "/").replace(/~0/g, "~");
|
8670 | }
|
8671 | function eS(t9) {
|
8672 | if (void 0 === t9)
|
8673 | return true;
|
8674 | if (t9) {
|
8675 | if (Array.isArray(t9)) {
|
8676 | for (var r2 = 0, e2 = t9.length; r2 < e2; r2++)
|
8677 | if (eS(t9[r2]))
|
8678 | return true;
|
8679 | } else if ("object" == typeof t9) {
|
8680 | var n2 = KA(t9), o2 = n2.length;
|
8681 | for (r2 = 0; r2 < o2; r2++)
|
8682 | if (eS(t9[n2[r2]]))
|
8683 | return true;
|
8684 | }
|
8685 | }
|
8686 | return false;
|
8687 | }
|
8688 | function nS(t9, r2) {
|
8689 | var e2 = [t9];
|
8690 | for (var n2 in r2) {
|
8691 | var o2 = "object" == typeof r2[n2] ? JSON.stringify(r2[n2], null, 2) : r2[n2];
|
8692 | void 0 !== o2 && e2.push(n2 + ": " + o2);
|
8693 | }
|
8694 | return e2.join("\n");
|
8695 | }
|
8696 | var oS = function(t9) {
|
8697 | function r2(r3, e2, n2, o2, i2) {
|
8698 | var u2 = this.constructor, a2 = t9.call(this, nS(r3, { name: e2, index: n2, operation: o2, tree: i2 })) || this;
|
8699 | return a2.name = e2, a2.index = n2, a2.operation = o2, a2.tree = i2, Object.setPrototypeOf(a2, u2.prototype), a2.message = nS(r3, { name: e2, index: n2, operation: o2, tree: i2 }), a2;
|
8700 | }
|
8701 | return VA(r2, t9), r2;
|
8702 | }(Error), iS = oS, uS = XA, aS = { add: function(t9, r2, e2) {
|
8703 | return t9[r2] = this.value, { newDocument: e2 };
|
8704 | }, remove: function(t9, r2, e2) {
|
8705 | var n2 = t9[r2];
|
8706 | return delete t9[r2], { newDocument: e2, removed: n2 };
|
8707 | }, replace: function(t9, r2, e2) {
|
8708 | var n2 = t9[r2];
|
8709 | return t9[r2] = this.value, { newDocument: e2, removed: n2 };
|
8710 | }, move: function(t9, r2, e2) {
|
8711 | var n2 = cS(e2, this.path);
|
8712 | n2 && (n2 = XA(n2));
|
8713 | var o2 = sS(e2, { op: "remove", path: this.from }).removed;
|
8714 | return sS(e2, { op: "add", path: this.path, value: o2 }), { newDocument: e2, removed: n2 };
|
8715 | }, copy: function(t9, r2, e2) {
|
8716 | var n2 = cS(e2, this.from);
|
8717 | return sS(e2, { op: "add", path: this.path, value: XA(n2) }), { newDocument: e2 };
|
8718 | }, test: function(t9, r2, e2) {
|
8719 | return { newDocument: e2, test: hS(t9[r2], this.value) };
|
8720 | }, _get: function(t9, r2, e2) {
|
8721 | return this.value = t9[r2], { newDocument: e2 };
|
8722 | } }, fS = { add: function(t9, r2, e2) {
|
8723 | return ZA(r2) ? t9.splice(r2, 0, this.value) : t9[r2] = this.value, { newDocument: e2, index: r2 };
|
8724 | }, remove: function(t9, r2, e2) {
|
8725 | return { newDocument: e2, removed: t9.splice(r2, 1)[0] };
|
8726 | }, replace: function(t9, r2, e2) {
|
8727 | var n2 = t9[r2];
|
8728 | return t9[r2] = this.value, { newDocument: e2, removed: n2 };
|
8729 | }, move: aS.move, copy: aS.copy, test: aS.test, _get: aS._get };
|
8730 | function cS(t9, r2) {
|
8731 | if ("" == r2)
|
8732 | return t9;
|
8733 | var e2 = { op: "_get", path: r2 };
|
8734 | return sS(t9, e2), e2.value;
|
8735 | }
|
8736 | function sS(t9, r2, e2, n2, o2, i2) {
|
8737 | if (void 0 === e2 && (e2 = false), void 0 === n2 && (n2 = true), void 0 === o2 && (o2 = true), void 0 === i2 && (i2 = 0), e2 && ("function" == typeof e2 ? e2(r2, 0, t9, r2.path) : pS(r2, 0)), "" === r2.path) {
|
8738 | var u2 = { newDocument: t9 };
|
8739 | if ("add" === r2.op)
|
8740 | return u2.newDocument = r2.value, u2;
|
8741 | if ("replace" === r2.op)
|
8742 | return u2.newDocument = r2.value, u2.removed = t9, u2;
|
8743 | if ("move" === r2.op || "copy" === r2.op)
|
8744 | return u2.newDocument = cS(t9, r2.from), "move" === r2.op && (u2.removed = t9), u2;
|
8745 | if ("test" === r2.op) {
|
8746 | if (u2.test = hS(t9, r2.value), false === u2.test)
|
8747 | throw new iS("Test operation failed", "TEST_OPERATION_FAILED", i2, r2, t9);
|
8748 | return u2.newDocument = t9, u2;
|
8749 | }
|
8750 | if ("remove" === r2.op)
|
8751 | return u2.removed = t9, u2.newDocument = null, u2;
|
8752 | if ("_get" === r2.op)
|
8753 | return r2.value = t9, u2;
|
8754 | if (e2)
|
8755 | throw new iS("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", i2, r2, t9);
|
8756 | return u2;
|
8757 | }
|
8758 | n2 || (t9 = XA(t9));
|
8759 | var a2 = (r2.path || "").split("/"), f2 = t9, c2 = 1, s2 = a2.length, l2 = void 0, p2 = void 0, v2 = void 0;
|
8760 | for (v2 = "function" == typeof e2 ? e2 : pS; ; ) {
|
8761 | if ((p2 = a2[c2]) && -1 != p2.indexOf("~") && (p2 = rS(p2)), o2 && "__proto__" == p2)
|
8762 | throw new TypeError("JSON-Patch: modifying `__proto__` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");
|
8763 | if (e2 && void 0 === l2 && (void 0 === f2[p2] ? l2 = a2.slice(0, c2).join("/") : c2 == s2 - 1 && (l2 = r2.path), void 0 !== l2 && v2(r2, 0, t9, l2)), c2++, Array.isArray(f2)) {
|
8764 | if ("-" === p2)
|
8765 | p2 = f2.length;
|
8766 | else {
|
8767 | if (e2 && !ZA(p2))
|
8768 | throw new iS("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", i2, r2, t9);
|
8769 | ZA(p2) && (p2 = ~~p2);
|
8770 | }
|
8771 | if (c2 >= s2) {
|
8772 | if (e2 && "add" === r2.op && p2 > f2.length)
|
8773 | throw new iS("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", i2, r2, t9);
|
8774 | if (false === (u2 = fS[r2.op].call(r2, f2, p2, t9)).test)
|
8775 | throw new iS("Test operation failed", "TEST_OPERATION_FAILED", i2, r2, t9);
|
8776 | return u2;
|
8777 | }
|
8778 | } else if (c2 >= s2) {
|
8779 | if (false === (u2 = aS[r2.op].call(r2, f2, p2, t9)).test)
|
8780 | throw new iS("Test operation failed", "TEST_OPERATION_FAILED", i2, r2, t9);
|
8781 | return u2;
|
8782 | }
|
8783 | if (f2 = f2[p2], e2 && c2 < s2 && (!f2 || "object" != typeof f2))
|
8784 | throw new iS("Cannot perform operation at the desired path", "OPERATION_PATH_UNRESOLVABLE", i2, r2, t9);
|
8785 | }
|
8786 | }
|
8787 | function lS(t9, r2, e2, n2, o2) {
|
8788 | if (void 0 === n2 && (n2 = true), void 0 === o2 && (o2 = true), e2 && !Array.isArray(r2))
|
8789 | throw new iS("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
|
8790 | n2 || (t9 = XA(t9));
|
8791 | for (var i2 = new Array(r2.length), u2 = 0, a2 = r2.length; u2 < a2; u2++)
|
8792 | i2[u2] = sS(t9, r2[u2], e2, true, o2, u2), t9 = i2[u2].newDocument;
|
8793 | return i2.newDocument = t9, i2;
|
8794 | }
|
8795 | function pS(t9, r2, e2, n2) {
|
8796 | if ("object" != typeof t9 || null === t9 || Array.isArray(t9))
|
8797 | throw new iS("Operation is not an object", "OPERATION_NOT_AN_OBJECT", r2, t9, e2);
|
8798 | if (!aS[t9.op])
|
8799 | throw new iS("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", r2, t9, e2);
|
8800 | if ("string" != typeof t9.path)
|
8801 | throw new iS("Operation `path` property is not a string", "OPERATION_PATH_INVALID", r2, t9, e2);
|
8802 | if (0 !== t9.path.indexOf("/") && t9.path.length > 0)
|
8803 | throw new iS('Operation `path` property must start with "/"', "OPERATION_PATH_INVALID", r2, t9, e2);
|
8804 | if (("move" === t9.op || "copy" === t9.op) && "string" != typeof t9.from)
|
8805 | throw new iS("Operation `from` property is not present (applicable in `move` and `copy` operations)", "OPERATION_FROM_REQUIRED", r2, t9, e2);
|
8806 | if (("add" === t9.op || "replace" === t9.op || "test" === t9.op) && void 0 === t9.value)
|
8807 | throw new iS("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_REQUIRED", r2, t9, e2);
|
8808 | if (("add" === t9.op || "replace" === t9.op || "test" === t9.op) && eS(t9.value))
|
8809 | throw new iS("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED", r2, t9, e2);
|
8810 | if (e2) {
|
8811 | if ("add" == t9.op) {
|
8812 | var o2 = t9.path.split("/").length, i2 = n2.split("/").length;
|
8813 | if (o2 !== i2 + 1 && o2 !== i2)
|
8814 | throw new iS("Cannot perform an `add` operation at the desired path", "OPERATION_PATH_CANNOT_ADD", r2, t9, e2);
|
8815 | } else if ("replace" === t9.op || "remove" === t9.op || "_get" === t9.op) {
|
8816 | if (t9.path !== n2)
|
8817 | throw new iS("Cannot perform the operation at a path that does not exist", "OPERATION_PATH_UNRESOLVABLE", r2, t9, e2);
|
8818 | } else if ("move" === t9.op || "copy" === t9.op) {
|
8819 | var u2 = vS([{ op: "_get", path: t9.from, value: void 0 }], e2);
|
8820 | if (u2 && "OPERATION_PATH_UNRESOLVABLE" === u2.name)
|
8821 | throw new iS("Cannot perform the operation from a path that does not exist", "OPERATION_FROM_UNRESOLVABLE", r2, t9, e2);
|
8822 | }
|
8823 | }
|
8824 | }
|
8825 | function vS(t9, r2, e2) {
|
8826 | try {
|
8827 | if (!Array.isArray(t9))
|
8828 | throw new iS("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
|
8829 | if (r2)
|
8830 | lS(XA(r2), XA(t9), e2 || true);
|
8831 | else {
|
8832 | e2 = e2 || pS;
|
8833 | for (var n2 = 0; n2 < t9.length; n2++)
|
8834 | e2(t9[n2], n2, r2, void 0);
|
8835 | }
|
8836 | } catch (t10) {
|
8837 | if (t10 instanceof iS)
|
8838 | return t10;
|
8839 | throw t10;
|
8840 | }
|
8841 | }
|
8842 | function hS(t9, r2) {
|
8843 | if (t9 === r2)
|
8844 | return true;
|
8845 | if (t9 && r2 && "object" == typeof t9 && "object" == typeof r2) {
|
8846 | var e2, n2, o2, i2 = Array.isArray(t9), u2 = Array.isArray(r2);
|
8847 | if (i2 && u2) {
|
8848 | if ((n2 = t9.length) != r2.length)
|
8849 | return false;
|
8850 | for (e2 = n2; 0 != e2--; )
|
8851 | if (!hS(t9[e2], r2[e2]))
|
8852 | return false;
|
8853 | return true;
|
8854 | }
|
8855 | if (i2 != u2)
|
8856 | return false;
|
8857 | var a2 = Object.keys(t9);
|
8858 | if ((n2 = a2.length) !== Object.keys(r2).length)
|
8859 | return false;
|
8860 | for (e2 = n2; 0 != e2--; )
|
8861 | if (!r2.hasOwnProperty(a2[e2]))
|
8862 | return false;
|
8863 | for (e2 = n2; 0 != e2--; )
|
8864 | if (!hS(t9[o2 = a2[e2]], r2[o2]))
|
8865 | return false;
|
8866 | return true;
|
8867 | }
|
8868 | return t9 != t9 && r2 != r2;
|
8869 | }
|
8870 | const dS = Object.freeze(Object.defineProperty({ __proto__: null, JsonPatchError: iS, deepClone: uS, getValueByPointer: cS, applyOperation: sS, applyPatch: lS, applyReducer: function(t9, r2, e2) {
|
8871 | var n2 = sS(t9, r2);
|
8872 | if (false === n2.test)
|
8873 | throw new iS("Test operation failed", "TEST_OPERATION_FAILED", e2, r2, t9);
|
8874 | return n2.newDocument;
|
8875 | }, validator: pS, validate: vS, _areEquals: hS }, Symbol.toStringTag, { value: "Module" }));
|
8876 |
|
8877 |
|
8878 |
|
8879 |
|
8880 |
|
8881 | var yS = new WeakMap(), bS = function(t9) {
|
8882 | this.observers = new Map(), this.obj = t9;
|
8883 | }, mS = function(t9, r2) {
|
8884 | this.callback = t9, this.observer = r2;
|
8885 | };
|
8886 | function gS(t9, r2) {
|
8887 | void 0 === r2 && (r2 = false);
|
8888 | var e2 = yS.get(t9.object);
|
8889 | wS(e2.value, t9.object, t9.patches, "", r2), t9.patches.length && lS(e2.value, t9.patches);
|
8890 | var n2 = t9.patches;
|
8891 | return n2.length > 0 && (t9.patches = [], t9.callback && t9.callback(n2)), n2;
|
8892 | }
|
8893 | function wS(t9, r2, e2, n2, o2) {
|
8894 | if (r2 !== t9) {
|
8895 | "function" == typeof r2.toJSON && (r2 = r2.toJSON());
|
8896 | for (var i2 = KA(r2), u2 = KA(t9), a2 = false, f2 = u2.length - 1; f2 >= 0; f2--) {
|
8897 | var c2 = t9[l2 = u2[f2]];
|
8898 | if (!QA(r2, l2) || void 0 === r2[l2] && void 0 !== c2 && false === Array.isArray(r2))
|
8899 | Array.isArray(t9) === Array.isArray(r2) ? (o2 && e2.push({ op: "test", path: n2 + "/" + tS(l2), value: XA(c2) }), e2.push({ op: "remove", path: n2 + "/" + tS(l2) }), a2 = true) : (o2 && e2.push({ op: "test", path: n2, value: t9 }), e2.push({ op: "replace", path: n2, value: r2 }));
|
8900 | else {
|
8901 | var s2 = r2[l2];
|
8902 | "object" == typeof c2 && null != c2 && "object" == typeof s2 && null != s2 && Array.isArray(c2) === Array.isArray(s2) ? wS(c2, s2, e2, n2 + "/" + tS(l2), o2) : c2 !== s2 && (o2 && e2.push({ op: "test", path: n2 + "/" + tS(l2), value: XA(c2) }), e2.push({ op: "replace", path: n2 + "/" + tS(l2), value: XA(s2) }));
|
8903 | }
|
8904 | }
|
8905 | if (a2 || i2.length != u2.length)
|
8906 | for (f2 = 0; f2 < i2.length; f2++) {
|
8907 | var l2;
|
8908 | QA(t9, l2 = i2[f2]) || void 0 === r2[l2] || e2.push({ op: "add", path: n2 + "/" + tS(l2), value: XA(r2[l2]) });
|
8909 | }
|
8910 | }
|
8911 | }
|
8912 | const jS = Object.freeze(Object.defineProperty({ __proto__: null, unobserve: function(t9, r2) {
|
8913 | r2.unobserve();
|
8914 | }, observe: function(t9, r2) {
|
8915 | var e2, n2 = function(t10) {
|
8916 | return yS.get(t10);
|
8917 | }(t9);
|
8918 | if (n2) {
|
8919 | var o2 = function(t10, r3) {
|
8920 | return t10.observers.get(r3);
|
8921 | }(n2, r2);
|
8922 | e2 = o2 && o2.observer;
|
8923 | } else
|
8924 | n2 = new bS(t9), yS.set(t9, n2);
|
8925 | if (e2)
|
8926 | return e2;
|
8927 | if (e2 = {}, n2.value = XA(t9), r2) {
|
8928 | e2.callback = r2, e2.next = null;
|
8929 | var i2 = function() {
|
8930 | gS(e2);
|
8931 | }, u2 = function() {
|
8932 | clearTimeout(e2.next), e2.next = setTimeout(i2);
|
8933 | };
|
8934 | "undefined" != typeof window && (window.addEventListener("mouseup", u2), window.addEventListener("keyup", u2), window.addEventListener("mousedown", u2), window.addEventListener("keydown", u2), window.addEventListener("change", u2));
|
8935 | }
|
8936 | return e2.patches = [], e2.object = t9, e2.unobserve = function() {
|
8937 | gS(e2), clearTimeout(e2.next), function(t10, r3) {
|
8938 | t10.observers.delete(r3.callback);
|
8939 | }(n2, e2), "undefined" != typeof window && (window.removeEventListener("mouseup", u2), window.removeEventListener("keyup", u2), window.removeEventListener("mousedown", u2), window.removeEventListener("keydown", u2), window.removeEventListener("change", u2));
|
8940 | }, n2.observers.set(r2, new mS(r2, e2)), e2;
|
8941 | }, generate: gS, compare: function(t9, r2, e2) {
|
8942 | void 0 === e2 && (e2 = false);
|
8943 | var n2 = [];
|
8944 | return wS(t9, r2, n2, "", e2), n2;
|
8945 | } }, Symbol.toStringTag, { value: "Module" }));
|
8946 | Object.assign({}, dS, jS, { JsonPatchError: oS, deepClone: XA, escapePathComponent: tS, unescapePathComponent: rS });
|
8947 | var OS = function(t9) {
|
8948 | return function(t10) {
|
8949 | return !!t10 && "object" == typeof t10;
|
8950 | }(t9) && !function(t10) {
|
8951 | var r2 = Object.prototype.toString.call(t10);
|
8952 | return "[object RegExp]" === r2 || "[object Date]" === r2 || function(t11) {
|
8953 | return t11.$$typeof === AS;
|
8954 | }(t10);
|
8955 | }(t9);
|
8956 | };
|
8957 | var AS = "function" == typeof Symbol && Symbol.for ? Symbol.for("react.element") : 60103;
|
8958 | function SS(t9, r2) {
|
8959 | return false !== r2.clone && r2.isMergeableObject(t9) ? _S((e2 = t9, Array.isArray(e2) ? [] : {}), t9, r2) : t9;
|
8960 | var e2;
|
8961 | }
|
8962 | function xS(t9, r2, e2) {
|
8963 | return t9.concat(r2).map(function(t10) {
|
8964 | return SS(t10, e2);
|
8965 | });
|
8966 | }
|
8967 | function ES(t9) {
|
8968 | return Object.keys(t9).concat(function(t10) {
|
8969 | return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(t10).filter(function(r2) {
|
8970 | return t10.propertyIsEnumerable(r2);
|
8971 | }) : [];
|
8972 | }(t9));
|
8973 | }
|
8974 | function PS(t9, r2) {
|
8975 | try {
|
8976 | return r2 in t9;
|
8977 | } catch (t10) {
|
8978 | return false;
|
8979 | }
|
8980 | }
|
8981 | function kS(t9, r2, e2) {
|
8982 | var n2 = {};
|
8983 | return e2.isMergeableObject(t9) && ES(t9).forEach(function(r3) {
|
8984 | n2[r3] = SS(t9[r3], e2);
|
8985 | }), ES(r2).forEach(function(o2) {
|
8986 | (function(t10, r3) {
|
8987 | return PS(t10, r3) && !(Object.hasOwnProperty.call(t10, r3) && Object.propertyIsEnumerable.call(t10, r3));
|
8988 | })(t9, o2) || (PS(t9, o2) && e2.isMergeableObject(r2[o2]) ? n2[o2] = function(t10, r3) {
|
8989 | if (!r3.customMerge)
|
8990 | return _S;
|
8991 | var e3 = r3.customMerge(t10);
|
8992 | return "function" == typeof e3 ? e3 : _S;
|
8993 | }(o2, e2)(t9[o2], r2[o2], e2) : n2[o2] = SS(r2[o2], e2));
|
8994 | }), n2;
|
8995 | }
|
8996 | function _S(t9, r2, e2) {
|
8997 | (e2 = e2 || {}).arrayMerge = e2.arrayMerge || xS, e2.isMergeableObject = e2.isMergeableObject || OS, e2.cloneUnlessOtherwiseSpecified = SS;
|
8998 | var n2 = Array.isArray(r2);
|
8999 | return n2 === Array.isArray(t9) ? n2 ? e2.arrayMerge(t9, r2, e2) : kS(t9, r2, e2) : SS(r2, e2);
|
9000 | }
|
9001 | _S.all = function(t9, r2) {
|
9002 | if (!Array.isArray(t9))
|
9003 | throw new Error("first argument should be an array");
|
9004 | return t9.reduce(function(t10, e2) {
|
9005 | return _S(t10, e2, r2);
|
9006 | }, {});
|
9007 | };
|
9008 | var IS = _S;
|
9009 | const TS = { add: function(t9, r2) {
|
9010 | return { op: "add", path: t9, value: r2 };
|
9011 | }, replace: FS, remove: function(t9) {
|
9012 | return { op: "remove", path: t9 };
|
9013 | }, merge: function(t9, r2) {
|
9014 | return { type: "mutation", op: "merge", path: t9, value: r2 };
|
9015 | }, mergeDeep: function(t9, r2) {
|
9016 | return { type: "mutation", op: "mergeDeep", path: t9, value: r2 };
|
9017 | }, context: function(t9, r2) {
|
9018 | return { type: "context", path: t9, value: r2 };
|
9019 | }, getIn: function(t9, r2) {
|
9020 | return r2.reduce(function(t10, r3) {
|
9021 | return void 0 !== r3 && t10 ? t10[r3] : t10;
|
9022 | }, t9);
|
9023 | }, applyPatch: function(t9, r2, e2) {
|
9024 | if (e2 = e2 || {}, "merge" === (r2 = Rc(Rc({}, r2), {}, { path: r2.path && RS(r2.path) })).op) {
|
9025 | var n2 = JS(t9, r2.path);
|
9026 | Yc(n2, r2.value), lS(t9, [FS(r2.path, n2)]);
|
9027 | } else if ("mergeDeep" === r2.op) {
|
9028 | var o2 = JS(t9, r2.path), i2 = IS(o2, r2.value);
|
9029 | t9 = lS(t9, [FS(r2.path, i2)]).newDocument;
|
9030 | } else if ("add" === r2.op && "" === r2.path && $S(r2.value)) {
|
9031 | var u2 = Yb(r2.value).reduce(function(t10, e3) {
|
9032 | return t10.push({ op: "add", path: "/".concat(RS(e3)), value: r2.value[e3] }), t10;
|
9033 | }, []);
|
9034 | lS(t9, u2);
|
9035 | } else if ("replace" === r2.op && "" === r2.path) {
|
9036 | var a2 = r2.value;
|
9037 | e2.allowMetaPatches && r2.meta && WS(r2) && (Array.isArray(r2.value) || $S(r2.value)) && (a2 = Rc(Rc({}, a2), r2.meta)), t9 = a2;
|
9038 | } else if (lS(t9, [r2]), e2.allowMetaPatches && r2.meta && WS(r2) && (Array.isArray(r2.value) || $S(r2.value))) {
|
9039 | var f2 = Rc(Rc({}, JS(t9, r2.path)), r2.meta);
|
9040 | lS(t9, [FS(r2.path, f2)]);
|
9041 | }
|
9042 | return t9;
|
9043 | }, parentPathMatch: function(t9, r2) {
|
9044 | if (!Array.isArray(r2))
|
9045 | return false;
|
9046 | for (var e2 = 0, n2 = r2.length; e2 < n2; e2 += 1)
|
9047 | if (r2[e2] !== t9[e2])
|
9048 | return false;
|
9049 | return true;
|
9050 | }, flatten: LS, fullyNormalizeArray: function(t9) {
|
9051 | return CS(LS(US(t9)));
|
9052 | }, normalizeArray: US, isPromise: function(t9) {
|
9053 | return $S(t9) && BS(t9.then);
|
9054 | }, forEachNew: function(t9, r2) {
|
9055 | try {
|
9056 | return NS(t9, DS, r2);
|
9057 | } catch (t10) {
|
9058 | return t10;
|
9059 | }
|
9060 | }, forEachNewPrimitive: function(t9, r2) {
|
9061 | try {
|
9062 | return NS(t9, MS, r2);
|
9063 | } catch (t10) {
|
9064 | return t10;
|
9065 | }
|
9066 | }, isJsonPatch: qS, isContextPatch: function(t9) {
|
9067 | return zS(t9) && "context" === t9.type;
|
9068 | }, isPatch: zS, isMutation: GS, isAdditiveMutation: WS, isGenerator: function(t9) {
|
9069 | return "[object GeneratorFunction]" === Object.prototype.toString.call(t9);
|
9070 | }, isFunction: BS, isObject: $S, isError: function(t9) {
|
9071 | return t9 instanceof Error;
|
9072 | } };
|
9073 | function RS(t9) {
|
9074 | return Array.isArray(t9) ? t9.length < 1 ? "" : "/".concat(Hb(t9).call(t9, function(t10) {
|
9075 | return (t10 + "").replace(/~/g, "~0").replace(/\//g, "~1");
|
9076 | }).join("/")) : t9;
|
9077 | }
|
9078 | function FS(t9, r2, e2) {
|
9079 | return { op: "replace", path: t9, value: r2, meta: e2 };
|
9080 | }
|
9081 | function NS(t9, r2, e2) {
|
9082 | var n2;
|
9083 | return CS(LS(Hb(n2 = hm(t9).call(t9, WS)).call(n2, function(t10) {
|
9084 | return r2(t10.value, e2, t10.path);
|
9085 | }) || []));
|
9086 | }
|
9087 | function MS(t9, r2, e2) {
|
9088 | return e2 = e2 || [], Array.isArray(t9) ? Hb(t9).call(t9, function(t10, n3) {
|
9089 | return MS(t10, r2, rm(e2).call(e2, n3));
|
9090 | }) : $S(t9) ? Hb(n2 = Yb(t9)).call(n2, function(n3) {
|
9091 | return MS(t9[n3], r2, rm(e2).call(e2, n3));
|
9092 | }) : r2(t9, e2[e2.length - 1], e2);
|
9093 | var n2;
|
9094 | }
|
9095 | function DS(t9, r2, e2) {
|
9096 | var n2 = [];
|
9097 | if ((e2 = e2 || []).length > 0) {
|
9098 | var o2 = r2(t9, e2[e2.length - 1], e2);
|
9099 | o2 && (n2 = rm(n2).call(n2, o2));
|
9100 | }
|
9101 | if (Array.isArray(t9)) {
|
9102 | var i2 = Hb(t9).call(t9, function(t10, n3) {
|
9103 | return DS(t10, r2, rm(e2).call(e2, n3));
|
9104 | });
|
9105 | i2 && (n2 = rm(n2).call(n2, i2));
|
9106 | } else if ($S(t9)) {
|
9107 | var u2, a2 = Hb(u2 = Yb(t9)).call(u2, function(n3) {
|
9108 | return DS(t9[n3], r2, rm(e2).call(e2, n3));
|
9109 | });
|
9110 | a2 && (n2 = rm(n2).call(n2, a2));
|
9111 | }
|
9112 | return n2 = LS(n2);
|
9113 | }
|
9114 | function US(t9) {
|
9115 | return Array.isArray(t9) ? t9 : [t9];
|
9116 | }
|
9117 | function LS(t9) {
|
9118 | var r2;
|
9119 | return rm(r2 = []).apply(r2, WO(Hb(t9).call(t9, function(t10) {
|
9120 | return Array.isArray(t10) ? LS(t10) : t10;
|
9121 | })));
|
9122 | }
|
9123 | function CS(t9) {
|
9124 | return hm(t9).call(t9, function(t10) {
|
9125 | return void 0 !== t10;
|
9126 | });
|
9127 | }
|
9128 | function $S(t9) {
|
9129 | return t9 && "object" === qp(t9);
|
9130 | }
|
9131 | function BS(t9) {
|
9132 | return t9 && "function" == typeof t9;
|
9133 | }
|
9134 | function qS(t9) {
|
9135 | if (zS(t9)) {
|
9136 | var r2 = t9.op;
|
9137 | return "add" === r2 || "remove" === r2 || "replace" === r2;
|
9138 | }
|
9139 | return false;
|
9140 | }
|
9141 | function GS(t9) {
|
9142 | return qS(t9) || zS(t9) && "mutation" === t9.type;
|
9143 | }
|
9144 | function WS(t9) {
|
9145 | return GS(t9) && ("add" === t9.op || "replace" === t9.op || "merge" === t9.op || "mergeDeep" === t9.op);
|
9146 | }
|
9147 | function zS(t9) {
|
9148 | return t9 && "object" === qp(t9);
|
9149 | }
|
9150 | function JS(t9, r2) {
|
9151 | try {
|
9152 | return cS(t9, r2);
|
9153 | } catch (t10) {
|
9154 | return console.error(t10), {};
|
9155 | }
|
9156 | }
|
9157 | var HS = { exports: {} }, VS = { exports: {} }, YS = openapi_parser_i(function() {
|
9158 | if ("function" == typeof ArrayBuffer) {
|
9159 | var t9 = new ArrayBuffer(8);
|
9160 | Object.isExtensible(t9) && Object.defineProperty(t9, "a", { value: 8 });
|
9161 | }
|
9162 | }), QS = openapi_parser_i, KS = openapi_parser_H, XS = openapi_parser_N, ZS = YS, tx = Object.isExtensible, rx = QS(function() {
|
9163 | tx(1);
|
9164 | }) || ZS ? function(t9) {
|
9165 | return !!KS(t9) && ((!ZS || "ArrayBuffer" != XS(t9)) && (!tx || tx(t9)));
|
9166 | } : tx, ex = !openapi_parser_i(function() {
|
9167 | return Object.isExtensible(Object.preventExtensions({}));
|
9168 | }), nx = ge, ox = openapi_parser_b, ix = Ue, ux = openapi_parser_H, ax = qt, fx = Wr.f, cx = $n, sx = Gn, lx = rx, px = ex, vx = false, hx = Ht("meta"), dx = 0, yx = function(t9) {
|
9169 | fx(t9, hx, { value: { objectID: "O" + dx++, weakData: {} } });
|
9170 | }, bx = VS.exports = { enable: function() {
|
9171 | bx.enable = function() {
|
9172 | }, vx = true;
|
9173 | var t9 = cx.f, r2 = ox([].splice), e2 = {};
|
9174 | e2[hx] = 1, t9(e2).length && (cx.f = function(e3) {
|
9175 | for (var n2 = t9(e3), o2 = 0, i2 = n2.length; o2 < i2; o2++)
|
9176 | if (n2[o2] === hx) {
|
9177 | r2(n2, o2, 1);
|
9178 | break;
|
9179 | }
|
9180 | return n2;
|
9181 | }, nx({ target: "Object", stat: true, forced: true }, { getOwnPropertyNames: sx.f }));
|
9182 | }, fastKey: function(t9, r2) {
|
9183 | if (!ux(t9))
|
9184 | return "symbol" == typeof t9 ? t9 : ("string" == typeof t9 ? "S" : "P") + t9;
|
9185 | if (!ax(t9, hx)) {
|
9186 | if (!lx(t9))
|
9187 | return "F";
|
9188 | if (!r2)
|
9189 | return "E";
|
9190 | yx(t9);
|
9191 | }
|
9192 | return t9[hx].objectID;
|
9193 | }, getWeakData: function(t9, r2) {
|
9194 | if (!ax(t9, hx)) {
|
9195 | if (!lx(t9))
|
9196 | return true;
|
9197 | if (!r2)
|
9198 | return false;
|
9199 | yx(t9);
|
9200 | }
|
9201 | return t9[hx].weakData;
|
9202 | }, onFreeze: function(t9) {
|
9203 | return px && vx && lx(t9) && !ax(t9, hx) && yx(t9), t9;
|
9204 | } };
|
9205 | ix[hx] = true;
|
9206 | var mx = ge, gx = openapi_parser_o, wx = VS.exports, jx = openapi_parser_i, Ox = ae, Ax = hv, Sx = Qv, xx = openapi_parser_m, Ex = openapi_parser_H, Px = xo, kx = Wr.f, _x = _i.forEach, Ix = openapi_parser_w, Tx = Zo.set, Rx = Zo.getterFor, Fx = openapi_parser_b, Nx = Gv, Mx = VS.exports.getWeakData, Dx = Qr, Ux = openapi_parser_H, Lx = Qv, Cx = hv, $x = qt, Bx = Zo.set, qx = Zo.getterFor, Gx = _i.find, Wx = _i.findIndex, zx = Fx([].splice), Jx = 0, Hx = function(t9) {
|
9207 | return t9.frozen || (t9.frozen = new Vx());
|
9208 | }, Vx = function() {
|
9209 | this.entries = [];
|
9210 | }, Yx = function(t9, r2) {
|
9211 | return Gx(t9.entries, function(t10) {
|
9212 | return t10[0] === r2;
|
9213 | });
|
9214 | };
|
9215 | Vx.prototype = { get: function(t9) {
|
9216 | var r2 = Yx(this, t9);
|
9217 | if (r2)
|
9218 | return r2[1];
|
9219 | }, has: function(t9) {
|
9220 | return !!Yx(this, t9);
|
9221 | }, set: function(t9, r2) {
|
9222 | var e2 = Yx(this, t9);
|
9223 | e2 ? e2[1] = r2 : this.entries.push([t9, r2]);
|
9224 | }, delete: function(t9) {
|
9225 | var r2 = Wx(this.entries, function(r3) {
|
9226 | return r3[0] === t9;
|
9227 | });
|
9228 | return ~r2 && zx(this.entries, r2, 1), !!~r2;
|
9229 | } };
|
9230 | var Qx, Kx = { getConstructor: function(t9, r2, e2, n2) {
|
9231 | var o2 = t9(function(t10, o3) {
|
9232 | Lx(t10, i2), Bx(t10, { type: r2, id: Jx++, frozen: void 0 }), null != o3 && Cx(o3, t10[n2], { that: t10, AS_ENTRIES: e2 });
|
9233 | }), i2 = o2.prototype, u2 = qx(r2), a2 = function(t10, r3, e3) {
|
9234 | var n3 = u2(t10), o3 = Mx(Dx(r3), true);
|
9235 | return true === o3 ? Hx(n3).set(r3, e3) : o3[n3.id] = e3, t10;
|
9236 | };
|
9237 | return Nx(i2, { delete: function(t10) {
|
9238 | var r3 = u2(this);
|
9239 | if (!Ux(t10))
|
9240 | return false;
|
9241 | var e3 = Mx(t10);
|
9242 | return true === e3 ? Hx(r3).delete(t10) : e3 && $x(e3, r3.id) && delete e3[r3.id];
|
9243 | }, has: function(t10) {
|
9244 | var r3 = u2(this);
|
9245 | if (!Ux(t10))
|
9246 | return false;
|
9247 | var e3 = Mx(t10);
|
9248 | return true === e3 ? Hx(r3).has(t10) : e3 && $x(e3, r3.id);
|
9249 | } }), Nx(i2, e2 ? { get: function(t10) {
|
9250 | var r3 = u2(this);
|
9251 | if (Ux(t10)) {
|
9252 | var e3 = Mx(t10);
|
9253 | return true === e3 ? Hx(r3).get(t10) : e3 ? e3[r3.id] : void 0;
|
9254 | }
|
9255 | }, set: function(t10, r3) {
|
9256 | return a2(this, t10, r3);
|
9257 | } } : { add: function(t10) {
|
9258 | return a2(this, t10, true);
|
9259 | } }), o2;
|
9260 | } }, Xx = openapi_parser_o, Zx = openapi_parser_b, tE = Gv, rE = VS.exports, eE = function(t9, r2, e2) {
|
9261 | var n2, o2 = -1 !== t9.indexOf("Map"), i2 = -1 !== t9.indexOf("Weak"), u2 = o2 ? "set" : "add", a2 = gx[t9], f2 = a2 && a2.prototype, c2 = {};
|
9262 | if (Ix && xx(a2) && (i2 || f2.forEach && !jx(function() {
|
9263 | new a2().entries().next();
|
9264 | }))) {
|
9265 | var s2 = (n2 = r2(function(r3, e3) {
|
9266 | Tx(Sx(r3, s2), { type: t9, collection: new a2() }), null != e3 && Ax(e3, r3[u2], { that: r3, AS_ENTRIES: o2 });
|
9267 | })).prototype, l2 = Rx(t9);
|
9268 | _x(["add", "clear", "delete", "forEach", "get", "has", "set", "keys", "values", "entries"], function(t10) {
|
9269 | var r3 = "add" == t10 || "set" == t10;
|
9270 | !(t10 in f2) || i2 && "clear" == t10 || Ox(s2, t10, function(e3, n3) {
|
9271 | var o3 = l2(this).collection;
|
9272 | if (!r3 && i2 && !Ex(e3))
|
9273 | return "get" == t10 && void 0;
|
9274 | var u3 = o3[t10](0 === e3 ? 0 : e3, n3);
|
9275 | return r3 ? this : u3;
|
9276 | });
|
9277 | }), i2 || kx(s2, "size", { configurable: true, get: function() {
|
9278 | return l2(this).collection.size;
|
9279 | } });
|
9280 | } else
|
9281 | n2 = e2.getConstructor(r2, t9, o2, u2), wx.enable();
|
9282 | return Px(n2, t9, false, true), c2[t9] = n2, mx({ global: true, forced: true }, c2), i2 || e2.setStrong(n2, t9, o2), n2;
|
9283 | }, nE = Kx, oE = openapi_parser_H, iE = rx, uE = Zo.enforce, aE = Do, fE = !Xx.ActiveXObject && "ActiveXObject" in Xx, cE = function(t9) {
|
9284 | return function() {
|
9285 | return t9(this, arguments.length ? arguments[0] : void 0);
|
9286 | };
|
9287 | }, sE = eE("WeakMap", cE, nE);
|
9288 | if (aE && fE) {
|
9289 | Qx = nE.getConstructor(cE, "WeakMap", true), rE.enable();
|
9290 | var lE = sE.prototype, pE = Zx(lE.delete), vE = Zx(lE.has), hE = Zx(lE.get), dE = Zx(lE.set);
|
9291 | tE(lE, { delete: function(t9) {
|
9292 | if (oE(t9) && !iE(t9)) {
|
9293 | var r2 = uE(this);
|
9294 | return r2.frozen || (r2.frozen = new Qx()), pE(this, t9) || r2.frozen.delete(t9);
|
9295 | }
|
9296 | return pE(this, t9);
|
9297 | }, has: function(t9) {
|
9298 | if (oE(t9) && !iE(t9)) {
|
9299 | var r2 = uE(this);
|
9300 | return r2.frozen || (r2.frozen = new Qx()), vE(this, t9) || r2.frozen.has(t9);
|
9301 | }
|
9302 | return vE(this, t9);
|
9303 | }, get: function(t9) {
|
9304 | if (oE(t9) && !iE(t9)) {
|
9305 | var r2 = uE(this);
|
9306 | return r2.frozen || (r2.frozen = new Qx()), vE(this, t9) ? hE(this, t9) : r2.frozen.get(t9);
|
9307 | }
|
9308 | return hE(this, t9);
|
9309 | }, set: function(t9, r2) {
|
9310 | if (oE(t9) && !iE(t9)) {
|
9311 | var e2 = uE(this);
|
9312 | e2.frozen || (e2.frozen = new Qx()), vE(this, t9) ? dE(this, t9, r2) : e2.frozen.set(t9, r2);
|
9313 | } else
|
9314 | dE(this, t9, r2);
|
9315 | return this;
|
9316 | } });
|
9317 | }
|
9318 | const yE = openapi_parser_t(HS.exports = openapi_parser_V.WeakMap);
|
9319 | var bE = { exports: {} }, mE = openapi_parser_i, gE = or("iterator"), wE = !mE(function() {
|
9320 | var t9 = new URL("b?a=1&b=2&c=3", "http://a"), r2 = t9.searchParams, e2 = "";
|
9321 | return t9.pathname = "c%20d", r2.forEach(function(t10, n2) {
|
9322 | r2.delete("b"), e2 += n2 + t10;
|
9323 | }), !t9.toJSON || !r2.sort || "http://a/c%20d?a=1&c=3" !== t9.href || "3" !== r2.get("c") || "a=1" !== String(new URLSearchParams("?a=1")) || !r2[gE] || "a" !== new URL("https://a@b").username || "b" !== new URLSearchParams(new URLSearchParams("a=b")).get("a") || "xn--e1aybc" !== new URL("http://\u0442\u0435\u0441\u0442").host || "#%D0%B1" !== new URL("http://a#\u0431").hash || "a1c3" !== e2 || "x" !== new URL("http://x", void 0).host;
|
9324 | }), jE = Zn, OE = Math.floor, AE = function(t9, r2) {
|
9325 | var e2 = t9.length, n2 = OE(e2 / 2);
|
9326 | return e2 < 8 ? SE(t9, r2) : xE(t9, AE(jE(t9, 0, n2), r2), AE(jE(t9, n2), r2), r2);
|
9327 | }, SE = function(t9, r2) {
|
9328 | for (var e2, n2, o2 = t9.length, i2 = 1; i2 < o2; ) {
|
9329 | for (n2 = i2, e2 = t9[i2]; n2 && r2(t9[n2 - 1], e2) > 0; )
|
9330 | t9[n2] = t9[--n2];
|
9331 | n2 !== i2++ && (t9[n2] = e2);
|
9332 | }
|
9333 | return t9;
|
9334 | }, xE = function(t9, r2, e2, n2) {
|
9335 | for (var o2 = r2.length, i2 = e2.length, u2 = 0, a2 = 0; u2 < o2 || a2 < i2; )
|
9336 | t9[u2 + a2] = u2 < o2 && a2 < i2 ? n2(r2[u2], e2[a2]) <= 0 ? r2[u2++] : e2[a2++] : u2 < o2 ? r2[u2++] : e2[a2++];
|
9337 | return t9;
|
9338 | }, EE = ge, PE = openapi_parser_o, kE = openapi_parser_Z, _E = openapi_parser_A, IE = openapi_parser_b, TE = wE, RE = fo, FE = Gv, NE = xo, ME = of, DE = Zo, UE = Qv, LE = openapi_parser_m, CE = qt, $E = Gr, BE = ln, qE = Qr, GE = openapi_parser_H, WE = hn, zE = Cn, JE = openapi_parser_I, HE = yp, VE = El, YE = ih, QE = AE, KE = or("iterator"), XE = DE.set, ZE = DE.getterFor("URLSearchParams"), tP = DE.getterFor("URLSearchParamsIterator"), rP = kE("fetch"), eP = kE("Request"), nP = kE("Headers"), oP = eP && eP.prototype, iP = nP && nP.prototype, uP = PE.RegExp, aP = PE.TypeError, fP = PE.decodeURIComponent, cP = PE.encodeURIComponent, sP = IE("".charAt), lP = IE([].join), pP = IE([].push), vP = IE("".replace), hP = IE([].shift), dP = IE([].splice), yP = IE("".split), bP = IE("".slice), mP = /\+/g, gP = Array(4), wP = function(t9) {
|
9339 | return gP[t9 - 1] || (gP[t9 - 1] = uP("((?:%[\\da-f]{2}){" + t9 + "})", "gi"));
|
9340 | }, jP = function(t9) {
|
9341 | try {
|
9342 | return fP(t9);
|
9343 | } catch (r2) {
|
9344 | return t9;
|
9345 | }
|
9346 | }, OP = function(t9) {
|
9347 | var r2 = vP(t9, mP, " "), e2 = 4;
|
9348 | try {
|
9349 | return fP(r2);
|
9350 | } catch (t10) {
|
9351 | for (; e2; )
|
9352 | r2 = vP(r2, wP(e2--), jP);
|
9353 | return r2;
|
9354 | }
|
9355 | }, AP = /[!'()~]|%20/g, SP = { "!": "%21", "'": "%27", "(": "%28", ")": "%29", "~": "%7E", "%20": "+" }, xP = function(t9) {
|
9356 | return SP[t9];
|
9357 | }, EP = function(t9) {
|
9358 | return vP(cP(t9), AP, xP);
|
9359 | }, PP = ME(function(t9, r2) {
|
9360 | XE(this, { type: "URLSearchParamsIterator", iterator: HE(ZE(t9).entries), kind: r2 });
|
9361 | }, "Iterator", function() {
|
9362 | var t9 = tP(this), r2 = t9.kind, e2 = t9.iterator.next(), n2 = e2.value;
|
9363 | return e2.done || (e2.value = "keys" === r2 ? n2.key : "values" === r2 ? n2.value : [n2.key, n2.value]), e2;
|
9364 | }, true), kP = function(t9) {
|
9365 | this.entries = [], this.url = null, void 0 !== t9 && (GE(t9) ? this.parseObject(t9) : this.parseQuery("string" == typeof t9 ? "?" === sP(t9, 0) ? bP(t9, 1) : t9 : WE(t9)));
|
9366 | };
|
9367 | kP.prototype = { type: "URLSearchParams", bindURL: function(t9) {
|
9368 | this.url = t9, this.update();
|
9369 | }, parseObject: function(t9) {
|
9370 | var r2, e2, n2, o2, i2, u2, a2, f2 = VE(t9);
|
9371 | if (f2)
|
9372 | for (e2 = (r2 = HE(t9, f2)).next; !(n2 = _E(e2, r2)).done; ) {
|
9373 | if (i2 = (o2 = HE(qE(n2.value))).next, (u2 = _E(i2, o2)).done || (a2 = _E(i2, o2)).done || !_E(i2, o2).done)
|
9374 | throw aP("Expected sequence with length 2");
|
9375 | pP(this.entries, { key: WE(u2.value), value: WE(a2.value) });
|
9376 | }
|
9377 | else
|
9378 | for (var c2 in t9)
|
9379 | CE(t9, c2) && pP(this.entries, { key: c2, value: WE(t9[c2]) });
|
9380 | }, parseQuery: function(t9) {
|
9381 | if (t9)
|
9382 | for (var r2, e2, n2 = yP(t9, "&"), o2 = 0; o2 < n2.length; )
|
9383 | (r2 = n2[o2++]).length && (e2 = yP(r2, "="), pP(this.entries, { key: OP(hP(e2)), value: OP(lP(e2, "=")) }));
|
9384 | }, serialize: function() {
|
9385 | for (var t9, r2 = this.entries, e2 = [], n2 = 0; n2 < r2.length; )
|
9386 | t9 = r2[n2++], pP(e2, EP(t9.key) + "=" + EP(t9.value));
|
9387 | return lP(e2, "&");
|
9388 | }, update: function() {
|
9389 | this.entries.length = 0, this.parseQuery(this.url.query);
|
9390 | }, updateURL: function() {
|
9391 | this.url && this.url.update();
|
9392 | } };
|
9393 | var _P = function() {
|
9394 | UE(this, IP);
|
9395 | var t9 = arguments.length > 0 ? arguments[0] : void 0;
|
9396 | XE(this, new kP(t9));
|
9397 | }, IP = _P.prototype;
|
9398 | if (FE(IP, { append: function(t9, r2) {
|
9399 | YE(arguments.length, 2);
|
9400 | var e2 = ZE(this);
|
9401 | pP(e2.entries, { key: WE(t9), value: WE(r2) }), e2.updateURL();
|
9402 | }, delete: function(t9) {
|
9403 | YE(arguments.length, 1);
|
9404 | for (var r2 = ZE(this), e2 = r2.entries, n2 = WE(t9), o2 = 0; o2 < e2.length; )
|
9405 | e2[o2].key === n2 ? dP(e2, o2, 1) : o2++;
|
9406 | r2.updateURL();
|
9407 | }, get: function(t9) {
|
9408 | YE(arguments.length, 1);
|
9409 | for (var r2 = ZE(this).entries, e2 = WE(t9), n2 = 0; n2 < r2.length; n2++)
|
9410 | if (r2[n2].key === e2)
|
9411 | return r2[n2].value;
|
9412 | return null;
|
9413 | }, getAll: function(t9) {
|
9414 | YE(arguments.length, 1);
|
9415 | for (var r2 = ZE(this).entries, e2 = WE(t9), n2 = [], o2 = 0; o2 < r2.length; o2++)
|
9416 | r2[o2].key === e2 && pP(n2, r2[o2].value);
|
9417 | return n2;
|
9418 | }, has: function(t9) {
|
9419 | YE(arguments.length, 1);
|
9420 | for (var r2 = ZE(this).entries, e2 = WE(t9), n2 = 0; n2 < r2.length; )
|
9421 | if (r2[n2++].key === e2)
|
9422 | return true;
|
9423 | return false;
|
9424 | }, set: function(t9, r2) {
|
9425 | YE(arguments.length, 1);
|
9426 | for (var e2, n2 = ZE(this), o2 = n2.entries, i2 = false, u2 = WE(t9), a2 = WE(r2), f2 = 0; f2 < o2.length; f2++)
|
9427 | (e2 = o2[f2]).key === u2 && (i2 ? dP(o2, f2--, 1) : (i2 = true, e2.value = a2));
|
9428 | i2 || pP(o2, { key: u2, value: a2 }), n2.updateURL();
|
9429 | }, sort: function() {
|
9430 | var t9 = ZE(this);
|
9431 | QE(t9.entries, function(t10, r2) {
|
9432 | return t10.key > r2.key ? 1 : -1;
|
9433 | }), t9.updateURL();
|
9434 | }, forEach: function(t9) {
|
9435 | for (var r2, e2 = ZE(this).entries, n2 = $E(t9, arguments.length > 1 ? arguments[1] : void 0), o2 = 0; o2 < e2.length; )
|
9436 | n2((r2 = e2[o2++]).value, r2.key, this);
|
9437 | }, keys: function() {
|
9438 | return new PP(this, "keys");
|
9439 | }, values: function() {
|
9440 | return new PP(this, "values");
|
9441 | }, entries: function() {
|
9442 | return new PP(this, "entries");
|
9443 | } }, { enumerable: true }), RE(IP, KE, IP.entries, { name: "entries" }), RE(IP, "toString", function() {
|
9444 | return ZE(this).serialize();
|
9445 | }, { enumerable: true }), NE(_P, "URLSearchParams"), EE({ global: true, forced: !TE }, { URLSearchParams: _P }), !TE && LE(nP)) {
|
9446 | var TP = IE(iP.has), RP = IE(iP.set), FP = function(t9) {
|
9447 | if (GE(t9)) {
|
9448 | var r2, e2 = t9.body;
|
9449 | if ("URLSearchParams" === BE(e2))
|
9450 | return r2 = t9.headers ? new nP(t9.headers) : new nP(), TP(r2, "content-type") || RP(r2, "content-type", "application/x-www-form-urlencoded;charset=UTF-8"), zE(t9, { body: JE(0, WE(e2)), headers: JE(0, r2) });
|
9451 | }
|
9452 | return t9;
|
9453 | };
|
9454 | if (LE(rP) && EE({ global: true, enumerable: true, forced: true }, { fetch: function(t9) {
|
9455 | return rP(t9, arguments.length > 1 ? FP(arguments[1]) : {});
|
9456 | } }), LE(eP)) {
|
9457 | var NP = function(t9) {
|
9458 | return UE(this, oP), new eP(t9, arguments.length > 1 ? FP(arguments[1]) : {});
|
9459 | };
|
9460 | oP.constructor = NP, NP.prototype = oP, EE({ global: true, forced: true }, { Request: NP });
|
9461 | }
|
9462 | }
|
9463 | const MP = openapi_parser_t(bE.exports = openapi_parser_V.URLSearchParams);
|
9464 | function DP(t9, r2) {
|
9465 | function e2() {
|
9466 | Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack;
|
9467 | for (var t10 = arguments.length, e3 = new Array(t10), n2 = 0; n2 < t10; n2++)
|
9468 | e3[n2] = arguments[n2];
|
9469 | this.message = e3[0], r2 && r2.apply(this, e3);
|
9470 | }
|
9471 | return e2.prototype = new Error(), e2.prototype.name = t9, e2.prototype.constructor = e2, e2;
|
9472 | }
|
9473 | var UP = { exports: {} }, LP = UP.exports = function(t9) {
|
9474 | return new CP(t9);
|
9475 | };
|
9476 | function CP(t9) {
|
9477 | this.value = t9;
|
9478 | }
|
9479 | function $P(t9, r2, e2) {
|
9480 | var n2 = [], o2 = [], i2 = true;
|
9481 | return function t10(u2) {
|
9482 | var a2 = e2 ? BP(u2) : u2, f2 = {}, c2 = true, s2 = { node: a2, node_: u2, path: [].concat(n2), parent: o2[o2.length - 1], parents: o2, key: n2.slice(-1)[0], isRoot: 0 === n2.length, level: n2.length, circular: null, update: function(t11, r3) {
|
9483 | s2.isRoot || (s2.parent.node[s2.key] = t11), s2.node = t11, r3 && (c2 = false);
|
9484 | }, delete: function(t11) {
|
9485 | delete s2.parent.node[s2.key], t11 && (c2 = false);
|
9486 | }, remove: function(t11) {
|
9487 | WP(s2.parent.node) ? s2.parent.node.splice(s2.key, 1) : delete s2.parent.node[s2.key], t11 && (c2 = false);
|
9488 | }, keys: null, before: function(t11) {
|
9489 | f2.before = t11;
|
9490 | }, after: function(t11) {
|
9491 | f2.after = t11;
|
9492 | }, pre: function(t11) {
|
9493 | f2.pre = t11;
|
9494 | }, post: function(t11) {
|
9495 | f2.post = t11;
|
9496 | }, stop: function() {
|
9497 | i2 = false;
|
9498 | }, block: function() {
|
9499 | c2 = false;
|
9500 | } };
|
9501 | if (!i2)
|
9502 | return s2;
|
9503 | function l2() {
|
9504 | if ("object" == typeof s2.node && null !== s2.node) {
|
9505 | s2.keys && s2.node_ === s2.node || (s2.keys = qP(s2.node)), s2.isLeaf = 0 == s2.keys.length;
|
9506 | for (var t11 = 0; t11 < o2.length; t11++)
|
9507 | if (o2[t11].node_ === u2) {
|
9508 | s2.circular = o2[t11];
|
9509 | break;
|
9510 | }
|
9511 | } else
|
9512 | s2.isLeaf = true, s2.keys = null;
|
9513 | s2.notLeaf = !s2.isLeaf, s2.notRoot = !s2.isRoot;
|
9514 | }
|
9515 | l2();
|
9516 | var p2 = r2.call(s2, s2.node);
|
9517 | return void 0 !== p2 && s2.update && s2.update(p2), f2.before && f2.before.call(s2, s2.node), c2 ? ("object" != typeof s2.node || null === s2.node || s2.circular || (o2.push(s2), l2(), zP(s2.keys, function(r3, o3) {
|
9518 | n2.push(r3), f2.pre && f2.pre.call(s2, s2.node[r3], r3);
|
9519 | var i3 = t10(s2.node[r3]);
|
9520 | e2 && JP.call(s2.node, r3) && (s2.node[r3] = i3.node), i3.isLast = o3 == s2.keys.length - 1, i3.isFirst = 0 == o3, f2.post && f2.post.call(s2, i3), n2.pop();
|
9521 | }), o2.pop()), f2.after && f2.after.call(s2, s2.node), s2) : s2;
|
9522 | }(t9).node;
|
9523 | }
|
9524 | function BP(t9) {
|
9525 | if ("object" == typeof t9 && null !== t9) {
|
9526 | var r2;
|
9527 | if (WP(t9))
|
9528 | r2 = [];
|
9529 | else if ("[object Date]" === GP(t9))
|
9530 | r2 = new Date(t9.getTime ? t9.getTime() : t9);
|
9531 | else if (function(t10) {
|
9532 | return "[object RegExp]" === GP(t10);
|
9533 | }(t9))
|
9534 | r2 = new RegExp(t9);
|
9535 | else if (function(t10) {
|
9536 | return "[object Error]" === GP(t10);
|
9537 | }(t9))
|
9538 | r2 = { message: t9.message };
|
9539 | else if (function(t10) {
|
9540 | return "[object Boolean]" === GP(t10);
|
9541 | }(t9))
|
9542 | r2 = new Boolean(t9);
|
9543 | else if (function(t10) {
|
9544 | return "[object Number]" === GP(t10);
|
9545 | }(t9))
|
9546 | r2 = new Number(t9);
|
9547 | else if (function(t10) {
|
9548 | return "[object String]" === GP(t10);
|
9549 | }(t9))
|
9550 | r2 = new String(t9);
|
9551 | else if (Object.create && Object.getPrototypeOf)
|
9552 | r2 = Object.create(Object.getPrototypeOf(t9));
|
9553 | else if (t9.constructor === Object)
|
9554 | r2 = {};
|
9555 | else {
|
9556 | var e2 = t9.constructor && t9.constructor.prototype || t9.__proto__ || {}, n2 = function() {
|
9557 | };
|
9558 | n2.prototype = e2, r2 = new n2();
|
9559 | }
|
9560 | return zP(qP(t9), function(e3) {
|
9561 | r2[e3] = t9[e3];
|
9562 | }), r2;
|
9563 | }
|
9564 | return t9;
|
9565 | }
|
9566 | CP.prototype.get = function(t9) {
|
9567 | for (var r2 = this.value, e2 = 0; e2 < t9.length; e2++) {
|
9568 | var n2 = t9[e2];
|
9569 | if (!r2 || !JP.call(r2, n2)) {
|
9570 | r2 = void 0;
|
9571 | break;
|
9572 | }
|
9573 | r2 = r2[n2];
|
9574 | }
|
9575 | return r2;
|
9576 | }, CP.prototype.has = function(t9) {
|
9577 | for (var r2 = this.value, e2 = 0; e2 < t9.length; e2++) {
|
9578 | var n2 = t9[e2];
|
9579 | if (!r2 || !JP.call(r2, n2))
|
9580 | return false;
|
9581 | r2 = r2[n2];
|
9582 | }
|
9583 | return true;
|
9584 | }, CP.prototype.set = function(t9, r2) {
|
9585 | for (var e2 = this.value, n2 = 0; n2 < t9.length - 1; n2++) {
|
9586 | var o2 = t9[n2];
|
9587 | JP.call(e2, o2) || (e2[o2] = {}), e2 = e2[o2];
|
9588 | }
|
9589 | return e2[t9[n2]] = r2, r2;
|
9590 | }, CP.prototype.map = function(t9) {
|
9591 | return $P(this.value, t9, true);
|
9592 | }, CP.prototype.forEach = function(t9) {
|
9593 | return this.value = $P(this.value, t9, false), this.value;
|
9594 | }, CP.prototype.reduce = function(t9, r2) {
|
9595 | var e2 = 1 === arguments.length, n2 = e2 ? this.value : r2;
|
9596 | return this.forEach(function(r3) {
|
9597 | this.isRoot && e2 || (n2 = t9.call(this, n2, r3));
|
9598 | }), n2;
|
9599 | }, CP.prototype.paths = function() {
|
9600 | var t9 = [];
|
9601 | return this.forEach(function(r2) {
|
9602 | t9.push(this.path);
|
9603 | }), t9;
|
9604 | }, CP.prototype.nodes = function() {
|
9605 | var t9 = [];
|
9606 | return this.forEach(function(r2) {
|
9607 | t9.push(this.node);
|
9608 | }), t9;
|
9609 | }, CP.prototype.clone = function() {
|
9610 | var t9 = [], r2 = [];
|
9611 | return function e2(n2) {
|
9612 | for (var o2 = 0; o2 < t9.length; o2++)
|
9613 | if (t9[o2] === n2)
|
9614 | return r2[o2];
|
9615 | if ("object" == typeof n2 && null !== n2) {
|
9616 | var i2 = BP(n2);
|
9617 | return t9.push(n2), r2.push(i2), zP(qP(n2), function(t10) {
|
9618 | i2[t10] = e2(n2[t10]);
|
9619 | }), t9.pop(), r2.pop(), i2;
|
9620 | }
|
9621 | return n2;
|
9622 | }(this.value);
|
9623 | };
|
9624 | var qP = Object.keys || function(t9) {
|
9625 | var r2 = [];
|
9626 | for (var e2 in t9)
|
9627 | r2.push(e2);
|
9628 | return r2;
|
9629 | };
|
9630 | function GP(t9) {
|
9631 | return Object.prototype.toString.call(t9);
|
9632 | }
|
9633 | var WP = Array.isArray || function(t9) {
|
9634 | return "[object Array]" === Object.prototype.toString.call(t9);
|
9635 | }, zP = function(t9, r2) {
|
9636 | if (t9.forEach)
|
9637 | return t9.forEach(r2);
|
9638 | for (var e2 = 0; e2 < t9.length; e2++)
|
9639 | r2(t9[e2], e2, t9);
|
9640 | };
|
9641 | zP(qP(CP.prototype), function(t9) {
|
9642 | LP[t9] = function(r2) {
|
9643 | var e2 = [].slice.call(arguments, 1), n2 = new CP(r2);
|
9644 | return n2[t9].apply(n2, e2);
|
9645 | };
|
9646 | });
|
9647 | var JP = Object.hasOwnProperty || function(t9, r2) {
|
9648 | return r2 in t9;
|
9649 | }, HP = ["properties"], VP = ["properties"], YP = ["definitions", "parameters", "responses", "securityDefinitions", "components/schemas", "components/responses", "components/parameters", "components/securitySchemes"], QP = ["schema/example", "items/example"];
|
9650 | function KP(t9) {
|
9651 | var r2 = t9[t9.length - 1], e2 = t9[t9.length - 2], n2 = t9.join("/");
|
9652 | return HP.indexOf(r2) > -1 && -1 === VP.indexOf(e2) || YP.indexOf(n2) > -1 || QP.some(function(t10) {
|
9653 | return n2.indexOf(t10) > -1;
|
9654 | });
|
9655 | }
|
9656 | function XP(t9, r2) {
|
9657 | var e2, n2 = Gp(t9.split("#"), 2), o2 = n2[0], i2 = n2[1], u2 = ws.resolve(o2 || "", r2 || "");
|
9658 | return i2 ? rm(e2 = "".concat(u2, "#")).call(e2, i2) : u2;
|
9659 | }
|
9660 | var ZP = /^([a-z]+:\/\/|\/\/)/i, tk = DP("JSONRefError", function(t9, r2, e2) {
|
9661 | this.originalError = e2, Yc(this, r2 || {});
|
9662 | }), rk = {}, ek = new yE(), nk = [function(t9) {
|
9663 | return "paths" === t9[0] && "responses" === t9[3] && "examples" === t9[5];
|
9664 | }, function(t9) {
|
9665 | return "paths" === t9[0] && "responses" === t9[3] && "content" === t9[5] && "example" === t9[7];
|
9666 | }, function(t9) {
|
9667 | return "paths" === t9[0] && "responses" === t9[3] && "content" === t9[5] && "examples" === t9[7] && "value" === t9[9];
|
9668 | }, function(t9) {
|
9669 | return "paths" === t9[0] && "requestBody" === t9[3] && "content" === t9[4] && "example" === t9[6];
|
9670 | }, function(t9) {
|
9671 | return "paths" === t9[0] && "requestBody" === t9[3] && "content" === t9[4] && "examples" === t9[6] && "value" === t9[8];
|
9672 | }, function(t9) {
|
9673 | return "paths" === t9[0] && "parameters" === t9[2] && "example" === t9[4];
|
9674 | }, function(t9) {
|
9675 | return "paths" === t9[0] && "parameters" === t9[3] && "example" === t9[5];
|
9676 | }, function(t9) {
|
9677 | return "paths" === t9[0] && "parameters" === t9[2] && "examples" === t9[4] && "value" === t9[6];
|
9678 | }, function(t9) {
|
9679 | return "paths" === t9[0] && "parameters" === t9[3] && "examples" === t9[5] && "value" === t9[7];
|
9680 | }, function(t9) {
|
9681 | return "paths" === t9[0] && "parameters" === t9[2] && "content" === t9[4] && "example" === t9[6];
|
9682 | }, function(t9) {
|
9683 | return "paths" === t9[0] && "parameters" === t9[2] && "content" === t9[4] && "examples" === t9[6] && "value" === t9[8];
|
9684 | }, function(t9) {
|
9685 | return "paths" === t9[0] && "parameters" === t9[3] && "content" === t9[4] && "example" === t9[7];
|
9686 | }, function(t9) {
|
9687 | return "paths" === t9[0] && "parameters" === t9[3] && "content" === t9[5] && "examples" === t9[7] && "value" === t9[9];
|
9688 | }], ok = { key: "$ref", plugin: function(t9, r2, e2, n2) {
|
9689 | var o2 = n2.getInstance(), i2 = JO(e2).call(e2, 0, -1);
|
9690 | if (!KP(i2) && !function(t10) {
|
9691 | return nk.some(function(r3) {
|
9692 | return r3(t10);
|
9693 | });
|
9694 | }(i2)) {
|
9695 | var u2 = n2.getContext(e2).baseDoc;
|
9696 | if ("string" != typeof t9)
|
9697 | return new tk("$ref: must be a string (JSON-Ref)", { $ref: t9, baseDoc: u2, fullPath: e2 });
|
9698 | var a2, f2, c2, s2 = fk(t9), l2 = s2[0], p2 = s2[1] || "";
|
9699 | try {
|
9700 | a2 = u2 || l2 ? uk(l2, u2) : null;
|
9701 | } catch (r3) {
|
9702 | return ak(r3, { pointer: p2, $ref: t9, basePath: a2, fullPath: e2 });
|
9703 | }
|
9704 | if (function(t10, r3, e3, n3) {
|
9705 | var o3, i3, u3 = ek.get(n3);
|
9706 | u3 || (u3 = {}, ek.set(n3, u3));
|
9707 | var a3 = function(t11) {
|
9708 | if (0 === t11.length)
|
9709 | return "";
|
9710 | return "/".concat(Hb(t11).call(t11, hk).join("/"));
|
9711 | }(e3), f3 = rm(o3 = "".concat(r3 || "<specmap-base>", "#")).call(o3, t10), c3 = a3.replace(/allOf\/\d+\/?/g, ""), s3 = n3.contextTree.get([]).baseDoc;
|
9712 | if (r3 === s3 && dk(c3, t10))
|
9713 | return true;
|
9714 | var l3 = "", p3 = e3.some(function(t11) {
|
9715 | var r4;
|
9716 | return l3 = rm(r4 = "".concat(l3, "/")).call(r4, hk(t11)), u3[l3] && u3[l3].some(function(t12) {
|
9717 | return dk(t12, f3) || dk(f3, t12);
|
9718 | });
|
9719 | });
|
9720 | if (p3)
|
9721 | return true;
|
9722 | return void (u3[c3] = rm(i3 = u3[c3] || []).call(i3, f3));
|
9723 | }(p2, a2, i2, n2) && !o2.useCircularStructures) {
|
9724 | var v2 = XP(t9, a2);
|
9725 | return t9 === v2 ? null : TS.replace(e2, v2);
|
9726 | }
|
9727 | if (null == a2 ? (c2 = pk(p2), void 0 === (f2 = n2.get(c2)) && (f2 = new tk("Could not resolve reference: ".concat(t9), { pointer: p2, $ref: t9, baseDoc: u2, fullPath: e2 }))) : f2 = null != (f2 = ck(a2, p2)).l ? f2.l : f2.catch(function(r3) {
|
9728 | throw ak(r3, { pointer: p2, $ref: t9, baseDoc: u2, fullPath: e2 });
|
9729 | }), f2 instanceof Error)
|
9730 | return [TS.remove(e2), f2];
|
9731 | var h2 = XP(t9, a2), d2 = TS.replace(i2, f2, { $$ref: h2 });
|
9732 | if (a2 && a2 !== u2)
|
9733 | return [d2, TS.context(i2, { baseDoc: a2 })];
|
9734 | try {
|
9735 | if (!function(t10, r3) {
|
9736 | var e3 = [t10];
|
9737 | return r3.path.reduce(function(t11, r4) {
|
9738 | return e3.push(t11[r4]), t11[r4];
|
9739 | }, t10), n3(r3.value);
|
9740 | function n3(t11) {
|
9741 | return TS.isObject(t11) && (e3.indexOf(t11) >= 0 || Yb(t11).some(function(r4) {
|
9742 | return n3(t11[r4]);
|
9743 | }));
|
9744 | }
|
9745 | }(n2.state, d2) || o2.useCircularStructures)
|
9746 | return d2;
|
9747 | } catch (t10) {
|
9748 | return null;
|
9749 | }
|
9750 | }
|
9751 | } }, ik = Yc(ok, { docCache: rk, absoluteify: uk, clearCache: function(t9) {
|
9752 | void 0 !== t9 ? delete rk[t9] : Yb(rk).forEach(function(t10) {
|
9753 | delete rk[t10];
|
9754 | });
|
9755 | }, JSONRefError: tk, wrapError: ak, getDoc: sk, split: fk, extractFromDoc: ck, fetchJSON: function(t9) {
|
9756 | return fetch(t9, { headers: { Accept: "application/json, application/yaml" }, loadSpec: true }).then(function(t10) {
|
9757 | return t10.text();
|
9758 | }).then(function(t10) {
|
9759 | return CO.load(t10);
|
9760 | });
|
9761 | }, extract: lk, jsonPointerToArray: pk, unescapeJsonPointerToken: vk });
|
9762 | function uk(t9, r2) {
|
9763 | if (!ZP.test(t9)) {
|
9764 | var e2;
|
9765 | if (!r2)
|
9766 | throw new tk(rm(e2 = "Tried to resolve a relative URL, without having a basePath. path: '".concat(t9, "' basePath: '")).call(e2, r2, "'"));
|
9767 | return ws.resolve(r2, t9);
|
9768 | }
|
9769 | return t9;
|
9770 | }
|
9771 | function ak(t9, r2) {
|
9772 | var e2, n2;
|
9773 | t9 && t9.response && t9.response.body ? e2 = rm(n2 = "".concat(t9.response.body.code, " ")).call(n2, t9.response.body.message) : e2 = t9.message;
|
9774 | return new tk("Could not resolve reference: ".concat(e2), r2, t9);
|
9775 | }
|
9776 | function fk(t9) {
|
9777 | return (t9 + "").split("#");
|
9778 | }
|
9779 | function ck(t9, r2) {
|
9780 | var e2 = rk[t9];
|
9781 | if (e2 && !TS.isPromise(e2))
|
9782 | try {
|
9783 | var n2 = lk(r2, e2);
|
9784 | return Yc(kA.resolve(n2), { l: n2 });
|
9785 | } catch (t10) {
|
9786 | return kA.reject(t10);
|
9787 | }
|
9788 | return sk(t9).then(function(t10) {
|
9789 | return lk(r2, t10);
|
9790 | });
|
9791 | }
|
9792 | function sk(t9) {
|
9793 | var r2 = rk[t9];
|
9794 | return r2 ? TS.isPromise(r2) ? r2 : kA.resolve(r2) : (rk[t9] = ik.fetchJSON(t9).then(function(r3) {
|
9795 | return rk[t9] = r3, r3;
|
9796 | }), rk[t9]);
|
9797 | }
|
9798 | function lk(t9, r2) {
|
9799 | var e2 = pk(t9);
|
9800 | if (e2.length < 1)
|
9801 | return r2;
|
9802 | var n2 = TS.getIn(r2, e2);
|
9803 | if (void 0 === n2)
|
9804 | throw new tk("Could not resolve pointer: ".concat(t9, " does not exist in document"), { pointer: t9 });
|
9805 | return n2;
|
9806 | }
|
9807 | function pk(t9) {
|
9808 | var r2;
|
9809 | if ("string" != typeof t9)
|
9810 | throw new TypeError("Expected a string, got a ".concat(qp(t9)));
|
9811 | return "/" === t9[0] && (t9 = t9.substr(1)), "" === t9 ? [] : Hb(r2 = t9.split("/")).call(r2, vk);
|
9812 | }
|
9813 | function vk(t9) {
|
9814 | return "string" != typeof t9 ? t9 : new MP("=".concat(t9.replace(/~1/g, "/").replace(/~0/g, "~"))).get("");
|
9815 | }
|
9816 | function hk(t9) {
|
9817 | var r2, e2 = new MP([["", t9.replace(/~/g, "~0").replace(/\//g, "~1")]]);
|
9818 | return JO(r2 = e2.toString()).call(r2, 1);
|
9819 | }
|
9820 | function dk(t9, r2) {
|
9821 | if (!(e2 = r2) || "/" === e2 || "#" === e2)
|
9822 | return true;
|
9823 | var e2, n2 = t9.charAt(r2.length), o2 = JO(r2).call(r2, -1);
|
9824 | return 0 === t9.indexOf(r2) && (!n2 || "/" === n2 || "#" === n2) && "#" !== o2;
|
9825 | }
|
9826 | const yk = { key: "allOf", plugin: function(t9, r2, e2, n2, o2) {
|
9827 | if (!o2.meta || !o2.meta.$$ref) {
|
9828 | var i2 = JO(e2).call(e2, 0, -1);
|
9829 | if (!KP(i2)) {
|
9830 | if (!Array.isArray(t9)) {
|
9831 | var u2 = new TypeError("allOf must be an array");
|
9832 | return u2.fullPath = e2, u2;
|
9833 | }
|
9834 | var a2 = false, f2 = o2.value;
|
9835 | if (i2.forEach(function(t10) {
|
9836 | f2 && (f2 = f2[t10]);
|
9837 | }), f2 = Rc({}, f2), 0 !== Yb(f2).length) {
|
9838 | delete f2.allOf;
|
9839 | var c2, s2, l2 = [];
|
9840 | if (l2.push(n2.replace(i2, {})), t9.forEach(function(t10, r3) {
|
9841 | if (!n2.isObject(t10)) {
|
9842 | if (a2)
|
9843 | return null;
|
9844 | a2 = true;
|
9845 | var o3 = new TypeError("Elements in allOf must be objects");
|
9846 | return o3.fullPath = e2, l2.push(o3);
|
9847 | }
|
9848 | l2.push(n2.mergeDeep(i2, t10));
|
9849 | var u3 = function(t11, r4) {
|
9850 | var e3 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, n3 = e3.specmap, o4 = e3.getBaseUrlForNodePath, i3 = void 0 === o4 ? function(t12) {
|
9851 | var e4;
|
9852 | return n3.getContext(rm(e4 = []).call(e4, WO(r4), WO(t12))).baseDoc;
|
9853 | } : o4, u4 = e3.targetKeys, a3 = void 0 === u4 ? ["$ref", "$$ref"] : u4, f3 = [];
|
9854 | return UP.exports(t11).forEach(function() {
|
9855 | if (fb(a3).call(a3, this.key) && "string" == typeof this.node) {
|
9856 | var t12 = this.path, e4 = rm(r4).call(r4, this.path), o5 = XP(this.node, i3(t12));
|
9857 | f3.push(n3.replace(e4, o5));
|
9858 | }
|
9859 | }), f3;
|
9860 | }(t10, JO(e2).call(e2, 0, -1), { getBaseUrlForNodePath: function(t11) {
|
9861 | var o4;
|
9862 | return n2.getContext(rm(o4 = []).call(o4, WO(e2), [r3], WO(t11))).baseDoc;
|
9863 | }, specmap: n2 });
|
9864 | l2.push.apply(l2, WO(u3));
|
9865 | }), f2.example)
|
9866 | l2.push(n2.remove(rm(c2 = []).call(c2, i2, "example")));
|
9867 | if (l2.push(n2.mergeDeep(i2, f2)), !f2.$$ref)
|
9868 | l2.push(n2.remove(rm(s2 = []).call(s2, i2, "$$ref")));
|
9869 | return l2;
|
9870 | }
|
9871 | }
|
9872 | }
|
9873 | } }, bk = { key: "parameters", plugin: function(t9, r2, e2, n2) {
|
9874 | if (Array.isArray(t9) && t9.length) {
|
9875 | var o2 = Yc([], t9), i2 = JO(e2).call(e2, 0, -1), u2 = Rc({}, TS.getIn(n2.spec, i2));
|
9876 | return t9.forEach(function(t10, r3) {
|
9877 | try {
|
9878 | o2[r3].default = n2.parameterMacro(u2, t10);
|
9879 | } catch (t11) {
|
9880 | var i3 = new Error(t11);
|
9881 | return i3.fullPath = e2, i3;
|
9882 | }
|
9883 | }), TS.replace(e2, o2);
|
9884 | }
|
9885 | return TS.replace(e2, t9);
|
9886 | } }, mk = { key: "properties", plugin: function(t9, r2, e2, n2) {
|
9887 | var o2 = Rc({}, t9);
|
9888 | for (var i2 in t9)
|
9889 | try {
|
9890 | o2[i2].default = n2.modelPropertyMacro(o2[i2]);
|
9891 | } catch (t10) {
|
9892 | var u2 = new Error(t10);
|
9893 | return u2.fullPath = e2, u2;
|
9894 | }
|
9895 | return TS.replace(e2, o2);
|
9896 | } };
|
9897 | var gk = function() {
|
9898 | function t9(r2) {
|
9899 | dA(this, t9), this.root = wk(r2 || {});
|
9900 | }
|
9901 | return bA(t9, [{ key: "set", value: function(t10, r2) {
|
9902 | var e2 = this.getParent(t10, true);
|
9903 | if (e2) {
|
9904 | var n2 = t10[t10.length - 1], o2 = e2.children;
|
9905 | o2[n2] ? jk(o2[n2], r2, e2) : o2[n2] = wk(r2, e2);
|
9906 | } else
|
9907 | jk(this.root, r2, null);
|
9908 | } }, { key: "get", value: function(t10) {
|
9909 | if ((t10 = t10 || []).length < 1)
|
9910 | return this.root.value;
|
9911 | for (var r2, e2, n2 = this.root, o2 = 0; o2 < t10.length && (e2 = t10[o2], (r2 = n2.children)[e2]); o2 += 1)
|
9912 | n2 = r2[e2];
|
9913 | return n2 && n2.protoValue;
|
9914 | } }, { key: "getParent", value: function(t10, r2) {
|
9915 | return !t10 || t10.length < 1 ? null : t10.length < 2 ? this.root : JO(t10).call(t10, 0, -1).reduce(function(t11, e2) {
|
9916 | if (!t11)
|
9917 | return t11;
|
9918 | var n2 = t11.children;
|
9919 | return !n2[e2] && r2 && (n2[e2] = wk(null, t11)), n2[e2];
|
9920 | }, this.root);
|
9921 | } }]), t9;
|
9922 | }();
|
9923 | function wk(t9, r2) {
|
9924 | return jk({ children: {} }, t9, r2);
|
9925 | }
|
9926 | function jk(t9, r2, e2) {
|
9927 | return t9.value = r2 || {}, t9.protoValue = e2 ? Rc(Rc({}, e2.protoValue), t9.value) : t9.value, Yb(t9.children).forEach(function(r3) {
|
9928 | var e3 = t9.children[r3];
|
9929 | t9.children[r3] = jk(e3, e3.value, t9);
|
9930 | }), t9;
|
9931 | }
|
9932 | var Ok = function() {
|
9933 | }, Ak = function() {
|
9934 | function t9(r2) {
|
9935 | var e2, n2, o2 = this;
|
9936 | dA(this, t9), Yc(this, { spec: "", debugLevel: "info", plugins: [], pluginHistory: {}, errors: [], mutations: [], promisedPatches: [], state: {}, patches: [], context: {}, contextTree: new gk(), showDebug: false, allPatches: [], pluginProp: "specMap", libMethods: Yc(Object.create(this), TS, { getInstance: function() {
|
9937 | return o2;
|
9938 | } }), allowMetaPatches: false }, r2), this.get = this._get.bind(this), this.getContext = this._getContext.bind(this), this.hasRun = this._hasRun.bind(this), this.wrappedPlugins = hm(e2 = Hb(n2 = this.plugins).call(n2, this.wrapPlugin.bind(this))).call(e2, TS.isFunction), this.patches.push(TS.add([], this.spec)), this.patches.push(TS.context([], this.context)), this.updatePatches(this.patches);
|
9939 | }
|
9940 | return bA(t9, [{ key: "debug", value: function(t10) {
|
9941 | if (this.debugLevel === t10) {
|
9942 | for (var r2, e2 = arguments.length, n2 = new Array(e2 > 1 ? e2 - 1 : 0), o2 = 1; o2 < e2; o2++)
|
9943 | n2[o2 - 1] = arguments[o2];
|
9944 | (r2 = console).log.apply(r2, n2);
|
9945 | }
|
9946 | } }, { key: "verbose", value: function(t10) {
|
9947 | if ("verbose" === this.debugLevel) {
|
9948 | for (var r2, e2, n2 = arguments.length, o2 = new Array(n2 > 1 ? n2 - 1 : 0), i2 = 1; i2 < n2; i2++)
|
9949 | o2[i2 - 1] = arguments[i2];
|
9950 | (r2 = console).log.apply(r2, rm(e2 = ["[".concat(t10, "] ")]).call(e2, o2));
|
9951 | }
|
9952 | } }, { key: "wrapPlugin", value: function(t10, r2) {
|
9953 | var e2, n2, o2, i2 = this.pathDiscriminator, u2 = null;
|
9954 | return t10[this.pluginProp] ? (u2 = t10, e2 = t10[this.pluginProp]) : TS.isFunction(t10) ? e2 = t10 : TS.isObject(t10) && (n2 = t10, o2 = function(t11, r3) {
|
9955 | return !Array.isArray(t11) || t11.every(function(t12, e3) {
|
9956 | return t12 === r3[e3];
|
9957 | });
|
9958 | }, e2 = Jy.mark(function t11(r3, e3) {
|
9959 | var u3, a2, f2, c2, s2, l2;
|
9960 | return Jy.wrap(function(t12) {
|
9961 | for (; ; )
|
9962 | switch (t12.prev = t12.next) {
|
9963 | case 0:
|
9964 | l2 = function(t13, r4, f3) {
|
9965 | var c3, s3, p2, v2, h2, d2, y2, b2, m2, g2, w2, j2, O2;
|
9966 | return Jy.wrap(function(u4) {
|
9967 | for (; ; )
|
9968 | switch (u4.prev = u4.next) {
|
9969 | case 0:
|
9970 | if (TS.isObject(t13)) {
|
9971 | u4.next = 6;
|
9972 | break;
|
9973 | }
|
9974 | if (n2.key !== r4[r4.length - 1]) {
|
9975 | u4.next = 4;
|
9976 | break;
|
9977 | }
|
9978 | return u4.next = 4, n2.plugin(t13, n2.key, r4, e3);
|
9979 | case 4:
|
9980 | u4.next = 30;
|
9981 | break;
|
9982 | case 6:
|
9983 | c3 = r4.length - 1, s3 = r4[c3], p2 = r4.indexOf("properties"), v2 = "properties" === s3 && c3 === p2, h2 = e3.allowMetaPatches && a2[t13.$$ref], d2 = 0, y2 = Yb(t13);
|
9984 | case 12:
|
9985 | if (!(d2 < y2.length)) {
|
9986 | u4.next = 30;
|
9987 | break;
|
9988 | }
|
9989 | if (b2 = y2[d2], m2 = t13[b2], g2 = rm(r4).call(r4, b2), w2 = TS.isObject(m2), j2 = t13.$$ref, h2) {
|
9990 | u4.next = 22;
|
9991 | break;
|
9992 | }
|
9993 | if (!w2) {
|
9994 | u4.next = 22;
|
9995 | break;
|
9996 | }
|
9997 | return e3.allowMetaPatches && j2 && (a2[j2] = true), u4.delegateYield(l2(m2, g2, f3), "t0", 22);
|
9998 | case 22:
|
9999 | if (v2 || b2 !== n2.key) {
|
10000 | u4.next = 27;
|
10001 | break;
|
10002 | }
|
10003 | if (O2 = o2(i2, r4), i2 && !O2) {
|
10004 | u4.next = 27;
|
10005 | break;
|
10006 | }
|
10007 | return u4.next = 27, n2.plugin(m2, b2, g2, e3, f3);
|
10008 | case 27:
|
10009 | d2++, u4.next = 12;
|
10010 | break;
|
10011 | case 30:
|
10012 | case "end":
|
10013 | return u4.stop();
|
10014 | }
|
10015 | }, u3);
|
10016 | }, u3 = Jy.mark(l2), a2 = {}, f2 = Lp(hm(r3).call(r3, TS.isAdditiveMutation)), t12.prev = 4, f2.s();
|
10017 | case 6:
|
10018 | if ((c2 = f2.n()).done) {
|
10019 | t12.next = 11;
|
10020 | break;
|
10021 | }
|
10022 | return s2 = c2.value, t12.delegateYield(l2(s2.value, s2.path, s2), "t0", 9);
|
10023 | case 9:
|
10024 | t12.next = 6;
|
10025 | break;
|
10026 | case 11:
|
10027 | t12.next = 16;
|
10028 | break;
|
10029 | case 13:
|
10030 | t12.prev = 13, t12.t1 = t12.catch(4), f2.e(t12.t1);
|
10031 | case 16:
|
10032 | return t12.prev = 16, f2.f(), t12.finish(16);
|
10033 | case 19:
|
10034 | case "end":
|
10035 | return t12.stop();
|
10036 | }
|
10037 | }, t11, null, [[4, 13, 16, 19]]);
|
10038 | })), Yc(e2.bind(u2), { pluginName: t10.name || r2, isGenerator: TS.isGenerator(e2) });
|
10039 | } }, { key: "nextPlugin", value: function() {
|
10040 | var t10, r2 = this;
|
10041 | return EA(t10 = this.wrappedPlugins).call(t10, function(t11) {
|
10042 | return r2.getMutationsForPlugin(t11).length > 0;
|
10043 | });
|
10044 | } }, { key: "nextPromisedPatch", value: function() {
|
10045 | var t10;
|
10046 | if (this.promisedPatches.length > 0)
|
10047 | return kA.race(Hb(t10 = this.promisedPatches).call(t10, function(t11) {
|
10048 | return t11.value;
|
10049 | }));
|
10050 | } }, { key: "getPluginHistory", value: function(t10) {
|
10051 | var r2 = this.constructor.getPluginName(t10);
|
10052 | return this.pluginHistory[r2] || [];
|
10053 | } }, { key: "getPluginRunCount", value: function(t10) {
|
10054 | return this.getPluginHistory(t10).length;
|
10055 | } }, { key: "getPluginHistoryTip", value: function(t10) {
|
10056 | var r2 = this.getPluginHistory(t10);
|
10057 | return r2 && r2[r2.length - 1] || {};
|
10058 | } }, { key: "getPluginMutationIndex", value: function(t10) {
|
10059 | var r2 = this.getPluginHistoryTip(t10).mutationIndex;
|
10060 | return "number" != typeof r2 ? -1 : r2;
|
10061 | } }, { key: "updatePluginHistory", value: function(t10, r2) {
|
10062 | var e2 = this.constructor.getPluginName(t10);
|
10063 | this.pluginHistory[e2] = this.pluginHistory[e2] || [], this.pluginHistory[e2].push(r2);
|
10064 | } }, { key: "updatePatches", value: function(t10) {
|
10065 | var r2 = this;
|
10066 | TS.normalizeArray(t10).forEach(function(t11) {
|
10067 | if (t11 instanceof Error)
|
10068 | r2.errors.push(t11);
|
10069 | else
|
10070 | try {
|
10071 | if (!TS.isObject(t11))
|
10072 | return void r2.debug("updatePatches", "Got a non-object patch", t11);
|
10073 | if (r2.showDebug && r2.allPatches.push(t11), TS.isPromise(t11.value))
|
10074 | return r2.promisedPatches.push(t11), void r2.promisedPatchThen(t11);
|
10075 | if (TS.isContextPatch(t11))
|
10076 | return void r2.setContext(t11.path, t11.value);
|
10077 | if (TS.isMutation(t11))
|
10078 | return void r2.updateMutations(t11);
|
10079 | } catch (t12) {
|
10080 | console.error(t12), r2.errors.push(t12);
|
10081 | }
|
10082 | });
|
10083 | } }, { key: "updateMutations", value: function(t10) {
|
10084 | "object" === qp(t10.value) && !Array.isArray(t10.value) && this.allowMetaPatches && (t10.value = Rc({}, t10.value));
|
10085 | var r2 = TS.applyPatch(this.state, t10, { allowMetaPatches: this.allowMetaPatches });
|
10086 | r2 && (this.mutations.push(t10), this.state = r2);
|
10087 | } }, { key: "removePromisedPatch", value: function(t10) {
|
10088 | var r2, e2 = this.promisedPatches.indexOf(t10);
|
10089 | e2 < 0 ? this.debug("Tried to remove a promisedPatch that isn't there!") : JA(r2 = this.promisedPatches).call(r2, e2, 1);
|
10090 | } }, { key: "promisedPatchThen", value: function(t10) {
|
10091 | var r2 = this;
|
10092 | return t10.value = t10.value.then(function(e2) {
|
10093 | var n2 = Rc(Rc({}, t10), {}, { value: e2 });
|
10094 | r2.removePromisedPatch(t10), r2.updatePatches(n2);
|
10095 | }).catch(function(e2) {
|
10096 | r2.removePromisedPatch(t10), r2.updatePatches(e2);
|
10097 | }), t10.value;
|
10098 | } }, { key: "getMutations", value: function(t10, r2) {
|
10099 | var e2;
|
10100 | return t10 = t10 || 0, "number" != typeof r2 && (r2 = this.mutations.length), JO(e2 = this.mutations).call(e2, t10, r2);
|
10101 | } }, { key: "getCurrentMutations", value: function() {
|
10102 | return this.getMutationsForPlugin(this.getCurrentPlugin());
|
10103 | } }, { key: "getMutationsForPlugin", value: function(t10) {
|
10104 | var r2 = this.getPluginMutationIndex(t10);
|
10105 | return this.getMutations(r2 + 1);
|
10106 | } }, { key: "getCurrentPlugin", value: function() {
|
10107 | return this.currentPlugin;
|
10108 | } }, { key: "getLib", value: function() {
|
10109 | return this.libMethods;
|
10110 | } }, { key: "_get", value: function(t10) {
|
10111 | return TS.getIn(this.state, t10);
|
10112 | } }, { key: "_getContext", value: function(t10) {
|
10113 | return this.contextTree.get(t10);
|
10114 | } }, { key: "setContext", value: function(t10, r2) {
|
10115 | return this.contextTree.set(t10, r2);
|
10116 | } }, { key: "_hasRun", value: function(t10) {
|
10117 | return this.getPluginRunCount(this.getCurrentPlugin()) > (t10 || 0);
|
10118 | } }, { key: "dispatch", value: function() {
|
10119 | var t10, r2 = this, e2 = this, n2 = this.nextPlugin();
|
10120 | if (!n2) {
|
10121 | var o2 = this.nextPromisedPatch();
|
10122 | if (o2)
|
10123 | return o2.then(function() {
|
10124 | return r2.dispatch();
|
10125 | }).catch(function() {
|
10126 | return r2.dispatch();
|
10127 | });
|
10128 | var i2 = { spec: this.state, errors: this.errors };
|
10129 | return this.showDebug && (i2.patches = this.allPatches), kA.resolve(i2);
|
10130 | }
|
10131 | if (e2.pluginCount = e2.pluginCount || {}, e2.pluginCount[n2] = (e2.pluginCount[n2] || 0) + 1, e2.pluginCount[n2] > 100)
|
10132 | return kA.resolve({ spec: e2.state, errors: rm(t10 = e2.errors).call(t10, new Error("We've reached a hard limit of ".concat(100, " plugin runs"))) });
|
10133 | if (n2 !== this.currentPlugin && this.promisedPatches.length) {
|
10134 | var u2, a2 = Hb(u2 = this.promisedPatches).call(u2, function(t11) {
|
10135 | return t11.value;
|
10136 | });
|
10137 | return kA.all(Hb(a2).call(a2, function(t11) {
|
10138 | return t11.then(Ok, Ok);
|
10139 | })).then(function() {
|
10140 | return r2.dispatch();
|
10141 | });
|
10142 | }
|
10143 | return function() {
|
10144 | e2.currentPlugin = n2;
|
10145 | var t11 = e2.getCurrentMutations(), r3 = e2.mutations.length - 1;
|
10146 | try {
|
10147 | if (n2.isGenerator) {
|
10148 | var o3, i3 = Lp(n2(t11, e2.getLib()));
|
10149 | try {
|
10150 | for (i3.s(); !(o3 = i3.n()).done; ) {
|
10151 | f2(o3.value);
|
10152 | }
|
10153 | } catch (t12) {
|
10154 | i3.e(t12);
|
10155 | } finally {
|
10156 | i3.f();
|
10157 | }
|
10158 | } else {
|
10159 | f2(n2(t11, e2.getLib()));
|
10160 | }
|
10161 | } catch (t12) {
|
10162 | console.error(t12), f2([Yc(Object.create(t12), { plugin: n2 })]);
|
10163 | } finally {
|
10164 | e2.updatePluginHistory(n2, { mutationIndex: r3 });
|
10165 | }
|
10166 | return e2.dispatch();
|
10167 | }();
|
10168 | function f2(t11) {
|
10169 | t11 && (t11 = TS.fullyNormalizeArray(t11), e2.updatePatches(t11, n2));
|
10170 | }
|
10171 | } }], [{ key: "getPluginName", value: function(t10) {
|
10172 | return t10.pluginName;
|
10173 | } }, { key: "getPatchesOfType", value: function(t10, r2) {
|
10174 | return hm(t10).call(t10, r2);
|
10175 | } }]), t9;
|
10176 | }();
|
10177 | var Sk = { refs: ik, allOf: yk, parameters: bk, properties: mk }, xk = function(t9) {
|
10178 | return String.prototype.toLowerCase.call(t9);
|
10179 | }, Ek = function(t9) {
|
10180 | return t9.replace(/[^\w]/gi, "_");
|
10181 | };
|
10182 | function Pk(t9) {
|
10183 | var r2 = t9.openapi;
|
10184 | return !!r2 && gs(r2).call(r2, "3");
|
10185 | }
|
10186 | function kk(t9, r2) {
|
10187 | var e2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "", n2 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}, o2 = n2.v2OperationIdCompatibilityMode;
|
10188 | if (!t9 || "object" !== qp(t9))
|
10189 | return null;
|
10190 | var i2 = (t9.operationId || "").replace(/\s/g, "");
|
10191 | return i2.length ? Ek(t9.operationId) : _k(r2, e2, { v2OperationIdCompatibilityMode: o2 });
|
10192 | }
|
10193 | function _k(t9, r2) {
|
10194 | var e2, n2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, o2 = n2.v2OperationIdCompatibilityMode;
|
10195 | if (o2) {
|
10196 | var i2, u2, a2 = rm(i2 = "".concat(r2.toLowerCase(), "_")).call(i2, t9).replace(/[\s!@#$%^&*()_+=[{\]};:<>|./?,\\'""-]/g, "_");
|
10197 | return (a2 = a2 || rm(u2 = "".concat(t9.substring(1), "_")).call(u2, r2)).replace(/((_){2,})/g, "_").replace(/^(_)*/g, "").replace(/([_])*$/g, "");
|
10198 | }
|
10199 | return rm(e2 = "".concat(xk(r2))).call(e2, Ek(t9));
|
10200 | }
|
10201 | function Ik(t9, r2) {
|
10202 | var e2;
|
10203 | return rm(e2 = "".concat(xk(r2), "-")).call(e2, t9);
|
10204 | }
|
10205 | function Tk(t9, r2) {
|
10206 | return t9 && t9.paths ? function(t10, r3) {
|
10207 | return Rk(t10, r3, true) || null;
|
10208 | }(t9, function(t10) {
|
10209 | var e2 = t10.pathName, n2 = t10.method, o2 = t10.operation;
|
10210 | if (!o2 || "object" !== qp(o2))
|
10211 | return false;
|
10212 | var i2 = o2.operationId;
|
10213 | return [kk(o2, e2, n2), Ik(e2, n2), i2].some(function(t11) {
|
10214 | return t11 && t11 === r2;
|
10215 | });
|
10216 | }) : null;
|
10217 | }
|
10218 | function Rk(t9, r2, e2) {
|
10219 | if (!t9 || "object" !== qp(t9) || !t9.paths || "object" !== qp(t9.paths))
|
10220 | return null;
|
10221 | var n2 = t9.paths;
|
10222 | for (var o2 in n2)
|
10223 | for (var i2 in n2[o2])
|
10224 | if ("PARAMETERS" !== i2.toUpperCase()) {
|
10225 | var u2 = n2[o2][i2];
|
10226 | if (u2 && "object" === qp(u2)) {
|
10227 | var a2 = { spec: t9, pathName: o2, method: i2.toUpperCase(), operation: u2 }, f2 = r2(a2);
|
10228 | if (e2 && f2)
|
10229 | return a2;
|
10230 | }
|
10231 | }
|
10232 | }
|
10233 | function Fk(t9) {
|
10234 | var r2 = t9.spec, e2 = r2.paths, n2 = {};
|
10235 | if (!e2 || r2.$$normalized)
|
10236 | return t9;
|
10237 | for (var o2 in e2) {
|
10238 | var i2, u2 = e2[o2];
|
10239 | if (null != u2 && fb(i2 = ["object", "function"]).call(i2, qp(u2))) {
|
10240 | var a2 = u2.parameters, f2 = function(t10) {
|
10241 | var e3, i3 = u2[t10];
|
10242 | if (null == i3 || !fb(e3 = ["object", "function"]).call(e3, qp(i3)))
|
10243 | return "continue";
|
10244 | var f3 = kk(i3, o2, t10);
|
10245 | if (f3) {
|
10246 | n2[f3] ? n2[f3].push(i3) : n2[f3] = [i3];
|
10247 | var c3 = n2[f3];
|
10248 | if (c3.length > 1)
|
10249 | c3.forEach(function(t11, r3) {
|
10250 | var e4;
|
10251 | t11.p = t11.p || t11.operationId, t11.operationId = rm(e4 = "".concat(f3)).call(e4, r3 + 1);
|
10252 | });
|
10253 | else if (void 0 !== i3.operationId) {
|
10254 | var s2 = c3[0];
|
10255 | s2.p = s2.p || i3.operationId, s2.operationId = f3;
|
10256 | }
|
10257 | }
|
10258 | if ("parameters" !== t10) {
|
10259 | var l2 = [], p2 = {};
|
10260 | for (var v2 in r2)
|
10261 | "produces" !== v2 && "consumes" !== v2 && "security" !== v2 || (p2[v2] = r2[v2], l2.push(p2));
|
10262 | if (a2 && (p2.parameters = a2, l2.push(p2)), l2.length) {
|
10263 | var h2, d2 = Lp(l2);
|
10264 | try {
|
10265 | for (d2.s(); !(h2 = d2.n()).done; ) {
|
10266 | var y2 = h2.value;
|
10267 | for (var b2 in y2)
|
10268 | if (i3[b2]) {
|
10269 | if ("parameters" === b2) {
|
10270 | var m2, g2 = Lp(y2[b2]);
|
10271 | try {
|
10272 | var w2 = function() {
|
10273 | var t11 = m2.value;
|
10274 | i3[b2].some(function(r3) {
|
10275 | return r3.name && r3.name === t11.name || r3.$ref && r3.$ref === t11.$ref || r3.$$ref && r3.$$ref === t11.$$ref || r3 === t11;
|
10276 | }) || i3[b2].push(t11);
|
10277 | };
|
10278 | for (g2.s(); !(m2 = g2.n()).done; )
|
10279 | w2();
|
10280 | } catch (t11) {
|
10281 | g2.e(t11);
|
10282 | } finally {
|
10283 | g2.f();
|
10284 | }
|
10285 | }
|
10286 | } else
|
10287 | i3[b2] = y2[b2];
|
10288 | }
|
10289 | } catch (t11) {
|
10290 | d2.e(t11);
|
10291 | } finally {
|
10292 | d2.f();
|
10293 | }
|
10294 | }
|
10295 | }
|
10296 | };
|
10297 | for (var c2 in u2)
|
10298 | f2(c2);
|
10299 | }
|
10300 | }
|
10301 | return r2.$$normalized = true, t9;
|
10302 | }
|
10303 | function Nk(t9) {
|
10304 | var r2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, e2 = r2.requestInterceptor, n2 = r2.responseInterceptor, o2 = t9.withCredentials ? "include" : "same-origin";
|
10305 | return function(r3) {
|
10306 | return t9({ url: r3, loadSpec: true, requestInterceptor: e2, responseInterceptor: n2, headers: { Accept: "application/json, application/yaml" }, credentials: o2 }).then(function(t10) {
|
10307 | return t10.body;
|
10308 | });
|
10309 | };
|
10310 | }
|
10311 | function Mk(t9) {
|
10312 | var r2 = t9.fetch, e2 = t9.spec, n2 = t9.url, o2 = t9.mode, i2 = t9.allowMetaPatches, u2 = void 0 === i2 || i2, a2 = t9.pathDiscriminator, f2 = t9.modelPropertyMacro, c2 = t9.parameterMacro, s2 = t9.requestInterceptor, l2 = t9.responseInterceptor, p2 = t9.skipNormalization, v2 = t9.useCircularStructures, h2 = t9.http, d2 = t9.baseDoc;
|
10313 | return d2 = d2 || n2, h2 = r2 || h2 || ZO, e2 ? y2(e2) : Nk(h2, { requestInterceptor: s2, responseInterceptor: l2 })(d2).then(y2);
|
10314 | function y2(t10) {
|
10315 | d2 && (Sk.refs.docCache[d2] = t10), Sk.refs.fetchJSON = Nk(h2, { requestInterceptor: s2, responseInterceptor: l2 });
|
10316 | var r3, e3 = [Sk.refs];
|
10317 | return "function" == typeof c2 && e3.push(Sk.parameters), "function" == typeof f2 && e3.push(Sk.properties), "strict" !== o2 && e3.push(Sk.allOf), (r3 = { spec: t10, context: { baseDoc: d2 }, plugins: e3, allowMetaPatches: u2, pathDiscriminator: a2, parameterMacro: c2, modelPropertyMacro: f2, useCircularStructures: v2 }, new Ak(r3).dispatch()).then(p2 ? function() {
|
10318 | var t11 = Gy(Jy.mark(function t12(r4) {
|
10319 | return Jy.wrap(function(t13) {
|
10320 | for (; ; )
|
10321 | switch (t13.prev = t13.next) {
|
10322 | case 0:
|
10323 | return t13.abrupt("return", r4);
|
10324 | case 1:
|
10325 | case "end":
|
10326 | return t13.stop();
|
10327 | }
|
10328 | }, t12);
|
10329 | }));
|
10330 | return function(r4) {
|
10331 | return t11.apply(this, arguments);
|
10332 | };
|
10333 | }() : Fk);
|
10334 | }
|
10335 | }
|
10336 | var Dk = Array.isArray, Uk = "object" == typeof global && global && global.Object === Object && global, Lk = "object" == typeof self && self && self.Object === Object && self, Ck = Uk || Lk || Function("return this")(), $k = Ck.Symbol, Bk = $k, qk = Object.prototype, Gk = qk.hasOwnProperty, Wk = qk.toString, zk = Bk ? Bk.toStringTag : void 0;
|
10337 | var Jk = function(t9) {
|
10338 | var r2 = Gk.call(t9, zk), e2 = t9[zk];
|
10339 | try {
|
10340 | t9[zk] = void 0;
|
10341 | var n2 = true;
|
10342 | } catch (t10) {
|
10343 | }
|
10344 | var o2 = Wk.call(t9);
|
10345 | return n2 && (r2 ? t9[zk] = e2 : delete t9[zk]), o2;
|
10346 | }, Hk = Object.prototype.toString;
|
10347 | var Vk = Jk, Yk = function(t9) {
|
10348 | return Hk.call(t9);
|
10349 | }, Qk = $k ? $k.toStringTag : void 0;
|
10350 | var Kk = function(t9) {
|
10351 | return null == t9 ? void 0 === t9 ? "[object Undefined]" : "[object Null]" : Qk && Qk in Object(t9) ? Vk(t9) : Yk(t9);
|
10352 | };
|
10353 | var Xk = Kk, Zk = function(t9) {
|
10354 | return null != t9 && "object" == typeof t9;
|
10355 | };
|
10356 | var t_ = function(t9) {
|
10357 | return "symbol" == typeof t9 || Zk(t9) && "[object Symbol]" == Xk(t9);
|
10358 | }, r_ = Dk, e_ = t_, n_ = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, o_ = /^\w*$/;
|
10359 | var i_ = function(t9, r2) {
|
10360 | if (r_(t9))
|
10361 | return false;
|
10362 | var e2 = typeof t9;
|
10363 | return !("number" != e2 && "symbol" != e2 && "boolean" != e2 && null != t9 && !e_(t9)) || (o_.test(t9) || !n_.test(t9) || null != r2 && t9 in Object(r2));
|
10364 | };
|
10365 | var u_ = function(t9) {
|
10366 | var r2 = typeof t9;
|
10367 | return null != t9 && ("object" == r2 || "function" == r2);
|
10368 | }, a_ = Kk, f_ = u_;
|
10369 | var c_ = function(t9) {
|
10370 | if (!f_(t9))
|
10371 | return false;
|
10372 | var r2 = a_(t9);
|
10373 | return "[object Function]" == r2 || "[object GeneratorFunction]" == r2 || "[object AsyncFunction]" == r2 || "[object Proxy]" == r2;
|
10374 | }, s_ = Ck["i"], l_ = function() {
|
10375 | var t9 = /[^.]+$/.exec(s_ && s_.keys && s_.keys.IE_PROTO || "");
|
10376 | return t9 ? "Symbol(src)_1." + t9 : "";
|
10377 | }();
|
10378 | var p_ = function(t9) {
|
10379 | return !!l_ && l_ in t9;
|
10380 | }, v_ = Function.prototype.toString;
|
10381 | var h_ = c_, d_ = p_, y_ = u_, b_ = function(t9) {
|
10382 | if (null != t9) {
|
10383 | try {
|
10384 | return v_.call(t9);
|
10385 | } catch (t10) {
|
10386 | }
|
10387 | try {
|
10388 | return t9 + "";
|
10389 | } catch (t10) {
|
10390 | }
|
10391 | }
|
10392 | return "";
|
10393 | }, m_ = /^\[object .+?Constructor\]$/, g_ = Function.prototype, w_ = Object.prototype, j_ = g_.toString, O_ = w_.hasOwnProperty, A_ = RegExp("^" + j_.call(O_).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
|
10394 | var S_ = function(t9) {
|
10395 | return !(!y_(t9) || d_(t9)) && (h_(t9) ? A_ : m_).test(b_(t9));
|
10396 | }, x_ = function(t9, r2) {
|
10397 | return null == t9 ? void 0 : t9[r2];
|
10398 | };
|
10399 | var E_ = function(t9, r2) {
|
10400 | var e2 = x_(t9, r2);
|
10401 | return S_(e2) ? e2 : void 0;
|
10402 | }, P_ = E_(Object, "create"), k_ = P_;
|
10403 | var __ = function() {
|
10404 | this.v = k_ ? k_(null) : {}, this.size = 0;
|
10405 | };
|
10406 | var I_ = function(t9) {
|
10407 | var r2 = this.has(t9) && delete this.v[t9];
|
10408 | return this.size -= r2 ? 1 : 0, r2;
|
10409 | }, T_ = P_, R_ = Object.prototype.hasOwnProperty;
|
10410 | var F_ = function(t9) {
|
10411 | var r2 = this.v;
|
10412 | if (T_) {
|
10413 | var e2 = r2[t9];
|
10414 | return "__lodash_hash_undefined__" === e2 ? void 0 : e2;
|
10415 | }
|
10416 | return R_.call(r2, t9) ? r2[t9] : void 0;
|
10417 | }, N_ = P_, M_ = Object.prototype.hasOwnProperty;
|
10418 | var D_ = function(t9) {
|
10419 | var r2 = this.v;
|
10420 | return N_ ? void 0 !== r2[t9] : M_.call(r2, t9);
|
10421 | }, U_ = P_;
|
10422 | var L_ = function(t9, r2) {
|
10423 | var e2 = this.v;
|
10424 | return this.size += this.has(t9) ? 0 : 1, e2[t9] = U_ && void 0 === r2 ? "__lodash_hash_undefined__" : r2, this;
|
10425 | }, C_ = __, $_ = I_, B_ = F_, q_ = D_, G_ = L_;
|
10426 | function W_(t9) {
|
10427 | var r2 = -1, e2 = null == t9 ? 0 : t9.length;
|
10428 | for (this.clear(); ++r2 < e2; ) {
|
10429 | var n2 = t9[r2];
|
10430 | this.set(n2[0], n2[1]);
|
10431 | }
|
10432 | }
|
10433 | W_.prototype.clear = C_, W_.prototype.delete = $_, W_.prototype.get = B_, W_.prototype.has = q_, W_.prototype.set = G_;
|
10434 | var z_ = W_;
|
10435 | var J_ = function() {
|
10436 | this.v = [], this.size = 0;
|
10437 | };
|
10438 | var H_ = function(t9, r2) {
|
10439 | return t9 === r2 || t9 != t9 && r2 != r2;
|
10440 | };
|
10441 | var V_ = function(t9, r2) {
|
10442 | for (var e2 = t9.length; e2--; )
|
10443 | if (H_(t9[e2][0], r2))
|
10444 | return e2;
|
10445 | return -1;
|
10446 | }, Y_ = V_, Q_ = Array.prototype.splice;
|
10447 | var K_ = function(t9) {
|
10448 | var r2 = this.v, e2 = Y_(r2, t9);
|
10449 | return !(e2 < 0) && (e2 == r2.length - 1 ? r2.pop() : Q_.call(r2, e2, 1), --this.size, true);
|
10450 | }, X_ = V_;
|
10451 | var Z_ = function(t9) {
|
10452 | var r2 = this.v, e2 = X_(r2, t9);
|
10453 | return e2 < 0 ? void 0 : r2[e2][1];
|
10454 | }, tI = V_;
|
10455 | var rI = V_;
|
10456 | var eI = function(t9, r2) {
|
10457 | var e2 = this.v, n2 = rI(e2, t9);
|
10458 | return n2 < 0 ? (++this.size, e2.push([t9, r2])) : e2[n2][1] = r2, this;
|
10459 | }, nI = J_, oI = K_, iI = Z_, uI = function(t9) {
|
10460 | return tI(this.v, t9) > -1;
|
10461 | }, aI = eI;
|
10462 | function fI(t9) {
|
10463 | var r2 = -1, e2 = null == t9 ? 0 : t9.length;
|
10464 | for (this.clear(); ++r2 < e2; ) {
|
10465 | var n2 = t9[r2];
|
10466 | this.set(n2[0], n2[1]);
|
10467 | }
|
10468 | }
|
10469 | fI.prototype.clear = nI, fI.prototype.delete = oI, fI.prototype.get = iI, fI.prototype.has = uI, fI.prototype.set = aI;
|
10470 | var cI = fI, sI = E_(Ck, "Map"), lI = z_, pI = cI, vI = sI;
|
10471 | var hI = function(t9) {
|
10472 | var r2 = typeof t9;
|
10473 | return "string" == r2 || "number" == r2 || "symbol" == r2 || "boolean" == r2 ? "__proto__" !== t9 : null === t9;
|
10474 | }, dI = hI;
|
10475 | var yI = function(t9, r2) {
|
10476 | var e2 = t9.v;
|
10477 | return dI(r2) ? e2["string" == typeof r2 ? "string" : "hash"] : e2.map;
|
10478 | }, bI = yI;
|
10479 | var mI = yI;
|
10480 | var gI = yI;
|
10481 | var wI = yI;
|
10482 | var jI = function(t9, r2) {
|
10483 | var e2 = wI(this, t9), n2 = e2.size;
|
10484 | return e2.set(t9, r2), this.size += e2.size == n2 ? 0 : 1, this;
|
10485 | }, OI = function() {
|
10486 | this.size = 0, this.v = { hash: new lI(), map: new (vI || pI)(), string: new lI() };
|
10487 | }, AI = function(t9) {
|
10488 | var r2 = bI(this, t9).delete(t9);
|
10489 | return this.size -= r2 ? 1 : 0, r2;
|
10490 | }, SI = function(t9) {
|
10491 | return mI(this, t9).get(t9);
|
10492 | }, xI = function(t9) {
|
10493 | return gI(this, t9).has(t9);
|
10494 | }, EI = jI;
|
10495 | function PI(t9) {
|
10496 | var r2 = -1, e2 = null == t9 ? 0 : t9.length;
|
10497 | for (this.clear(); ++r2 < e2; ) {
|
10498 | var n2 = t9[r2];
|
10499 | this.set(n2[0], n2[1]);
|
10500 | }
|
10501 | }
|
10502 | PI.prototype.clear = OI, PI.prototype.delete = AI, PI.prototype.get = SI, PI.prototype.has = xI, PI.prototype.set = EI;
|
10503 | var kI = PI;
|
10504 | function _I(t9, r2) {
|
10505 | if ("function" != typeof t9 || null != r2 && "function" != typeof r2)
|
10506 | throw new TypeError("Expected a function");
|
10507 | var e2 = function() {
|
10508 | var n2 = arguments, o2 = r2 ? r2.apply(this, n2) : n2[0], i2 = e2.cache;
|
10509 | if (i2.has(o2))
|
10510 | return i2.get(o2);
|
10511 | var u2 = t9.apply(this, n2);
|
10512 | return e2.cache = i2.set(o2, u2) || i2, u2;
|
10513 | };
|
10514 | return e2.cache = new (_I.Cache || kI)(), e2;
|
10515 | }
|
10516 | _I.Cache = kI;
|
10517 | var II = _I;
|
10518 | var TI = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, RI = /\\(\\)?/g, FI = function(t9) {
|
10519 | var r2 = II(t9, function(t10) {
|
10520 | return 500 === e2.size && e2.clear(), t10;
|
10521 | }), e2 = r2.cache;
|
10522 | return r2;
|
10523 | }(function(t9) {
|
10524 | var r2 = [];
|
10525 | return 46 === t9.charCodeAt(0) && r2.push(""), t9.replace(TI, function(t10, e2, n2, o2) {
|
10526 | r2.push(n2 ? o2.replace(RI, "$1") : e2 || t10);
|
10527 | }), r2;
|
10528 | }), NI = FI;
|
10529 | var MI = function(t9, r2) {
|
10530 | for (var e2 = -1, n2 = null == t9 ? 0 : t9.length, o2 = Array(n2); ++e2 < n2; )
|
10531 | o2[e2] = r2(t9[e2], e2, t9);
|
10532 | return o2;
|
10533 | }, DI = MI, UI = Dk, LI = t_, CI = $k ? $k.prototype : void 0, $I = CI ? CI.toString : void 0;
|
10534 | var BI = function t6(r2) {
|
10535 | if ("string" == typeof r2)
|
10536 | return r2;
|
10537 | if (UI(r2))
|
10538 | return DI(r2, t6) + "";
|
10539 | if (LI(r2))
|
10540 | return $I ? $I.call(r2) : "";
|
10541 | var e2 = r2 + "";
|
10542 | return "0" == e2 && 1 / r2 == -Infinity ? "-0" : e2;
|
10543 | }, qI = BI;
|
10544 | var GI = Dk, WI = i_, zI = NI, JI = function(t9) {
|
10545 | return null == t9 ? "" : qI(t9);
|
10546 | };
|
10547 | var HI = t_;
|
10548 | var VI = function(t9, r2) {
|
10549 | return GI(t9) ? t9 : WI(t9, r2) ? [t9] : zI(JI(t9));
|
10550 | }, YI = function(t9) {
|
10551 | if ("string" == typeof t9 || HI(t9))
|
10552 | return t9;
|
10553 | var r2 = t9 + "";
|
10554 | return "0" == r2 && 1 / t9 == -Infinity ? "-0" : r2;
|
10555 | };
|
10556 | var QI = function(t9, r2) {
|
10557 | for (var e2 = 0, n2 = (r2 = VI(r2, t9)).length; null != t9 && e2 < n2; )
|
10558 | t9 = t9[YI(r2[e2++])];
|
10559 | return e2 && e2 == n2 ? t9 : void 0;
|
10560 | }, KI = QI;
|
10561 | var XI = function(t9, r2, e2) {
|
10562 | var n2 = null == t9 ? void 0 : KI(t9, r2);
|
10563 | return void 0 === n2 ? e2 : n2;
|
10564 | };
|
10565 | function ZI() {
|
10566 | return ZI = Gy(Jy.mark(function t9(r2, e2) {
|
10567 | var n2, o2, i2, u2, a2, f2, c2, s2, l2, p2, v2, h2, d2 = arguments;
|
10568 | return Jy.wrap(function(t10) {
|
10569 | for (; ; )
|
10570 | switch (t10.prev = t10.next) {
|
10571 | case 0:
|
10572 | return n2 = d2.length > 2 && void 0 !== d2[2] ? d2[2] : {}, o2 = n2.returnEntireTree, i2 = n2.baseDoc, u2 = n2.requestInterceptor, a2 = n2.responseInterceptor, f2 = n2.parameterMacro, c2 = n2.modelPropertyMacro, s2 = n2.useCircularStructures, l2 = { pathDiscriminator: e2, baseDoc: i2, requestInterceptor: u2, responseInterceptor: a2, parameterMacro: f2, modelPropertyMacro: c2, useCircularStructures: s2 }, p2 = Fk({ spec: r2 }), v2 = p2.spec, t10.next = 6, Mk(Rc(Rc({}, l2), {}, { spec: v2, allowMetaPatches: true, skipNormalization: true }));
|
10573 | case 6:
|
10574 | return h2 = t10.sent, !o2 && Array.isArray(e2) && e2.length && (h2.spec = XI(h2.spec, e2) || null), t10.abrupt("return", h2);
|
10575 | case 9:
|
10576 | case "end":
|
10577 | return t10.stop();
|
10578 | }
|
10579 | }, t9);
|
10580 | })), ZI.apply(this, arguments);
|
10581 | }
|
10582 | var tT = function() {
|
10583 | return null;
|
10584 | }, rT = { mapTagOperations: function(t9) {
|
10585 | var r2 = t9.spec, e2 = t9.cb, n2 = void 0 === e2 ? tT : e2, o2 = t9.defaultTag, i2 = void 0 === o2 ? "default" : o2, u2 = t9.v2OperationIdCompatibilityMode, a2 = {}, f2 = {};
|
10586 | return Rk(r2, function(t10) {
|
10587 | var e3, o3 = t10.pathName, c2 = t10.method, s2 = t10.operation;
|
10588 | (s2.tags ? (e3 = s2.tags, Array.isArray(e3) ? e3 : [e3]) : [i2]).forEach(function(t11) {
|
10589 | if ("string" == typeof t11) {
|
10590 | f2[t11] = f2[t11] || {};
|
10591 | var e4, i3 = f2[t11], l2 = kk(s2, o3, c2, { v2OperationIdCompatibilityMode: u2 }), p2 = n2({ spec: r2, pathName: o3, method: c2, operation: s2, operationId: l2 });
|
10592 | if (a2[l2])
|
10593 | a2[l2] += 1, i3[rm(e4 = "".concat(l2)).call(e4, a2[l2])] = p2;
|
10594 | else if (void 0 !== i3[l2]) {
|
10595 | var v2, h2, d2 = a2[l2] || 1;
|
10596 | a2[l2] = d2 + 1, i3[rm(v2 = "".concat(l2)).call(v2, a2[l2])] = p2;
|
10597 | var y2 = i3[l2];
|
10598 | delete i3[l2], i3[rm(h2 = "".concat(l2)).call(h2, d2)] = y2;
|
10599 | } else
|
10600 | i3[l2] = p2;
|
10601 | }
|
10602 | });
|
10603 | }), f2;
|
10604 | }, makeExecute: function() {
|
10605 | var t9 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
10606 | return function(r2) {
|
10607 | var e2 = r2.pathName, n2 = r2.method, o2 = r2.operationId;
|
10608 | return function(r3) {
|
10609 | var i2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, u2 = t9.requestInterceptor, a2 = t9.responseInterceptor, f2 = t9.userFetch;
|
10610 | return t9.execute(Rc({ spec: t9.spec, requestInterceptor: u2, responseInterceptor: a2, userFetch: f2, pathName: e2, method: n2, parameters: r3, operationId: o2 }, i2));
|
10611 | };
|
10612 | };
|
10613 | } };
|
10614 | var eT = { exports: {} }, nT = ge, oT = De.indexOf, iT = qf, uT = openapi_parser_b([].indexOf), aT = !!uT && 1 / uT([1], 1, -0) < 0, fT = iT("indexOf");
|
10615 | nT({ target: "Array", proto: true, forced: aT || !fT }, { indexOf: function(t9) {
|
10616 | var r2 = arguments.length > 1 ? arguments[1] : void 0;
|
10617 | return aT ? uT(this, t9, r2) || 0 : oT(this, t9, r2);
|
10618 | } });
|
10619 | var cT = na("Array").indexOf, sT = tt, lT = cT, pT = Array.prototype;
|
10620 | const vT = openapi_parser_t(eT.exports = function(t9) {
|
10621 | var r2 = t9.indexOf;
|
10622 | return t9 === pT || sT(pT, t9) && r2 === pT.indexOf ? lT : r2;
|
10623 | });
|
10624 | function hT(t9, r2) {
|
10625 | if (null == t9)
|
10626 | return {};
|
10627 | var e2, n2, o2 = function(t10, r3) {
|
10628 | if (null == t10)
|
10629 | return {};
|
10630 | var e3, n3, o3 = {}, i3 = Ke(t10);
|
10631 | for (n3 = 0; n3 < i3.length; n3++)
|
10632 | e3 = i3[n3], vT(r3).call(r3, e3) >= 0 || (o3[e3] = t10[e3]);
|
10633 | return o3;
|
10634 | }(t9, r2);
|
10635 | if (Yu) {
|
10636 | var i2 = Yu(t9);
|
10637 | for (n2 = 0; n2 < i2.length; n2++)
|
10638 | e2 = i2[n2], vT(r2).call(r2, e2) >= 0 || Object.prototype.propertyIsEnumerable.call(t9, e2) && (o2[e2] = t9[e2]);
|
10639 | }
|
10640 | return o2;
|
10641 | }
|
10642 | var dT = {
|
10643 | parse: function(t9, r2) {
|
10644 | if ("string" != typeof t9)
|
10645 | throw new TypeError("argument str must be a string");
|
10646 | var e2 = {}, n2 = (r2 || {}).decode || mT, o2 = 0;
|
10647 | for (; o2 < t9.length; ) {
|
10648 | var i2 = t9.indexOf("=", o2);
|
10649 | if (-1 === i2)
|
10650 | break;
|
10651 | var u2 = t9.indexOf(";", o2);
|
10652 | if (-1 === u2)
|
10653 | u2 = t9.length;
|
10654 | else if (u2 < i2) {
|
10655 | o2 = t9.lastIndexOf(";", i2 - 1) + 1;
|
10656 | continue;
|
10657 | }
|
10658 | var a2 = t9.slice(o2, i2).trim();
|
10659 | if (void 0 === e2[a2]) {
|
10660 | var f2 = t9.slice(i2 + 1, u2).trim();
|
10661 | 34 === f2.charCodeAt(0) && (f2 = f2.slice(1, -1)), e2[a2] = wT(f2, n2);
|
10662 | }
|
10663 | o2 = u2 + 1;
|
10664 | }
|
10665 | return e2;
|
10666 | },
|
10667 | serialize: function(t9, r2, e2) {
|
10668 | var n2 = e2 || {}, o2 = n2.encode || gT;
|
10669 | if ("function" != typeof o2)
|
10670 | throw new TypeError("option encode is invalid");
|
10671 | if (!bT.test(t9))
|
10672 | throw new TypeError("argument name is invalid");
|
10673 | var i2 = o2(r2);
|
10674 | if (i2 && !bT.test(i2))
|
10675 | throw new TypeError("argument val is invalid");
|
10676 | var u2 = t9 + "=" + i2;
|
10677 | if (null != n2.maxAge) {
|
10678 | var a2 = n2.maxAge - 0;
|
10679 | if (isNaN(a2) || !isFinite(a2))
|
10680 | throw new TypeError("option maxAge is invalid");
|
10681 | u2 += "; Max-Age=" + Math.floor(a2);
|
10682 | }
|
10683 | if (n2.domain) {
|
10684 | if (!bT.test(n2.domain))
|
10685 | throw new TypeError("option domain is invalid");
|
10686 | u2 += "; Domain=" + n2.domain;
|
10687 | }
|
10688 | if (n2.path) {
|
10689 | if (!bT.test(n2.path))
|
10690 | throw new TypeError("option path is invalid");
|
10691 | u2 += "; Path=" + n2.path;
|
10692 | }
|
10693 | if (n2.expires) {
|
10694 | var f2 = n2.expires;
|
10695 | if (!function(t10) {
|
10696 | return "[object Date]" === yT.call(t10) || t10 instanceof Date;
|
10697 | }(f2) || isNaN(f2.valueOf()))
|
10698 | throw new TypeError("option expires is invalid");
|
10699 | u2 += "; Expires=" + f2.toUTCString();
|
10700 | }
|
10701 | n2.httpOnly && (u2 += "; HttpOnly");
|
10702 | n2.secure && (u2 += "; Secure");
|
10703 | if (n2.priority) {
|
10704 | switch ("string" == typeof n2.priority ? n2.priority.toLowerCase() : n2.priority) {
|
10705 | case "low":
|
10706 | u2 += "; Priority=Low";
|
10707 | break;
|
10708 | case "medium":
|
10709 | u2 += "; Priority=Medium";
|
10710 | break;
|
10711 | case "high":
|
10712 | u2 += "; Priority=High";
|
10713 | break;
|
10714 | default:
|
10715 | throw new TypeError("option priority is invalid");
|
10716 | }
|
10717 | }
|
10718 | if (n2.sameSite) {
|
10719 | switch ("string" == typeof n2.sameSite ? n2.sameSite.toLowerCase() : n2.sameSite) {
|
10720 | case true:
|
10721 | u2 += "; SameSite=Strict";
|
10722 | break;
|
10723 | case "lax":
|
10724 | u2 += "; SameSite=Lax";
|
10725 | break;
|
10726 | case "strict":
|
10727 | u2 += "; SameSite=Strict";
|
10728 | break;
|
10729 | case "none":
|
10730 | u2 += "; SameSite=None";
|
10731 | break;
|
10732 | default:
|
10733 | throw new TypeError("option sameSite is invalid");
|
10734 | }
|
10735 | }
|
10736 | return u2;
|
10737 | }
|
10738 | }, yT = Object.prototype.toString, bT = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
10739 | function mT(t9) {
|
10740 | return -1 !== t9.indexOf("%") ? decodeURIComponent(t9) : t9;
|
10741 | }
|
10742 | function gT(t9) {
|
10743 | return encodeURIComponent(t9);
|
10744 | }
|
10745 | function wT(t9, r2) {
|
10746 | try {
|
10747 | return r2(t9);
|
10748 | } catch (r3) {
|
10749 | return t9;
|
10750 | }
|
10751 | }
|
10752 |
|
10753 |
|
10754 |
|
10755 |
|
10756 |
|
10757 |
|
10758 | function jT(t9) {
|
10759 | return "[object Object]" === Object.prototype.toString.call(t9);
|
10760 | }
|
10761 | function OT(t9) {
|
10762 | var r2, e2;
|
10763 | return false !== jT(t9) && (void 0 === (r2 = t9.constructor) || false !== jT(e2 = r2.prototype) && false !== e2.hasOwnProperty("isPrototypeOf"));
|
10764 | }
|
10765 | const AT = { body: function(t9) {
|
10766 | var r2 = t9.req, e2 = t9.value;
|
10767 | r2.body = e2;
|
10768 | }, header: function(t9) {
|
10769 | var r2 = t9.req, e2 = t9.parameter, n2 = t9.value;
|
10770 | r2.headers = r2.headers || {}, void 0 !== n2 && (r2.headers[e2.name] = n2);
|
10771 | }, query: function(t9) {
|
10772 | var r2 = t9.req, e2 = t9.value, n2 = t9.parameter;
|
10773 | r2.query = r2.query || {}, false === e2 && "boolean" === n2.type && (e2 = "false");
|
10774 | 0 === e2 && ["number", "integer"].indexOf(n2.type) > -1 && (e2 = "0");
|
10775 | if (e2)
|
10776 | r2.query[n2.name] = { collectionFormat: n2.collectionFormat, value: e2 };
|
10777 | else if (n2.allowEmptyValue && void 0 !== e2) {
|
10778 | var o2 = n2.name;
|
10779 | r2.query[o2] = r2.query[o2] || {}, r2.query[o2].allowEmptyValue = true;
|
10780 | }
|
10781 | }, path: function(t9) {
|
10782 | var r2 = t9.req, e2 = t9.value, n2 = t9.parameter;
|
10783 | r2.url = r2.url.split("{".concat(n2.name, "}")).join(encodeURIComponent(e2));
|
10784 | }, formData: function(t9) {
|
10785 | var r2 = t9.req, e2 = t9.value, n2 = t9.parameter;
|
10786 | (e2 || n2.allowEmptyValue) && (r2.form = r2.form || {}, r2.form[n2.name] = { value: e2, allowEmptyValue: n2.allowEmptyValue, collectionFormat: n2.collectionFormat });
|
10787 | } };
|
10788 | function ST(t9, r2) {
|
10789 | return fb(r2).call(r2, "application/json") ? "string" == typeof t9 ? t9 : $b(t9) : t9.toString();
|
10790 | }
|
10791 | var xT = ["accept", "authorization", "content-type"];
|
10792 | const ET = Object.freeze(Object.defineProperty({ __proto__: null, path: function(t9) {
|
10793 | var r2 = t9.req, e2 = t9.value, n2 = t9.parameter, o2 = n2.name, i2 = n2.style, u2 = n2.explode, a2 = n2.content;
|
10794 | if (a2) {
|
10795 | var f2 = Yb(a2)[0];
|
10796 | r2.url = r2.url.split("{".concat(o2, "}")).join(YO(ST(e2, f2), { escape: true }));
|
10797 | } else {
|
10798 | var c2 = QO({ key: n2.name, value: e2, style: i2 || "simple", explode: u2 || false, escape: true });
|
10799 | r2.url = r2.url.split("{".concat(o2, "}")).join(c2);
|
10800 | }
|
10801 | }, query: function(t9) {
|
10802 | var r2 = t9.req, e2 = t9.value, n2 = t9.parameter;
|
10803 | if (r2.query = r2.query || {}, n2.content) {
|
10804 | var o2 = Yb(n2.content)[0];
|
10805 | r2.query[n2.name] = ST(e2, o2);
|
10806 | } else if (false === e2 && (e2 = "false"), 0 === e2 && (e2 = "0"), e2) {
|
10807 | var i2 = n2.style, u2 = n2.explode, a2 = n2.allowReserved;
|
10808 | r2.query[n2.name] = { value: e2, serializationOption: { style: i2, explode: u2, allowReserved: a2 } };
|
10809 | } else if (n2.allowEmptyValue && void 0 !== e2) {
|
10810 | var f2 = n2.name;
|
10811 | r2.query[f2] = r2.query[f2] || {}, r2.query[f2].allowEmptyValue = true;
|
10812 | }
|
10813 | }, header: function(t9) {
|
10814 | var r2 = t9.req, e2 = t9.parameter, n2 = t9.value;
|
10815 | if (r2.headers = r2.headers || {}, !(xT.indexOf(e2.name.toLowerCase()) > -1))
|
10816 | if (e2.content) {
|
10817 | var o2 = Yb(e2.content)[0];
|
10818 | r2.headers[e2.name] = ST(n2, o2);
|
10819 | } else
|
10820 | void 0 !== n2 && (r2.headers[e2.name] = QO({ key: e2.name, value: n2, style: e2.style || "simple", explode: void 0 !== e2.explode && e2.explode, escape: false }));
|
10821 | }, cookie: function(t9) {
|
10822 | var r2 = t9.req, e2 = t9.parameter, n2 = t9.value;
|
10823 | r2.headers = r2.headers || {};
|
10824 | var o2 = qp(n2);
|
10825 | if (e2.content) {
|
10826 | var i2, u2 = Yb(e2.content)[0];
|
10827 | r2.headers.Cookie = rm(i2 = "".concat(e2.name, "=")).call(i2, ST(n2, u2));
|
10828 | } else if ("undefined" !== o2) {
|
10829 | var a2 = "object" === o2 && !Array.isArray(n2) && e2.explode ? "" : "".concat(e2.name, "=");
|
10830 | r2.headers.Cookie = a2 + QO({ key: e2.name, value: n2, escape: false, style: e2.style || "form", explode: void 0 !== e2.explode && e2.explode });
|
10831 | }
|
10832 | } }, Symbol.toStringTag, { value: "Module" }));
|
10833 | var PT = { exports: {} };
|
10834 | ge({ global: true }, { globalThis: openapi_parser_o });
|
10835 | var kT = { exports: {} };
|
10836 | const _T = openapi_parser_t(PT.exports = kT.exports = openapi_parser_o);
|
10837 | var IT = (void 0 !== _T ? _T : "undefined" != typeof self ? self : window).btoa;
|
10838 | function TT(t9, r2) {
|
10839 | var e2 = t9.operation, n2 = t9.requestBody, o2 = t9.securities, i2 = t9.spec, u2 = t9.attachContentTypeForEmptyPayload, a2 = t9.requestContentType;
|
10840 | r2 = function(t10) {
|
10841 | var r3 = t10.request, e3 = t10.securities, n3 = void 0 === e3 ? {} : e3, o3 = t10.operation, i3 = void 0 === o3 ? {} : o3, u3 = t10.spec, a3 = Rc({}, r3), f3 = n3.authorized, c3 = void 0 === f3 ? {} : f3, s3 = i3.security || u3.security || [], l3 = c3 && !!Yb(c3).length, p3 = XI(u3, ["components", "securitySchemes"]) || {};
|
10842 | if (a3.headers = a3.headers || {}, a3.query = a3.query || {}, !Yb(n3).length || !l3 || !s3 || Array.isArray(i3.security) && !i3.security.length)
|
10843 | return r3;
|
10844 | return s3.forEach(function(t11) {
|
10845 | Yb(t11).forEach(function(t12) {
|
10846 | var r4 = c3[t12], e4 = p3[t12];
|
10847 | if (r4) {
|
10848 | var n4 = r4.value || r4, o4 = e4.type;
|
10849 | if (r4) {
|
10850 | if ("apiKey" === o4)
|
10851 | "query" === e4.in && (a3.query[e4.name] = n4), "header" === e4.in && (a3.headers[e4.name] = n4), "cookie" === e4.in && (a3.cookies[e4.name] = n4);
|
10852 | else if ("http" === o4) {
|
10853 | if (/^basic$/i.test(e4.scheme)) {
|
10854 | var i4, u4 = n4.username || "", f4 = n4.password || "", s4 = IT(rm(i4 = "".concat(u4, ":")).call(i4, f4));
|
10855 | a3.headers.Authorization = "Basic ".concat(s4);
|
10856 | }
|
10857 | /^bearer$/i.test(e4.scheme) && (a3.headers.Authorization = "Bearer ".concat(n4));
|
10858 | } else if ("oauth2" === o4 || "openIdConnect" === o4) {
|
10859 | var l4, v3 = r4.token || {}, h3 = v3[e4["x-tokenName"] || "access_token"], d2 = v3.token_type;
|
10860 | d2 && "bearer" !== d2.toLowerCase() || (d2 = "Bearer"), a3.headers.Authorization = rm(l4 = "".concat(d2, " ")).call(l4, h3);
|
10861 | }
|
10862 | }
|
10863 | }
|
10864 | });
|
10865 | }), a3;
|
10866 | }({ request: r2, securities: o2, operation: e2, spec: i2 });
|
10867 | var f2 = e2.requestBody || {}, c2 = Yb(f2.content || {}), s2 = a2 && c2.indexOf(a2) > -1;
|
10868 | if (n2 || u2) {
|
10869 | if (a2 && s2)
|
10870 | r2.headers["Content-Type"] = a2;
|
10871 | else if (!a2) {
|
10872 | var l2 = c2[0];
|
10873 | l2 && (r2.headers["Content-Type"] = l2, a2 = l2);
|
10874 | }
|
10875 | } else
|
10876 | a2 && s2 && (r2.headers["Content-Type"] = a2);
|
10877 | if (!t9.responseContentType && e2.responses) {
|
10878 | var p2, v2 = hm(p2 = pm(e2.responses)).call(p2, function(t10) {
|
10879 | var r3 = Gp(t10, 2), e3 = r3[0], n3 = r3[1], o3 = parseInt(e3, 10);
|
10880 | return o3 >= 200 && o3 < 300 && OT(n3.content);
|
10881 | }).reduce(function(t10, r3) {
|
10882 | var e3 = Gp(r3, 2)[1];
|
10883 | return rm(t10).call(t10, Yb(e3.content));
|
10884 | }, []);
|
10885 | v2.length > 0 && (r2.headers.accept = v2.join(", "));
|
10886 | }
|
10887 | if (n2)
|
10888 | if (a2) {
|
10889 | if (c2.indexOf(a2) > -1)
|
10890 | if ("application/x-www-form-urlencoded" === a2 || "multipart/form-data" === a2)
|
10891 | if ("object" === qp(n2)) {
|
10892 | var h2 = (f2.content[a2] || {}).encoding || {};
|
10893 | r2.form = {}, Yb(n2).forEach(function(t10) {
|
10894 | r2.form[t10] = { value: n2[t10], encoding: h2[t10] || {} };
|
10895 | });
|
10896 | } else
|
10897 | r2.form = n2;
|
10898 | else
|
10899 | r2.body = n2;
|
10900 | } else
|
10901 | r2.body = n2;
|
10902 | return r2;
|
10903 | }
|
10904 | function RT(t9, r2) {
|
10905 | var e2, n2, o2 = t9.spec, i2 = t9.operation, u2 = t9.securities, a2 = t9.requestContentType, f2 = t9.responseContentType, c2 = t9.attachContentTypeForEmptyPayload;
|
10906 | if (r2 = function(t10) {
|
10907 | var r3 = t10.request, e3 = t10.securities, n3 = void 0 === e3 ? {} : e3, o3 = t10.operation, i3 = void 0 === o3 ? {} : o3, u3 = t10.spec, a3 = Rc({}, r3), f3 = n3.authorized, c3 = void 0 === f3 ? {} : f3, s3 = n3.specSecurity, l3 = void 0 === s3 ? [] : s3, p3 = i3.security || l3, v3 = c3 && !!Yb(c3).length, h3 = u3.securityDefinitions;
|
10908 | if (a3.headers = a3.headers || {}, a3.query = a3.query || {}, !Yb(n3).length || !v3 || !p3 || Array.isArray(i3.security) && !i3.security.length)
|
10909 | return r3;
|
10910 | return p3.forEach(function(t11) {
|
10911 | Yb(t11).forEach(function(t12) {
|
10912 | var r4 = c3[t12];
|
10913 | if (r4) {
|
10914 | var e4 = r4.token, n4 = r4.value || r4, o4 = h3[t12], i4 = o4.type, u4 = o4["x-tokenName"] || "access_token", f4 = e4 && e4[u4], s4 = e4 && e4.token_type;
|
10915 | if (r4) {
|
10916 | if ("apiKey" === i4) {
|
10917 | var l4 = "query" === o4.in ? "query" : "headers";
|
10918 | a3[l4] = a3[l4] || {}, a3[l4][o4.name] = n4;
|
10919 | } else if ("basic" === i4)
|
10920 | if (n4.header)
|
10921 | a3.headers.authorization = n4.header;
|
10922 | else {
|
10923 | var p4, v4 = n4.username || "", d3 = n4.password || "";
|
10924 | n4.base64 = IT(rm(p4 = "".concat(v4, ":")).call(p4, d3)), a3.headers.authorization = "Basic ".concat(n4.base64);
|
10925 | }
|
10926 | else if ("oauth2" === i4 && f4) {
|
10927 | var y2;
|
10928 | s4 = s4 && "bearer" !== s4.toLowerCase() ? s4 : "Bearer", a3.headers.authorization = rm(y2 = "".concat(s4, " ")).call(y2, f4);
|
10929 | }
|
10930 | }
|
10931 | }
|
10932 | });
|
10933 | }), a3;
|
10934 | }({ request: r2, securities: u2, operation: i2, spec: o2 }), r2.body || r2.form || c2)
|
10935 | if (a2)
|
10936 | r2.headers["Content-Type"] = a2;
|
10937 | else if (Array.isArray(i2.consumes)) {
|
10938 | var s2 = Gp(i2.consumes, 1);
|
10939 | r2.headers["Content-Type"] = s2[0];
|
10940 | } else if (Array.isArray(o2.consumes)) {
|
10941 | var l2 = Gp(o2.consumes, 1);
|
10942 | r2.headers["Content-Type"] = l2[0];
|
10943 | } else
|
10944 | i2.parameters && hm(e2 = i2.parameters).call(e2, function(t10) {
|
10945 | return "file" === t10.type;
|
10946 | }).length ? r2.headers["Content-Type"] = "multipart/form-data" : i2.parameters && hm(n2 = i2.parameters).call(n2, function(t10) {
|
10947 | return "formData" === t10.in;
|
10948 | }).length && (r2.headers["Content-Type"] = "application/x-www-form-urlencoded");
|
10949 | else if (a2) {
|
10950 | var p2, v2, h2 = i2.parameters && hm(p2 = i2.parameters).call(p2, function(t10) {
|
10951 | return "body" === t10.in;
|
10952 | }).length > 0, d2 = i2.parameters && hm(v2 = i2.parameters).call(v2, function(t10) {
|
10953 | return "formData" === t10.in;
|
10954 | }).length > 0;
|
10955 | (h2 || d2) && (r2.headers["Content-Type"] = a2);
|
10956 | }
|
10957 | return !f2 && Array.isArray(i2.produces) && i2.produces.length > 0 && (r2.headers.accept = i2.produces.join(", ")), r2;
|
10958 | }
|
10959 | var FT = ["http", "fetch", "spec", "operationId", "pathName", "method", "parameters", "securities"], NT = function(t9) {
|
10960 | return Array.isArray(t9) ? t9 : [];
|
10961 | }, MT = DP("OperationNotFoundError", function(t9, r2, e2) {
|
10962 | this.originalError = e2, Yc(this, r2 || {});
|
10963 | }), DT = { buildRequest: UT };
|
10964 | function UT(t9) {
|
10965 | var r2, e2, n2 = t9.spec, o2 = t9.operationId, i2 = t9.responseContentType, u2 = t9.scheme, a2 = t9.requestInterceptor, f2 = t9.responseInterceptor, c2 = t9.contextUrl, s2 = t9.userFetch, l2 = t9.server, p2 = t9.serverVariables, v2 = t9.http, h2 = t9.signal, d2 = t9.parameters, y2 = t9.parameterBuilders, b2 = Pk(n2);
|
10966 | y2 || (y2 = b2 ? ET : AT);
|
10967 | var m2 = { url: "", credentials: v2 && v2.withCredentials ? "include" : "same-origin", headers: {}, cookies: {} };
|
10968 | h2 && (m2.signal = h2), a2 && (m2.requestInterceptor = a2), f2 && (m2.responseInterceptor = f2), s2 && (m2.userFetch = s2);
|
10969 | var g2 = Tk(n2, o2);
|
10970 | if (!g2)
|
10971 | throw new MT("Operation ".concat(o2, " not found"));
|
10972 | var w2 = g2.operation, j2 = void 0 === w2 ? {} : w2, O2 = g2.method, A2 = g2.pathName;
|
10973 | if (m2.url += CT({ spec: n2, scheme: u2, contextUrl: c2, server: l2, serverVariables: p2, pathName: A2, method: O2 }), !o2)
|
10974 | return delete m2.cookies, m2;
|
10975 | m2.url += A2, m2.method = "".concat(O2).toUpperCase(), d2 = d2 || {};
|
10976 | var S2 = n2.paths[A2] || {};
|
10977 | i2 && (m2.headers.accept = i2);
|
10978 | var x2 = function(t10) {
|
10979 | var r3 = {};
|
10980 | t10.forEach(function(t11) {
|
10981 | r3[t11.in] || (r3[t11.in] = {}), r3[t11.in][t11.name] = t11;
|
10982 | });
|
10983 | var e3 = [];
|
10984 | return Yb(r3).forEach(function(t11) {
|
10985 | Yb(r3[t11]).forEach(function(n3) {
|
10986 | e3.push(r3[t11][n3]);
|
10987 | });
|
10988 | }), e3;
|
10989 | }(rm(r2 = rm(e2 = []).call(e2, NT(j2.parameters))).call(r2, NT(S2.parameters)));
|
10990 | x2.forEach(function(t10) {
|
10991 | var r3, e3, o3 = y2[t10.in];
|
10992 | if ("body" === t10.in && t10.schema && t10.schema.properties && (r3 = d2), void 0 === (r3 = t10 && t10.name && d2[t10.name]))
|
10993 | r3 = t10 && t10.name && d2[rm(e3 = "".concat(t10.in, ".")).call(e3, t10.name)];
|
10994 | else if (function(t11, r4) {
|
10995 | return hm(r4).call(r4, function(r5) {
|
10996 | return r5.name === t11;
|
10997 | });
|
10998 | }(t10.name, x2).length > 1) {
|
10999 | var i3;
|
11000 | console.warn(rm(i3 = "Parameter '".concat(t10.name, "' is ambiguous because the defined spec has more than one parameter with the name: '")).call(i3, t10.name, "' and the passed-in parameter values did not define an 'in' value."));
|
11001 | }
|
11002 | if (null !== r3) {
|
11003 | if (void 0 !== t10.default && void 0 === r3 && (r3 = t10.default), void 0 === r3 && t10.required && !t10.allowEmptyValue)
|
11004 | throw new Error("Required parameter ".concat(t10.name, " is not provided"));
|
11005 | if (b2 && t10.schema && "object" === t10.schema.type && "string" == typeof r3)
|
11006 | try {
|
11007 | r3 = JSON.parse(r3);
|
11008 | } catch (t11) {
|
11009 | throw new Error("Could not parse object parameter value string as JSON");
|
11010 | }
|
11011 | o3 && o3({ req: m2, parameter: t10, value: r3, operation: j2, spec: n2 });
|
11012 | }
|
11013 | });
|
11014 | var E2 = Rc(Rc({}, t9), {}, { operation: j2 });
|
11015 | if ((m2 = b2 ? TT(E2, m2) : RT(E2, m2)).cookies && Yb(m2.cookies).length) {
|
11016 | var P2 = Yb(m2.cookies).reduce(function(t10, r3) {
|
11017 | var e3 = m2.cookies[r3];
|
11018 | return t10 + (t10 ? "&" : "") + dT.serialize(r3, e3);
|
11019 | }, "");
|
11020 | m2.headers.Cookie = P2;
|
11021 | }
|
11022 | return m2.cookies && delete m2.cookies, hA(m2), m2;
|
11023 | }
|
11024 | var LT = function(t9) {
|
11025 | return t9 ? t9.replace(/\W/g, "") : null;
|
11026 | };
|
11027 | function CT(t9) {
|
11028 | return Pk(t9.spec) ? function(t10) {
|
11029 | var r2 = t10.spec, e2 = t10.pathName, n2 = t10.method, o2 = t10.server, i2 = t10.contextUrl, u2 = t10.serverVariables, a2 = void 0 === u2 ? {} : u2, f2 = XI(r2, ["paths", e2, (n2 || "").toLowerCase(), "servers"]) || XI(r2, ["paths", e2, "servers"]) || XI(r2, ["servers"]), c2 = "", s2 = null;
|
11030 | if (o2 && f2 && f2.length) {
|
11031 | var l2 = Hb(f2).call(f2, function(t11) {
|
11032 | return t11.url;
|
11033 | });
|
11034 | l2.indexOf(o2) > -1 && (c2 = o2, s2 = f2[l2.indexOf(o2)]);
|
11035 | }
|
11036 | if (!c2 && f2 && f2.length) {
|
11037 | c2 = f2[0].url;
|
11038 | var p2 = Gp(f2, 1);
|
11039 | s2 = p2[0];
|
11040 | }
|
11041 | if (c2.indexOf("{") > -1) {
|
11042 | var v2 = function(t11) {
|
11043 | var r3, e3 = [], n3 = /{([^}]+)}/g;
|
11044 | for (; r3 = n3.exec(t11); )
|
11045 | e3.push(r3[1]);
|
11046 | return e3;
|
11047 | }(c2);
|
11048 | v2.forEach(function(t11) {
|
11049 | if (s2.variables && s2.variables[t11]) {
|
11050 | var r3 = s2.variables[t11], e3 = a2[t11] || r3.default, n3 = new RegExp("{".concat(t11, "}"), "g");
|
11051 | c2 = c2.replace(n3, e3);
|
11052 | }
|
11053 | });
|
11054 | }
|
11055 | return function() {
|
11056 | var t11, r3, e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "", n3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "", o3 = e3 && n3 ? ws.parse(ws.resolve(n3, e3)) : ws.parse(e3), i3 = ws.parse(n3), u3 = LT(o3.protocol) || LT(i3.protocol) || "", a3 = o3.host || i3.host, f3 = o3.pathname || "";
|
11057 | t11 = u3 && a3 ? rm(r3 = "".concat(u3, "://")).call(r3, a3 + f3) : f3;
|
11058 | return "/" === t11[t11.length - 1] ? JO(t11).call(t11, 0, -1) : t11;
|
11059 | }(c2, i2);
|
11060 | }(t9) : function(t10) {
|
11061 | var r2, e2, n2 = t10.spec, o2 = t10.scheme, i2 = t10.contextUrl, u2 = void 0 === i2 ? "" : i2, a2 = ws.parse(u2), f2 = Array.isArray(n2.schemes) ? n2.schemes[0] : null, c2 = o2 || f2 || LT(a2.protocol) || "http", s2 = n2.host || a2.host || "", l2 = n2.basePath || "";
|
11062 | r2 = c2 && s2 ? rm(e2 = "".concat(c2, "://")).call(e2, s2 + l2) : l2;
|
11063 | return "/" === r2[r2.length - 1] ? JO(r2).call(r2, 0, -1) : r2;
|
11064 | }(t9);
|
11065 | }
|
11066 | function $T(t9) {
|
11067 | var r2 = this, e2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
11068 | if ("string" == typeof t9 ? e2.url = t9 : e2 = t9, !(this instanceof $T))
|
11069 | return new $T(e2);
|
11070 | Yc(this, e2);
|
11071 | var n2 = this.resolve().then(function() {
|
11072 | return r2.disableInterfaces || Yc(r2, $T.makeApisTagOperation(r2)), r2;
|
11073 | });
|
11074 | return n2.client = this, n2;
|
11075 | }
|
11076 | $T.http = ZO, $T.makeHttp = function(t9, r2, e2) {
|
11077 | return e2 = e2 || function(t10) {
|
11078 | return t10;
|
11079 | }, r2 = r2 || function(t10) {
|
11080 | return t10;
|
11081 | }, function(n2) {
|
11082 | return "string" == typeof n2 && (n2 = { url: n2 }), XO.mergeInQueryOrForm(n2), n2 = r2(n2), e2(t9(n2));
|
11083 | };
|
11084 | }.bind(null, $T.http), $T.resolve = Mk, $T.resolveSubtree = function(t9, r2) {
|
11085 | return ZI.apply(this, arguments);
|
11086 | }, $T.execute = function(t9) {
|
11087 | var r2 = t9.http, e2 = t9.fetch, n2 = t9.spec, o2 = t9.operationId, i2 = t9.pathName, u2 = t9.method, a2 = t9.parameters, f2 = t9.securities, c2 = hT(t9, FT), s2 = r2 || e2 || ZO;
|
11088 | i2 && u2 && !o2 && (o2 = Ik(i2, u2));
|
11089 | var l2 = DT.buildRequest(Rc({ spec: n2, operationId: o2, parameters: a2, securities: f2, http: s2 }, c2));
|
11090 | return l2.body && (OT(l2.body) || Array.isArray(l2.body)) && (l2.body = $b(l2.body)), s2(l2);
|
11091 | }, $T.serializeRes = nA, $T.serializeHeaders = iA, $T.clearCache = function() {
|
11092 | Sk.refs.clearCache();
|
11093 | }, $T.makeApisTagOperation = function() {
|
11094 | var t9 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, r2 = rT.makeExecute(t9);
|
11095 | return { apis: rT.mapTagOperations({ v2OperationIdCompatibilityMode: t9.v2OperationIdCompatibilityMode, spec: t9.spec, cb: r2 }) };
|
11096 | }, $T.buildRequest = UT, $T.helpers = { opId: kk }, $T.getBaseUrl = CT, $T.prototype = { http: ZO, execute: function(t9) {
|
11097 | return this.applyDefaults(), $T.execute(Rc({ spec: this.spec, http: this.http, securities: { authorized: this.authorizations }, contextUrl: "string" == typeof this.url ? this.url : void 0, requestInterceptor: this.requestInterceptor || null, responseInterceptor: this.responseInterceptor || null }, t9));
|
11098 | }, resolve: function() {
|
11099 | var t9 = this, r2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
11100 | return $T.resolve(Rc({ spec: this.spec, url: this.url, http: this.http || this.fetch, allowMetaPatches: this.allowMetaPatches, useCircularStructures: this.useCircularStructures, requestInterceptor: this.requestInterceptor || null, responseInterceptor: this.responseInterceptor || null, skipNormalization: this.skipNormalization || false }, r2)).then(function(r3) {
|
11101 | return t9.originalSpec = t9.spec, t9.spec = r3.spec, t9.errors = r3.errors, t9;
|
11102 | });
|
11103 | } }, $T.prototype.applyDefaults = function() {
|
11104 | var t9 = this.spec, r2 = this.url;
|
11105 | if (r2 && gs(r2).call(r2, "http")) {
|
11106 | var e2 = ws.parse(r2);
|
11107 | t9.host || (t9.host = e2.host), t9.schemes || (t9.schemes = [e2.protocol.replace(":", "")]), t9.basePath || (t9.basePath = "/");
|
11108 | }
|
11109 | }, $T.helpers;
|
11110 | function BT(t9) {
|
11111 | const r2 = (t9 = t9.replace("[]", "Array")).split("/");
|
11112 | return r2[0] = r2[0].replace(/[^A-Za-z0-9_\-\.]+|\s+/gm, "_"), r2.join("/");
|
11113 | }
|
11114 | const qT = { parameterTypeProperties: ["format", "minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum", "minLength", "maxLength", "multipleOf", "minItems", "maxItems", "uniqueItems", "minProperties", "maxProperties", "additionalProperties", "pattern", "enum", "default"], arrayProperties: ["items", "minItems", "maxItems", "uniqueItems"], httpMethods: ["get", "post", "put", "delete", "patch", "head", "options", "trace"], uniqueOnly: function(t9, r2, e2) {
|
11115 | return e2.indexOf(t9) === r2;
|
11116 | }, createHash: function(t9) {
|
11117 | let r2, e2 = 0;
|
11118 | if (0 === t9.length)
|
11119 | return e2;
|
11120 | for (let n2 = 0; n2 < t9.length; n2++)
|
11121 | r2 = t9.charCodeAt(n2), e2 = (e2 << 5) - e2 + r2, e2 |= 0;
|
11122 | return e2;
|
11123 | }, sanitise: BT, sanitiseAll: function(t9) {
|
11124 | return BT(t9.split("/").join("_"));
|
11125 | }, camelize: function(t9) {
|
11126 | return t9.toLowerCase().replace(/[-_ \/\.](.)/g, (t10, r2) => r2.toUpperCase());
|
11127 | }, clone: function(t9) {
|
11128 | return JSON.parse(JSON.stringify(t9));
|
11129 | }, circularClone: function t7(r2, e2 = null) {
|
11130 | if (e2 || (e2 = new WeakMap()), Object(r2) !== r2 || r2 instanceof Function)
|
11131 | return r2;
|
11132 | if (e2.has(r2))
|
11133 | return e2.get(r2);
|
11134 | let n2;
|
11135 | try {
|
11136 | n2 = new r2.constructor();
|
11137 | } catch (t9) {
|
11138 | n2 = Object.create(Object.getPrototypeOf(r2));
|
11139 | }
|
11140 | return e2.set(r2, n2), Object.assign(n2, ...Object.keys(r2).map((n3) => ({ [n3]: t7(r2[n3], e2) })));
|
11141 | } };
|
11142 | function GT() {
|
11143 | return { depth: 0, seen: new WeakMap(), top: true, combine: false, allowRefSiblings: false };
|
11144 | }
|
11145 | const WT = { getDefaultState: GT, walkSchema: function t8(r2, e2, n2, o2) {
|
11146 | if (void 0 === n2.depth && (n2 = GT()), null == r2)
|
11147 | return r2;
|
11148 | if (n2.combine && (r2.allOf && Array.isArray(r2.allOf) && 1 === r2.allOf.length && delete (r2 = { ...r2.allOf[0], ...r2 })?.allOf, r2?.anyOf && Array.isArray(r2.anyOf) && 1 === r2.anyOf.length && delete (r2 = { ...r2.anyOf[0], ...r2 })?.anyOf, r2?.oneOf && Array.isArray(r2.oneOf) && 1 === r2.oneOf.length && delete (r2 = { ...r2.oneOf[0], ...r2 })?.oneOf), o2(r2, e2, n2), n2.seen.has(r2))
|
11149 | return r2;
|
11150 | if ("object" == typeof r2 && null !== r2 && n2.seen.set(r2, true), n2.top = false, n2.depth++, void 0 !== r2?.items && (n2.property = "items", t8(r2.items, r2, n2, o2)), r2?.additionalItems && "object" == typeof r2.additionalItems && (n2.property = "additionalItems", t8(r2.additionalItems, r2, n2, o2)), r2?.additionalProperties && "object" == typeof r2.additionalProperties && (n2.property = "additionalProperties", t8(r2.additionalProperties, r2, n2, o2)), r2?.properties)
|
11151 | for (const e3 in r2.properties) {
|
11152 | const i2 = r2.properties[e3];
|
11153 | n2.property = `properties/${e3}`, t8(i2, r2, n2, o2);
|
11154 | }
|
11155 | if (r2?.patternProperties)
|
11156 | for (const e3 in r2.patternProperties) {
|
11157 | const i2 = r2.patternProperties[e3];
|
11158 | n2.property = `patternProperties/${e3}`, t8(i2, r2, n2, o2);
|
11159 | }
|
11160 | if (r2?.allOf)
|
11161 | for (const e3 in r2.allOf) {
|
11162 | const i2 = r2.allOf[e3];
|
11163 | n2.property = `allOf/${e3}`, t8(i2, r2, n2, o2);
|
11164 | }
|
11165 | if (r2?.anyOf)
|
11166 | for (const e3 in r2.anyOf) {
|
11167 | const i2 = r2.anyOf[e3];
|
11168 | n2.property = `anyOf/${e3}`, t8(i2, r2, n2, o2);
|
11169 | }
|
11170 | if (r2?.oneOf)
|
11171 | for (const e3 in r2.oneOf) {
|
11172 | const i2 = r2.oneOf[e3];
|
11173 | n2.property = `oneOf/${e3}`, t8(i2, r2, n2, o2);
|
11174 | }
|
11175 | return r2?.not && (n2.property = "not", t8(r2.not, r2, n2, o2)), n2.depth--, r2;
|
11176 | } };
|
11177 | function zT(t9, r2, e2) {
|
11178 | if (r2 || (r2 = { depth: 0 }), r2.depth || (r2 = { path: "#", depth: 0, pkey: "", parent: {}, payload: {}, seen: new WeakMap(), identity: false, identityDetection: false, ...r2 }), "object" != typeof t9)
|
11179 | return;
|
11180 | const n2 = r2.path;
|
11181 | for (const o2 in t9) {
|
11182 | if (r2.key = o2, r2.path = `${r2.path}/${encodeURIComponent(o2)}`, r2.identityPath = r2.seen.get(t9[o2]), r2.identity = void 0 !== r2.identityPath, t9.hasOwnProperty(o2) && e2(t9, o2, r2), "object" == typeof t9[o2] && !r2.identity) {
|
11183 | r2.identityDetection && !Array.isArray(t9[o2]) && null !== t9[o2] && r2.seen.set(t9[o2], r2.path);
|
11184 | const n3 = {};
|
11185 | n3.parent = t9, n3.path = r2.path, n3.depth = r2.depth ? r2.depth + 1 : 1, n3.pkey = o2, n3.payload = r2.payload, n3.seen = r2.seen, n3.identity = false, n3.identityDetection = r2.identityDetection, zT(t9[o2], n3, e2);
|
11186 | }
|
11187 | r2.path = n2;
|
11188 | }
|
11189 | }
|
11190 | let JT;
|
11191 | function HT(t9, r2) {
|
11192 | for (const e2 in t9)
|
11193 | e2.startsWith("x-") && !e2.startsWith("x-s2o") && (r2[e2] = t9[e2]);
|
11194 | }
|
11195 | function VT(t9, r2) {
|
11196 | WT.walkSchema(t9, {}, {}, (t10, e2) => {
|
11197 | !function(t11) {
|
11198 | if (t11["x-required"] && Array.isArray(t11["x-required"]) && (t11.required || (t11.required = []), t11.required = t11.required.concat(t11["x-required"]), delete t11["x-required"]), t11["x-anyOf"] && (t11.anyOf = t11["x-anyOf"], delete t11["x-anyOf"]), t11["x-oneOf"] && (t11.oneOf = t11["x-oneOf"], delete t11["x-oneOf"]), t11["x-not"] && (t11.not = t11["x-not"], delete t11["x-not"]), "boolean" == typeof t11["x-nullable"] && (t11.nullable = t11["x-nullable"], delete t11["x-nullable"]), "object" == typeof t11["x-discriminator"] && "string" == typeof t11["x-discriminator"].propertyName) {
|
11199 | t11.discriminator = t11["x-discriminator"], delete t11["x-discriminator"];
|
11200 | for (const r3 in t11.discriminator.mapping) {
|
11201 | const e3 = t11.discriminator.mapping[r3];
|
11202 | e3.startsWith("#/definitions/") && (t11.discriminator.mapping[r3] = e3.replace("#/definitions/", "#/components/schemas/"));
|
11203 | }
|
11204 | }
|
11205 | }(t10), function(t11, r3, e3) {
|
11206 | if (t11.nullable && e3.patches++, t11.discriminator && "string" == typeof t11.discriminator && (t11.discriminator = { propertyName: t11.discriminator }), t11.items && Array.isArray(t11.items) && (0 === t11.items.length ? t11.items = {} : 1 === t11.items.length ? t11.items = t11.items[0] : t11.items = { anyOf: t11.items }), t11.type && Array.isArray(t11.type)) {
|
11207 | if (e3.patches++, e3.warnings.push("(Patchable) schema type must not be an array"), 0 === t11.type.length)
|
11208 | delete t11.type;
|
11209 | else {
|
11210 | t11.oneOf || (t11.oneOf = []);
|
11211 | for (const r4 of t11.type) {
|
11212 | const e4 = {};
|
11213 | if ("null" === r4)
|
11214 | t11.nullable = true;
|
11215 | else {
|
11216 | e4.type = r4;
|
11217 | for (const r5 of qT.arrayProperties)
|
11218 | void 0 !== t11.prop && (e4[r5] = t11[r5], delete t11[r5]);
|
11219 | }
|
11220 | e4.type && t11.oneOf.push(e4);
|
11221 | }
|
11222 | delete t11.type, 0 === t11.oneOf.length ? delete t11.oneOf : t11.oneOf.length < 2 && (t11.type = t11.oneOf[0].type, Object.keys(t11.oneOf[0]).length > 1 && (e3.patches++, e3.warnings.push("Lost properties from oneOf")), delete t11.oneOf);
|
11223 | }
|
11224 | t11.type && Array.isArray(t11.type) && 1 === t11.type.length && (t11.type = t11.type[0]);
|
11225 | }
|
11226 | t11.type && "null" === t11.type && (delete t11.type, t11.nullable = true), "array" !== t11.type || t11.items || (t11.items = {}), "file" === t11.type && (t11.type = "string", t11.format = "binary"), "boolean" == typeof t11.required && (t11.required && t11.name && (void 0 === r3.required && (r3.required = []), Array.isArray(r3.required) && r3.required.push(t11.name)), delete t11.required), t11.xml && "string" == typeof t11.xml.namespace && (t11.xml.namespace || delete t11.xml.namespace), t11.allowEmptyValue && (delete t11.allowEmptyValue, e3.patches++, e3.warnings.push("(Patchable): deleted schema.allowEmptyValue"));
|
11227 | }(t10, e2, r2);
|
11228 | });
|
11229 | }
|
11230 | function YT(t9) {
|
11231 | for (const r2 in t9)
|
11232 | for (const e2 in t9[r2]) {
|
11233 | const n2 = qT.sanitise(e2);
|
11234 | e2 !== n2 && (t9[r2][n2] = t9[r2][e2], delete t9[r2][e2]);
|
11235 | }
|
11236 | }
|
11237 | function QT(t9, r2) {
|
11238 | if ("basic" === t9.type && (t9.type = "http", t9.scheme = "basic"), "oauth2" === t9.type) {
|
11239 | const e2 = {};
|
11240 | let n2 = t9.flow;
|
11241 | "application" === t9.flow && (n2 = "clientCredentials"), "accessCode" === t9.flow && (n2 = "authorizationCode"), "string" == typeof t9.authorizationUrl && (e2.authorizationUrl = t9.authorizationUrl.split("?")[0].trim() || "/"), "string" == typeof t9.tokenUrl && (e2.tokenUrl = t9.tokenUrl.split("?")[0].trim() || "/"), e2.scopes = t9.scopes || {}, t9.flows = {}, t9.flows[n2] = e2, delete t9.flow, delete t9.authorizationUrl, delete t9.tokenUrl, delete t9.scopes, t9.name && (delete t9.name, r2.patches++, r2.warnings.push("(Patchable) oauth2 securitySchemes should not have name property"));
|
11242 | }
|
11243 | }
|
11244 | function KT(t9) {
|
11245 | return t9 && !t9["x-s2o-delete"];
|
11246 | }
|
11247 | function XT(t9, r2) {
|
11248 | if (t9.type && !t9.schema && (t9.schema = {}), t9.type && (t9.schema.type = t9.type), t9.items && "array" !== t9.items.type) {
|
11249 | if (t9.items.collectionFormat !== t9.collectionFormat)
|
11250 | return r2.errCount++, void r2.errors.push({ message: "Nested collectionFormats are not supported", pointer: "/.../responses/header" });
|
11251 | delete t9.items.collectionFormat;
|
11252 | }
|
11253 | "array" === t9.type ? ("ssv" === t9.collectionFormat ? (r2.patches++, r2.warnings.push("collectionFormat:ssv is no longer supported for headers")) : "pipes" === t9.collectionFormat ? (r2.patches++, r2.warnings.push("collectionFormat:pipes is no longer supported for headers")) : "multi" === t9.collectionFormat ? t9.explode = true : "tsv" === t9.collectionFormat ? (t9["x-collectionFormat"] = "tsv", r2.patches++, r2.warnings.push("collectionFormat:tsv is no longer supported")) : t9.style = "simple", delete t9.collectionFormat) : t9.collectionFormat && (delete t9.collectionFormat, r2.patches++, r2.warnings.push("(Patchable) collectionFormat is only applicable to header.type array")), delete t9.type;
|
11254 | for (const r3 of qT.parameterTypeProperties)
|
11255 | void 0 !== t9[r3] && (t9.schema[r3] = t9[r3], delete t9[r3]);
|
11256 | for (const r3 of qT.arrayProperties)
|
11257 | void 0 !== t9[r3] && (t9.schema[r3] = t9[r3], delete t9[r3]);
|
11258 | }
|
11259 | function ZT(t9, r2, e2, n2, o2, i2, u2) {
|
11260 | const a2 = {};
|
11261 | let f2, c2 = true;
|
11262 | r2 && r2.consumes && "string" == typeof r2.consumes && (r2.consumes = [r2.consumes], u2.patches++, u2.warnings.push("(Patchable) operation.consumes must be an array")), Array.isArray(i2.consumes) || delete i2.consumes;
|
11263 | const s2 = ((r2 ? r2.consumes : null) || i2.consumes || []).filter(qT.uniqueOnly);
|
11264 | if (t9 && (t9.name || t9.in)) {
|
11265 | "boolean" == typeof t9["x-deprecated"] && (t9.deprecated = t9["x-deprecated"], delete t9["x-deprecated"]), void 0 !== t9["x-example"] && (t9.example = t9["x-example"], delete t9["x-example"]), "body" === t9.in || t9.type || (t9.type = "string", u2.patches++, u2.warnings.push("(Patchable) parameter.type is mandatory for non-body parameters")), "file" === t9.type && (t9["x-s2o-originalType"] = t9.type, f2 = t9.type), null === t9.description && delete t9.description;
|
11266 | let r3 = t9.collectionFormat;
|
11267 | if ("array" !== t9.type || r3 || (r3 = "csv"), r3 && ("array" !== t9.type && (delete t9.collectionFormat, u2.patches++, u2.warnings.push("(Patchable) collectionFormat is only applicable to param.type array")), "csv" !== r3 || "query" !== t9.in && "cookie" !== t9.in || (t9.style = "form", t9.explode = false), "csv" !== r3 || "path" !== t9.in && "header" !== t9.in || (t9.style = "simple"), "ssv" === r3 && ("query" === t9.in ? t9.style = "spaceDelimited" : u2.warnings.push(`${t9.name} collectionFormat:ssv is no longer supported except for in:query parameters`)), "pipes" === r3 && ("query" === t9.in ? t9.style = "pipeDelimited" : u2.warnings.push(`${t9.name} collectionFormat:pipes is no longer supported except for in:query parameters`)), "multi" === r3 && (t9.explode = true), "tsv" === r3 && (u2.warnings.push("collectionFormat:tsv is no longer supported"), t9["x-collectionFormat"] = "tsv"), delete t9.collectionFormat), t9.type && "body" !== t9.type && "formData" !== t9.in)
|
11268 | if (t9.items && t9.schema)
|
11269 | u2.warnings.push(`${t9.name} parameter has array,items and schema`);
|
11270 | else {
|
11271 | t9.schema && u2.patches++, t9.schema && "object" == typeof t9.schema || (t9.schema = {}), t9.schema.type = t9.type, t9.items && (t9.schema.items = t9.items, delete t9.items, zT(t9.schema.items, null, (e3, n3) => {
|
11272 | "collectionFormat" === n3 && "string" == typeof e3[n3] && (r3 && e3[n3] !== r3 && u2.warnings.push(`${t9.name} Nested collectionFormats are not supported`), delete e3[n3]);
|
11273 | }));
|
11274 | for (const r4 of qT.parameterTypeProperties)
|
11275 | void 0 !== t9[r4] && (t9.schema[r4] = t9[r4]), delete t9[r4];
|
11276 | }
|
11277 | t9.schema && VT(t9.schema, u2), t9["x-ms-skip-url-encoding"] && "query" === t9.in && (t9.allowReserved = true, delete t9["x-ms-skip-url-encoding"]);
|
11278 | }
|
11279 | if (t9 && "formData" === t9.in) {
|
11280 | c2 = false, a2.content = {};
|
11281 | let r3 = "application/x-www-form-urlencoded";
|
11282 | if (s2.length && s2.indexOf("multipart/form-data") >= 0 && (r3 = "multipart/form-data"), a2.content[r3] = {}, t9.schema)
|
11283 | a2.content[r3].schema = t9.schema;
|
11284 | else {
|
11285 | a2.content[r3].schema = {}, a2.content[r3].schema.type = "object", a2.content[r3].schema.properties = {}, a2.content[r3].schema.properties[t9.name] = {};
|
11286 | const e3 = a2.content[r3].schema, n3 = a2.content[r3].schema.properties[t9.name];
|
11287 | t9.description && (n3.description = t9.description), t9.example && (n3.example = t9.example), t9.type && (n3.type = t9.type);
|
11288 | for (const r4 of qT.parameterTypeProperties)
|
11289 | void 0 !== t9[r4] && (n3[r4] = t9[r4]);
|
11290 | true === t9.required && (e3.required || (e3.required = []), e3.required.push(t9.name), a2.required = true), void 0 !== t9.default && (n3.default = t9.default), n3.properties && (n3.properties = t9.properties), t9.allOf && (n3.allOf = t9.allOf), "array" === t9.type && t9.items && (n3.items = t9.items, n3.items.collectionFormat && delete n3.items.collectionFormat), "file" !== f2 && "file" !== t9["x-s2o-originalType"] || (n3.type = "string", n3.format = "binary"), HT(t9, n3);
|
11291 | }
|
11292 | } else
|
11293 | t9 && "file" === t9.type && (t9.required && (a2.required = t9.required), a2.content = {}, a2.content["application/octet-stream"] = {}, a2.content["application/octet-stream"].schema = {}, a2.content["application/octet-stream"].schema.type = "string", a2.content["application/octet-stream"].schema.format = "binary", HT(t9, a2));
|
11294 | if (t9 && "body" === t9.in) {
|
11295 | a2.content = {}, t9.name && (a2["x-s2o-name"] = (r2 && r2.operationId ? qT.sanitiseAll(r2.operationId) : "") + qT.camelize(`_${t9.name}`)), t9.description && (a2.description = t9.description), t9.required && (a2.required = t9.required), s2.length || s2.push("application/json");
|
11296 | for (const r3 of s2)
|
11297 | a2.content[r3] = {}, a2.content[r3].schema = qT.clone(t9.schema || {}), VT(a2.content[r3].schema, u2);
|
11298 | HT(t9, a2);
|
11299 | }
|
11300 | if (Object.keys(a2).length > 0 && (t9["x-s2o-delete"] = true, r2))
|
11301 | if (r2.requestBody && c2) {
|
11302 | r2.requestBody["x-s2o-overloaded"] = true;
|
11303 | const t10 = r2.operationId || o2;
|
11304 | u2.warnings.push(`Operation ${t10} has multiple requestBodies`);
|
11305 | } else
|
11306 | r2.requestBody || (r2 = function(t10, r3) {
|
11307 | const e3 = {};
|
11308 | for (const n3 of Object.keys(t10))
|
11309 | e3[n3] = t10[n3], "parameters" === n3 && (e3.requestBody = {}, r3.rbname && (e3[r3.rbname] = ""));
|
11310 | return e3.requestBody = {}, e3;
|
11311 | }(r2, u2), e2[n2] = r2), r2.requestBody.content && r2.requestBody.content["multipart/form-data"] && r2.requestBody.content["multipart/form-data"].schema && r2.requestBody.content["multipart/form-data"].schema.properties && a2.content["multipart/form-data"] && a2.content["multipart/form-data"].schema && a2.content["multipart/form-data"].schema.properties ? (r2.requestBody.content["multipart/form-data"].schema.properties = Object.assign(r2.requestBody.content["multipart/form-data"].schema.properties, a2.content["multipart/form-data"].schema.properties), r2.requestBody.content["multipart/form-data"].schema.required = (r2.requestBody.content["multipart/form-data"].schema.required || []).concat(a2.content["multipart/form-data"].schema.required || []), r2.requestBody.content["multipart/form-data"].schema.required.length || delete r2.requestBody.content["multipart/form-data"].schema.required) : r2.requestBody.content && r2.requestBody.content["application/x-www-form-urlencoded"] && r2.requestBody.content["application/x-www-form-urlencoded"].schema && r2.requestBody.content["application/x-www-form-urlencoded"].schema.properties && a2.content["application/x-www-form-urlencoded"] && a2.content["application/x-www-form-urlencoded"].schema && a2.content["application/x-www-form-urlencoded"].schema.properties ? (r2.requestBody.content["application/x-www-form-urlencoded"].schema.properties = Object.assign(r2.requestBody.content["application/x-www-form-urlencoded"].schema.properties, a2.content["application/x-www-form-urlencoded"].schema.properties), r2.requestBody.content["application/x-www-form-urlencoded"].schema.required = (r2.requestBody.content["application/x-www-form-urlencoded"].schema.required || []).concat(a2.content["application/x-www-form-urlencoded"].schema.required || []), r2.requestBody.content["application/x-www-form-urlencoded"].schema.required.length || delete r2.requestBody.content["application/x-www-form-urlencoded"].schema.required) : (r2.requestBody = Object.assign(r2.requestBody, a2), r2.requestBody["x-s2o-name"] || r2.operationId && (r2.requestBody["x-s2o-name"] = qT.sanitiseAll(r2.operationId)));
|
11312 | if (t9 && !t9["x-s2o-delete"]) {
|
11313 | delete t9.type;
|
11314 | for (const r3 of qT.parameterTypeProperties)
|
11315 | delete t9[r3];
|
11316 | "path" !== t9.in || void 0 !== t9.required && true === t9.required || (t9.required = true, u2.patches++, u2.warnings.push(`(Patchable) path parameters must be required:true [${t9.name} in ${o2}]`));
|
11317 | }
|
11318 | return r2;
|
11319 | }
|
11320 | function tR(t9, r2, e2, n2) {
|
11321 | if (!t9)
|
11322 | return false;
|
11323 | if (t9.description || "object" != typeof t9 || Array.isArray(t9) || (n2.patches++, n2.warnings.push("(Patchable) response.description is mandatory")), void 0 !== t9.schema) {
|
11324 | VT(t9.schema, n2), r2 && r2.produces && "string" == typeof r2.produces && (r2.produces = [r2.produces], n2.patches++, n2.warnings.push("(Patchable) operation.produces must be an array")), e2.produces && !Array.isArray(e2.produces) && delete e2.produces;
|
11325 | const o2 = ((r2 ? r2.produces : null) || e2.produces || []).filter(qT.uniqueOnly);
|
11326 | o2.length || o2.push("*/*"), t9.content = {};
|
11327 | for (const r3 of o2) {
|
11328 | if (t9.content[r3] = {}, t9.content[r3].schema = qT.clone(t9.schema), t9.examples && t9.examples[r3]) {
|
11329 | const e3 = {};
|
11330 | e3.value = t9.examples[r3], t9.content[r3].examples = {}, t9.content[r3].examples.response = e3, delete t9.examples[r3];
|
11331 | }
|
11332 | "file" === t9.content[r3].schema.type && (t9.content[r3].schema = { type: "string", format: "binary" });
|
11333 | }
|
11334 | delete t9.schema;
|
11335 | }
|
11336 | for (const r3 in t9.examples)
|
11337 | t9.content || (t9.content = {}), t9.content[r3] || (t9.content[r3] = {}), t9.content[r3].examples = {}, t9.content[r3].examples.response = {}, t9.content[r3].examples.response.value = t9.examples[r3];
|
11338 | if (delete t9.examples, t9.headers)
|
11339 | for (const r3 in t9.headers)
|
11340 | "status code" === r3.toLowerCase() ? (delete t9.headers[r3], n2.patches++, n2.warnings.push('(Patchable) "Status Code" is not a valid header')) : XT(t9.headers[r3], n2);
|
11341 | }
|
11342 | function rR(t9, r2, e2, n2, o2) {
|
11343 | for (const i2 in t9) {
|
11344 | const u2 = t9[i2];
|
11345 | u2 && u2["x-trace"] && "object" == typeof u2["x-trace"] && (u2.trace = u2["x-trace"], delete u2["x-trace"]), u2 && u2["x-summary"] && "string" == typeof u2["x-summary"] && (u2.summary = u2["x-summary"], delete u2["x-summary"]), u2 && u2["x-description"] && "string" == typeof u2["x-description"] && (u2.description = u2["x-description"], delete u2["x-description"]), u2 && u2["x-servers"] && Array.isArray(u2["x-servers"]) && (u2.servers = u2["x-servers"], delete u2["x-servers"]);
|
11346 | for (const t10 in u2)
|
11347 | if (qT.httpMethods.indexOf(t10) >= 0 || "x-amazon-apigateway-any-method" === t10) {
|
11348 | let a2 = u2[t10];
|
11349 | if (a2 && a2.parameters && Array.isArray(a2.parameters)) {
|
11350 | if (u2.parameters)
|
11351 | for (const r3 of u2.parameters) {
|
11352 | a2.parameters.find((t11) => t11.name === r3.name && t11.in === r3.in) || "formData" !== r3.in && "body" !== r3.in && "file" !== r3.type || (a2 = ZT(r3, a2, u2, t10, i2, o2, e2));
|
11353 | }
|
11354 | for (const r3 of a2.parameters)
|
11355 | a2 = ZT(r3, a2, u2, t10, `${t10}: ${i2}`, o2, e2);
|
11356 | a2.parameters && (a2.parameters = a2.parameters.filter(KT));
|
11357 | }
|
11358 | if (a2 && a2.security && YT(a2.security), "object" == typeof a2) {
|
11359 | if (!a2.responses) {
|
11360 | const t11 = { description: "Default response" };
|
11361 | a2.responses = { default: t11 };
|
11362 | }
|
11363 | for (const t11 in a2.responses) {
|
11364 | tR(a2.responses[t11], a2, o2, e2);
|
11365 | }
|
11366 | }
|
11367 | if (a2 && a2["x-servers"] && Array.isArray(a2["x-servers"]))
|
11368 | a2.servers = a2["x-servers"], delete a2["x-servers"];
|
11369 | else if (a2 && a2.schemes && a2.schemes.length) {
|
11370 | for (const t11 of a2.schemes)
|
11371 | if ((!o2.schemes || o2.schemes.indexOf(t11) < 0) && (a2.servers || (a2.servers = []), Array.isArray(o2.servers)))
|
11372 | for (const t12 of o2.servers) {
|
11373 | const r3 = qT.clone(t12);
|
11374 | a2.servers.push(r3);
|
11375 | }
|
11376 | }
|
11377 | if (a2) {
|
11378 | if (delete a2.consumes, delete a2.produces, delete a2.schemes, a2["x-ms-examples"]) {
|
11379 | for (const t11 in a2["x-ms-examples"]) {
|
11380 | const r3 = a2["x-ms-examples"][t11], e3 = qT.sanitiseAll(t11);
|
11381 | if (r3.parameters)
|
11382 | for (const e4 in r3.parameters) {
|
11383 | const n3 = r3.parameters[e4];
|
11384 | for (const r4 of (a2.parameters || []).concat(u2.parameters || []))
|
11385 | r4.name !== e4 || r4.example || (r4.examples || (r4.examples = {}), r4.examples[t11] = { value: n3 });
|
11386 | }
|
11387 | if (r3.responses)
|
11388 | for (const n3 in r3.responses) {
|
11389 | if (r3.responses[n3].headers)
|
11390 | for (const t12 in r3.responses[n3].headers) {
|
11391 | const e4 = r3.responses[n3].headers[t12];
|
11392 | for (const r4 in a2.responses[n3].headers)
|
11393 | if (r4 === t12) {
|
11394 | a2.responses[n3].headers[r4].example = e4;
|
11395 | }
|
11396 | }
|
11397 | if (r3.responses[n3].body && (o2.components.examples[e3] = { value: qT.clone(r3.responses[n3].body) }, a2.responses[n3] && a2.responses[n3].content))
|
11398 | for (const r4 in a2.responses[n3].content) {
|
11399 | const o3 = a2.responses[n3].content[r4];
|
11400 | o3.examples || (o3.examples = {}), o3.examples[t11] = { $ref: `#/components/examples/${e3}` };
|
11401 | }
|
11402 | }
|
11403 | }
|
11404 | delete a2["x-ms-examples"];
|
11405 | }
|
11406 | if (a2.parameters && 0 === a2.parameters.length && delete a2.parameters, a2.requestBody) {
|
11407 | const e3 = a2.operationId ? qT.sanitiseAll(a2.operationId) : qT.camelize(qT.sanitiseAll(t10 + i2)), o3 = qT.sanitise(a2.requestBody["x-s2o-name"] || e3 || "");
|
11408 | delete a2.requestBody["x-s2o-name"];
|
11409 | const u3 = JSON.stringify(a2.requestBody), f2 = qT.createHash(u3);
|
11410 | if (!n2[f2]) {
|
11411 | const t11 = {};
|
11412 | t11.name = o3, t11.body = a2.requestBody, t11.refs = [], n2[f2] = t11;
|
11413 | }
|
11414 | const c2 = `#/${r2}/${encodeURIComponent(i2)}/${t10}/requestBody`;
|
11415 | n2[f2].refs.push(c2);
|
11416 | }
|
11417 | }
|
11418 | }
|
11419 | if (u2 && u2.parameters) {
|
11420 | for (const t10 in u2.parameters) {
|
11421 | ZT(u2.parameters[t10], null, u2, null, i2, o2, e2);
|
11422 | }
|
11423 | Array.isArray(u2.parameters) && (u2.parameters = u2.parameters.filter(KT));
|
11424 | }
|
11425 | }
|
11426 | }
|
11427 | function eR(t9) {
|
11428 | return t9 && t9.url && "string" == typeof t9.url ? (t9.url = t9.url.split("{{").join("{"), t9.url = t9.url.split("}}").join("}"), t9.url.replace(/\{(.+?)\}/g, (r2, e2) => {
|
11429 | t9.variables || (t9.variables = {}), t9.variables[e2] = { default: "unknown" };
|
11430 | }), t9) : t9;
|
11431 | }
|
11432 | function nR(t9, r2) {
|
11433 | void 0 !== t9.info && null !== t9.info || (t9.info = { version: "", title: "" }, r2.patches++, r2.warnings.push("(Patchable) info object is mandatory")), ("object" != typeof t9.info || Array.isArray(t9.info)) && (r2.errCount++, r2.errors.push({ message: "info must be an object", pointer: "/info" })), t9.info && (void 0 === t9.info.title && (r2.patches++, t9.info.title = "", r2.warnings.push({ message: "(Patchable) info.title cannot be null", pointer: "/info/title", patchable: true })), void 0 === t9.info.version ? (r2.patches++, t9.info.version = "", r2.warnings.push("(Patchable) info.version cannot be null")) : "string" != typeof t9.info.version && (r2.patches++, t9.info.version = t9.info.version.toString(), r2.warnings.push("(Patchable) info.version must be a string")));
|
11434 | }
|
11435 | function oR(t9, r2) {
|
11436 | t9.paths || (r2.patches++, t9.paths = {}, r2.warnings.push("(Patchable) paths object is mandatory"));
|
11437 | }
|
11438 | function iR(t9 = {}) {
|
11439 | const r2 = { original: t9, openapi: {}, patches: 0, warnings: [], errCount: 0, errors: [] };
|
11440 | if (t9.openapi && "string" == typeof t9.openapi && t9.openapi.startsWith("3."))
|
11441 | return r2.openapi = qT.circularClone(t9), nR(r2.openapi, r2), oR(r2.openapi, r2), r2;
|
11442 | if ("2.0" !== t9.swagger)
|
11443 | return r2.errCount++, r2.errors.push({ message: `Unsupported swagger/OpenAPI version: ${t9.openapi ? t9.openapi : t9.swagger}`, pointer: "/swagger" }), r2;
|
11444 | if (r2.openapi = qT.circularClone(t9), r2.openapi.openapi = "3.0.0", delete r2.openapi.swagger, zT(r2.openapi, {}, (t10, r3, e2) => {
|
11445 | null === t10[r3] && !r3.startsWith("x-") && "default" !== r3 && e2.path.indexOf("/example") < 0 && delete t10[r3];
|
11446 | }), t9.host)
|
11447 | (t9.schemes || []).forEach((e2) => {
|
11448 | const n2 = {}, o2 = (t9.basePath || "").replace(/\/$/, "");
|
11449 | n2.url = `${e2 ? `${e2}:` : ""}//${t9.host}${o2}`, eR(n2), r2.openapi.servers || (r2.openapi.servers = []), r2.openapi.servers.push(n2);
|
11450 | });
|
11451 | else if (t9.basePath) {
|
11452 | const e2 = {};
|
11453 | e2.url = t9.basePath, eR(e2), r2.openapi.servers || (r2.openapi.servers = []), r2.openapi.servers.push(e2);
|
11454 | }
|
11455 | if (delete r2.openapi.host, delete r2.openapi.basePath, t9["x-ms-parameterized-host"]) {
|
11456 | const e2 = t9["x-ms-parameterized-host"], n2 = {};
|
11457 | n2.url = e2.hostTemplate + (t9.basePath ? t9.basePath : ""), n2.variables = {};
|
11458 | const o2 = n2.url.match(/\{\w+\}/g);
|
11459 | for (const t10 in e2.parameters) {
|
11460 | const r3 = e2.parameters[t10];
|
11461 | t10.startsWith("x-") || (delete r3.required, delete r3.type, delete r3.in, void 0 === r3.default && (r3.enum ? r3.default = r3.enum[0] : r3.default = "none"), r3.name || (r3.name = o2[t10].replace("{", "").replace("}", "")), n2.variables[r3.name] = r3, delete r3.name);
|
11462 | }
|
11463 | r2.openapi.servers || (r2.openapi.servers = []), false === e2.useSchemePrefix ? r2.openapi.servers.push(n2) : t9.schemes.forEach((t10) => {
|
11464 | r2.openapi.servers.push({ ...n2, url: `${t10}://${n2.url}` });
|
11465 | }), delete r2.openapi["x-ms-parameterized-host"];
|
11466 | }
|
11467 | return nR(r2.openapi, r2), oR(r2.openapi, r2), "string" == typeof r2.openapi.consumes && (r2.openapi.consumes = [r2.openapi.consumes]), "string" == typeof r2.openapi.produces && (r2.openapi.produces = [r2.openapi.produces]), r2.openapi.components = {}, r2.openapi["x-callbacks"] && (r2.openapi.components.callbacks = r2.openapi["x-callbacks"], delete r2.openapi["x-callbacks"]), r2.openapi.components.examples = {}, r2.openapi.components.headers = {}, r2.openapi["x-links"] && (r2.openapi.components.links = r2.openapi["x-links"], delete r2.openapi["x-links"]), r2.openapi.components.parameters = r2.openapi.parameters || {}, r2.openapi.components.responses = r2.openapi.responses || {}, r2.openapi.components.requestBodies = {}, r2.openapi.components.securitySchemes = r2.openapi.securityDefinitions || {}, r2.openapi.components.schemas = r2.openapi.definitions || {}, delete r2.openapi.definitions, delete r2.openapi.responses, delete r2.openapi.parameters, delete r2.openapi.securityDefinitions, function(t10) {
|
11468 | const r3 = t10.openapi, e2 = {};
|
11469 | JT = { schemas: {} }, r3.security && YT(r3.security);
|
11470 | for (const e3 in r3.components.securitySchemes) {
|
11471 | const n2 = qT.sanitise(e3);
|
11472 | if (e3 !== n2) {
|
11473 | if (r3.components.securitySchemes[n2])
|
11474 | return t10.errCount++, t10.errors.push({ message: `Duplicate sanitised securityScheme name ${n2}`, pointer: `/components/securitySchemes/${n2}` }), t10;
|
11475 | r3.components.securitySchemes[n2] = r3.components.securitySchemes[e3], delete r3.components.securitySchemes[e3];
|
11476 | }
|
11477 | QT(r3.components.securitySchemes[n2], t10);
|
11478 | }
|
11479 | for (const e3 in r3.components.schemas) {
|
11480 | const n2 = qT.sanitiseAll(e3);
|
11481 | let o2 = 0;
|
11482 | if (e3 !== n2) {
|
11483 | for (; r3.components.schemas[n2 + o2]; )
|
11484 | o2 = o2 ? ++o2 : 2;
|
11485 | r3.components.schemas[n2 + o2] = r3.components.schemas[e3], delete r3.components.schemas[e3];
|
11486 | }
|
11487 | JT.schemas[e3] = n2 + o2, VT(r3.components.schemas[`${n2}${o2}`], t10);
|
11488 | }
|
11489 | for (const e3 in r3.components.parameters) {
|
11490 | const n2 = qT.sanitise(e3);
|
11491 | if (e3 !== n2) {
|
11492 | if (r3.components.parameters[n2])
|
11493 | return t10.errCount++, t10.errors.push({ message: `Duplicate sanitised parameter name ${n2}`, pointer: `/components/parameters/${n2}` }), t10;
|
11494 | r3.components.parameters[n2] = r3.components.parameters[e3], delete r3.components.parameters[e3];
|
11495 | }
|
11496 | ZT(r3.components.parameters[n2], null, null, null, n2, r3, t10);
|
11497 | }
|
11498 | for (const e3 in r3.components.responses) {
|
11499 | const n2 = qT.sanitise(e3);
|
11500 | if (e3 !== n2) {
|
11501 | if (r3.components.responses[n2])
|
11502 | return t10.errCount++, t10.errors.push({ message: `Duplicate sanitised response name ${n2}`, pointer: `/components/responses/${n2}` }), t10;
|
11503 | r3.components.responses[n2] = r3.components.responses[e3], delete r3.components.responses[e3];
|
11504 | }
|
11505 | const o2 = r3.components.responses[n2];
|
11506 | if (tR(o2, null, r3, t10), o2.headers)
|
11507 | for (const r4 in o2.headers)
|
11508 | "status code" === r4.toLowerCase() ? (delete o2.headers[r4], t10.patches++, t10.warnings.push('(Patchable) "Status Code" is not a valid header')) : XT(o2.headers[r4], t10);
|
11509 | }
|
11510 | for (const t11 in r3.components.requestBodies) {
|
11511 | const n2 = r3.components.requestBodies[t11], o2 = JSON.stringify(n2), i2 = qT.createHash(o2), u2 = {};
|
11512 | u2.name = t11, u2.body = n2, u2.refs = [], e2[i2] = u2;
|
11513 | }
|
11514 | rR(r3.paths, "paths", t10, e2, r3), r3["x-ms-paths"] && rR(r3["x-ms-paths"], "x-ms-paths", t10, e2, r3);
|
11515 | for (const t11 in r3.components.parameters)
|
11516 | r3.components.parameters[t11]["x-s2o-delete"] && delete r3.components.parameters[t11];
|
11517 | return delete r3.consumes, delete r3.produces, delete r3.schemes, r3.components.requestBodies = {}, r3.components.responses && 0 === Object.keys(r3.components.responses).length && delete r3.components.responses, r3.components.parameters && 0 === Object.keys(r3.components.parameters).length && delete r3.components.parameters, r3.components.examples && 0 === Object.keys(r3.components.examples).length && delete r3.components.examples, r3.components.requestBodies && 0 === Object.keys(r3.components.requestBodies).length && delete r3.components.requestBodies, r3.components.securitySchemes && 0 === Object.keys(r3.components.securitySchemes).length && delete r3.components.securitySchemes, r3.components.headers && 0 === Object.keys(r3.components.headers).length && delete r3.components.headers, r3.components.schemas && 0 === Object.keys(r3.components.schemas).length && delete r3.components.schemas, r3.components && 0 === Object.keys(r3.components).length && delete r3.components, t10;
|
11518 | }(r2);
|
11519 | }
|
11520 | function uR(t9) {
|
11521 | return t9.ok && t9.text && t9.parseError && "YAMLException" === t9.parseError.name && (!t9.headers["content-type"] || t9.headers["content-type"].match("text/plain")) && (t9.body = t9.text), t9;
|
11522 | }
|
11523 | const aR = { convertObj: iR, resolve: function(t9) {
|
11524 | return new Promise(async (r2) => {
|
11525 | try {
|
11526 | const e2 = await $T.resolve(t9, uR);
|
11527 | if (e2.errors && e2.errors.length > 0)
|
11528 | r2(e2);
|
11529 | else {
|
11530 | e2.spec.openapi && (e2.resolvedSpec = e2.spec, r2(e2));
|
11531 | const t10 = iR(e2.spec);
|
11532 | t10.errors && t10.errors.length > 0 && (Array.isArray(e2.errors) ? e2.errors.concat(e2.errors) : e2.errors = t10.errors), t10.warnings && t10.warnings.length > 0 && (e2.warnings = t10.warnings), e2.resolvedSpec = e2.spec, e2.spec = t10.openapi, r2(e2);
|
11533 | }
|
11534 | } catch (t10) {
|
11535 | r2(t10);
|
11536 | }
|
11537 | });
|
11538 | } };
|
11539 |
|
11540 |
|
11541 | ;
|
11542 |
|
11543 |
|
11544 |
|
11545 |
|
11546 | async function ProcessSpec(specUrl, generateMissingTags = false, sortTags = false, sortEndpointsBy = '', attrApiKey = '', attrApiKeyLocation = '', attrApiKeyValue = '', serverUrl = '') {
|
11547 | var _jsonParsedSpec$info, _jsonParsedSpec$compo;
|
11548 | let jsonParsedSpec;
|
11549 | try {
|
11550 | var _specMeta$resolvedSpe, _specMeta$resolvedSpe2;
|
11551 | this.requestUpdate();
|
11552 | let specMeta;
|
11553 | if (typeof specUrl === 'string') {
|
11554 | specMeta = await aR.resolve({
|
11555 | url: specUrl,
|
11556 | allowMetaPatches: false
|
11557 | });
|
11558 | } else {
|
11559 | specMeta = await aR.resolve({
|
11560 | spec: specUrl,
|
11561 | allowMetaPatches: false
|
11562 | });
|
11563 | }
|
11564 |
|
11565 | await sleep(0);
|
11566 |
|
11567 |
|
11568 | if ((_specMeta$resolvedSpe = specMeta.resolvedSpec) !== null && _specMeta$resolvedSpe !== void 0 && _specMeta$resolvedSpe.jsonSchemaViewer && (_specMeta$resolvedSpe2 = specMeta.resolvedSpec) !== null && _specMeta$resolvedSpe2 !== void 0 && _specMeta$resolvedSpe2.schemaAndExamples) {
|
11569 | this.dispatchEvent(new CustomEvent('before-render', {
|
11570 | detail: {
|
11571 | spec: specMeta.resolvedSpec
|
11572 | }
|
11573 | }));
|
11574 | const schemaAndExamples = Object.entries(specMeta.resolvedSpec.schemaAndExamples).map(v => ({
|
11575 | show: true,
|
11576 | expanded: true,
|
11577 | selectedExample: null,
|
11578 | name: v[0],
|
11579 | elementId: v[0].replace(invalidCharsRegEx, '-'),
|
11580 | ...v[1]
|
11581 | }));
|
11582 | const parsedSpec = {
|
11583 | specLoadError: false,
|
11584 | isSpecLoading: false,
|
11585 | info: specMeta.resolvedSpec.info,
|
11586 | schemaAndExamples
|
11587 | };
|
11588 | return parsedSpec;
|
11589 | }
|
11590 | if (specMeta.spec && (specMeta.spec.components || specMeta.spec.info || specMeta.spec.servers || specMeta.spec.tags || specMeta.spec.paths)) {
|
11591 | jsonParsedSpec = specMeta.spec;
|
11592 | this.dispatchEvent(new CustomEvent('before-render', {
|
11593 | detail: {
|
11594 | spec: jsonParsedSpec
|
11595 | }
|
11596 | }));
|
11597 | } else {
|
11598 | var _specMeta$response, _specMeta$response2, _specMeta$response3, _specMeta$response4;
|
11599 | console.info('RapiDoc: %c There was an issue while parsing the spec %o ', 'color:orangered', specMeta);
|
11600 | return {
|
11601 | specLoadError: true,
|
11602 | isSpecLoading: false,
|
11603 | info: {
|
11604 | title: 'Error loading the spec',
|
11605 | description: (_specMeta$response = specMeta.response) !== null && _specMeta$response !== void 0 && _specMeta$response.url ? `${(_specMeta$response2 = specMeta.response) === null || _specMeta$response2 === void 0 ? void 0 : _specMeta$response2.url} ┃ ${(_specMeta$response3 = specMeta.response) === null || _specMeta$response3 === void 0 ? void 0 : _specMeta$response3.status} ${(_specMeta$response4 = specMeta.response) === null || _specMeta$response4 === void 0 ? void 0 : _specMeta$response4.statusText}` : 'Unable to load the Spec',
|
11606 | version: ' '
|
11607 | },
|
11608 | tags: []
|
11609 | };
|
11610 | }
|
11611 | } catch (err) {
|
11612 | console.info('RapiDoc: %c There was an issue while parsing the spec %o ', 'color:orangered', err);
|
11613 | }
|
11614 |
|
11615 |
|
11616 |
|
11617 |
|
11618 | const tags = groupByTags(jsonParsedSpec, sortEndpointsBy, generateMissingTags, sortTags);
|
11619 |
|
11620 |
|
11621 | const components = getComponents(jsonParsedSpec);
|
11622 |
|
11623 |
|
11624 | const infoDescriptionHeaders = (_jsonParsedSpec$info = jsonParsedSpec.info) !== null && _jsonParsedSpec$info !== void 0 && _jsonParsedSpec$info.description ? getHeadersFromMarkdown(jsonParsedSpec.info.description) : [];
|
11625 |
|
11626 |
|
11627 | const securitySchemes = [];
|
11628 | if ((_jsonParsedSpec$compo = jsonParsedSpec.components) !== null && _jsonParsedSpec$compo !== void 0 && _jsonParsedSpec$compo.securitySchemes) {
|
11629 | const securitySchemeSet = new Set();
|
11630 | Object.entries(jsonParsedSpec.components.securitySchemes).forEach(kv => {
|
11631 | if (!securitySchemeSet.has(kv[0])) {
|
11632 | securitySchemeSet.add(kv[0]);
|
11633 | const securityObj = {
|
11634 | securitySchemeId: kv[0],
|
11635 | ...kv[1]
|
11636 | };
|
11637 | securityObj.value = '';
|
11638 | securityObj.finalKeyValue = '';
|
11639 | if (kv[1].type === 'apiKey' || kv[1].type === 'http') {
|
11640 | securityObj.in = kv[1].in || 'header';
|
11641 | securityObj.name = kv[1].name || 'Authorization';
|
11642 | securityObj.user = '';
|
11643 | securityObj.password = '';
|
11644 | } else if (kv[1].type === 'oauth2') {
|
11645 | securityObj.in = 'header';
|
11646 | securityObj.name = 'Authorization';
|
11647 | securityObj.clientId = '';
|
11648 | securityObj.clientSecret = '';
|
11649 | }
|
11650 | securitySchemes.push(securityObj);
|
11651 | }
|
11652 | });
|
11653 | }
|
11654 | if (attrApiKey && attrApiKeyLocation && attrApiKeyValue) {
|
11655 | securitySchemes.push({
|
11656 | securitySchemeId: rapidocApiKey,
|
11657 | description: 'api-key provided in rapidoc element attributes',
|
11658 | type: 'apiKey',
|
11659 | oAuthFlow: '',
|
11660 | name: attrApiKey,
|
11661 | in: attrApiKeyLocation,
|
11662 | value: attrApiKeyValue,
|
11663 | finalKeyValue: attrApiKeyValue
|
11664 | });
|
11665 | }
|
11666 |
|
11667 |
|
11668 | securitySchemes.forEach(v => {
|
11669 | if (v.type === 'http') {
|
11670 | v.typeDisplay = v.scheme === 'basic' ? 'HTTP Basic' : 'HTTP Bearer';
|
11671 | } else if (v.type === 'apiKey') {
|
11672 | v.typeDisplay = `API Key (${v.name})`;
|
11673 | } else if (v.type === 'oauth2') {
|
11674 | v.typeDisplay = `OAuth (${v.securitySchemeId})`;
|
11675 | } else {
|
11676 | v.typeDisplay = v.type || 'None';
|
11677 | }
|
11678 | });
|
11679 |
|
11680 |
|
11681 | let servers = [];
|
11682 | if (jsonParsedSpec.servers && Array.isArray(jsonParsedSpec.servers)) {
|
11683 | jsonParsedSpec.servers.forEach(v => {
|
11684 | let computedUrl = v.url.trim();
|
11685 | if (!(computedUrl.startsWith('http') || computedUrl.startsWith('//') || computedUrl.startsWith('{'))) {
|
11686 | if (window.location.origin.startsWith('http')) {
|
11687 | v.url = window.location.origin + v.url;
|
11688 | computedUrl = v.url;
|
11689 | }
|
11690 | }
|
11691 |
|
11692 | if (v.variables) {
|
11693 | Object.entries(v.variables).forEach(kv => {
|
11694 | const regex = new RegExp(`{${kv[0]}}`, 'g');
|
11695 | computedUrl = computedUrl.replace(regex, kv[1].default || '');
|
11696 | kv[1].value = kv[1].default || '';
|
11697 | });
|
11698 | }
|
11699 | v.computedUrl = computedUrl;
|
11700 | });
|
11701 | if (serverUrl) {
|
11702 | jsonParsedSpec.servers.push({
|
11703 | url: serverUrl,
|
11704 | computedUrl: serverUrl
|
11705 | });
|
11706 | }
|
11707 | } else if (serverUrl) {
|
11708 | jsonParsedSpec.servers = [{
|
11709 | url: serverUrl,
|
11710 | computedUrl: serverUrl
|
11711 | }];
|
11712 | } else if (window.location.origin.startsWith('http')) {
|
11713 | jsonParsedSpec.servers = [{
|
11714 | url: window.location.origin,
|
11715 | computedUrl: window.location.origin
|
11716 | }];
|
11717 | } else {
|
11718 | jsonParsedSpec.servers = [{
|
11719 | url: 'http://localhost',
|
11720 | computedUrl: 'http://localhost'
|
11721 | }];
|
11722 | }
|
11723 | servers = jsonParsedSpec.servers;
|
11724 | const parsedSpec = {
|
11725 | specLoadError: false,
|
11726 | isSpecLoading: false,
|
11727 | info: jsonParsedSpec.info,
|
11728 | infoDescriptionHeaders,
|
11729 | tags,
|
11730 | components,
|
11731 | externalDocs: jsonParsedSpec.externalDocs,
|
11732 | securitySchemes,
|
11733 | servers
|
11734 | };
|
11735 | return parsedSpec;
|
11736 | }
|
11737 | function getHeadersFromMarkdown(markdownContent) {
|
11738 | const tokens = marked.lexer(markdownContent);
|
11739 | const headers = tokens.filter(v => v.type === 'heading' && v.depth <= 2);
|
11740 | return headers || [];
|
11741 | }
|
11742 | function getComponents(openApiSpec) {
|
11743 | if (!openApiSpec.components) {
|
11744 | return [];
|
11745 | }
|
11746 | const components = [];
|
11747 | for (const component in openApiSpec.components) {
|
11748 | const subComponents = [];
|
11749 | for (const sComponent in openApiSpec.components[component]) {
|
11750 | const scmp = {
|
11751 | show: true,
|
11752 | id: `${component.toLowerCase()}-${sComponent.toLowerCase()}`.replace(invalidCharsRegEx, '-'),
|
11753 | name: sComponent,
|
11754 | component: openApiSpec.components[component][sComponent]
|
11755 | };
|
11756 | subComponents.push(scmp);
|
11757 | }
|
11758 | let cmpDescription = component;
|
11759 | let cmpName = component;
|
11760 | switch (component) {
|
11761 | case 'schemas':
|
11762 | cmpName = 'Schemas';
|
11763 | cmpDescription = 'Schemas allows the definition of input and output data types. These types can be objects, but also primitives and arrays.';
|
11764 | break;
|
11765 | case 'responses':
|
11766 | cmpName = 'Responses';
|
11767 | cmpDescription = 'Describes responses from an API Operation, including design-time, static links to operations based on the response.';
|
11768 | break;
|
11769 | case 'parameters':
|
11770 | cmpName = 'Parameters';
|
11771 | cmpDescription = 'Describes operation parameters. A unique parameter is defined by a combination of a name and location.';
|
11772 | break;
|
11773 | case 'examples':
|
11774 | cmpName = 'Examples';
|
11775 | cmpDescription = 'List of Examples for operations, can be requests, responses and objects examples.';
|
11776 | break;
|
11777 | case 'requestBodies':
|
11778 | cmpName = 'Request Bodies';
|
11779 | cmpDescription = 'Describes common request bodies that are used across the API operations.';
|
11780 | break;
|
11781 | case 'headers':
|
11782 | cmpName = 'Headers';
|
11783 | cmpDescription = 'Headers follows the structure of the Parameters but they are explicitly in "header"';
|
11784 | break;
|
11785 | case 'securitySchemes':
|
11786 | cmpName = 'Security Schemes';
|
11787 |
|
11788 | cmpDescription = 'Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), OAuth2\'s common flows(implicit, password, client credentials and authorization code) as defined in RFC6749, and OpenID Connect Discovery.';
|
11789 | break;
|
11790 | case 'links':
|
11791 | cmpName = 'Links';
|
11792 | cmpDescription = 'Links represent a possible design-time link for a response. The presence of a link does not guarantee the caller\'s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.';
|
11793 | break;
|
11794 | case 'callbacks':
|
11795 | cmpName = 'Callbacks';
|
11796 |
|
11797 | cmpDescription = 'A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the path item object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.';
|
11798 | break;
|
11799 | default:
|
11800 | cmpName = component;
|
11801 | cmpDescription = component;
|
11802 | break;
|
11803 | }
|
11804 | const cmp = {
|
11805 | show: true,
|
11806 | name: cmpName,
|
11807 | description: cmpDescription,
|
11808 | subComponents
|
11809 | };
|
11810 | components.push(cmp);
|
11811 | }
|
11812 | return components || [];
|
11813 | }
|
11814 | function groupByTags(openApiSpec, sortEndpointsBy, generateMissingTags = false, sortTags = false) {
|
11815 | const supportedMethods = ['get', 'put', 'post', 'delete', 'patch', 'head', 'options'];
|
11816 | const tags = openApiSpec.tags && Array.isArray(openApiSpec.tags) ? openApiSpec.tags.map(v => ({
|
11817 | show: true,
|
11818 | elementId: `tag--${v.name.replace(invalidCharsRegEx, '-')}`,
|
11819 | name: v.name,
|
11820 | description: v.description || '',
|
11821 | headers: v.description ? getHeadersFromMarkdown(v.description) : [],
|
11822 | paths: [],
|
11823 | expanded: v['x-tag-expanded'] !== false
|
11824 | })) : [];
|
11825 | const pathsAndWebhooks = openApiSpec.paths || {};
|
11826 | if (openApiSpec.webhooks) {
|
11827 | for (const [key, value] of Object.entries(openApiSpec.webhooks)) {
|
11828 | value._type = 'webhook';
|
11829 | pathsAndWebhooks[key] = value;
|
11830 | }
|
11831 | }
|
11832 |
|
11833 | for (const pathOrHookName in pathsAndWebhooks) {
|
11834 | const commonParams = pathsAndWebhooks[pathOrHookName].parameters;
|
11835 | const commonPathProp = {
|
11836 | servers: pathsAndWebhooks[pathOrHookName].servers || [],
|
11837 | parameters: pathsAndWebhooks[pathOrHookName].parameters || []
|
11838 | };
|
11839 | const isWebhook = pathsAndWebhooks[pathOrHookName]._type === 'webhook';
|
11840 | supportedMethods.forEach(methodName => {
|
11841 | if (pathsAndWebhooks[pathOrHookName][methodName]) {
|
11842 | const pathOrHookObj = openApiSpec.paths[pathOrHookName][methodName];
|
11843 |
|
11844 | const pathTags = pathOrHookObj.tags || [];
|
11845 | if (pathTags.length === 0) {
|
11846 | if (generateMissingTags) {
|
11847 | const pathOrHookNameKey = pathOrHookName.replace(/^\/+|\/+$/g, '');
|
11848 | const firstWordEndIndex = pathOrHookNameKey.indexOf('/');
|
11849 | if (firstWordEndIndex === -1) {
|
11850 | pathTags.push(pathOrHookNameKey);
|
11851 | } else {
|
11852 |
|
11853 | pathTags.push(pathOrHookNameKey.substr(0, firstWordEndIndex));
|
11854 | }
|
11855 | } else {
|
11856 | pathTags.push('General ⦂');
|
11857 | }
|
11858 | }
|
11859 | pathTags.forEach(tag => {
|
11860 | let tagObj;
|
11861 | let specTagsItem;
|
11862 | if (openApiSpec.tags) {
|
11863 | specTagsItem = openApiSpec.tags.find(v => v.name.toLowerCase() === tag.toLowerCase());
|
11864 | }
|
11865 | tagObj = tags.find(v => v.name === tag);
|
11866 | if (!tagObj) {
|
11867 | var _specTagsItem, _specTagsItem2;
|
11868 | tagObj = {
|
11869 | show: true,
|
11870 | elementId: `tag--${tag.replace(invalidCharsRegEx, '-')}`,
|
11871 | name: tag,
|
11872 | description: ((_specTagsItem = specTagsItem) === null || _specTagsItem === void 0 ? void 0 : _specTagsItem.description) || '',
|
11873 | headers: (_specTagsItem2 = specTagsItem) !== null && _specTagsItem2 !== void 0 && _specTagsItem2.description ? getHeadersFromMarkdown(specTagsItem.description) : [],
|
11874 | paths: [],
|
11875 | expanded: specTagsItem ? specTagsItem['x-tag-expanded'] !== false : true
|
11876 | };
|
11877 | tags.push(tagObj);
|
11878 | }
|
11879 |
|
11880 |
|
11881 | let shortSummary = (pathOrHookObj.summary || pathOrHookObj.description || `${methodName.toUpperCase()} ${pathOrHookName}`).trim();
|
11882 | if (shortSummary.length > 100) {
|
11883 | [shortSummary] = shortSummary.split(/[.|!|?]\s|[\r?\n]/);
|
11884 | }
|
11885 |
|
11886 | let finalParameters = [];
|
11887 | if (commonParams) {
|
11888 | if (pathOrHookObj.parameters) {
|
11889 | finalParameters = commonParams.filter(commonParam => {
|
11890 | if (!pathOrHookObj.parameters.some(param => commonParam.name === param.name && commonParam.in === param.in)) {
|
11891 | return commonParam;
|
11892 | }
|
11893 | }).concat(pathOrHookObj.parameters);
|
11894 | } else {
|
11895 | finalParameters = commonParams.slice(0);
|
11896 | }
|
11897 | } else {
|
11898 | finalParameters = pathOrHookObj.parameters ? pathOrHookObj.parameters.slice(0) : [];
|
11899 | }
|
11900 |
|
11901 |
|
11902 | if (pathOrHookObj.callbacks) {
|
11903 | for (const [callbackName, callbackConfig] of Object.entries(pathOrHookObj.callbacks)) {
|
11904 | const filteredCallbacks = Object.entries(callbackConfig).filter(entry => typeof entry[1] === 'object') || [];
|
11905 | pathOrHookObj.callbacks[callbackName] = Object.fromEntries(filteredCallbacks);
|
11906 | }
|
11907 | }
|
11908 |
|
11909 |
|
11910 | tagObj.paths.push({
|
11911 | show: true,
|
11912 | expanded: false,
|
11913 | isWebhook,
|
11914 | expandedAtLeastOnce: false,
|
11915 | summary: pathOrHookObj.summary || '',
|
11916 | description: pathOrHookObj.description || '',
|
11917 | externalDocs: pathOrHookObj.externalDocs,
|
11918 | shortSummary,
|
11919 | method: methodName,
|
11920 | path: pathOrHookName,
|
11921 | operationId: pathOrHookObj.operationId,
|
11922 | elementId: `${methodName}-${pathOrHookName.replace(invalidCharsRegEx, '-')}`,
|
11923 | servers: pathOrHookObj.servers ? commonPathProp.servers.concat(pathOrHookObj.servers) : commonPathProp.servers,
|
11924 | parameters: finalParameters,
|
11925 | requestBody: pathOrHookObj.requestBody,
|
11926 | responses: pathOrHookObj.responses,
|
11927 | callbacks: pathOrHookObj.callbacks,
|
11928 | deprecated: pathOrHookObj.deprecated,
|
11929 | security: pathOrHookObj.security,
|
11930 |
|
11931 |
|
11932 | xBadges: pathOrHookObj['x-badges'] || undefined,
|
11933 | xCodeSamples: pathOrHookObj['x-codeSamples'] || pathOrHookObj['x-code-samples'] || ''
|
11934 | });
|
11935 | });
|
11936 | }
|
11937 | });
|
11938 | }
|
11939 |
|
11940 | const tagsWithSortedPaths = tags.filter(tag => tag.paths && tag.paths.length > 0);
|
11941 | tagsWithSortedPaths.forEach(tag => {
|
11942 | if (sortEndpointsBy === 'method') {
|
11943 | tag.paths.sort((a, b) => supportedMethods.indexOf(a.method).toString().localeCompare(supportedMethods.indexOf(b.method)));
|
11944 | } else if (sortEndpointsBy === 'summary') {
|
11945 | tag.paths.sort((a, b) => a.shortSummary.localeCompare(b.shortSummary));
|
11946 | } else if (sortEndpointsBy === 'path') {
|
11947 | tag.paths.sort((a, b) => a.path.localeCompare(b.path));
|
11948 | } else if (sortEndpointsBy === 'none') {
|
11949 |
|
11950 | }
|
11951 | tag.firstPathId = tag.paths[0].elementId;
|
11952 | });
|
11953 | return sortTags ? tagsWithSortedPaths.sort((a, b) => a.name.localeCompare(b.name)) : tagsWithSortedPaths;
|
11954 | }
|
11955 | ;
|
11956 |
|
11957 |
|
11958 |
|
11959 |
|
11960 |
|
11961 | const directive_t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},directive_e=t=>(...e)=>({_$litDirective$:t,values:e});class directive_i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
11962 |
|
11963 |
|
11964 | ;
|
11965 |
|
11966 |
|
11967 |
|
11968 |
|
11969 |
|
11970 | class unsafe_html_e extends directive_i{constructor(i){if(super(i),this.it=b,i.type!==directive_t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===b||null==r)return this._t=void 0,this.it=r;if(r===x)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}unsafe_html_e.directiveName="unsafeHTML",unsafe_html_e.resultType=1;const unsafe_html_o=directive_e(unsafe_html_e);
|
11971 |
|
11972 |
|
11973 | ;
|
11974 |
|
11975 |
|
11976 |
|
11977 | ;
|
11978 | var Buffer = __webpack_require__(764)["lW"];
|
11979 |
|
11980 |
|
11981 |
|
11982 |
|
11983 | const codeVerifier = '731DB1C3F7EA533B85E29492D26AA-1234567890-1234567890';
|
11984 | const codeChallenge = '4FatVDBJKPAo4JgLLaaQFMUcQPn5CrPRvLlaob9PTYc';
|
11985 |
|
11986 | const localStorageKey = 'rapidoc';
|
11987 | function applyApiKey(securitySchemeId, username = '', password = '', providedApikeyVal = '') {
|
11988 | var _this$resolvedSpec$se, _securityObj$scheme;
|
11989 | const securityObj = (_this$resolvedSpec$se = this.resolvedSpec.securitySchemes) === null || _this$resolvedSpec$se === void 0 ? void 0 : _this$resolvedSpec$se.find(v => v.securitySchemeId === securitySchemeId);
|
11990 | if (!securityObj) {
|
11991 | return false;
|
11992 | }
|
11993 | let finalApiKeyValue = '';
|
11994 | if (((_securityObj$scheme = securityObj.scheme) === null || _securityObj$scheme === void 0 ? void 0 : _securityObj$scheme.toLowerCase()) === 'basic') {
|
11995 | if (username) {
|
11996 | finalApiKeyValue = `Basic ${Buffer.from(`${username}:${password}`, 'utf8').toString('base64')}`;
|
11997 | }
|
11998 | } else if (providedApikeyVal) {
|
11999 | var _securityObj$scheme2;
|
12000 | securityObj.value = providedApikeyVal;
|
12001 | finalApiKeyValue = `${((_securityObj$scheme2 = securityObj.scheme) === null || _securityObj$scheme2 === void 0 ? void 0 : _securityObj$scheme2.toLowerCase()) === 'bearer' ? 'Bearer ' : ''}${providedApikeyVal}`;
|
12002 | }
|
12003 | if (finalApiKeyValue) {
|
12004 | securityObj.finalKeyValue = finalApiKeyValue;
|
12005 | this.requestUpdate();
|
12006 | return true;
|
12007 | }
|
12008 | return false;
|
12009 | }
|
12010 | function onClearAllApiKeys() {
|
12011 | var _this$resolvedSpec$se2;
|
12012 | (_this$resolvedSpec$se2 = this.resolvedSpec.securitySchemes) === null || _this$resolvedSpec$se2 === void 0 ? void 0 : _this$resolvedSpec$se2.forEach(v => {
|
12013 | v.user = '';
|
12014 | v.password = '';
|
12015 | v.value = '';
|
12016 | v.finalKeyValue = '';
|
12017 | });
|
12018 | this.requestUpdate();
|
12019 | }
|
12020 | function getPersistedApiKeys() {
|
12021 | return JSON.parse(localStorage.getItem(localStorageKey)) || {};
|
12022 | }
|
12023 | function setPersistedApiKeys(obj) {
|
12024 | localStorage.setItem(localStorageKey, JSON.stringify(obj));
|
12025 | }
|
12026 | function recoverPersistedApiKeys() {
|
12027 | const rapidocLs = getPersistedApiKeys.call(this);
|
12028 | Object.values(rapidocLs).forEach(p => {
|
12029 | applyApiKey.call(this, p.securitySchemeId, p.username, p.password, p.value);
|
12030 | });
|
12031 | }
|
12032 | function onApiKeyChange(securitySchemeId) {
|
12033 | let apiKeyValue = '';
|
12034 | const securityObj = this.resolvedSpec.securitySchemes.find(v => v.securitySchemeId === securitySchemeId);
|
12035 | if (securityObj) {
|
12036 | const trEl = this.shadowRoot.getElementById(`security-scheme-${securitySchemeId}`);
|
12037 | if (trEl) {
|
12038 | if (securityObj.type && securityObj.scheme && securityObj.type === 'http' && securityObj.scheme.toLowerCase() === 'basic') {
|
12039 | const userVal = trEl.querySelector('.api-key-user').value.trim();
|
12040 | const passwordVal = trEl.querySelector('.api-key-password').value.trim();
|
12041 | applyApiKey.call(this, securitySchemeId, userVal, passwordVal);
|
12042 | } else {
|
12043 | apiKeyValue = trEl.querySelector('.api-key-input').value.trim();
|
12044 | applyApiKey.call(this, securitySchemeId, '', '', apiKeyValue);
|
12045 | }
|
12046 | if (this.persistAuth === 'true') {
|
12047 | const rapidocLs = getPersistedApiKeys.call(this);
|
12048 | rapidocLs[securitySchemeId] = securityObj;
|
12049 | setPersistedApiKeys.call(this, rapidocLs);
|
12050 | }
|
12051 | }
|
12052 | }
|
12053 | }
|
12054 |
|
12055 |
|
12056 | function updateOAuthKey(securitySchemeId, accessToken, tokenType = 'Bearer') {
|
12057 | const securityObj = this.resolvedSpec.securitySchemes.find(v => v.securitySchemeId === securitySchemeId);
|
12058 | securityObj.finalKeyValue = `${tokenType.toLowerCase() === 'bearer' ? 'Bearer' : tokenType.toLowerCase() === 'mac' ? 'MAC' : tokenType} ${accessToken}`;
|
12059 | this.requestUpdate();
|
12060 | }
|
12061 |
|
12062 |
|
12063 |
|
12064 | async function fetchAccessToken(tokenUrl, clientId, clientSecret, redirectUrl, grantType, authCode, securitySchemeId, authFlowDivEl, sendClientSecretIn = 'header', scopes = null, username = null, password = null) {
|
12065 | const respDisplayEl = authFlowDivEl ? authFlowDivEl.querySelector('.oauth-resp-display') : undefined;
|
12066 | const urlFormParams = new URLSearchParams();
|
12067 | const headers = new Headers();
|
12068 | urlFormParams.append('grant_type', grantType);
|
12069 | if (grantType === 'authorization_code') {
|
12070 | urlFormParams.append('client_id', clientId);
|
12071 | urlFormParams.append('client_secret', clientSecret);
|
12072 | }
|
12073 | if (grantType !== 'client_credentials' && grantType !== 'password') {
|
12074 | urlFormParams.append('redirect_uri', redirectUrl);
|
12075 | }
|
12076 | if (authCode) {
|
12077 | urlFormParams.append('code', authCode);
|
12078 | urlFormParams.append('code_verifier', codeVerifier);
|
12079 | }
|
12080 |
|
12081 | if (sendClientSecretIn === 'header') {
|
12082 | headers.set('Authorization', `Basic ${Buffer.from(`${clientId}:${clientSecret}`, 'utf8').toString('base64')}`);
|
12083 | } else {
|
12084 | urlFormParams.append('client_id', clientId);
|
12085 | urlFormParams.append('client_secret', clientSecret);
|
12086 | }
|
12087 | if (grantType === 'password') {
|
12088 | urlFormParams.append('username', username);
|
12089 | urlFormParams.append('password', password);
|
12090 | }
|
12091 | if (scopes) {
|
12092 | urlFormParams.append('scope', scopes);
|
12093 | }
|
12094 | try {
|
12095 | const resp = await fetch(tokenUrl, {
|
12096 | method: 'POST',
|
12097 | headers,
|
12098 | body: urlFormParams
|
12099 | });
|
12100 | const tokenResp = await resp.json();
|
12101 | if (resp.ok) {
|
12102 | if (tokenResp.token_type && tokenResp.access_token) {
|
12103 | updateOAuthKey.call(this, securitySchemeId, tokenResp.access_token, tokenResp.token_type);
|
12104 | if (respDisplayEl) {
|
12105 | respDisplayEl.innerHTML = '<span style="color:var(--green)">Access Token Received</span>';
|
12106 | }
|
12107 | return true;
|
12108 | }
|
12109 | } else {
|
12110 | if (respDisplayEl) {
|
12111 | respDisplayEl.innerHTML = `<span style="color:var(--red)">${tokenResp.error_description || tokenResp.error_description || 'Unable to get access token'}</span>`;
|
12112 | }
|
12113 | return false;
|
12114 | }
|
12115 | } catch (err) {
|
12116 | if (respDisplayEl) {
|
12117 | respDisplayEl.innerHTML = '<span style="color:var(--red)">Failed to get access token</span>';
|
12118 | }
|
12119 | return false;
|
12120 | }
|
12121 | }
|
12122 |
|
12123 |
|
12124 | async function onWindowMessageEvent(msgEvent, winObj, tokenUrl, clientId, clientSecret, redirectUrl, grantType, sendClientSecretIn, securitySchemeId, authFlowDivEl) {
|
12125 | sessionStorage.removeItem('winMessageEventActive');
|
12126 | winObj.close();
|
12127 | if (msgEvent.data.fake) {
|
12128 | return;
|
12129 | }
|
12130 | if (!msgEvent.data) {
|
12131 | console.warn('RapiDoc: Received no data with authorization message');
|
12132 | }
|
12133 | if (msgEvent.data.error) {
|
12134 | console.warn('RapiDoc: Error while receiving data');
|
12135 | }
|
12136 | if (msgEvent.data) {
|
12137 | if (msgEvent.data.responseType === 'code') {
|
12138 |
|
12139 | fetchAccessToken.call(this, tokenUrl, clientId, clientSecret, redirectUrl, grantType, msgEvent.data.code, securitySchemeId, authFlowDivEl, sendClientSecretIn);
|
12140 | } else if (msgEvent.data.responseType === 'token') {
|
12141 |
|
12142 | updateOAuthKey.call(this, securitySchemeId, msgEvent.data.access_token, msgEvent.data.token_type);
|
12143 | }
|
12144 | }
|
12145 | }
|
12146 |
|
12147 |
|
12148 |
|
12149 |
|
12150 |
|
12151 |
|
12152 |
|
12153 |
|
12154 |
|
12155 |
|
12156 |
|
12157 |
|
12158 |
|
12159 |
|
12160 |
|
12161 | async function onInvokeOAuthFlow(securitySchemeId, flowType, authUrl, tokenUrl, e) {
|
12162 | const authFlowDivEl = e.target.closest('.oauth-flow');
|
12163 | const clientId = authFlowDivEl.querySelector('.oauth-client-id') ? authFlowDivEl.querySelector('.oauth-client-id').value.trim() : '';
|
12164 | const clientSecret = authFlowDivEl.querySelector('.oauth-client-secret') ? authFlowDivEl.querySelector('.oauth-client-secret').value.trim() : '';
|
12165 | const username = authFlowDivEl.querySelector('.api-key-user') ? authFlowDivEl.querySelector('.api-key-user').value.trim() : '';
|
12166 | const password = authFlowDivEl.querySelector('.api-key-password') ? authFlowDivEl.querySelector('.api-key-password').value.trim() : '';
|
12167 | const sendClientSecretIn = authFlowDivEl.querySelector('.oauth-send-client-secret-in') ? authFlowDivEl.querySelector('.oauth-send-client-secret-in').value.trim() : 'header';
|
12168 | const checkedScopeEls = [...authFlowDivEl.querySelectorAll('.scope-checkbox:checked')];
|
12169 | const pkceCheckboxEl = authFlowDivEl.querySelector(`#${securitySchemeId}-pkce`);
|
12170 | const state = `${Math.random().toString(36).slice(2, 9)}random${Math.random().toString(36).slice(2, 9)}`;
|
12171 | const nonce = `${Math.random().toString(36).slice(2, 9)}random${Math.random().toString(36).slice(2, 9)}`;
|
12172 |
|
12173 | const redirectUrlObj = new URL(`${window.location.origin}${window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'))}/${this.oauthReceiver}`);
|
12174 | let grantType = '';
|
12175 | let responseType = '';
|
12176 | let newWindow;
|
12177 |
|
12178 |
|
12179 | const errEls = [...authFlowDivEl.parentNode.querySelectorAll('.oauth-resp-display')];
|
12180 | errEls.forEach(v => {
|
12181 | v.innerHTML = '';
|
12182 | });
|
12183 | if (flowType === 'authorizationCode' || flowType === 'implicit') {
|
12184 | const authUrlObj = new URL(authUrl);
|
12185 | if (flowType === 'authorizationCode') {
|
12186 | grantType = 'authorization_code';
|
12187 | responseType = 'code';
|
12188 | } else if (flowType === 'implicit') {
|
12189 | responseType = 'token';
|
12190 | }
|
12191 | const authCodeParams = new URLSearchParams(authUrlObj.search);
|
12192 | const selectedScopes = checkedScopeEls.map(v => v.value).join(' ');
|
12193 | if (selectedScopes) {
|
12194 | authCodeParams.set('scope', selectedScopes);
|
12195 | }
|
12196 | authCodeParams.set('client_id', clientId);
|
12197 | authCodeParams.set('redirect_uri', redirectUrlObj.toString());
|
12198 | authCodeParams.set('response_type', responseType);
|
12199 | authCodeParams.set('state', state);
|
12200 | authCodeParams.set('nonce', nonce);
|
12201 | if (pkceCheckboxEl && pkceCheckboxEl.checked) {
|
12202 | authCodeParams.set('code_challenge', codeChallenge);
|
12203 | authCodeParams.set('code_challenge_method', 'S256');
|
12204 | }
|
12205 | authCodeParams.set('show_dialog', true);
|
12206 | authUrlObj.search = authCodeParams.toString();
|
12207 |
|
12208 | if (sessionStorage.getItem('winMessageEventActive') === 'true') {
|
12209 | window.postMessage({
|
12210 | fake: true
|
12211 | }, this);
|
12212 | }
|
12213 | setTimeout(() => {
|
12214 | newWindow = window.open(authUrlObj.toString());
|
12215 | if (!newWindow) {
|
12216 | console.error(`RapiDoc: Unable to open ${authUrlObj.toString()} in a new window`);
|
12217 | } else {
|
12218 | sessionStorage.setItem('winMessageEventActive', 'true');
|
12219 | window.addEventListener('message', msgEvent => onWindowMessageEvent.call(this, msgEvent, newWindow, tokenUrl, clientId, clientSecret, redirectUrlObj.toString(), grantType, sendClientSecretIn, securitySchemeId, authFlowDivEl), {
|
12220 | once: true
|
12221 | });
|
12222 | }
|
12223 | }, 10);
|
12224 | } else if (flowType === 'clientCredentials') {
|
12225 | grantType = 'client_credentials';
|
12226 | const selectedScopes = checkedScopeEls.map(v => v.value).join(' ');
|
12227 | fetchAccessToken.call(this, tokenUrl, clientId, clientSecret, redirectUrlObj.toString(), grantType, '', securitySchemeId, authFlowDivEl, sendClientSecretIn, selectedScopes);
|
12228 | } else if (flowType === 'password') {
|
12229 | grantType = 'password';
|
12230 | const selectedScopes = checkedScopeEls.map(v => v.value).join(' ');
|
12231 | fetchAccessToken.call(this, tokenUrl, clientId, clientSecret, redirectUrlObj.toString(), grantType, '', securitySchemeId, authFlowDivEl, sendClientSecretIn, selectedScopes, username, password);
|
12232 | }
|
12233 | }
|
12234 |
|
12235 |
|
12236 |
|
12237 |
|
12238 | function oAuthFlowTemplate(flowName, clientId, clientSecret, securitySchemeId, authFlow, defaultScopes = [], receiveTokenIn = 'header') {
|
12239 | let {
|
12240 | authorizationUrl,
|
12241 | tokenUrl,
|
12242 | refreshUrl
|
12243 | } = authFlow;
|
12244 | const pkceOnly = authFlow['x-pkce-only'] || false;
|
12245 | const isUrlAbsolute = url => url.indexOf('://') > 0 || url.indexOf('//') === 0;
|
12246 |
|
12247 | const url = new URL(this.selectedServer.computedUrl);
|
12248 | const baseUrl = url.origin;
|
12249 | if (refreshUrl && !isUrlAbsolute(refreshUrl)) {
|
12250 | refreshUrl = `${baseUrl}/${refreshUrl.replace(/^\//, '')}`;
|
12251 | }
|
12252 | if (tokenUrl && !isUrlAbsolute(tokenUrl)) {
|
12253 | tokenUrl = `${baseUrl}/${tokenUrl.replace(/^\//, '')}`;
|
12254 | }
|
12255 | if (authorizationUrl && !isUrlAbsolute(authorizationUrl)) {
|
12256 | authorizationUrl = `${baseUrl}/${authorizationUrl.replace(/^\//, '')}`;
|
12257 | }
|
12258 | let flowNameDisplay;
|
12259 | if (flowName === 'authorizationCode') {
|
12260 | flowNameDisplay = 'Authorization Code Flow';
|
12261 | } else if (flowName === 'clientCredentials') {
|
12262 | flowNameDisplay = 'Client Credentials Flow';
|
12263 | } else if (flowName === 'implicit') {
|
12264 | flowNameDisplay = 'Implicit Flow';
|
12265 | } else if (flowName === 'password') {
|
12266 | flowNameDisplay = 'Password Flow';
|
12267 | } else {
|
12268 | flowNameDisplay = flowName;
|
12269 | }
|
12270 | return y`
|
12271 | <div class="oauth-flow ${flowName}" style="padding: 12px 0; margin-bottom:12px;">
|
12272 | <div class="tiny-title upper" style="margin-bottom:8px;">${flowNameDisplay}</div>
|
12273 | ${authorizationUrl ? y`<div style="margin-bottom:5px"><span style="width:75px; display: inline-block;">Auth URL</span> <span class="mono-font"> ${authorizationUrl} </span></div>` : ''}
|
12274 | ${tokenUrl ? y`<div style="margin-bottom:5px"><span style="width:75px; display: inline-block;">Token URL</span> <span class="mono-font">${tokenUrl}</span></div>` : ''}
|
12275 | ${refreshUrl ? y`<div style="margin-bottom:5px"><span style="width:75px; display: inline-block;">Refresh URL</span> <span class="mono-font">${refreshUrl}</span></div>` : ''}
|
12276 | ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'implicit' || flowName === 'password' ? y`
|
12277 | ${authFlow.scopes ? y`
|
12278 | <span> Scopes </span>
|
12279 | <div class= "oauth-scopes" part="section-auth-scopes" style = "width:100%; display:flex; flex-direction:column; flex-wrap:wrap; margin:0 0 10px 24px">
|
12280 | ${Object.entries(authFlow.scopes).map((scopeAndDescr, index) => y`
|
12281 | <div class="m-checkbox" style="display:inline-flex; align-items:center">
|
12282 | <input type="checkbox" part="checkbox checkbox-auth-scope" class="scope-checkbox" id="${securitySchemeId}${flowName}${index}" ?checked="${defaultScopes.includes(scopeAndDescr[0])}" value="${scopeAndDescr[0]}">
|
12283 | <label for="${securitySchemeId}${flowName}${index}" style="margin-left:5px; cursor:pointer">
|
12284 | <span class="mono-font">${scopeAndDescr[0]}</span>
|
12285 | ${scopeAndDescr[0] !== scopeAndDescr[1] ? ` - ${scopeAndDescr[1] || ''}` : ''}
|
12286 | </label>
|
12287 | </div>
|
12288 | `)}
|
12289 | </div>
|
12290 | ` : ''}
|
12291 | ${flowName === 'password' ? y`
|
12292 | <div style="margin:5px 0">
|
12293 | <input type="text" value = "" placeholder="username" spellcheck="false" class="oauth2 ${flowName} ${securitySchemeId} api-key-user" part="textbox textbox-username">
|
12294 | <input type="password" value = "" placeholder="password" spellcheck="false" class="oauth2 ${flowName} ${securitySchemeId} api-key-password" style = "margin:0 5px;" part="textbox textbox-password">
|
12295 | </div>` : ''}
|
12296 | <div>
|
12297 | ${flowName === 'authorizationCode' ? y`
|
12298 | <div style="margin: 16px 0 4px">
|
12299 | <input type="checkbox" part="checkbox checkbox-auth-scope" id="${securitySchemeId}-pkce" checked ?disabled=${pkceOnly}>
|
12300 | <label for="${securitySchemeId}-pkce" style="margin:0 16px 0 4px; line-height:24px; cursor:pointer">
|
12301 | Send Proof Key for Code Exchange (PKCE)
|
12302 | </label>
|
12303 | </div>
|
12304 | ` : ''}
|
12305 | <input type="text" part="textbox textbox-auth-client-id" value = "${clientId || ''}" placeholder="client-id" spellcheck="false" class="oauth2 ${flowName} ${securitySchemeId} oauth-client-id">
|
12306 | ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'password' ? y`
|
12307 | <input
|
12308 | type="password" part="textbox textbox-auth-client-secret"
|
12309 | value = "${clientSecret || ''}" placeholder="client-secret" spellcheck="false"
|
12310 | class="oauth2 ${flowName} ${securitySchemeId}
|
12311 | oauth-client-secret"
|
12312 | style = "margin:0 5px;${pkceOnly ? 'display:none;' : ''}"
|
12313 | >
|
12314 | <select style="margin-right:5px;${pkceOnly ? 'display:none;' : ''}" class="${flowName} ${securitySchemeId} oauth-send-client-secret-in">
|
12315 | <option value = 'header' .selected = ${receiveTokenIn === 'header'} > Authorization Header </option>
|
12316 | <option value = 'request-body' .selected = ${receiveTokenIn === 'request-body'}> Request Body </option>
|
12317 | </select>` : ''}
|
12318 | ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'implicit' || flowName === 'password' ? y`
|
12319 | <button class="m-btn thin-border" part="btn btn-outline"
|
12320 | @click="${e => {
|
12321 | onInvokeOAuthFlow.call(this, securitySchemeId, flowName, authorizationUrl, tokenUrl, e);
|
12322 | }}"
|
12323 | > GET TOKEN </button>` : ''}
|
12324 | </div>
|
12325 | <div class="oauth-resp-display red-text small-font-size"></div>
|
12326 | ` : ''}
|
12327 | </div>
|
12328 | `;
|
12329 | }
|
12330 | function removeApiKey(securitySchemeId) {
|
12331 | var _this$resolvedSpec$se3;
|
12332 | const securityObj = (_this$resolvedSpec$se3 = this.resolvedSpec.securitySchemes) === null || _this$resolvedSpec$se3 === void 0 ? void 0 : _this$resolvedSpec$se3.find(v => v.securitySchemeId === securitySchemeId);
|
12333 | securityObj.user = '';
|
12334 | securityObj.password = '';
|
12335 | securityObj.value = '';
|
12336 | securityObj.finalKeyValue = '';
|
12337 | if (this.persistAuth === 'true') {
|
12338 | const rapidocLs = getPersistedApiKeys.call(this);
|
12339 | delete rapidocLs[securityObj.securitySchemeId];
|
12340 | setPersistedApiKeys.call(this, rapidocLs);
|
12341 | }
|
12342 | this.requestUpdate();
|
12343 | }
|
12344 | function securitySchemeTemplate() {
|
12345 | var _this$resolvedSpec$se4;
|
12346 | if (!this.resolvedSpec) {
|
12347 | return '';
|
12348 | }
|
12349 | const providedApiKeys = (_this$resolvedSpec$se4 = this.resolvedSpec.securitySchemes) === null || _this$resolvedSpec$se4 === void 0 ? void 0 : _this$resolvedSpec$se4.filter(v => v.finalKeyValue);
|
12350 | if (!providedApiKeys) {
|
12351 | return;
|
12352 | }
|
12353 | return y`
|
12354 | <section id='auth' part="section-auth" style="text-align:left; direction:ltr; margin-top:24px; margin-bottom:24px;" class = 'observe-me ${'read focused'.includes(this.renderStyle) ? 'section-gap--read-mode' : 'section-gap '}'>
|
12355 | <div class='sub-title regular-font'> AUTHENTICATION </div>
|
12356 |
|
12357 | <div class="small-font-size" style="display:flex; align-items: center; min-height:30px">
|
12358 | ${providedApiKeys.length > 0 ? y`
|
12359 | <div class="blue-text"> ${providedApiKeys.length} API key applied </div>
|
12360 | <div style="flex:1"></div>
|
12361 | <button class="m-btn thin-border" part="btn btn-outline" @click=${() => {
|
12362 | onClearAllApiKeys.call(this);
|
12363 | }}>CLEAR ALL API KEYS</button>` : y`<div class="red-text">No API key applied</div>`}
|
12364 | </div>
|
12365 | ${this.resolvedSpec.securitySchemes && this.resolvedSpec.securitySchemes.length > 0 ? y`
|
12366 | <table role="presentation" id="auth-table" class='m-table padded-12' style="width:100%;">
|
12367 | ${this.resolvedSpec.securitySchemes.map(v => y`
|
12368 | <tr id="security-scheme-${v.securitySchemeId}" class="${v.type.toLowerCase()}">
|
12369 | <td style="max-width:500px; overflow-wrap: break-word;">
|
12370 | <div style="line-height:28px; margin-bottom:5px;">
|
12371 | <span style="font-weight:bold; font-size:var(--font-size-regular)">${v.typeDisplay}</span>
|
12372 | ${v.finalKeyValue ? y`
|
12373 | <span class='blue-text'> ${v.finalKeyValue ? 'Key Applied' : ''} </span>
|
12374 | <button class="m-btn thin-border small" part="btn btn-outline" @click=${() => {
|
12375 | removeApiKey.call(this, v.securitySchemeId);
|
12376 | }}>REMOVE</button>
|
12377 | ` : ''}
|
12378 | </div>
|
12379 | ${v.description ? y`
|
12380 | <div class="m-markdown">
|
12381 | ${unsafe_html_o(marked(v.description || ''))}
|
12382 | </div>` : ''}
|
12383 |
|
12384 | ${v.type.toLowerCase() === 'apikey' || v.type.toLowerCase() === 'http' && v.scheme.toLowerCase() === 'bearer' ? y`
|
12385 | <div style="margin-bottom:5px">
|
12386 | ${v.type.toLowerCase() === 'apikey' ? y`Send <code>${v.name}</code> in <code>${v.in}</code>` : y`Send <code>Authorization</code> in <code>header</code> containing the word <code>Bearer</code> followed by a space and a Token String.`}
|
12387 | </div>
|
12388 | <div style="max-height:28px;">
|
12389 | ${v.in !== 'cookie' ? y`
|
12390 | <input type = "text" value = "${v.value}" class="${v.type} ${v.securitySchemeId} api-key-input" placeholder = "api-token" spellcheck = "false">
|
12391 | <button class="m-btn thin-border" style = "margin-left:5px;"
|
12392 | part = "btn btn-outline"
|
12393 | @click="${e => {
|
12394 | onApiKeyChange.call(this, v.securitySchemeId, e);
|
12395 | }}">
|
12396 | ${v.finalKeyValue ? 'UPDATE' : 'SET'}
|
12397 | </button>` : y`<span class="gray-text" style="font-size::var(--font-size-small)"> cookies cannot be set from here</span>`}
|
12398 | </div>` : ''}
|
12399 | ${v.type.toLowerCase() === 'http' && v.scheme.toLowerCase() === 'basic' ? y`
|
12400 | <div style="margin-bottom:5px">
|
12401 | Send <code>Authorization</code> in <code>header</code> containing the word <code>Basic</code> followed by a space and a base64 encoded string of <code>username:password</code>.
|
12402 | </div>
|
12403 | <div>
|
12404 | <input type="text" value = "${v.user}" placeholder="username" spellcheck="false" class="${v.type} ${v.securitySchemeId} api-key-user" style="width:100px">
|
12405 | <input type="password" value = "${v.password}" placeholder="password" spellcheck="false" class="${v.type} ${v.securitySchemeId} api-key-password" style = "width:100px; margin:0 5px;">
|
12406 | <button class="m-btn thin-border"
|
12407 | @click="${e => {
|
12408 | onApiKeyChange.call(this, v.securitySchemeId, e);
|
12409 | }}"
|
12410 | part = "btn btn-outline"
|
12411 | >
|
12412 | ${v.finalKeyValue ? 'UPDATE' : 'SET'}
|
12413 | </button>
|
12414 | </div>` : ''}
|
12415 | </td>
|
12416 | </tr>
|
12417 | ${v.type.toLowerCase() === 'oauth2' ? y`
|
12418 | <tr>
|
12419 | <td style="border:none; padding-left:48px">
|
12420 | ${Object.keys(v.flows).map(f => oAuthFlowTemplate.call(this, f, v.flows[f]['x-client-id'] || v['x-client-id'] || '', v.flows[f]['x-client-secret'] || v['x-client-secret'] || '', v.securitySchemeId, v.flows[f], v.flows[f]['x-default-scopes'] || v['x-default-scopes'], v.flows[f]['x-receive-token-in'] || v['x-receive-token-in']))}
|
12421 | </td>
|
12422 | </tr>
|
12423 | ` : ''}
|
12424 | `)}
|
12425 | </table>` : ''}
|
12426 | <slot name="auth"></slot>
|
12427 | </section>
|
12428 | `;
|
12429 | }
|
12430 | function pathSecurityTemplate(pathSecurity) {
|
12431 | if (this.resolvedSpec.securitySchemes && pathSecurity) {
|
12432 | const orSecurityKeys1 = [];
|
12433 | if (Array.isArray(pathSecurity)) {
|
12434 | if (pathSecurity.length === 0) {
|
12435 | return '';
|
12436 | }
|
12437 | } else {
|
12438 | return '';
|
12439 | }
|
12440 | pathSecurity.forEach(pSecurity => {
|
12441 | const andSecurityKeys1 = [];
|
12442 | const andKeyTypes = [];
|
12443 | if (Object.keys(pSecurity).length === 0) {
|
12444 | orSecurityKeys1.push({
|
12445 | securityTypes: 'None',
|
12446 | securityDefs: []
|
12447 | });
|
12448 | } else {
|
12449 | Object.keys(pSecurity).forEach(pathSecurityKey => {
|
12450 | let pathScopes = '';
|
12451 | const s = this.resolvedSpec.securitySchemes.find(ss => ss.securitySchemeId === pathSecurityKey);
|
12452 | if (pSecurity[pathSecurityKey] && Array.isArray(pSecurity[pathSecurityKey])) {
|
12453 | pathScopes = pSecurity[pathSecurityKey].join(', ');
|
12454 | }
|
12455 | if (s) {
|
12456 | andKeyTypes.push(s.typeDisplay);
|
12457 | andSecurityKeys1.push({
|
12458 | ...s,
|
12459 | ...{
|
12460 | scopes: pathScopes
|
12461 | }
|
12462 | });
|
12463 | }
|
12464 | });
|
12465 | orSecurityKeys1.push({
|
12466 | securityTypes: andKeyTypes.length > 1 ? `${andKeyTypes[0]} + ${andKeyTypes.length - 1} more` : andKeyTypes[0],
|
12467 | securityDefs: andSecurityKeys1
|
12468 | });
|
12469 | }
|
12470 | });
|
12471 | return y`<div style="position:absolute; top:3px; right:2px; font-size:var(--font-size-small); line-height: 1.5;">
|
12472 | <div style="position:relative; display:flex; min-width:350px; max-width:700px; justify-content: flex-end;">
|
12473 | <svg width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" fill="none" style="stroke:var(--fg3)"> <rect x="5" y="11" width="14" height="10" rx="2" /> <circle cx="12" cy="16" r="1" /> <path d="M8 11v-4a4 4 0 0 1 8 0v4" /></svg>
|
12474 | ${orSecurityKeys1.map((orSecurityItem1, i) => y`
|
12475 | ${orSecurityItem1.securityTypes ? y`
|
12476 | ${i !== 0 ? y`<div style="padding:3px 4px;"> OR </div>` : ''}
|
12477 | <div class="tooltip">
|
12478 | <div style = "padding:2px 4px; white-space:nowrap; text-overflow:ellipsis;max-width:150px; overflow:hidden;">
|
12479 | ${this.updateRoute === 'true' && this.allowAuthentication === 'true' ? y`<a part="anchor anchor-operation-security" href="#auth"> ${orSecurityItem1.securityTypes} </a>` : y`${orSecurityItem1.securityTypes}`}
|
12480 | </div>
|
12481 | <div class="tooltip-text" style="position:absolute; color: var(--fg); top:26px; right:0; border:1px solid var(--border-color);padding:2px 4px; display:block;">
|
12482 | ${orSecurityItem1.securityDefs.length > 1 ? y`<div>Requires <b>all</b> of the following </div>` : ''}
|
12483 | <div style="padding-left: 8px">
|
12484 | ${orSecurityItem1.securityDefs.map((andSecurityItem, j) => {
|
12485 | const scopeHtml = y`${andSecurityItem.scopes !== '' ? y`
|
12486 | <div>
|
12487 | <b>Required scopes:</b>
|
12488 | <br/>
|
12489 | <div style="margin-left:8px">
|
12490 | ${andSecurityItem.scopes.split(',').map((scope, cnt) => y`${cnt === 0 ? '' : '┃'}<span>${scope}</span>`)}
|
12491 | </div>
|
12492 | </div>` : ''}`;
|
12493 | return y`
|
12494 | ${andSecurityItem.type === 'oauth2' ? y`
|
12495 | <div>
|
12496 | ${orSecurityItem1.securityDefs.length > 1 ? y`<b>${j + 1}.</b> ` : 'Needs'}
|
12497 | OAuth Token <span style="font-family:var(--font-mono); color:var(--primary-color);">${andSecurityItem.securitySchemeId}</span> in <b>Authorization header</b>
|
12498 | ${scopeHtml}
|
12499 | </div>` : andSecurityItem.type === 'http' ? y`
|
12500 | <div>
|
12501 | ${orSecurityItem1.securityDefs.length > 1 ? y`<b>${j + 1}.</b> ` : y`Requires`}
|
12502 | ${andSecurityItem.scheme === 'basic' ? 'Base 64 encoded username:password' : 'Bearer Token'} in <b>Authorization header</b>
|
12503 | ${scopeHtml}
|
12504 | </div>` : y`
|
12505 | <div>
|
12506 | ${orSecurityItem1.securityDefs.length > 1 ? y`<b>${j + 1}.</b> ` : y`Requires`}
|
12507 | Token in <b>${andSecurityItem.name} ${andSecurityItem.in}</b>
|
12508 | ${scopeHtml}
|
12509 | </div>`}`;
|
12510 | })}
|
12511 | </div>
|
12512 | </div>
|
12513 | </div>
|
12514 | ` : ''}
|
12515 | `)}
|
12516 | </div>
|
12517 | `;
|
12518 | }
|
12519 | return '';
|
12520 | }
|
12521 |
|
12522 |
|
12523 | ;
|
12524 |
|
12525 |
|
12526 |
|
12527 |
|
12528 |
|
12529 |
|
12530 | function codeSamplesTemplate(xCodeSamples) {
|
12531 | return y`
|
12532 | <section class="table-title" style="margin-top:24px;">CODE SAMPLES</div>
|
12533 | <div class="tab-panel col"
|
12534 | @click="${e => {
|
12535 | if (!e.target.classList.contains('tab-btn')) {
|
12536 | return;
|
12537 | }
|
12538 | const clickedTab = e.target.dataset.tab;
|
12539 | const tabButtons = [...e.currentTarget.querySelectorAll('.tab-btn')];
|
12540 | const tabContents = [...e.currentTarget.querySelectorAll('.tab-content')];
|
12541 | tabButtons.forEach(tabBtnEl => tabBtnEl.classList[tabBtnEl.dataset.tab === clickedTab ? 'add' : 'remove']('active'));
|
12542 | tabContents.forEach(tabBodyEl => {
|
12543 | tabBodyEl.style.display = tabBodyEl.dataset.tab === clickedTab ? 'block' : 'none';
|
12544 | });
|
12545 | }}">
|
12546 | <div class="tab-buttons row" style="width:100; overflow">
|
12547 | ${xCodeSamples.map((v, i) => y`<button class="tab-btn ${i === 0 ? 'active' : ''}" data-tab = '${v.lang}${i}'> ${v.label || v.lang} </button>`)}
|
12548 | </div>
|
12549 | ${xCodeSamples.map((v, i) => {
|
12550 | var _v$lang, _v$lang2, _v$lang3;
|
12551 | return y`
|
12552 | <div class="tab-content m-markdown" style= "display:${i === 0 ? 'block' : 'none'}" data-tab = '${v.lang}${i}'>
|
12553 | <button class="toolbar-btn" style = "position:absolute; top:12px; right:8px" @click='${e => {
|
12554 | copyToClipboard(v.source, e);
|
12555 | }}'> Copy </button>
|
12556 | <pre><code class="language">${(prism_default()).languages[(_v$lang = v.lang) === null || _v$lang === void 0 ? void 0 : _v$lang.toLowerCase()] ? unsafe_html_o(prism_default().highlight(v.source, (prism_default()).languages[(_v$lang2 = v.lang) === null || _v$lang2 === void 0 ? void 0 : _v$lang2.toLowerCase()], (_v$lang3 = v.lang) === null || _v$lang3 === void 0 ? void 0 : _v$lang3.toLowerCase())) : v.source}</code></pre>
|
12557 | </div>`;
|
12558 | })}
|
12559 | </div>
|
12560 | </section>`;
|
12561 | }
|
12562 |
|
12563 | ;
|
12564 |
|
12565 |
|
12566 |
|
12567 | function callbackTemplate(callbacks) {
|
12568 | return y`
|
12569 | <div class="req-res-title" style="margin-top:12px">CALLBACKS</div>
|
12570 | ${Object.entries(callbacks).map(kv => y`
|
12571 | <div class="tiny-title" style="padding: 12px; border:1px solid var(--light-border-color)">
|
12572 | ${kv[0]}
|
12573 | ${Object.entries(kv[1]).map(pathObj => y`
|
12574 | <div class="mono-font small-font-size" style="display:flex; margin-left:16px;">
|
12575 | <div style="width:100%">
|
12576 | ${Object.entries(pathObj[1]).map(method => {
|
12577 | var _method$, _method$2, _method$3;
|
12578 | return y`
|
12579 | <div>
|
12580 | <div style="margin-top:12px;">
|
12581 | <div class="method method-fg ${method[0]}" style="width:70px; border:none; margin:0; padding:0; line-height:20px; vertical-align: baseline;text-align:left">
|
12582 | <span style="font-size:20px;"> ⥄ </span>
|
12583 | ${method[0]}
|
12584 | </div>
|
12585 | <span style="line-height:20px; vertical-align: baseline;">${pathObj[0]} </span>
|
12586 | </div>
|
12587 | <div class='expanded-req-resp-container'>
|
12588 | <api-request
|
12589 | class = "${this.renderStyle}-mode callback"
|
12590 | style = "width:100%;"
|
12591 | callback = "true"
|
12592 | method = "${method[0] || ''}",
|
12593 | path = "${pathObj[0] || ''}"
|
12594 | .parameters = "${((_method$ = method[1]) === null || _method$ === void 0 ? void 0 : _method$.parameters) || ''}"
|
12595 | .request_body = "${((_method$2 = method[1]) === null || _method$2 === void 0 ? void 0 : _method$2.requestBody) || ''}"
|
12596 | fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
|
12597 | allow-try = "false"
|
12598 | render-style="${this.renderStyle}"
|
12599 | schema-style = "${this.schemaStyle}"
|
12600 | active-schema-tab = "${this.defaultSchemaTab}"
|
12601 | schema-expand-level = "${this.schemaExpandLevel}"
|
12602 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
12603 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
12604 | schema-hide-read-only = "false"
|
12605 | schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : 'true'}"
|
12606 | fetch-credentials = "${this.fetchCredentials}"
|
12607 | exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
12608 | file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
12609 | anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
12610 | > </api-request>
|
12611 |
|
12612 | <api-response
|
12613 | style = "width:100%;"
|
12614 | class = "${this.renderStyle}-mode"
|
12615 | callback = "true"
|
12616 | .responses="${(_method$3 = method[1]) === null || _method$3 === void 0 ? void 0 : _method$3.responses}"
|
12617 | render-style="${this.renderStyle}"
|
12618 | schema-style="${this.schemaStyle}"
|
12619 | active-schema-tab = "${this.defaultSchemaTab}"
|
12620 | schema-expand-level = "${this.schemaExpandLevel}"
|
12621 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
12622 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
12623 | schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : 'true'}"
|
12624 | schema-hide-write-only = "false"
|
12625 | exportparts = "btn:btn, btn-response-status:btn-response-status, btn-selected-response-status:btn-selected-response-status, btn-fill:btn-fill, btn-copy:btn-copy,
|
12626 | schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
12627 | > </api-response>
|
12628 | </div>
|
12629 | </div>
|
12630 | `;
|
12631 | })}
|
12632 | </div>
|
12633 | </div>
|
12634 | `)}
|
12635 | </div>
|
12636 | `)}
|
12637 | `;
|
12638 | }
|
12639 |
|
12640 | ;
|
12641 |
|
12642 |
|
12643 |
|
12644 |
|
12645 |
|
12646 |
|
12647 | const guard_e={},guard_i=directive_e(class extends directive_i{constructor(){super(...arguments),this.ot=guard_e}render(r,t){return t()}update(t,[s,e]){if(Array.isArray(s)){if(Array.isArray(this.ot)&&this.ot.length===s.length&&s.every(((r,t)=>r===this.ot[t])))return x}else if(this.ot===s)return x;return this.ot=Array.isArray(s)?Array.from(s):s,this.render(s,e)}});
|
12648 |
|
12649 |
|
12650 | ;
|
12651 |
|
12652 |
|
12653 |
|
12654 | ;
|
12655 |
|
12656 |
|
12657 |
|
12658 |
|
12659 |
|
12660 | const{I:directive_helpers_l}=L,directive_helpers_t=o=>null===o||"object"!=typeof o&&"function"!=typeof o,directive_helpers_i={HTML:1,SVG:2},directive_helpers_n=(o,l)=>void 0===l?void 0!==(null==o?void 0:o._$litType$):(null==o?void 0:o._$litType$)===l,directive_helpers_d=o=>void 0!==(null==o?void 0:o._$litDirective$),directive_helpers_v=o=>null==o?void 0:o._$litDirective$,directive_helpers_e=o=>void 0===o.strings,directive_helpers_c=()=>document.createComment(""),directive_helpers_r=(o,t,i)=>{var n;const d=o._$AA.parentNode,v=void 0===t?o._$AB:t._$AA;if(void 0===i){const t=d.insertBefore(directive_helpers_c(),v),n=d.insertBefore(directive_helpers_c(),v);i=new directive_helpers_l(t,n,o,o.options)}else{const l=i._$AB.nextSibling,t=i._$AM,e=t!==o;if(e){let l;null===(n=i._$AQ)||void 0===n||n.call(i,o),i._$AM=o,void 0!==i._$AP&&(l=o._$AU)!==t._$AU&&i._$AP(l)}if(l!==v||e){let o=i._$AA;for(;o!==l;){const l=o.nextSibling;d.insertBefore(o,v),o=l}}}return i},directive_helpers_u=(o,l,t=o)=>(o._$AI(l,t),o),directive_helpers_f={},directive_helpers_s=(o,l=directive_helpers_f)=>o._$AH=l,directive_helpers_m=o=>o._$AH,directive_helpers_p=o=>{var l;null===(l=o._$AP)||void 0===l||l.call(o,!1,!0);let t=o._$AA;const i=o._$AB.nextSibling;for(;t!==i;){const o=t.nextSibling;t.remove(),t=o}},directive_helpers_a=o=>{o._$AR()};
|
12661 |
|
12662 |
|
12663 | ;
|
12664 |
|
12665 |
|
12666 |
|
12667 |
|
12668 |
|
12669 | const live_l=directive_e(class extends directive_i{constructor(r){if(super(r),r.type!==directive_t.PROPERTY&&r.type!==directive_t.ATTRIBUTE&&r.type!==directive_t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!directive_helpers_e(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(i,[t]){if(t===x||t===b)return t;const o=i.element,l=i.name;if(i.type===directive_t.PROPERTY){if(t===o[l])return x}else if(i.type===directive_t.BOOLEAN_ATTRIBUTE){if(!!t===o.hasAttribute(l))return x}else if(i.type===directive_t.ATTRIBUTE&&o.getAttribute(l)===t+"")return x;return directive_helpers_s(i),t}});
|
12670 |
|
12671 |
|
12672 | ;
|
12673 |
|
12674 |
|
12675 |
|
12676 |
|
12677 | var dist = __webpack_require__(131);
|
12678 | var dist_default = __webpack_require__.n(dist);
|
12679 | ;
|
12680 |
|
12681 | const border_styles = (i`
|
12682 | .border-top {
|
12683 | border-top:1px solid var(--border-color);
|
12684 | }
|
12685 | .border{
|
12686 | border:1px solid var(--border-color);
|
12687 | border-radius: var(--border-radius);
|
12688 | }
|
12689 | .light-border{
|
12690 | border:1px solid var(--light-border-color);
|
12691 | border-radius: var(--border-radius);
|
12692 | }
|
12693 | .pad-8-16{
|
12694 | padding: 8px 16px;
|
12695 | }
|
12696 | .pad-top-8{
|
12697 | padding-top: 8px;
|
12698 | }
|
12699 | .mar-top-8{
|
12700 | margin-top: 8px;
|
12701 | }
|
12702 | `);
|
12703 | ;
|
12704 |
|
12705 | function getPrintableVal(val) {
|
12706 | if (val === undefined) {
|
12707 | return '';
|
12708 | }
|
12709 | if (val === null) {
|
12710 | return 'null';
|
12711 | }
|
12712 | if (val === '') {
|
12713 | return '∅';
|
12714 | }
|
12715 | if (typeof val === 'boolean' || typeof val === 'number') {
|
12716 | return `${val}`;
|
12717 | }
|
12718 | if (Array.isArray(val)) {
|
12719 | return val.map(v => v === null ? 'null' : v === '' ? '∅' : v.toString().replace(/^ +| +$/g, m => '●'.repeat(m.length)) || '').join(', ');
|
12720 | }
|
12721 | return val.toString().replace(/^ +| +$/g, m => '●'.repeat(m.length)) || '';
|
12722 | }
|
12723 |
|
12724 |
|
12725 | function getTypeInfo(schema) {
|
12726 | if (!schema) {
|
12727 | return;
|
12728 | }
|
12729 | let dataType = '';
|
12730 | let constrain = '';
|
12731 |
|
12732 |
|
12733 | if (schema.$ref) {
|
12734 | const n = schema.$ref.lastIndexOf('/');
|
12735 | const schemaNode = schema.$ref.substring(n + 1);
|
12736 | dataType = `{recursive: ${schemaNode}} `;
|
12737 | } else if (schema.type) {
|
12738 | dataType = Array.isArray(schema.type) ? schema.type.join(schema.length === 2 ? ' or ' : '┃') : schema.type;
|
12739 | if (schema.format || schema.enum || schema.const) {
|
12740 | dataType = dataType.replace('string', schema.enum ? 'enum' : schema.const ? 'const' : schema.format);
|
12741 | }
|
12742 | if (schema.nullable) {
|
12743 | dataType += '┃null';
|
12744 | }
|
12745 | } else if (schema.const) {
|
12746 | dataType = 'const';
|
12747 | } else if (Object.keys(schema).length === 0) {
|
12748 | dataType = 'any';
|
12749 | } else {
|
12750 | dataType = '{missing-type-info}';
|
12751 | }
|
12752 | const info = {
|
12753 | type: dataType,
|
12754 | format: schema.format || '',
|
12755 | pattern: schema.pattern && !schema.enum ? schema.pattern : '',
|
12756 | readOrWriteOnly: schema.readOnly ? '🆁' : schema.writeOnly ? '🆆' : '',
|
12757 | deprecated: schema.deprecated ? '❌' : '',
|
12758 | examples: schema.examples || schema.example,
|
12759 | default: getPrintableVal(schema.default),
|
12760 | description: schema.description || '',
|
12761 | constrain: '',
|
12762 | allowedValues: '',
|
12763 | arrayType: '',
|
12764 | html: ''
|
12765 | };
|
12766 | if (info.type === '{recursive}') {
|
12767 | info.description = schema.$ref.substring(schema.$ref.lastIndexOf('/') + 1);
|
12768 | } else if (info.type === '{missing-type-info}' || info.type === 'any') {
|
12769 | info.description = info.description || '';
|
12770 | }
|
12771 |
|
12772 | info.allowedValues = schema.const ? schema.const : Array.isArray(schema.enum) ? schema.enum.map(v => getPrintableVal(v)).join('┃') : '';
|
12773 | if (dataType === 'array' && schema.items) {
|
12774 | var _schema$items, _schema$items2;
|
12775 | const arrayItemType = (_schema$items = schema.items) === null || _schema$items === void 0 ? void 0 : _schema$items.type;
|
12776 | const arrayItemDefault = getPrintableVal(schema.items.default);
|
12777 | info.arrayType = `${schema.type} of ${Array.isArray(arrayItemType) ? arrayItemType.join('') : arrayItemType}`;
|
12778 | info.default = arrayItemDefault;
|
12779 | info.allowedValues = schema.items.const ? schema.const : Array.isArray((_schema$items2 = schema.items) === null || _schema$items2 === void 0 ? void 0 : _schema$items2.enum) ? schema.items.enum.map(v => getPrintableVal(v)).join('┃') : '';
|
12780 | }
|
12781 | if (dataType.match(/integer|number/g)) {
|
12782 | if (schema.minimum !== undefined || schema.exclusiveMinimum !== undefined) {
|
12783 | constrain += schema.minimum !== undefined ? `Min ${schema.minimum}` : `More than ${schema.exclusiveMinimum}`;
|
12784 | }
|
12785 | if (schema.maximum !== undefined || schema.exclusiveMaximum !== undefined) {
|
12786 | constrain += schema.maximum !== undefined ? `${constrain ? '┃' : ''}Max ${schema.maximum}` : `${constrain ? '┃' : ''}Less than ${schema.exclusiveMaximum}`;
|
12787 | }
|
12788 | if (schema.multipleOf !== undefined) {
|
12789 | constrain += `${constrain ? '┃' : ''} multiple of ${schema.multipleOf}`;
|
12790 | }
|
12791 | }
|
12792 | if (dataType.match(/string/g)) {
|
12793 | if (schema.minLength !== undefined && schema.maxLength !== undefined) {
|
12794 | constrain += `${constrain ? '┃' : ''}${schema.minLength} to ${schema.maxLength} chars`;
|
12795 | } else if (schema.minLength !== undefined) {
|
12796 | constrain += `${constrain ? '┃' : ''}Min ${schema.minLength} chars`;
|
12797 | } else if (schema.maxLength !== undefined) {
|
12798 | constrain += `Max ${constrain ? '┃' : ''}${schema.maxLength} chars`;
|
12799 | }
|
12800 | }
|
12801 | info.constrain = constrain;
|
12802 | info.html = `${info.type}~|~${info.readOrWriteOnly}~|~${info.constrain}~|~${info.default}~|~${info.allowedValues}~|~${info.pattern}~|~${info.description}~|~${schema.title || ''}~|~${info.deprecated ? 'deprecated' : ''}`;
|
12803 | return info;
|
12804 | }
|
12805 | function nestExampleIfPresent(example) {
|
12806 | if (typeof example === 'boolean' || typeof example === 'number') {
|
12807 | return {
|
12808 | Example: {
|
12809 | value: `${example}`
|
12810 | }
|
12811 | };
|
12812 | }
|
12813 | if (example === '') {
|
12814 | return {
|
12815 | Example: {
|
12816 | value: ''
|
12817 | }
|
12818 | };
|
12819 | }
|
12820 | return example ? {
|
12821 | Example: {
|
12822 | value: example
|
12823 | }
|
12824 | } : example;
|
12825 | }
|
12826 |
|
12827 |
|
12828 |
|
12829 |
|
12830 |
|
12831 |
|
12832 |
|
12833 |
|
12834 |
|
12835 |
|
12836 |
|
12837 |
|
12838 |
|
12839 | function normalizeExamples(examples, dataType = 'string') {
|
12840 | if (!examples) {
|
12841 | return {
|
12842 | exampleVal: '',
|
12843 | exampleList: []
|
12844 | };
|
12845 | }
|
12846 | if (examples.constructor === Object) {
|
12847 | const exampleList = Object.values(examples).filter(v => v['x-example-show-value'] !== false).map(v => ({
|
12848 | value: typeof v.value === 'boolean' || typeof v.value === 'number' ? `${v.value}` : v.value || '',
|
12849 | printableValue: getPrintableVal(v.value),
|
12850 | summary: v.summary || '',
|
12851 | description: v.description || ''
|
12852 | }));
|
12853 | const exampleVal = exampleList.length > 0 ? exampleList[0].value.toString() : '';
|
12854 | return {
|
12855 | exampleVal,
|
12856 | exampleList
|
12857 | };
|
12858 | }
|
12859 |
|
12860 |
|
12861 | if (!Array.isArray(examples)) {
|
12862 | examples = examples ? [examples] : [];
|
12863 | }
|
12864 | if (examples.length === 0) {
|
12865 | return {
|
12866 | exampleVal: '',
|
12867 | exampleList: []
|
12868 | };
|
12869 | }
|
12870 | if (dataType === 'array') {
|
12871 | const [exampleVal] = examples;
|
12872 | const exampleList = examples.map(v => ({
|
12873 | value: v,
|
12874 | printableValue: getPrintableVal(v)
|
12875 | }));
|
12876 | return {
|
12877 | exampleVal,
|
12878 | exampleList
|
12879 | };
|
12880 | }
|
12881 | const exampleVal = examples[0].toString();
|
12882 | const exampleList = examples.map(v => ({
|
12883 | value: v.toString(),
|
12884 | printableValue: getPrintableVal(v)
|
12885 | }));
|
12886 | return {
|
12887 | exampleVal,
|
12888 | exampleList
|
12889 | };
|
12890 | }
|
12891 | function anyExampleWithSummaryOrDescription(examples) {
|
12892 | return examples.some(x => {
|
12893 | var _x$summary, _x$description;
|
12894 | return ((_x$summary = x.summary) === null || _x$summary === void 0 ? void 0 : _x$summary.length) > 0 || ((_x$description = x.description) === null || _x$description === void 0 ? void 0 : _x$description.length) > 0;
|
12895 | });
|
12896 | }
|
12897 | function getSampleValueByType(schemaObj) {
|
12898 | const example = schemaObj.examples ? schemaObj.examples[0] : schemaObj.example === null ? null : schemaObj.example || undefined;
|
12899 | if (example === '') {
|
12900 | return '';
|
12901 | }
|
12902 | if (example === null) {
|
12903 | return null;
|
12904 | }
|
12905 | if (example === 0) {
|
12906 | return 0;
|
12907 | }
|
12908 | if (example === false) {
|
12909 | return false;
|
12910 | }
|
12911 | if (example instanceof Date) {
|
12912 | switch (schemaObj.format.toLowerCase()) {
|
12913 | case 'date':
|
12914 | return example.toISOString().split('T')[0];
|
12915 | case 'time':
|
12916 | return example.toISOString().split('T')[1];
|
12917 | default:
|
12918 | return example.toISOString();
|
12919 | }
|
12920 | }
|
12921 | if (example) {
|
12922 | return example;
|
12923 | }
|
12924 | if (Object.keys(schemaObj).length === 0) {
|
12925 | return null;
|
12926 | }
|
12927 | if (schemaObj.$ref) {
|
12928 |
|
12929 | return schemaObj.$ref;
|
12930 | }
|
12931 | if (schemaObj.const === false || schemaObj.const === 0 || schemaObj.const === null || schemaObj.const === '') {
|
12932 | return schemaObj.const;
|
12933 | }
|
12934 | if (schemaObj.const) {
|
12935 | return schemaObj.const;
|
12936 | }
|
12937 | const typeValue = Array.isArray(schemaObj.type) ? schemaObj.type[0] : schemaObj.type;
|
12938 | if (!typeValue) {
|
12939 | return '?';
|
12940 | }
|
12941 | if (typeValue.match(/^integer|^number/g)) {
|
12942 | const multipleOf = Number.isNaN(Number(schemaObj.multipleOf)) ? undefined : Number(schemaObj.multipleOf);
|
12943 | const maximum = Number.isNaN(Number(schemaObj.maximum)) ? undefined : Number(schemaObj.maximum);
|
12944 | const minimumPossibleVal = Number.isNaN(Number(schemaObj.minimum)) ? Number.isNaN(Number(schemaObj.exclusiveMinimum)) ? maximum || 0 : Number(schemaObj.exclusiveMinimum) + (typeValue.startsWith('integer') ? 1 : 0.001) : Number(schemaObj.minimum);
|
12945 | const finalVal = multipleOf ? multipleOf >= minimumPossibleVal ? multipleOf : minimumPossibleVal % multipleOf === 0 ? minimumPossibleVal : Math.ceil(minimumPossibleVal / multipleOf) * multipleOf : minimumPossibleVal;
|
12946 | return finalVal;
|
12947 | }
|
12948 | if (typeValue.match(/^boolean/g)) {
|
12949 | return false;
|
12950 | }
|
12951 | if (typeValue.match(/^null/g)) {
|
12952 | return null;
|
12953 | }
|
12954 | if (typeValue.match(/^string/g)) {
|
12955 | if (schemaObj.enum) {
|
12956 | return schemaObj.enum[0];
|
12957 | }
|
12958 | if (schemaObj.const) {
|
12959 | return schemaObj.const;
|
12960 | }
|
12961 | if (schemaObj.pattern) {
|
12962 | return schemaObj.pattern;
|
12963 | }
|
12964 | if (schemaObj.format) {
|
12965 | const u = `${Date.now().toString(16)}${Math.random().toString(16)}0`.repeat(16);
|
12966 | switch (schemaObj.format.toLowerCase()) {
|
12967 | case 'url':
|
12968 | case 'uri':
|
12969 | return 'http://example.com';
|
12970 | case 'date':
|
12971 | return new Date(0).toISOString().split('T')[0];
|
12972 | case 'time':
|
12973 | return new Date(0).toISOString().split('T')[1];
|
12974 | case 'date-time':
|
12975 | return new Date(0).toISOString();
|
12976 | case 'duration':
|
12977 | return 'P3Y6M4DT12H30M5S';
|
12978 |
|
12979 | case 'email':
|
12980 | case 'idn-email':
|
12981 | return 'user@example.com';
|
12982 | case 'hostname':
|
12983 | case 'idn-hostname':
|
12984 | return 'www.example.com';
|
12985 | case 'ipv4':
|
12986 | return '198.51.100.42';
|
12987 | case 'ipv6':
|
12988 | return '2001:0db8:5b96:0000:0000:426f:8e17:642a';
|
12989 | case 'uuid':
|
12990 | return [u.substr(0, 8), u.substr(8, 4), `4000-8${u.substr(13, 3)}`, u.substr(16, 12)].join('-');
|
12991 | default:
|
12992 | return '';
|
12993 | }
|
12994 | } else {
|
12995 | const minLength = Number.isNaN(schemaObj.minLength) ? undefined : Number(schemaObj.minLength);
|
12996 | const maxLength = Number.isNaN(schemaObj.maxLength) ? undefined : Number(schemaObj.maxLength);
|
12997 | const finalLength = minLength || (maxLength > 6 ? 6 : maxLength || undefined);
|
12998 | return finalLength ? 'A'.repeat(finalLength) : 'string';
|
12999 | }
|
13000 | }
|
13001 |
|
13002 | return '?';
|
13003 | }
|
13004 |
|
13005 |
|
13006 |
|
13007 |
|
13008 |
|
13009 |
|
13010 |
|
13011 |
|
13012 |
|
13013 |
|
13014 |
|
13015 |
|
13016 |
|
13017 |
|
13018 |
|
13019 |
|
13020 |
|
13021 |
|
13022 |
|
13023 |
|
13024 |
|
13025 |
|
13026 |
|
13027 |
|
13028 |
|
13029 | function json2xml(obj, level = 1) {
|
13030 | const indent = ' '.repeat(level);
|
13031 | let xmlText = '';
|
13032 | if (level === 1 && typeof obj !== 'object') {
|
13033 | return `\n${indent}${obj.toString()}`;
|
13034 | }
|
13035 | for (const prop in obj) {
|
13036 | const tagNameOrProp = obj[prop]['::XML_TAG'] || prop;
|
13037 | let tagName = '';
|
13038 | if (Array.isArray(obj[prop])) {
|
13039 | tagName = tagNameOrProp[0]['::XML_TAG'] || `${prop}`;
|
13040 | } else {
|
13041 | tagName = tagNameOrProp;
|
13042 | }
|
13043 | if (prop.startsWith('::')) {
|
13044 | continue;
|
13045 | }
|
13046 | if (Array.isArray(obj[prop])) {
|
13047 | xmlText = `${xmlText}\n${indent}<${tagName}>${json2xml(obj[prop], level + 1)}\n${indent}</${tagName}>`;
|
13048 | } else if (typeof obj[prop] === 'object') {
|
13049 | xmlText = `${xmlText}\n${indent}<${tagName}>${json2xml(obj[prop], level + 1)}\n${indent}</${tagName}>`;
|
13050 | } else {
|
13051 | xmlText = `${xmlText}\n${indent}<${tagName}>${obj[prop].toString()}</${tagName}>`;
|
13052 | }
|
13053 | }
|
13054 | return xmlText;
|
13055 | }
|
13056 | function addSchemaInfoToExample(schema, obj) {
|
13057 | var _schema$xml, _schema$xml3;
|
13058 | if (typeof obj !== 'object' || obj === null) {
|
13059 | return;
|
13060 | }
|
13061 | if (schema.title) {
|
13062 | obj['::TITLE'] = schema.title;
|
13063 | }
|
13064 | if (schema.description) {
|
13065 | obj['::DESCRIPTION'] = schema.description;
|
13066 | }
|
13067 | if ((_schema$xml = schema.xml) !== null && _schema$xml !== void 0 && _schema$xml.name) {
|
13068 | var _schema$xml2;
|
13069 | obj['::XML_TAG'] = (_schema$xml2 = schema.xml) === null || _schema$xml2 === void 0 ? void 0 : _schema$xml2.name;
|
13070 | }
|
13071 | if ((_schema$xml3 = schema.xml) !== null && _schema$xml3 !== void 0 && _schema$xml3.wrapped) {
|
13072 | var _schema$xml4;
|
13073 | obj['::XML_WRAP'] = (_schema$xml4 = schema.xml) === null || _schema$xml4 === void 0 ? void 0 : _schema$xml4.wrapped.toString();
|
13074 | }
|
13075 | }
|
13076 | function removeTitlesAndDescriptions(obj) {
|
13077 | if (typeof obj !== 'object' || obj === null) {
|
13078 | return;
|
13079 | }
|
13080 | delete obj['::TITLE'];
|
13081 | delete obj['::DESCRIPTION'];
|
13082 | delete obj['::XML_TAG'];
|
13083 | delete obj['::XML_WRAP'];
|
13084 | for (const k in obj) {
|
13085 | removeTitlesAndDescriptions(obj[k]);
|
13086 | }
|
13087 | }
|
13088 | function addPropertyExampleToObjectExamples(example, obj, propertyKey) {
|
13089 | for (const key in obj) {
|
13090 | obj[key][propertyKey] = example;
|
13091 | }
|
13092 | }
|
13093 | function mergePropertyExamples(obj, propertyName, propExamples) {
|
13094 |
|
13095 | let i = 0;
|
13096 | const maxCombinations = 10;
|
13097 | const mergedObj = {};
|
13098 | for (const exampleKey in obj) {
|
13099 | for (const propExampleKey in propExamples) {
|
13100 | mergedObj[`example-${i}`] = {
|
13101 | ...obj[exampleKey]
|
13102 | };
|
13103 | mergedObj[`example-${i}`][propertyName] = propExamples[propExampleKey];
|
13104 | i++;
|
13105 | if (i >= maxCombinations) {
|
13106 | break;
|
13107 | }
|
13108 | }
|
13109 | if (i >= maxCombinations) {
|
13110 | break;
|
13111 | }
|
13112 | }
|
13113 | return mergedObj;
|
13114 | }
|
13115 |
|
13116 |
|
13117 | function schemaToSampleObj(schema, config = {}) {
|
13118 | let obj = {};
|
13119 | if (!schema) {
|
13120 | return;
|
13121 | }
|
13122 | if (schema.allOf) {
|
13123 | var _schema$allOf$, _schema$allOf$2;
|
13124 | const objWithAllProps = {};
|
13125 | if (schema.allOf.length === 1 && !((_schema$allOf$ = schema.allOf[0]) !== null && _schema$allOf$ !== void 0 && _schema$allOf$.properties) && !((_schema$allOf$2 = schema.allOf[0]) !== null && _schema$allOf$2 !== void 0 && _schema$allOf$2.items)) {
|
13126 |
|
13127 | if (schema.allOf[0].$ref) {
|
13128 | return '{ }';
|
13129 | }
|
13130 | if (schema.allOf[0].readOnly && config.includeReadOnly) {
|
13131 | const tempSchema = schema.allOf[0];
|
13132 | return getSampleValueByType(tempSchema);
|
13133 | }
|
13134 | return;
|
13135 | }
|
13136 | schema.allOf.forEach(v => {
|
13137 | if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf) {
|
13138 | const partialObj = schemaToSampleObj(v, config);
|
13139 | Object.assign(objWithAllProps, partialObj);
|
13140 | } else if (v.type === 'array' || v.items) {
|
13141 | const partialObj = [schemaToSampleObj(v, config)];
|
13142 | Object.assign(objWithAllProps, partialObj);
|
13143 | } else if (v.type) {
|
13144 | const prop = `prop${Object.keys(objWithAllProps).length}`;
|
13145 | objWithAllProps[prop] = getSampleValueByType(v);
|
13146 | } else {
|
13147 | return '';
|
13148 | }
|
13149 | });
|
13150 | obj = objWithAllProps;
|
13151 | } else if (schema.oneOf) {
|
13152 |
|
13153 | const objWithSchemaProps = {};
|
13154 | if (schema.properties) {
|
13155 | for (const propertyName in schema.properties) {
|
13156 | var _schema$properties$pr;
|
13157 | if (schema.properties[propertyName].properties || (_schema$properties$pr = schema.properties[propertyName].properties) !== null && _schema$properties$pr !== void 0 && _schema$properties$pr.items) {
|
13158 | objWithSchemaProps[propertyName] = schemaToSampleObj(schema.properties[propertyName], config);
|
13159 | } else {
|
13160 | objWithSchemaProps[propertyName] = getSampleValueByType(schema.properties[propertyName]);
|
13161 | }
|
13162 | }
|
13163 | }
|
13164 | if (schema.oneOf.length > 0) {
|
13165 | |
13166 |
|
13167 |
|
13168 |
|
13169 |
|
13170 |
|
13171 |
|
13172 |
|
13173 |
|
13174 |
|
13175 |
|
13176 |
|
13177 |
|
13178 |
|
13179 |
|
13180 |
|
13181 |
|
13182 |
|
13183 |
|
13184 |
|
13185 |
|
13186 |
|
13187 |
|
13188 |
|
13189 |
|
13190 |
|
13191 |
|
13192 |
|
13193 |
|
13194 |
|
13195 |
|
13196 |
|
13197 |
|
13198 | let i = 0;
|
13199 |
|
13200 | for (const key in schema.oneOf) {
|
13201 | const oneOfSamples = schemaToSampleObj(schema.oneOf[key], config);
|
13202 | for (const sampleKey in oneOfSamples) {
|
13203 |
|
13204 | let finalExample;
|
13205 | if (Object.keys(objWithSchemaProps).length > 0) {
|
13206 | if (oneOfSamples[sampleKey] === null || typeof oneOfSamples[sampleKey] !== 'object') {
|
13207 |
|
13208 | continue;
|
13209 | } else {
|
13210 | finalExample = Object.assign(oneOfSamples[sampleKey], objWithSchemaProps);
|
13211 | }
|
13212 | } else {
|
13213 | finalExample = oneOfSamples[sampleKey];
|
13214 | }
|
13215 | obj[`example-${i}`] = finalExample;
|
13216 | addSchemaInfoToExample(schema.oneOf[key], obj[`example-${i}`]);
|
13217 | i++;
|
13218 | }
|
13219 | }
|
13220 | }
|
13221 | } else if (schema.anyOf) {
|
13222 |
|
13223 | let commonObj;
|
13224 | if (schema.type === 'object' || schema.properties) {
|
13225 | commonObj = {
|
13226 | 'example-0': {}
|
13227 | };
|
13228 | for (const propertyName in schema.properties) {
|
13229 | if (schema.example) {
|
13230 | commonObj = schema;
|
13231 | break;
|
13232 | }
|
13233 | if (schema.properties[propertyName].deprecated && !config.includeDeprecated) {
|
13234 | continue;
|
13235 | }
|
13236 | if (schema.properties[propertyName].readOnly && !config.includeReadOnly) {
|
13237 | continue;
|
13238 | }
|
13239 | if (schema.properties[propertyName].writeOnly && !config.includeWriteOnly) {
|
13240 | continue;
|
13241 | }
|
13242 | commonObj = mergePropertyExamples(commonObj, propertyName, schemaToSampleObj(schema.properties[propertyName], config));
|
13243 | }
|
13244 | }
|
13245 |
|
13246 |
|
13247 | let i = 0;
|
13248 | for (const key in schema.anyOf) {
|
13249 | const anyOfSamples = schemaToSampleObj(schema.anyOf[key], config);
|
13250 | for (const sampleKey in anyOfSamples) {
|
13251 | if (typeof commonObj !== 'undefined') {
|
13252 | for (const commonKey in commonObj) {
|
13253 | obj[`example-${i}`] = {
|
13254 | ...commonObj[commonKey],
|
13255 | ...anyOfSamples[sampleKey]
|
13256 | };
|
13257 | }
|
13258 | } else {
|
13259 | obj[`example-${i}`] = anyOfSamples[sampleKey];
|
13260 | }
|
13261 | addSchemaInfoToExample(schema.anyOf[key], obj[`example-${i}`]);
|
13262 | i++;
|
13263 | }
|
13264 | }
|
13265 | } else if (schema.type === 'object' || schema.properties) {
|
13266 | obj['example-0'] = {};
|
13267 | addSchemaInfoToExample(schema, obj['example-0']);
|
13268 | if (schema.example) {
|
13269 | obj['example-0'] = schema.example;
|
13270 | } else {
|
13271 | for (const propertyName in schema.properties) {
|
13272 | var _schema$properties$pr2, _schema$properties$pr3, _schema$properties$pr4, _schema$properties$pr5, _schema$properties$pr6;
|
13273 | if ((_schema$properties$pr2 = schema.properties[propertyName]) !== null && _schema$properties$pr2 !== void 0 && _schema$properties$pr2.deprecated && !config.includeDeprecated) {
|
13274 | continue;
|
13275 | }
|
13276 | if ((_schema$properties$pr3 = schema.properties[propertyName]) !== null && _schema$properties$pr3 !== void 0 && _schema$properties$pr3.readOnly && !config.includeReadOnly) {
|
13277 | continue;
|
13278 | }
|
13279 | if ((_schema$properties$pr4 = schema.properties[propertyName]) !== null && _schema$properties$pr4 !== void 0 && _schema$properties$pr4.writeOnly && !config.includeWriteOnly) {
|
13280 | continue;
|
13281 | }
|
13282 | if (((_schema$properties$pr5 = schema.properties[propertyName]) === null || _schema$properties$pr5 === void 0 ? void 0 : _schema$properties$pr5.type) === 'array' || (_schema$properties$pr6 = schema.properties[propertyName]) !== null && _schema$properties$pr6 !== void 0 && _schema$properties$pr6.items) {
|
13283 | var _schema$properties$pr7, _schema$properties$pr8;
|
13284 | if (schema.properties[propertyName].example) {
|
13285 | addPropertyExampleToObjectExamples(schema.properties[propertyName].example, obj, propertyName);
|
13286 | } else if ((_schema$properties$pr7 = schema.properties[propertyName]) !== null && _schema$properties$pr7 !== void 0 && (_schema$properties$pr8 = _schema$properties$pr7.items) !== null && _schema$properties$pr8 !== void 0 && _schema$properties$pr8.example) {
|
13287 |
|
13288 | addPropertyExampleToObjectExamples([schema.properties[propertyName].items.example], obj, propertyName);
|
13289 | } else {
|
13290 | const itemSamples = schemaToSampleObj(schema.properties[propertyName].items, config);
|
13291 | if (config.useXmlTagForProp) {
|
13292 | var _schema$properties$pr9, _schema$properties$pr10;
|
13293 | const xmlTagName = ((_schema$properties$pr9 = schema.properties[propertyName].xml) === null || _schema$properties$pr9 === void 0 ? void 0 : _schema$properties$pr9.name) || propertyName;
|
13294 | if ((_schema$properties$pr10 = schema.properties[propertyName].xml) !== null && _schema$properties$pr10 !== void 0 && _schema$properties$pr10.wrapped) {
|
13295 | const wrappedItemSample = JSON.parse(`{ "${xmlTagName}" : { "${xmlTagName}" : ${JSON.stringify(itemSamples['example-0'])} } }`);
|
13296 | obj = mergePropertyExamples(obj, xmlTagName, wrappedItemSample);
|
13297 | } else {
|
13298 | obj = mergePropertyExamples(obj, xmlTagName, itemSamples);
|
13299 | }
|
13300 | } else {
|
13301 | const arraySamples = [];
|
13302 | for (const key in itemSamples) {
|
13303 | arraySamples[key] = [itemSamples[key]];
|
13304 | }
|
13305 | obj = mergePropertyExamples(obj, propertyName, arraySamples);
|
13306 | }
|
13307 | }
|
13308 | continue;
|
13309 | }
|
13310 | obj = mergePropertyExamples(obj, propertyName, schemaToSampleObj(schema.properties[propertyName], config));
|
13311 | }
|
13312 | }
|
13313 | } else if (schema.type === 'array' || schema.items) {
|
13314 | if (schema.items || schema.example) {
|
13315 | var _schema$items3;
|
13316 | if (schema.example) {
|
13317 | obj['example-0'] = schema.example;
|
13318 | } else if ((_schema$items3 = schema.items) !== null && _schema$items3 !== void 0 && _schema$items3.example) {
|
13319 |
|
13320 | obj['example-0'] = [schema.items.example];
|
13321 | } else {
|
13322 | const samples = schemaToSampleObj(schema.items, config);
|
13323 | let i = 0;
|
13324 | for (const key in samples) {
|
13325 | obj[`example-${i}`] = [samples[key]];
|
13326 | addSchemaInfoToExample(schema.items, obj[`example-${i}`]);
|
13327 | i++;
|
13328 | }
|
13329 | }
|
13330 | } else {
|
13331 | obj['example-0'] = [];
|
13332 | }
|
13333 | } else {
|
13334 | return {
|
13335 | 'example-0': getSampleValueByType(schema)
|
13336 | };
|
13337 | }
|
13338 | return obj;
|
13339 | }
|
13340 | function generateMarkdownForArrayAndObjectDescription(schema, level = 0) {
|
13341 | var _schema$items4;
|
13342 | let markdown = (schema.description || schema.title) && (schema.minItems || schema.maxItems) ? '<span class="descr-expand-toggle">➔</span>' : '';
|
13343 | if (schema.title) {
|
13344 | if (schema.description) {
|
13345 | markdown = `${markdown} <b>${schema.title}:</b> ${schema.description}<br/>`;
|
13346 | } else {
|
13347 | markdown = `${markdown} ${schema.title}<br/>`;
|
13348 | }
|
13349 | } else if (schema.description) {
|
13350 | markdown = `${markdown} ${schema.description}<br/>`;
|
13351 | }
|
13352 | if (schema.minItems) {
|
13353 | markdown = `${markdown} <b>Min Items:</b> ${schema.minItems}`;
|
13354 | }
|
13355 | if (schema.maxItems) {
|
13356 | markdown = `${markdown} <b>Max Items:</b> ${schema.maxItems}`;
|
13357 | }
|
13358 | if (level > 0 && (_schema$items4 = schema.items) !== null && _schema$items4 !== void 0 && _schema$items4.description) {
|
13359 | let itemsMarkdown = '';
|
13360 | if (schema.items.minProperties) {
|
13361 | itemsMarkdown = `<b>Min Properties:</b> ${schema.items.minProperties}`;
|
13362 | }
|
13363 | if (schema.items.maxProperties) {
|
13364 | itemsMarkdown = `${itemsMarkdown} <b>Max Properties:</b> ${schema.items.maxProperties}`;
|
13365 | }
|
13366 | markdown = `${markdown} ⮕ ${itemsMarkdown} [ ${schema.items.description} ] `;
|
13367 | }
|
13368 | return markdown;
|
13369 | }
|
13370 |
|
13371 |
|
13372 |
|
13373 |
|
13374 |
|
13375 |
|
13376 |
|
13377 |
|
13378 | function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
|
13379 | if (!schema) {
|
13380 | return;
|
13381 | }
|
13382 | if (schema.allOf) {
|
13383 | const objWithAllProps = {};
|
13384 | if (schema.allOf.length === 1 && !schema.allOf[0].properties && !schema.allOf[0].items) {
|
13385 |
|
13386 | const tempSchema = schema.allOf[0];
|
13387 | return `${getTypeInfo(tempSchema).html}`;
|
13388 | }
|
13389 |
|
13390 | schema.allOf.map((v, i) => {
|
13391 | if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf) {
|
13392 | const propSuffix = (v.anyOf || v.oneOf) && i > 0 ? i : '';
|
13393 | const partialObj = schemaInObjectNotation(v, {}, level + 1, propSuffix);
|
13394 | Object.assign(objWithAllProps, partialObj);
|
13395 | } else if (v.type === 'array' || v.items) {
|
13396 | const partialObj = schemaInObjectNotation(v, {}, level + 1);
|
13397 | Object.assign(objWithAllProps, partialObj);
|
13398 | } else if (v.type) {
|
13399 | const prop = `prop${Object.keys(objWithAllProps).length}`;
|
13400 | const typeObj = getTypeInfo(v);
|
13401 | objWithAllProps[prop] = `${typeObj.html}`;
|
13402 | } else {
|
13403 | return '';
|
13404 | }
|
13405 | });
|
13406 | obj = objWithAllProps;
|
13407 | } else if (schema.anyOf || schema.oneOf) {
|
13408 | obj['::description'] = schema.description || '';
|
13409 |
|
13410 | if (schema.type === 'object' || schema.properties) {
|
13411 | obj['::description'] = schema.description || '';
|
13412 | obj['::type'] = 'object';
|
13413 |
|
13414 | for (const key in schema.properties) {
|
13415 | if (schema.required && schema.required.includes(key)) {
|
13416 | obj[`${key}*`] = schemaInObjectNotation(schema.properties[key], {}, level + 1);
|
13417 | } else {
|
13418 | obj[key] = schemaInObjectNotation(schema.properties[key], {}, level + 1);
|
13419 | }
|
13420 | }
|
13421 | }
|
13422 |
|
13423 | const objWithAnyOfProps = {};
|
13424 | const xxxOf = schema.anyOf ? 'anyOf' : 'oneOf';
|
13425 | schema[xxxOf].forEach((v, index) => {
|
13426 | if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf) {
|
13427 | const partialObj = schemaInObjectNotation(v, {});
|
13428 | objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`] = partialObj;
|
13429 | objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`]['::readwrite'] = '';
|
13430 | objWithAnyOfProps['::type'] = 'xxx-of-option';
|
13431 | } else if (v.type === 'array' || v.items) {
|
13432 |
|
13433 | const partialObj = schemaInObjectNotation(v, {});
|
13434 | objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`] = partialObj;
|
13435 | objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`]['::readwrite'] = '';
|
13436 | objWithAnyOfProps['::type'] = 'xxx-of-array';
|
13437 | } else {
|
13438 | const prop = `::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`;
|
13439 | objWithAnyOfProps[prop] = `${getTypeInfo(v).html}`;
|
13440 | objWithAnyOfProps['::type'] = 'xxx-of-option';
|
13441 | }
|
13442 | });
|
13443 | obj[schema.anyOf ? `::ANY~OF ${suffix}` : `::ONE~OF ${suffix}`] = objWithAnyOfProps;
|
13444 |
|
13445 | obj['::type'] = 'object';
|
13446 | } else if (Array.isArray(schema.type)) {
|
13447 |
|
13448 |
|
13449 | const subSchema = JSON.parse(JSON.stringify(schema));
|
13450 | const primitiveType = [];
|
13451 | const complexTypes = [];
|
13452 | subSchema.type.forEach(v => {
|
13453 | var _subSchema$items, _subSchema$items2;
|
13454 | if (v.match(/integer|number|string|null|boolean/g)) {
|
13455 | primitiveType.push(v);
|
13456 | } else if (v === 'array' && typeof ((_subSchema$items = subSchema.items) === null || _subSchema$items === void 0 ? void 0 : _subSchema$items.type) === 'string' && (_subSchema$items2 = subSchema.items) !== null && _subSchema$items2 !== void 0 && _subSchema$items2.type.match(/integer|number|string|null|boolean/g)) {
|
13457 |
|
13458 | if (subSchema.items.type === 'string' && subSchema.items.format) {
|
13459 | primitiveType.push(`[${subSchema.items.format}]`);
|
13460 | } else {
|
13461 | primitiveType.push(`[${subSchema.items.type}]`);
|
13462 | }
|
13463 | } else {
|
13464 | complexTypes.push(v);
|
13465 | }
|
13466 | });
|
13467 | let multiPrimitiveTypes;
|
13468 | if (primitiveType.length > 0) {
|
13469 | subSchema.type = primitiveType.join(primitiveType.length === 2 ? ' or ' : '┃');
|
13470 | multiPrimitiveTypes = getTypeInfo(subSchema);
|
13471 | if (complexTypes.length === 0) {
|
13472 | var _multiPrimitiveTypes;
|
13473 | return `${((_multiPrimitiveTypes = multiPrimitiveTypes) === null || _multiPrimitiveTypes === void 0 ? void 0 : _multiPrimitiveTypes.html) || ''}`;
|
13474 | }
|
13475 | }
|
13476 | if (complexTypes.length > 0) {
|
13477 | var _multiPrimitiveTypes2;
|
13478 | obj['::type'] = 'object';
|
13479 | const multiTypeOptions = {
|
13480 | '::type': 'xxx-of-option'
|
13481 | };
|
13482 |
|
13483 |
|
13484 | complexTypes.forEach((v, i) => {
|
13485 | if (v === 'null') {
|
13486 | multiTypeOptions[`::OPTION~${i + 1}`] = 'NULL~|~~|~~|~~|~~|~~|~~|~~|~';
|
13487 | } else if ('integer, number, string, boolean,'.includes(`${v},`)) {
|
13488 | subSchema.type = Array.isArray(v) ? v.join('┃') : v;
|
13489 | const primitiveTypeInfo = getTypeInfo(subSchema);
|
13490 | multiTypeOptions[`::OPTION~${i + 1}`] = primitiveTypeInfo.html;
|
13491 | } else if (v === 'object') {
|
13492 |
|
13493 | const objTypeOption = {
|
13494 | '::title': schema.title || '',
|
13495 | '::description': schema.description || '',
|
13496 | '::type': 'object',
|
13497 | '::deprecated': schema.deprecated || false
|
13498 | };
|
13499 | for (const key in schema.properties) {
|
13500 | if (schema.required && schema.required.includes(key)) {
|
13501 | objTypeOption[`${key}*`] = schemaInObjectNotation(schema.properties[key], {}, level + 1);
|
13502 | } else {
|
13503 | objTypeOption[key] = schemaInObjectNotation(schema.properties[key], {}, level + 1);
|
13504 | }
|
13505 | }
|
13506 | multiTypeOptions[`::OPTION~${i + 1}`] = objTypeOption;
|
13507 | } else if (v === 'array') {
|
13508 | multiTypeOptions[`::OPTION~${i + 1}`] = {
|
13509 | '::title': schema.title || '',
|
13510 | '::description': schema.description || '',
|
13511 | '::type': 'array',
|
13512 | '::props': schemaInObjectNotation(schema.items, {}, level + 1)
|
13513 | };
|
13514 | }
|
13515 | });
|
13516 | multiTypeOptions[`::OPTION~${complexTypes.length + 1}`] = ((_multiPrimitiveTypes2 = multiPrimitiveTypes) === null || _multiPrimitiveTypes2 === void 0 ? void 0 : _multiPrimitiveTypes2.html) || '';
|
13517 | obj['::ONE~OF'] = multiTypeOptions;
|
13518 | }
|
13519 | } else if (schema.type === 'object' || schema.properties) {
|
13520 |
|
13521 | obj['::title'] = schema.title || '';
|
13522 | obj['::description'] = generateMarkdownForArrayAndObjectDescription(schema, level);
|
13523 | obj['::type'] = 'object';
|
13524 | if (Array.isArray(schema.type) && schema.type.includes('null') || schema.nullable) {
|
13525 | obj['::dataTypeLabel'] = 'object or null';
|
13526 | }
|
13527 | obj['::deprecated'] = schema.deprecated || false;
|
13528 | obj['::readwrite'] = schema.readOnly ? 'readonly' : schema.writeOnly ? 'writeonly' : '';
|
13529 | for (const key in schema.properties) {
|
13530 | if (schema.required && schema.required.includes(key)) {
|
13531 | obj[`${key}*`] = schemaInObjectNotation(schema.properties[key], {}, level + 1);
|
13532 | } else {
|
13533 | obj[key] = schemaInObjectNotation(schema.properties[key], {}, level + 1);
|
13534 | }
|
13535 | }
|
13536 | for (const key in schema.patternProperties) {
|
13537 | obj[`[pattern: ${key}]`] = schemaInObjectNotation(schema.patternProperties[key], obj, level + 1);
|
13538 | }
|
13539 | if (schema.additionalProperties) {
|
13540 | obj['[any-key]'] = schemaInObjectNotation(schema.additionalProperties, {});
|
13541 | }
|
13542 | } else if (schema.type === 'array' || schema.items) {
|
13543 | var _schema$items5;
|
13544 |
|
13545 | obj['::title'] = schema.title || '';
|
13546 | obj['::description'] = generateMarkdownForArrayAndObjectDescription(schema, level);
|
13547 | obj['::type'] = 'array';
|
13548 | if (Array.isArray(schema.type) && schema.type.includes('null') || schema.nullable) {
|
13549 | obj['::dataTypeLabel'] = 'array or null';
|
13550 | }
|
13551 | obj['::deprecated'] = schema.deprecated || false;
|
13552 | obj['::readwrite'] = schema.readOnly ? 'readonly' : schema.writeOnly ? 'writeonly' : '';
|
13553 | if ((_schema$items5 = schema.items) !== null && _schema$items5 !== void 0 && _schema$items5.items) {
|
13554 | obj['::array-type'] = schema.items.items.type;
|
13555 | }
|
13556 | obj['::props'] = schemaInObjectNotation(schema.items, {}, level + 1);
|
13557 | } else {
|
13558 | const typeObj = getTypeInfo(schema);
|
13559 | if (typeObj !== null && typeObj !== void 0 && typeObj.html) {
|
13560 | return `${typeObj.html}`;
|
13561 | }
|
13562 | return '';
|
13563 | }
|
13564 | return obj;
|
13565 | }
|
13566 |
|
13567 |
|
13568 | function generateExample(schema, mimeType, examples = '', example = '', includeReadOnly = true, includeWriteOnly = true, outputType = 'json', includeGeneratedExample = false) {
|
13569 | const finalExamples = [];
|
13570 |
|
13571 | if (examples) {
|
13572 | for (const eg in examples) {
|
13573 | let egContent = '';
|
13574 | let egFormat = 'json';
|
13575 | if (mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('json')) {
|
13576 | if (outputType === 'text') {
|
13577 | egContent = typeof examples[eg].value === 'string' ? examples[eg].value : JSON.stringify(examples[eg].value, undefined, 2);
|
13578 | egFormat = 'text';
|
13579 | } else {
|
13580 | egContent = examples[eg].value;
|
13581 | if (typeof examples[eg].value === 'string') {
|
13582 | try {
|
13583 |
|
13584 | const fixedJsonString = examples[eg].value;
|
13585 | egContent = JSON.parse(fixedJsonString);
|
13586 | egFormat = 'json';
|
13587 | } catch (err) {
|
13588 | egFormat = 'text';
|
13589 | egContent = examples[eg].value;
|
13590 | }
|
13591 | }
|
13592 | }
|
13593 | } else {
|
13594 | egContent = examples[eg].value;
|
13595 | egFormat = 'text';
|
13596 | }
|
13597 | finalExamples.push({
|
13598 | exampleId: eg,
|
13599 | exampleSummary: examples[eg].summary || eg,
|
13600 | exampleDescription: examples[eg].description || '',
|
13601 | exampleType: mimeType,
|
13602 | exampleValue: egContent,
|
13603 | exampleFormat: egFormat
|
13604 | });
|
13605 | }
|
13606 | } else if (example) {
|
13607 | let egContent = '';
|
13608 | let egFormat = 'json';
|
13609 | if (mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('json')) {
|
13610 | if (outputType === 'text') {
|
13611 | egContent = typeof example === 'string' ? example : JSON.stringify(example, undefined, 2);
|
13612 | egFormat = 'text';
|
13613 | } else if (typeof example === 'object') {
|
13614 | egContent = example;
|
13615 | egFormat = 'json';
|
13616 | } else if (typeof example === 'string') {
|
13617 | try {
|
13618 | egContent = JSON.parse(example);
|
13619 | egFormat = 'json';
|
13620 | } catch (err) {
|
13621 | egFormat = 'text';
|
13622 | egContent = example;
|
13623 | }
|
13624 | }
|
13625 | } else {
|
13626 | egContent = example;
|
13627 | egFormat = 'text';
|
13628 | }
|
13629 | finalExamples.push({
|
13630 | exampleId: 'Example',
|
13631 | exampleSummary: '',
|
13632 | exampleDescription: '',
|
13633 | exampleType: mimeType,
|
13634 | exampleValue: egContent,
|
13635 | exampleFormat: egFormat
|
13636 | });
|
13637 | }
|
13638 |
|
13639 | if (finalExamples.length === 0 || includeGeneratedExample === true) {
|
13640 | if (schema) {
|
13641 | if (schema.example) {
|
13642 |
|
13643 | finalExamples.push({
|
13644 | exampleId: 'Example',
|
13645 | exampleSummary: '',
|
13646 | exampleDescription: '',
|
13647 | exampleType: mimeType,
|
13648 | exampleValue: schema.example,
|
13649 | exampleFormat: mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('json') && typeof schema.example === 'object' ? 'json' : 'text'
|
13650 | });
|
13651 | } else if (mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('json') || mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('text') || mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('*/*') || mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('xml')) {
|
13652 | let xmlRootStart = '';
|
13653 | let xmlRootEnd = '';
|
13654 | let exampleFormat = '';
|
13655 | let exampleValue = '';
|
13656 | if (mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('xml')) {
|
13657 | var _schema$xml5, _schema$xml6;
|
13658 | xmlRootStart = (_schema$xml5 = schema.xml) !== null && _schema$xml5 !== void 0 && _schema$xml5.name ? `<${schema.xml.name} ${schema.xml.namespace ? `xmlns="${schema.xml.namespace}"` : ''}>` : '<root>';
|
13659 | xmlRootEnd = (_schema$xml6 = schema.xml) !== null && _schema$xml6 !== void 0 && _schema$xml6.name ? `</${schema.xml.name}>` : '</root>';
|
13660 | exampleFormat = 'text';
|
13661 | } else {
|
13662 | exampleFormat = outputType;
|
13663 | }
|
13664 | const samples = schemaToSampleObj(schema, {
|
13665 | includeReadOnly,
|
13666 | includeWriteOnly,
|
13667 | deprecated: true,
|
13668 | useXmlTagForProp: mimeType === null || mimeType === void 0 ? void 0 : mimeType.toLowerCase().includes('xml')
|
13669 | });
|
13670 | let i = 0;
|
13671 | for (const samplesKey in samples) {
|
13672 | if (!samples[samplesKey]) {
|
13673 | continue;
|
13674 | }
|
13675 | const summary = samples[samplesKey]['::TITLE'] || `Example ${++i}`;
|
13676 | const description = samples[samplesKey]['::DESCRIPTION'] || '';
|
13677 | if (mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('xml')) {
|
13678 | exampleValue = `<?xml version="1.0" encoding="UTF-8"?>\n${xmlRootStart}${json2xml(samples[samplesKey], 1)}\n${xmlRootEnd}`;
|
13679 | } else {
|
13680 | removeTitlesAndDescriptions(samples[samplesKey]);
|
13681 | exampleValue = outputType === 'text' ? JSON.stringify(samples[samplesKey], null, 2) : samples[samplesKey];
|
13682 | }
|
13683 | finalExamples.push({
|
13684 | exampleId: samplesKey,
|
13685 | exampleSummary: summary,
|
13686 | exampleDescription: description,
|
13687 | exampleType: mimeType,
|
13688 | exampleFormat,
|
13689 | exampleValue
|
13690 | });
|
13691 | }
|
13692 | } else if (mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('jose')) {
|
13693 | finalExamples.push({
|
13694 | exampleId: 'Example',
|
13695 | exampleSummary: 'Base64 Encoded',
|
13696 | exampleDescription: '',
|
13697 | exampleType: mimeType,
|
13698 | exampleValue: schema.pattern || 'bXJpbg==',
|
13699 | exampleFormat: 'text'
|
13700 | });
|
13701 | } else {
|
13702 | finalExamples.push({
|
13703 | exampleId: 'Example',
|
13704 | exampleSummary: '',
|
13705 | exampleDescription: '',
|
13706 | exampleType: mimeType,
|
13707 | exampleValue: '',
|
13708 | exampleFormat: 'text'
|
13709 | });
|
13710 | }
|
13711 | } else {
|
13712 |
|
13713 | finalExamples.push({
|
13714 | exampleId: 'Example',
|
13715 | exampleSummary: '',
|
13716 | exampleDescription: '',
|
13717 | exampleType: mimeType,
|
13718 | exampleValue: '',
|
13719 | exampleFormat: 'text'
|
13720 | });
|
13721 | }
|
13722 | }
|
13723 | return finalExamples;
|
13724 | }
|
13725 | function getSerializeStyleForContentType(contentType) {
|
13726 | if (contentType === 'application/json') {
|
13727 | return 'json';
|
13728 | }
|
13729 | if (contentType === 'application/xml') {
|
13730 | return 'xml';
|
13731 | }
|
13732 | return null;
|
13733 | }
|
13734 | function getSchemaFromParam(param) {
|
13735 | if (param.schema) {
|
13736 | return [param.schema, null, null];
|
13737 | }
|
13738 | if (param.content) {
|
13739 |
|
13740 | for (const contentType of Object.keys(param.content)) {
|
13741 | if (param.content[contentType].schema) {
|
13742 | return [param.content[contentType].schema, getSerializeStyleForContentType(contentType), param.content[contentType]];
|
13743 | }
|
13744 | }
|
13745 | }
|
13746 | return [null, null, null];
|
13747 | }
|
13748 | ;
|
13749 |
|
13750 |
|
13751 |
|
13752 |
|
13753 |
|
13754 |
|
13755 | class JsonTree extends lit_element_s {
|
13756 | static get properties() {
|
13757 | return {
|
13758 | data: {
|
13759 | type: Object
|
13760 | },
|
13761 | renderStyle: {
|
13762 | type: String,
|
13763 | attribute: 'render-style'
|
13764 | }
|
13765 | };
|
13766 | }
|
13767 | static get styles() {
|
13768 | return [font_styles, border_styles, input_styles, i`
|
13769 | :host{
|
13770 | display:flex;
|
13771 | }
|
13772 | :where(button, input[type="checkbox"], [tabindex="0"]):focus-visible { box-shadow: var(--focus-shadow); }
|
13773 | :where(input[type="text"], input[type="password"], select, textarea):focus-visible { border-color: var(--primary-color); }
|
13774 | .json-tree {
|
13775 | position: relative;
|
13776 | font-family: var(--font-mono);
|
13777 | font-size: var(--font-size-small);
|
13778 | display:inline-block;
|
13779 | overflow:hidden;
|
13780 | word-break: break-all;
|
13781 | flex:1;
|
13782 | line-height: calc(var(--font-size-small) + 6px);
|
13783 | min-height: 40px;
|
13784 | direction: ltr;
|
13785 | text-align: left;
|
13786 | }
|
13787 |
|
13788 | .open-bracket {
|
13789 | display:inline-block;
|
13790 | padding: 0 20px 0 0;
|
13791 | cursor:pointer;
|
13792 | border: 1px solid transparent;
|
13793 | border-radius:3px;
|
13794 | }
|
13795 | .close-bracket {
|
13796 | border: 1px solid transparent;
|
13797 | border-radius:3px;
|
13798 | display:inline-block;
|
13799 | }
|
13800 | .open-bracket:hover {
|
13801 | color:var(--primary-color);
|
13802 | background-color:var(--hover-color);
|
13803 | border: 1px solid var(--border-color);
|
13804 | }
|
13805 | .open-bracket.expanded:hover ~ .inside-bracket {
|
13806 | border-left: 1px solid var(--fg3);
|
13807 | }
|
13808 | .open-bracket.expanded:hover ~ .close-bracket {
|
13809 | color:var(--primary-color);
|
13810 | }
|
13811 | .inside-bracket {
|
13812 | padding-left:12px;
|
13813 | overflow: hidden;
|
13814 | border-left:1px dotted var(--border-color);
|
13815 | }
|
13816 | .open-bracket.collapsed + .inside-bracket,
|
13817 | .open-bracket.collapsed + .inside-bracket + .close-bracket {
|
13818 | display:none;
|
13819 | }
|
13820 |
|
13821 | .string{color:var(--green);}
|
13822 | .number{color:var(--blue);}
|
13823 | .null{color:var(--red);}
|
13824 | .boolean{color:var(--purple);}
|
13825 | .object{color:var(--fg)}
|
13826 | .toolbar {
|
13827 | position: absolute;
|
13828 | top:5px;
|
13829 | right:6px;
|
13830 | display:flex;
|
13831 | padding:2px;
|
13832 | align-items: center;
|
13833 | }`, custom_styles];
|
13834 | }
|
13835 |
|
13836 |
|
13837 | render() {
|
13838 | return y`
|
13839 | <div class = "json-tree" @click='${e => {
|
13840 | if (e.target.classList.contains('btn-copy')) {
|
13841 | copyToClipboard(JSON.stringify(this.data, null, 2), e);
|
13842 | } else {
|
13843 | this.toggleExpand(e);
|
13844 | }
|
13845 | }}'>
|
13846 | <div class='toolbar'>
|
13847 | <button class="toolbar-btn btn-copy" part="btn btn-fill btn-copy"> Copy </button>
|
13848 | </div>
|
13849 | ${this.generateTree(this.data, true)}
|
13850 | </div>
|
13851 | `;
|
13852 | }
|
13853 | generateTree(data, isLast = false) {
|
13854 | if (data === null) {
|
13855 | return y`<div class="null" style="display:inline;">null</div>`;
|
13856 | }
|
13857 | if (typeof data === 'object' && data instanceof Date === false) {
|
13858 | const detailType = Array.isArray(data) ? 'array' : 'pure_object';
|
13859 | if (Object.keys(data).length === 0) {
|
13860 | return y`${Array.isArray(data) ? '[ ],' : '{ },'}`;
|
13861 | }
|
13862 | return y`
|
13863 | <div class="open-bracket expanded ${detailType === 'array' ? 'array' : 'object'}" > ${detailType === 'array' ? '[' : '{'}</div>
|
13864 | <div class="inside-bracket">
|
13865 | ${Object.keys(data).map((key, i, a) => y`
|
13866 | <div class="item">
|
13867 | ${detailType === 'pure_object' ? y`"${key}":` : ''}
|
13868 | ${this.generateTree(data[key], i === a.length - 1)}
|
13869 | </div>`)}
|
13870 | </div>
|
13871 | <div class="close-bracket">${detailType === 'array' ? ']' : '}'}${isLast ? '' : ','}</div>
|
13872 | `;
|
13873 | }
|
13874 | return typeof data === 'string' || data instanceof Date ? y`<span class="${typeof data}">"${data}"</span>${isLast ? '' : ','}` : y`<span class="${typeof data}">${data}</span>${isLast ? '' : ','}`;
|
13875 | }
|
13876 |
|
13877 |
|
13878 | toggleExpand(e) {
|
13879 | const openBracketEl = e.target;
|
13880 | if (e.target.classList.contains('open-bracket')) {
|
13881 | if (openBracketEl.classList.contains('expanded')) {
|
13882 | openBracketEl.classList.replace('expanded', 'collapsed');
|
13883 | e.target.innerHTML = e.target.classList.contains('array') ? '[...]' : '{...}';
|
13884 | } else {
|
13885 | openBracketEl.classList.replace('collapsed', 'expanded');
|
13886 | e.target.innerHTML = e.target.classList.contains('array') ? '[' : '{';
|
13887 | }
|
13888 | }
|
13889 | }
|
13890 | }
|
13891 |
|
13892 | customElements.define('json-tree', JsonTree);
|
13893 | ;
|
13894 |
|
13895 | const schema_styles = (i`
|
13896 |
|
13897 | *, *:before, *:after { box-sizing: border-box; }
|
13898 |
|
13899 | .tr {
|
13900 | display: flex;
|
13901 | flex: none;
|
13902 | width: 100%;
|
13903 | box-sizing: content-box;
|
13904 | border-bottom: 1px dotted transparent;
|
13905 | transition: max-height 0.3s ease-out;
|
13906 | }
|
13907 | .td {
|
13908 | display: block;
|
13909 | flex: 0 0 auto;
|
13910 | }
|
13911 | .key {
|
13912 | font-family: var(--font-mono);
|
13913 | white-space: normal;
|
13914 | word-break: break-all;
|
13915 | }
|
13916 |
|
13917 | .collapsed-all-descr .key {
|
13918 | overflow:hidden;
|
13919 | }
|
13920 | .expanded-all-descr .key-descr .descr-expand-toggle {
|
13921 | display:none;
|
13922 | }
|
13923 |
|
13924 | .key-descr .descr-expand-toggle {
|
13925 | display:inline-block;
|
13926 | user-select:none;
|
13927 | color: var(--fg);
|
13928 | cursor: pointer;
|
13929 | transform: rotate(45deg);
|
13930 | transition: transform .2s ease;
|
13931 | }
|
13932 |
|
13933 | .expanded-descr .key-descr .descr-expand-toggle {
|
13934 | transform: rotate(270deg)
|
13935 | }
|
13936 |
|
13937 | .key-descr .descr-expand-toggle:hover {
|
13938 | color: var(--primary-color);
|
13939 | }
|
13940 |
|
13941 | .expanded-descr .more-content { display:none; }
|
13942 |
|
13943 | .key-descr {
|
13944 | font-family:var(--font-regular);
|
13945 | color:var(--light-fg);
|
13946 | flex-shrink: 1;
|
13947 | text-overflow: ellipsis;
|
13948 | overflow: hidden;
|
13949 | display: none;
|
13950 | }
|
13951 | .expanded-descr .key-descr{
|
13952 | max-height:auto;
|
13953 | overflow:hidden;
|
13954 | display: none;
|
13955 | }
|
13956 |
|
13957 | .xxx-of-key {
|
13958 | font-size: calc(var(--font-size-small) - 2px);
|
13959 | font-weight:bold;
|
13960 | background-color:var(--primary-color);
|
13961 | color:var(--primary-color-invert);
|
13962 | border-radius:2px;
|
13963 | line-height:calc(var(--font-size-small) + 6px);
|
13964 | padding:0px 5px;
|
13965 | margin-bottom:1px;
|
13966 | display:inline-block;
|
13967 | }
|
13968 |
|
13969 | .xxx-of-descr {
|
13970 | font-family: var(--font-regular);
|
13971 | color: var(--primary-color);
|
13972 | font-size: calc(var(--font-size-small) - 1px);
|
13973 | margin-left: 2px;
|
13974 | }
|
13975 |
|
13976 | .stri, .string, .uri, .url, .byte, .bina, .date, .pass, .ipv4, .ipv4, .uuid, .emai, .host {color:var(--green);}
|
13977 | .inte, .numb, .number, .int6, .int3, .floa, .doub, .deci .blue {color:var(--blue);}
|
13978 | .null {color:var(--red);}
|
13979 | .bool, .boolean{color:var(--orange)}
|
13980 | .enum {color:var(--purple)}
|
13981 | .cons {color:var(--purple)}
|
13982 | .recu {color:var(--brown)}
|
13983 | .toolbar {
|
13984 | display:flex;
|
13985 | width:100%;
|
13986 | padding: 2px 0;
|
13987 | color:var(--primary-color);
|
13988 | }
|
13989 | .toolbar-item {
|
13990 | cursor:pointer;
|
13991 | padding:5px 0;
|
13992 | margin:0 2px;
|
13993 | }
|
13994 | .schema-root-type {
|
13995 | cursor:auto;
|
13996 | color:var(--fg2);
|
13997 | font-weight: bold;
|
13998 | text-transform: uppercase;
|
13999 | }
|
14000 | .toolbar-item:first-of-type { margin:0 2px 0 0;}
|
14001 |
|
14002 | @media only screen and (min-width: 500px) {
|
14003 | .key-descr {
|
14004 | display: block;
|
14005 | }
|
14006 | .expanded-descr .key-descr{
|
14007 | display: block;
|
14008 | }
|
14009 | }
|
14010 | `);
|
14011 | ;
|
14012 |
|
14013 |
|
14014 |
|
14015 |
|
14016 |
|
14017 |
|
14018 |
|
14019 | class SchemaTree extends lit_element_s {
|
14020 | static get properties() {
|
14021 | return {
|
14022 | data: {
|
14023 | type: Object
|
14024 | },
|
14025 | schemaExpandLevel: {
|
14026 | type: Number,
|
14027 | attribute: 'schema-expand-level'
|
14028 | },
|
14029 | schemaDescriptionExpanded: {
|
14030 | type: String,
|
14031 | attribute: 'schema-description-expanded'
|
14032 | },
|
14033 | allowSchemaDescriptionExpandToggle: {
|
14034 | type: String,
|
14035 | attribute: 'allow-schema-description-expand-toggle'
|
14036 | },
|
14037 | schemaHideReadOnly: {
|
14038 | type: String,
|
14039 | attribute: 'schema-hide-read-only'
|
14040 | },
|
14041 | schemaHideWriteOnly: {
|
14042 | type: String,
|
14043 | attribute: 'schema-hide-write-only'
|
14044 | }
|
14045 | };
|
14046 | }
|
14047 | connectedCallback() {
|
14048 | super.connectedCallback();
|
14049 | if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) {
|
14050 | this.schemaExpandLevel = 99999;
|
14051 | }
|
14052 | if (!this.schemaDescriptionExpanded || !'true false'.includes(this.schemaDescriptionExpanded)) {
|
14053 | this.schemaDescriptionExpanded = 'false';
|
14054 | }
|
14055 | if (!this.schemaHideReadOnly || !'true false'.includes(this.schemaHideReadOnly)) {
|
14056 | this.schemaHideReadOnly = 'true';
|
14057 | }
|
14058 | if (!this.schemaHideWriteOnly || !'true false'.includes(this.schemaHideWriteOnly)) {
|
14059 | this.schemaHideWriteOnly = 'true';
|
14060 | }
|
14061 | }
|
14062 | static get styles() {
|
14063 | return [font_styles, schema_styles, border_styles, i`
|
14064 | .tree {
|
14065 | font-size:var(--font-size-small);
|
14066 | text-align: left;
|
14067 | direction: ltr;
|
14068 | line-height:calc(var(--font-size-small) + 6px);
|
14069 | }
|
14070 | .tree .tr:hover{
|
14071 | background-color:var(--hover-color);
|
14072 | }
|
14073 | .collapsed-all-descr .tr:not(.expanded-descr) {
|
14074 | overflow: hidden;
|
14075 | max-height:calc(var(--font-size-small) + 8px);
|
14076 | }
|
14077 | .tree .key {
|
14078 | max-width: 300px;
|
14079 | }
|
14080 | .key.deprecated .key-label {
|
14081 | color: var(--red);
|
14082 | }
|
14083 | .tr.expanded:hover > .td.key > .open-bracket {
|
14084 | color: var(--primary-color);
|
14085 | }
|
14086 | .tr.expanded:hover + .inside-bracket {
|
14087 | border-left: 1px solid var(--fg3);
|
14088 | }
|
14089 | .tr.expanded:hover + .inside-bracket + .close-bracket {
|
14090 | color: var(--primary-color);
|
14091 | }
|
14092 | .inside-bracket.xxx-of-option {
|
14093 | border-left: 1px solid transparent;
|
14094 | }
|
14095 | .open-bracket{
|
14096 | display:inline-block;
|
14097 | padding: 0 20px 0 0;
|
14098 | cursor:pointer;
|
14099 | border: 1px solid transparent;
|
14100 | border-radius:3px;
|
14101 | }
|
14102 | .open-bracket:hover {
|
14103 | color:var(--primary-color);
|
14104 | background-color:var(--hover-color);
|
14105 | border: 1px solid var(--border-color);
|
14106 | }
|
14107 | .close-bracket{
|
14108 | display:inline-block;
|
14109 | font-family: var(--font-mono);
|
14110 | }
|
14111 | .tr.collapsed + .inside-bracket,
|
14112 | .tr.collapsed + .inside-bracket + .close-bracket{
|
14113 | overflow: hidden;
|
14114 | display:none;
|
14115 | }
|
14116 | .inside-bracket.object,
|
14117 | .inside-bracket.array {
|
14118 | border-left: 1px dotted var(--border-color);
|
14119 | }`, custom_styles];
|
14120 | }
|
14121 |
|
14122 |
|
14123 | render() {
|
14124 | var _this$data, _this$data2, _this$data3;
|
14125 | return y`
|
14126 | <div class="tree ${this.schemaDescriptionExpanded === 'true' ? 'expanded-all-descr' : 'collapsed-all-descr'}" @click="${e => this.handleAllEvents(e)}">
|
14127 | <div class="toolbar">
|
14128 | <div class="toolbar-item schema-root-type ${((_this$data = this.data) === null || _this$data === void 0 ? void 0 : _this$data['::type']) || ''} "> ${((_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2['::type']) || ''} </div>
|
14129 | ${this.allowSchemaDescriptionExpandToggle === 'true' ? y`
|
14130 | <div style="flex:1"></div>
|
14131 | <div part="schema-toolbar-item schema-multiline-toggle" class='toolbar-item schema-multiline-toggle'>
|
14132 | ${this.schemaDescriptionExpanded === 'true' ? 'Single line description' : 'Multiline description'}
|
14133 | </div>` : ''}
|
14134 | </div>
|
14135 | <span part="schema-description" class='m-markdown'> ${unsafe_html_o(marked(((_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3['::description']) || ''))}</span>
|
14136 | ${this.data ? y`
|
14137 | ${this.generateTree(this.data['::type'] === 'array' ? this.data['::props'] : this.data, this.data['::type'], this.data['::array-type'] || '')}` : y`<span class='mono-font' style='color:var(--red)'> Schema not found </span>`}
|
14138 | </div>
|
14139 | `;
|
14140 | }
|
14141 | generateTree(data, dataType = 'object', arrayType = '', key = '', description = '', schemaLevel = 0, indentLevel = 0, readOrWrite = '') {
|
14142 | var _data$Type;
|
14143 | if (this.schemaHideReadOnly === 'true') {
|
14144 | if (dataType === 'array') {
|
14145 | if (readOrWrite === 'readonly') {
|
14146 | return;
|
14147 | }
|
14148 | }
|
14149 | if ((data === null || data === void 0 ? void 0 : data['::readwrite']) === 'readonly') {
|
14150 | return;
|
14151 | }
|
14152 | }
|
14153 | if (this.schemaHideWriteOnly === 'true') {
|
14154 | if (dataType === 'array') {
|
14155 | if (readOrWrite === 'writeonly') {
|
14156 | return;
|
14157 | }
|
14158 | }
|
14159 | if ((data === null || data === void 0 ? void 0 : data['::readwrite']) === 'writeonly') {
|
14160 | return;
|
14161 | }
|
14162 | }
|
14163 | if (!data) {
|
14164 | return y`<div class="null" style="display:inline;">
|
14165 | <span class="key-label xxx-of-key"> ${key.replace('::OPTION~', '')}</span>
|
14166 | ${dataType === 'array' ? y`<span class='mono-font'> [ ] </span>` : dataType === 'object' ? y`<span class='mono-font'> { } </span>` : y`<span class='mono-font'> schema undefined </span>`}
|
14167 | </div>`;
|
14168 | }
|
14169 | if (Object.keys(data).length === 0) {
|
14170 | return y`<span class="key object">${key}:{ }</span>`;
|
14171 | }
|
14172 | let keyLabel = '';
|
14173 | let keyDescr = '';
|
14174 | if (key.startsWith('::ONE~OF') || key.startsWith('::ANY~OF')) {
|
14175 | keyLabel = key.replace('::', '').replace('~', ' ');
|
14176 | } else if (key.startsWith('::OPTION')) {
|
14177 | const parts = key.split('~');
|
14178 | [, keyLabel, keyDescr] = parts;
|
14179 | } else {
|
14180 | keyLabel = key;
|
14181 | }
|
14182 | const leftPadding = 12;
|
14183 | const minFieldColWidth = 400 - indentLevel * leftPadding;
|
14184 | let openBracket = '';
|
14185 | let closeBracket = '';
|
14186 | const newSchemaLevel = (_data$Type = data['::type']) !== null && _data$Type !== void 0 && _data$Type.startsWith('xxx-of') ? schemaLevel : schemaLevel + 1;
|
14187 |
|
14188 | const newIndentLevel = dataType === 'xxx-of-option' || data['::type'] === 'xxx-of-option' || key.startsWith('::OPTION') ? indentLevel : indentLevel + 1;
|
14189 | if (data['::type'] === 'object') {
|
14190 | if (dataType === 'array') {
|
14191 | if (schemaLevel < this.schemaExpandLevel) {
|
14192 | openBracket = y`<span class="open-bracket array-of-object" >[{</span>`;
|
14193 | } else {
|
14194 | openBracket = y`<span class="open-bracket array-of-object">[{...}]</span>`;
|
14195 | }
|
14196 | closeBracket = '}]';
|
14197 | } else {
|
14198 | if (schemaLevel < this.schemaExpandLevel) {
|
14199 | openBracket = y`<span class="open-bracket object">{</span>`;
|
14200 | } else {
|
14201 | openBracket = y`<span class="open-bracket object">{...}</span>`;
|
14202 | }
|
14203 | closeBracket = '}';
|
14204 | }
|
14205 | } else if (data['::type'] === 'array') {
|
14206 | if (dataType === 'array') {
|
14207 | const arrType = arrayType !== 'object' ? arrayType : '';
|
14208 | if (schemaLevel < this.schemaExpandLevel) {
|
14209 | openBracket = y`<span class="open-bracket array-of-array" data-array-type="${arrType}">[[ ${arrType} </span>`;
|
14210 | } else {
|
14211 | openBracket = y`<span class="open-bracket array-of-array" data-array-type="${arrType}">[[...]]</span>`;
|
14212 | }
|
14213 | closeBracket = ']]';
|
14214 | } else {
|
14215 | if (schemaLevel < this.schemaExpandLevel) {
|
14216 | openBracket = y`<span class="open-bracket array">[</span>`;
|
14217 | } else {
|
14218 | openBracket = y`<span class="open-bracket array">[...]</span>`;
|
14219 | }
|
14220 | closeBracket = ']';
|
14221 | }
|
14222 | }
|
14223 | if (typeof data === 'object') {
|
14224 | var _data$Type2;
|
14225 | return y`
|
14226 | <div class="tr ${schemaLevel < this.schemaExpandLevel || (_data$Type2 = data['::type']) !== null && _data$Type2 !== void 0 && _data$Type2.startsWith('xxx-of') ? 'expanded' : 'collapsed'} ${data['::type'] || 'no-type-info'}" title="${data['::deprecated'] ? 'Deprecated' : ''}">
|
14227 | <div class="td key ${data['::deprecated'] ? 'deprecated' : ''}" style='min-width:${minFieldColWidth}px'>
|
14228 | ${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' || key.startsWith('::OPTION') ? y`<span class='key-label xxx-of-key'> ${keyLabel}</span><span class="xxx-of-descr">${keyDescr}</span>` : keyLabel === '::props' || keyLabel === '::ARRAY~OF' ? '' : schemaLevel > 0 ? y`<span class="key-label" title="${readOrWrite === 'readonly' ? 'Read-Only' : readOrWrite === 'writeonly' ? 'Write-Only' : ''}">
|
14229 | ${data['::deprecated'] ? '✗' : ''}
|
14230 | ${keyLabel.replace(/\*$/, '')}${keyLabel.endsWith('*') ? y`<span style="color:var(--red)">*</span>` : ''}${readOrWrite === 'readonly' ? y` 🆁` : readOrWrite === 'writeonly' ? y` 🆆` : readOrWrite}:
|
14231 | </span>` : ''}
|
14232 | ${openBracket}
|
14233 | </div>
|
14234 | <div class='td key-descr m-markdown-small'>${unsafe_html_o(marked(description || ''))}</div>
|
14235 | </div>
|
14236 | <div class='inside-bracket ${data['::type'] || 'no-type-info'}' style='padding-left:${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' ? 0 : leftPadding}px;'>
|
14237 | ${Array.isArray(data) && data[0] ? y`${this.generateTree(data[0], 'xxx-of-option', '', '::ARRAY~OF', '', newSchemaLevel, newIndentLevel, data[0]['::readwrite'])}` : y`
|
14238 | ${Object.keys(data).map(dataKey => {
|
14239 | var _data$dataKey;
|
14240 | return y`
|
14241 | ${['::title', '::description', '::type', '::props', '::deprecated', '::array-type', '::readwrite', '::dataTypeLabel'].includes(dataKey) ? data[dataKey]['::type'] === 'array' || data[dataKey]['::type'] === 'object' ? y`${this.generateTree(data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey], data[dataKey]['::type'], data[dataKey]['::array-type'] || '', dataKey, data[dataKey]['::description'], newSchemaLevel, newIndentLevel, data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '')}` : '' : y`${this.generateTree(data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey], data[dataKey]['::type'], data[dataKey]['::array-type'] || '', dataKey, ((_data$dataKey = data[dataKey]) === null || _data$dataKey === void 0 ? void 0 : _data$dataKey['::description']) || '', newSchemaLevel, newIndentLevel, data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '')}`}
|
14242 | `;
|
14243 | })}
|
14244 | `}
|
14245 | </div>
|
14246 | ${data['::type'] && data['::type'].includes('xxx-of') ? '' : y`<div class='close-bracket'> ${closeBracket} </div>`}
|
14247 | `;
|
14248 | }
|
14249 |
|
14250 |
|
14251 |
|
14252 | const [type, primitiveReadOrWrite, constraint, defaultValue, allowedValues, pattern, schemaDescription, schemaTitle, deprecated] = data.split('~|~');
|
14253 | if (primitiveReadOrWrite === '🆁' && this.schemaHideReadOnly === 'true') {
|
14254 | return;
|
14255 | }
|
14256 | if (primitiveReadOrWrite === '🆆' && this.schemaHideWriteOnly === 'true') {
|
14257 | return;
|
14258 | }
|
14259 | const dataTypeCss = type.replace(/┃.*/g, '').replace(/[^a-zA-Z0-9+]/g, '').substring(0, 4).toLowerCase();
|
14260 | const descrExpander = `${constraint || defaultValue || allowedValues || pattern ? `<span class="descr-expand-toggle ${this.schemaDescriptionExpanded === 'true' ? 'expanded-descr' : ''}">➔</span>` : ''}`;
|
14261 | let finalReadWriteText = '';
|
14262 | let finalReadWriteTip = '';
|
14263 | if (dataType === 'array') {
|
14264 | if (readOrWrite === 'readonly') {
|
14265 | finalReadWriteText = '🆁';
|
14266 | finalReadWriteTip = 'Read-Only';
|
14267 | } else if (readOrWrite === 'writeonly') {
|
14268 | finalReadWriteText = '🆆';
|
14269 | finalReadWriteTip = 'Write-Only';
|
14270 | }
|
14271 | } else if (primitiveReadOrWrite === '🆁') {
|
14272 | finalReadWriteText = '🆁';
|
14273 | finalReadWriteTip = 'Read-Only';
|
14274 | } else if (primitiveReadOrWrite === '🆆') {
|
14275 | finalReadWriteText = '🆆';
|
14276 | finalReadWriteTip = 'Write-Only';
|
14277 | }
|
14278 | return y`
|
14279 | <div class = "tr primitive" title="${deprecated ? 'Deprecated' : ''}">
|
14280 | <div class="td key ${deprecated}" style='min-width:${minFieldColWidth}px'>
|
14281 | ${deprecated ? y`<span style='color:var(--red);'>✗</span>` : ''}
|
14282 | ${keyLabel.endsWith('*') ? y`<span class="key-label">${keyLabel.substring(0, keyLabel.length - 1)}</span><span style='color:var(--red);'>*</span>:` : key.startsWith('::OPTION') ? y`<span class='key-label xxx-of-key'>${keyLabel}</span><span class="xxx-of-descr">${keyDescr}</span>` : y`<span class="key-label">${keyLabel}:</span>`}
|
14283 | <span class="${dataTypeCss}" title="${finalReadWriteTip}">
|
14284 | ${dataType === 'array' ? `[${type}]` : `${type}`}
|
14285 | ${finalReadWriteText}
|
14286 | </span>
|
14287 | </div>
|
14288 | <div class='td key-descr'>
|
14289 | ${description || schemaTitle || schemaDescription ? y`${y`<span class="m-markdown-small">
|
14290 | ${unsafe_html_o(marked(dataType === 'array' ? `${descrExpander} ${description}` : schemaTitle ? `${descrExpander} <b>${schemaTitle}:</b> ${schemaDescription}` : `${descrExpander} ${schemaDescription}`))}
|
14291 | </span>`}` : ''}
|
14292 | ${constraint ? y`<div style='display:inline-block; line-break:anywhere; margin-right:8px'><span class='bold-text'>Constraints: </span>${constraint}</div>` : ''}
|
14293 | ${defaultValue ? y`<div style='display:inline-block; line-break:anywhere; margin-right:8px'><span class='bold-text'>Default: </span>${defaultValue}</div>` : ''}
|
14294 | ${allowedValues ? y`<div style='display:inline-block; line-break:anywhere; margin-right:8px'><span class='bold-text'>${type === 'const' ? 'Value' : 'Allowed'}: </span>${allowedValues}</div>` : ''}
|
14295 | ${pattern ? y`<div style='display:inline-block; line-break: anywhere; margin-right:8px'><span class='bold-text'>Pattern: </span>${pattern}</div>` : ''}
|
14296 | </div>
|
14297 | </div>
|
14298 | `;
|
14299 | }
|
14300 |
|
14301 |
|
14302 | handleAllEvents(e) {
|
14303 | if (e.target.classList.contains('open-bracket')) {
|
14304 | this.toggleObjectExpand(e);
|
14305 | } else if (e.target.classList.contains('schema-multiline-toggle')) {
|
14306 | this.schemaDescriptionExpanded = this.schemaDescriptionExpanded === 'true' ? 'false' : 'true';
|
14307 | } else if (e.target.classList.contains('descr-expand-toggle')) {
|
14308 | const trEl = e.target.closest('.tr');
|
14309 | if (trEl) {
|
14310 | trEl.classList.toggle('expanded-descr');
|
14311 | trEl.style.maxHeight = trEl.scrollHeight;
|
14312 | }
|
14313 | }
|
14314 | }
|
14315 | toggleObjectExpand(e) {
|
14316 | const rowEl = e.target.closest('.tr');
|
14317 | if (rowEl.classList.contains('expanded')) {
|
14318 | rowEl.classList.replace('expanded', 'collapsed');
|
14319 | e.target.innerHTML = e.target.classList.contains('array-of-object') ? '[{...}]' : e.target.classList.contains('array-of-array') ? '[[...]]' : e.target.classList.contains('array') ? '[...]' : '{...}';
|
14320 | } else {
|
14321 | rowEl.classList.replace('collapsed', 'expanded');
|
14322 | e.target.innerHTML = e.target.classList.contains('array-of-object') ? '[{' : e.target.classList.contains('array-of-array') ? `[[ ${e.target.dataset.arrayType}` : e.target.classList.contains('object') ? '{' : '[';
|
14323 | }
|
14324 | }
|
14325 | }
|
14326 | customElements.define('schema-tree', SchemaTree);
|
14327 | ;
|
14328 |
|
14329 | class TagInput extends lit_element_s {
|
14330 |
|
14331 | render() {
|
14332 | let tagItemTmpl = '';
|
14333 | if (Array.isArray(this.value)) {
|
14334 | tagItemTmpl = y`${this.value.filter(v => typeof v === 'string' && v.trim() !== '').map(v => y`<span class='tag'>${v}</span>`)}`;
|
14335 | }
|
14336 | return y`
|
14337 | <div class='tags'>
|
14338 | ${tagItemTmpl}
|
14339 | <input type="text" class='editor' @paste="${e => this.afterPaste(e)}" @keydown="${this.afterKeyDown}" @blur="${this.onBlur}" placeholder="${this.placeholder || ''}">
|
14340 | </div>
|
14341 | `;
|
14342 | }
|
14343 |
|
14344 |
|
14345 | static get properties() {
|
14346 | return {
|
14347 | placeholder: {
|
14348 | type: String
|
14349 | },
|
14350 | value: {
|
14351 | type: Array,
|
14352 | attribute: 'value'
|
14353 | }
|
14354 | };
|
14355 | }
|
14356 | attributeChangedCallback(name, oldVal, newVal) {
|
14357 | if (name === 'value') {
|
14358 | if (newVal && oldVal !== newVal) {
|
14359 | this.value = newVal.split(',').filter(v => v.trim() !== '');
|
14360 | }
|
14361 | }
|
14362 | super.attributeChangedCallback(name, oldVal, newVal);
|
14363 | }
|
14364 | afterPaste(e) {
|
14365 | const clipboardData = e.clipboardData || window.clipboardData;
|
14366 | const pastedData = clipboardData.getData('Text');
|
14367 | const pastedArray = pastedData ? pastedData.split(',').filter(v => v.trim() !== '') : '';
|
14368 | if (pastedArray) {
|
14369 | if (Array.isArray(this.value)) {
|
14370 | this.value = [...this.value, ...pastedArray];
|
14371 | } else {
|
14372 | this.value = pastedArray;
|
14373 | }
|
14374 | }
|
14375 | e.preventDefault();
|
14376 | }
|
14377 | afterKeyDown(e) {
|
14378 | if (e.keyCode === 13) {
|
14379 | e.stopPropagation();
|
14380 | e.preventDefault();
|
14381 | if (e.target.value) {
|
14382 | if (Array.isArray(this.value)) {
|
14383 | this.value = [...this.value, e.target.value];
|
14384 | } else {
|
14385 | this.value = [e.target.value];
|
14386 | }
|
14387 | e.target.value = '';
|
14388 | }
|
14389 | } else if (e.keyCode === 8) {
|
14390 | if (e.target.value.length === 0) {
|
14391 | if (Array.isArray(this.value) && this.value.length > 0) {
|
14392 | this.value.splice(-1);
|
14393 | this.value = [...this.value];
|
14394 | }
|
14395 | }
|
14396 | }
|
14397 | }
|
14398 | onBlur(e) {
|
14399 | if (e.target.value) {
|
14400 | if (Array.isArray(this.value)) {
|
14401 | this.value = [...this.value, e.target.value];
|
14402 | } else {
|
14403 | this.value = [e.target.value];
|
14404 | }
|
14405 | e.target.value = '';
|
14406 | }
|
14407 | }
|
14408 | static get styles() {
|
14409 | return [i`
|
14410 | .tags {
|
14411 | display:flex;
|
14412 | flex-wrap: wrap;
|
14413 | outline: none;
|
14414 | padding:0;
|
14415 | border-radius:var(--border-radius);
|
14416 | border:1px solid var(--border-color);
|
14417 | cursor:text;
|
14418 | overflow:hidden;
|
14419 | background:var(--input-bg);
|
14420 | }
|
14421 | .tag, .editor {
|
14422 | padding:3px;
|
14423 | margin:2px;
|
14424 | }
|
14425 | .tag{
|
14426 | border:1px solid var(--border-color);
|
14427 | background-color:var(--bg3);
|
14428 | color:var(--fg3);
|
14429 | border-radius:var(--border-radius);
|
14430 | word-break: break-all;
|
14431 | font-size: var(--font-size-small);
|
14432 | }
|
14433 | .tag:hover ~ #cursor {
|
14434 | display: block;
|
14435 | }
|
14436 | .editor {
|
14437 | flex:1;
|
14438 | border:1px solid transparent;
|
14439 | color:var(--fg);
|
14440 | min-width:60px;
|
14441 | outline: none;
|
14442 | line-height: inherit;
|
14443 | font-family:inherit;
|
14444 | background:transparent;
|
14445 | font-size: calc(var(--font-size-small) + 1px);
|
14446 | }
|
14447 | .editor:focus-visible {
|
14448 | outline: 1px solid;
|
14449 | }
|
14450 | .editor::placeholder {
|
14451 | color: var(--placeholder-color);
|
14452 | opacity:1;
|
14453 | }
|
14454 | `];
|
14455 | }
|
14456 | }
|
14457 |
|
14458 | customElements.define('tag-input', TagInput);
|
14459 | ;
|
14460 |
|
14461 |
|
14462 |
|
14463 |
|
14464 |
|
14465 |
|
14466 |
|
14467 |
|
14468 |
|
14469 |
|
14470 |
|
14471 |
|
14472 |
|
14473 |
|
14474 |
|
14475 |
|
14476 |
|
14477 |
|
14478 |
|
14479 |
|
14480 | class ApiRequest extends lit_element_s {
|
14481 | constructor() {
|
14482 | super();
|
14483 | this.responseMessage = '';
|
14484 | this.responseStatus = 'success';
|
14485 | this.responseHeaders = '';
|
14486 | this.responseText = '';
|
14487 | this.responseUrl = '';
|
14488 | this.curlSyntax = '';
|
14489 | this.activeResponseTab = 'response';
|
14490 | this.selectedRequestBodyType = '';
|
14491 | this.selectedRequestBodyExample = '';
|
14492 | this.activeParameterSchemaTabs = {};
|
14493 | }
|
14494 | static get properties() {
|
14495 | return {
|
14496 | serverUrl: {
|
14497 | type: String,
|
14498 | attribute: 'server-url'
|
14499 | },
|
14500 | servers: {
|
14501 | type: Array
|
14502 | },
|
14503 | method: {
|
14504 | type: String
|
14505 | },
|
14506 | path: {
|
14507 | type: String
|
14508 | },
|
14509 | security: {
|
14510 | type: Array
|
14511 | },
|
14512 | parameters: {
|
14513 | type: Array
|
14514 | },
|
14515 | request_body: {
|
14516 | type: Object
|
14517 | },
|
14518 | api_keys: {
|
14519 | type: Array
|
14520 | },
|
14521 | parser: {
|
14522 | type: Object
|
14523 | },
|
14524 | accept: {
|
14525 | type: String
|
14526 | },
|
14527 | callback: {
|
14528 | type: String
|
14529 | },
|
14530 | webhook: {
|
14531 | type: String
|
14532 | },
|
14533 | responseMessage: {
|
14534 | type: String,
|
14535 | attribute: false
|
14536 | },
|
14537 | responseText: {
|
14538 | type: String,
|
14539 | attribute: false
|
14540 | },
|
14541 | responseHeaders: {
|
14542 | type: String,
|
14543 | attribute: false
|
14544 | },
|
14545 | responseStatus: {
|
14546 | type: String,
|
14547 | attribute: false
|
14548 | },
|
14549 | responseUrl: {
|
14550 | type: String,
|
14551 | attribute: false
|
14552 | },
|
14553 | curlSyntax: {
|
14554 | type: String,
|
14555 | attribute: false
|
14556 | },
|
14557 | fillRequestFieldsWithExample: {
|
14558 | type: String,
|
14559 | attribute: 'fill-request-fields-with-example'
|
14560 | },
|
14561 | allowTry: {
|
14562 | type: String,
|
14563 | attribute: 'allow-try'
|
14564 | },
|
14565 | showCurlBeforeTry: {
|
14566 | type: String,
|
14567 | attribute: 'show-curl-before-try'
|
14568 | },
|
14569 | renderStyle: {
|
14570 | type: String,
|
14571 | attribute: 'render-style'
|
14572 | },
|
14573 | schemaStyle: {
|
14574 | type: String,
|
14575 | attribute: 'schema-style'
|
14576 | },
|
14577 | activeSchemaTab: {
|
14578 | type: String,
|
14579 | attribute: 'active-schema-tab'
|
14580 | },
|
14581 | activeParameterSchemaTabs: {
|
14582 | type: Object,
|
14583 | converter: {
|
14584 | fromAttribute: attr => JSON.parse(attr),
|
14585 | toAttribute: prop => JSON.stringify(prop)
|
14586 | },
|
14587 | attribute: 'active-parameter-schema-tabs'
|
14588 | },
|
14589 | schemaExpandLevel: {
|
14590 | type: Number,
|
14591 | attribute: 'schema-expand-level'
|
14592 | },
|
14593 | schemaDescriptionExpanded: {
|
14594 | type: String,
|
14595 | attribute: 'schema-description-expanded'
|
14596 | },
|
14597 | allowSchemaDescriptionExpandToggle: {
|
14598 | type: String,
|
14599 | attribute: 'allow-schema-description-expand-toggle'
|
14600 | },
|
14601 | schemaHideReadOnly: {
|
14602 | type: String,
|
14603 | attribute: 'schema-hide-read-only'
|
14604 | },
|
14605 | schemaHideWriteOnly: {
|
14606 | type: String,
|
14607 | attribute: 'schema-hide-write-only'
|
14608 | },
|
14609 | fetchCredentials: {
|
14610 | type: String,
|
14611 | attribute: 'fetch-credentials'
|
14612 | },
|
14613 |
|
14614 | activeResponseTab: {
|
14615 | type: String
|
14616 | },
|
14617 |
|
14618 | selectedRequestBodyType: {
|
14619 | type: String,
|
14620 | attribute: 'selected-request-body-type'
|
14621 | },
|
14622 |
|
14623 | selectedRequestBodyExample: {
|
14624 | type: String,
|
14625 | attribute: 'selected-request-body-example'
|
14626 | }
|
14627 | };
|
14628 | }
|
14629 |
|
14630 | static get styles() {
|
14631 | return [table_styles, input_styles, font_styles, flex_styles, border_styles, tab_styles, prism_styles, i`
|
14632 | *, *:before, *:after { box-sizing: border-box; }
|
14633 | :where(button, input[type="checkbox"], [tabindex="0"]):focus-visible { box-shadow: var(--focus-shadow); }
|
14634 | :where(input[type="text"], input[type="password"], select, textarea):focus-visible { border-color: var(--primary-color); }
|
14635 | tag-input:focus-within { outline: 1px solid;}
|
14636 | .read-mode {
|
14637 | margin-top: 24px;
|
14638 | }
|
14639 | .param-name,
|
14640 | .param-type {
|
14641 | margin: 1px 0;
|
14642 | text-align: right;
|
14643 | line-height: var(--font-size-small);
|
14644 | }
|
14645 | .param-name {
|
14646 | color: var(--fg);
|
14647 | font-family: var(--font-mono);
|
14648 | }
|
14649 | .param-name.deprecated {
|
14650 | color: var(--red);
|
14651 | }
|
14652 | .param-type{
|
14653 | color: var(--light-fg);
|
14654 | font-family: var(--font-regular);
|
14655 | }
|
14656 | .param-constraint{
|
14657 | min-width:100px;
|
14658 | }
|
14659 | .param-constraint:empty{
|
14660 | display:none;
|
14661 | }
|
14662 | .top-gap{margin-top:24px;}
|
14663 |
|
14664 | .textarea {
|
14665 | min-height:220px;
|
14666 | padding:5px;
|
14667 | resize:vertical;
|
14668 | direction: ltr;
|
14669 | }
|
14670 | .example:first-child {
|
14671 | margin-top: -9px;
|
14672 | }
|
14673 |
|
14674 | .response-message{
|
14675 | font-weight:bold;
|
14676 | text-overflow: ellipsis;
|
14677 | }
|
14678 | .response-message.error {
|
14679 | color:var(--red);
|
14680 | }
|
14681 | .response-message.success {
|
14682 | color:var(--blue);
|
14683 | }
|
14684 |
|
14685 | .file-input-container {
|
14686 | align-items:flex-end;
|
14687 | }
|
14688 | .file-input-container .input-set:first-child .file-input-remove-btn{
|
14689 | visibility:hidden;
|
14690 | }
|
14691 |
|
14692 | .file-input-remove-btn{
|
14693 | font-size:16px;
|
14694 | color:var(--red);
|
14695 | outline: none;
|
14696 | border: none;
|
14697 | background:none;
|
14698 | cursor:pointer;
|
14699 | }
|
14700 |
|
14701 | .v-tab-btn {
|
14702 | font-size: var(--smal-font-size);
|
14703 | height:24px;
|
14704 | border:none;
|
14705 | background:none;
|
14706 | opacity: 0.3;
|
14707 | cursor: pointer;
|
14708 | padding: 4px 8px;
|
14709 | }
|
14710 | .v-tab-btn.active {
|
14711 | font-weight: bold;
|
14712 | background: var(--bg);
|
14713 | opacity: 1;
|
14714 | }
|
14715 |
|
14716 | @media only screen and (min-width: 768px) {
|
14717 | .textarea {
|
14718 | padding:8px;
|
14719 | }
|
14720 | }
|
14721 |
|
14722 | @media only screen and (max-width: 470px) {
|
14723 | .hide-in-small-screen {
|
14724 | display:none;
|
14725 | }
|
14726 | }
|
14727 | `, custom_styles];
|
14728 | }
|
14729 | render() {
|
14730 | return y`
|
14731 | <div class="col regular-font request-panel ${'read focused'.includes(this.renderStyle) || this.callback === 'true' ? 'read-mode' : 'view-mode'}">
|
14732 | <div class=" ${this.callback === 'true' ? 'tiny-title' : 'req-res-title'} ">
|
14733 | ${this.callback === 'true' ? 'CALLBACK REQUEST' : 'REQUEST'}
|
14734 | </div>
|
14735 | <div>
|
14736 | ${guard_i([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('path'))}
|
14737 | ${guard_i([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('query'))}
|
14738 | ${this.requestBodyTemplate()}
|
14739 | ${guard_i([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('header'))}
|
14740 | ${guard_i([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('cookie'))}
|
14741 | ${this.allowTry === 'false' ? '' : y`${this.apiCallTemplate()}`}
|
14742 | </div>
|
14743 | </div>
|
14744 | `;
|
14745 | }
|
14746 | async updated() {
|
14747 | if (this.showCurlBeforeTry === 'true') {
|
14748 | this.applyCURLSyntax(this.shadowRoot);
|
14749 | }
|
14750 |
|
14751 |
|
14752 |
|
14753 |
|
14754 |
|
14755 |
|
14756 |
|
14757 |
|
14758 |
|
14759 |
|
14760 |
|
14761 |
|
14762 |
|
14763 | if (this.webhook === 'true') {
|
14764 | this.allowTry = 'false';
|
14765 | }
|
14766 | }
|
14767 | async saveExampleState() {
|
14768 | if (this.renderStyle === 'focused') {
|
14769 | const reqBodyTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea.request-body-param-user-input')];
|
14770 | reqBodyTextAreaEls.forEach(el => {
|
14771 | el.dataset.user_example = el.value;
|
14772 | });
|
14773 | const exampleTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea[data-ptype="form-data"]')];
|
14774 | exampleTextAreaEls.forEach(el => {
|
14775 | el.dataset.user_example = el.value;
|
14776 | });
|
14777 | this.requestUpdate();
|
14778 | }
|
14779 | }
|
14780 | async updateExamplesFromDataAttr() {
|
14781 |
|
14782 |
|
14783 |
|
14784 | if (this.renderStyle === 'focused') {
|
14785 | const reqBodyTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea.request-body-param-user-input')];
|
14786 | reqBodyTextAreaEls.forEach(el => {
|
14787 | el.value = el.dataset.user_example || el.dataset.example;
|
14788 | });
|
14789 | const exampleTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea[data-ptype="form-data"]')];
|
14790 | exampleTextAreaEls.forEach(el => {
|
14791 | el.value = el.dataset.user_example || el.dataset.example;
|
14792 | });
|
14793 | this.requestUpdate();
|
14794 | }
|
14795 | }
|
14796 |
|
14797 |
|
14798 | renderExample(example, paramType, paramName) {
|
14799 | var _example$value;
|
14800 | return y`
|
14801 | ${paramType === 'array' ? '[' : ''}
|
14802 | <a
|
14803 | part="anchor anchor-param-example"
|
14804 | style="display:inline-block; min-width:24px; text-align:center"
|
14805 | class="${this.allowTry === 'true' ? '' : 'inactive-link'}"
|
14806 | data-example-type="${paramType === 'array' ? paramType : 'string'}"
|
14807 | data-example="${example.value && Array.isArray(example.value) ? (_example$value = example.value) === null || _example$value === void 0 ? void 0 : _example$value.join('~|~') : example.value || ''}"
|
14808 | @click="${e => {
|
14809 | const inputEl = e.target.closest('table').querySelector(`[data-pname="${paramName}"]`);
|
14810 | if (inputEl) {
|
14811 | inputEl.value = e.target.dataset.exampleType === 'array' ? e.target.dataset.example.split('~|~') : e.target.dataset.example;
|
14812 | }
|
14813 | }}"
|
14814 | > ${example.printableValue || example.value} </a>
|
14815 | ${paramType === 'array' ? '] ' : ''}
|
14816 | `;
|
14817 | }
|
14818 | renderShortFormatExamples(examples, paramType, paramName) {
|
14819 | return y`${examples.map((x, i) => y`
|
14820 | ${i === 0 ? '' : '┃'}
|
14821 | ${this.renderExample(x, paramType, paramName)}`)}`;
|
14822 | }
|
14823 | renderLongFormatExamples(exampleList, paramType, paramName) {
|
14824 | return y` <ul style="list-style-type: disclosure-closed;">
|
14825 | ${exampleList.map(v => {
|
14826 | var _v$summary, _v$description;
|
14827 | return y`
|
14828 | <li>
|
14829 | ${this.renderExample(v, paramType, paramName)}
|
14830 | ${((_v$summary = v.summary) === null || _v$summary === void 0 ? void 0 : _v$summary.length) > 0 ? y`<span>(${v.summary})</span>` : ''}
|
14831 | ${((_v$description = v.description) === null || _v$description === void 0 ? void 0 : _v$description.length) > 0 ? y`<p>${unsafe_html_o(marked(v.description))}</p>` : ''}
|
14832 | </li>
|
14833 | `;
|
14834 | })}
|
14835 | </ul>`;
|
14836 | }
|
14837 | exampleListTemplate(paramName, paramType, exampleList = []) {
|
14838 | return y` ${exampleList.length > 0 ? y`<span style="font-weight:bold">Examples: </span>
|
14839 | ${anyExampleWithSummaryOrDescription(exampleList) ? this.renderLongFormatExamples(exampleList, paramType, paramName) : this.renderShortFormatExamples(exampleList, paramType, paramName)}` : ''}`;
|
14840 | }
|
14841 | inputParametersTemplate(paramType) {
|
14842 | const filteredParams = this.parameters ? this.parameters.filter(param => param.in === paramType) : [];
|
14843 | if (filteredParams.length === 0) {
|
14844 | return '';
|
14845 | }
|
14846 | let title = '';
|
14847 | if (paramType === 'path') {
|
14848 | title = 'PATH PARAMETERS';
|
14849 | } else if (paramType === 'query') {
|
14850 | title = 'QUERY-STRING PARAMETERS';
|
14851 | } else if (paramType === 'header') {
|
14852 | title = 'REQUEST HEADERS';
|
14853 | } else if (paramType === 'cookie') {
|
14854 | title = 'COOKIES';
|
14855 | }
|
14856 | const tableRows = [];
|
14857 | for (const param of filteredParams) {
|
14858 | const [declaredParamSchema, serializeStyle, mimeTypeElem] = getSchemaFromParam(param);
|
14859 | if (!declaredParamSchema) {
|
14860 | continue;
|
14861 | }
|
14862 | const paramSchema = getTypeInfo(declaredParamSchema);
|
14863 | if (!paramSchema) {
|
14864 | continue;
|
14865 | }
|
14866 |
|
14867 | const schemaAsObj = schemaInObjectNotation(declaredParamSchema, {});
|
14868 |
|
14869 |
|
14870 | let paramStyle = 'form';
|
14871 | let paramExplode = true;
|
14872 | let paramAllowReserved = false;
|
14873 | if (paramType === 'query') {
|
14874 | if (param.style && 'form spaceDelimited pipeDelimited'.includes(param.style)) {
|
14875 | paramStyle = param.style;
|
14876 | } else if (serializeStyle) {
|
14877 | paramStyle = serializeStyle;
|
14878 | }
|
14879 | if (typeof param.explode === 'boolean') {
|
14880 | paramExplode = param.explode;
|
14881 | }
|
14882 | if (typeof param.allowReserved === 'boolean') {
|
14883 | paramAllowReserved = param.allowReserved;
|
14884 | }
|
14885 | }
|
14886 |
|
14887 | const example = normalizeExamples(param.examples || nestExampleIfPresent(param.example) || nestExampleIfPresent(mimeTypeElem === null || mimeTypeElem === void 0 ? void 0 : mimeTypeElem.example) || (mimeTypeElem === null || mimeTypeElem === void 0 ? void 0 : mimeTypeElem.examples) || nestExampleIfPresent(paramSchema.examples) || nestExampleIfPresent(paramSchema.example), paramSchema.type);
|
14888 | if (!example.exampleVal && paramSchema.type === 'object') {
|
14889 | example.exampleVal = generateExample(declaredParamSchema, serializeStyle || 'json', '', '', this.callback === 'true' || this.webhook === 'true' ? true : false,
|
14890 |
|
14891 | this.callback === 'true' || this.webhook === 'true' ? false : true,
|
14892 |
|
14893 | true, 'text', false)[0].exampleValue;
|
14894 | }
|
14895 | const labelColWidth = 'read focused'.includes(this.renderStyle) ? '200px' : '160px';
|
14896 | tableRows.push(y`
|
14897 | <tr title="${param.deprecated ? 'Deprecated' : ''}">
|
14898 | <td rowspan="${this.allowTry === 'true' ? '1' : '2'}" style="width:${labelColWidth}; min-width:100px;">
|
14899 | <div class="param-name ${param.deprecated ? 'deprecated' : ''}" >
|
14900 | ${param.deprecated ? y`<span style='color:var(--red);'>✗</span>` : ''}
|
14901 | ${param.required ? y`<span style='color:var(--red)'>*</span>` : ''}
|
14902 | ${param.name}
|
14903 | </div>
|
14904 | <div class="param-type">
|
14905 | ${paramSchema.type === 'array' ? `${paramSchema.arrayType}` : `${paramSchema.format ? paramSchema.format : paramSchema.type}`}
|
14906 | </div>
|
14907 | </td>
|
14908 | ${this.allowTry === 'true' ? y`
|
14909 | <td style="min-width:100px;" colspan="${paramSchema.default || paramSchema.constrain || paramSchema.allowedValues || paramSchema.pattern ? '1' : '2'}">
|
14910 | ${paramSchema.type === 'array' ? y`
|
14911 | <tag-input class="request-param"
|
14912 | style = "width:100%"
|
14913 | data-ptype = "${paramType}"
|
14914 | data-pname = "${param.name}"
|
14915 | data-example = "${Array.isArray(example.exampleVal) ? example.exampleVal.join('~|~') : example.exampleVal}"
|
14916 | data-param-serialize-style = "${paramStyle}"
|
14917 | data-param-serialize-explode = "${paramExplode}"
|
14918 | data-param-allow-reserved = "${paramAllowReserved}"
|
14919 | data-x-fill-example = "${param['x-fill-example'] || 'yes'}"
|
14920 | data-array = "true"
|
14921 | placeholder = "add-multiple ↩"
|
14922 | .value="${param['x-fill-example'] === 'no' ? [] : live_l(this.fillRequestFieldsWithExample === 'true' ? Array.isArray(example.exampleVal) ? example.exampleVal : [example.exampleVal] : [])}"
|
14923 | >
|
14924 | </tag-input>` : paramSchema.type === 'object' ? y`
|
14925 | <div class="tab-panel col" style="border-width:0 0 1px 0;">
|
14926 | <div class="tab-buttons row" @click="${e => {
|
14927 | if (e.target.tagName.toLowerCase() === 'button') {
|
14928 | const newState = {
|
14929 | ...this.activeParameterSchemaTabs
|
14930 | };
|
14931 | newState[param.name] = e.target.dataset.tab;
|
14932 | this.activeParameterSchemaTabs = newState;
|
14933 | }
|
14934 | }}">
|
14935 | <button class="tab-btn ${this.activeParameterSchemaTabs[param.name] === 'example' ? 'active' : ''}" data-tab = 'example'>EXAMPLE </button>
|
14936 | <button class="tab-btn ${this.activeParameterSchemaTabs[param.name] !== 'example' ? 'active' : ''}" data-tab = 'schema'>SCHEMA</button>
|
14937 | </div>
|
14938 | ${this.activeParameterSchemaTabs[param.name] === 'example' ? y`<div class="tab-content col">
|
14939 | <textarea
|
14940 | class = "textarea request-param"
|
14941 | part = "textarea textarea-param"
|
14942 | data-ptype = "${paramType}-object"
|
14943 | data-pname = "${param.name}"
|
14944 | data-example = "${example.exampleVal}"
|
14945 | data-param-serialize-style = "${paramStyle}"
|
14946 | data-param-serialize-explode = "${paramExplode}"
|
14947 | data-param-allow-reserved = "${paramAllowReserved}"
|
14948 | data-x-fill-example = "${param['x-fill-example'] || 'yes'}"
|
14949 | spellcheck = "false"
|
14950 | .textContent="${param['x-fill-example'] === 'no' ? '' : live_l(this.fillRequestFieldsWithExample === 'true' ? example.exampleVal : '')}"
|
14951 | style = "resize:vertical; width:100%; height: ${'read focused'.includes(this.renderStyle) ? '180px' : '120px'};"
|
14952 | @input=${e => {
|
14953 | const requestPanelEl = this.getRequestPanel(e);
|
14954 | this.liveCURLSyntaxUpdate(requestPanelEl);
|
14955 | }}
|
14956 | ></textarea>
|
14957 | </div>` : y`
|
14958 | <div class="tab-content col">
|
14959 | <schema-tree
|
14960 | class = 'json'
|
14961 | style = 'display: block'
|
14962 | .data = '${schemaAsObj}'
|
14963 | schema-expand-level = "${this.schemaExpandLevel}"
|
14964 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
14965 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
14966 | schema-hide-read-only = "${this.schemaHideReadOnly.includes(this.method)}"
|
14967 | schema-hide-write-only = "${this.schemaHideWriteOnly.includes(this.method)}"
|
14968 | exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
14969 | file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
14970 | anchor:anchor, anchor-param-example:anchor-param-example"
|
14971 | > </schema-tree>
|
14972 | </div>`}
|
14973 | </div>` : y`
|
14974 | <input type="${paramSchema.format === 'password' ? 'password' : 'text'}" spellcheck="false" style="width:100%"
|
14975 | class="request-param"
|
14976 | part="textbox textbox-param"
|
14977 | data-ptype="${paramType}"
|
14978 | data-pname="${param.name}"
|
14979 | data-example="${Array.isArray(example.exampleVal) ? example.exampleVal.join('~|~') : example.exampleVal}"
|
14980 | data-param-allow-reserved = "${paramAllowReserved}"
|
14981 | data-x-fill-example = "${param['x-fill-example'] || 'yes'}"
|
14982 | data-array="false"
|
14983 | .value="${param['x-fill-example'] === 'no' ? '' : live_l(this.fillRequestFieldsWithExample === 'true' ? example.exampleVal : '')}"
|
14984 | @input=${e => {
|
14985 | const requestPanelEl = this.getRequestPanel(e);
|
14986 | this.liveCURLSyntaxUpdate(requestPanelEl);
|
14987 | }}
|
14988 | />`}
|
14989 | </td>` : ''}
|
14990 | ${paramSchema.default || paramSchema.constrain || paramSchema.allowedValues || paramSchema.pattern ? y`
|
14991 | <td colspan="${this.allowTry === 'true' ? '1' : '2'}">
|
14992 | <div class="param-constraint">
|
14993 | ${paramSchema.default ? y`<span style="font-weight:bold">Default: </span>${paramSchema.default}<br/>` : ''}
|
14994 | ${paramSchema.pattern ? y`<span style="font-weight:bold">Pattern: </span>${paramSchema.pattern}<br/>` : ''}
|
14995 | ${paramSchema.constrain ? y`${paramSchema.constrain}<br/>` : ''}
|
14996 | ${paramSchema.allowedValues && paramSchema.allowedValues.split('┃').map((v, i) => y`
|
14997 | ${i > 0 ? '┃' : y`<span style="font-weight:bold">Allowed: </span>`}
|
14998 | ${y`
|
14999 | <a part="anchor anchor-param-constraint" class = "${this.allowTry === 'true' ? '' : 'inactive-link'}"
|
15000 | data-type="${paramSchema.type === 'array' ? paramSchema.type : 'string'}"
|
15001 | data-enum="${v.trim()}"
|
15002 | @click="${e => {
|
15003 | const inputEl = e.target.closest('table').querySelector(`[data-pname="${param.name}"]`);
|
15004 | if (inputEl) {
|
15005 | if (e.target.dataset.type === 'array') {
|
15006 | inputEl.value = [e.target.dataset.enum];
|
15007 | } else {
|
15008 | inputEl.value = e.target.dataset.enum;
|
15009 | }
|
15010 | }
|
15011 | }}"
|
15012 | >${v}</a>`}`)}
|
15013 | </div>
|
15014 | </td>` : y`<td></td>`}
|
15015 | </tr>
|
15016 | <tr>
|
15017 | ${this.allowTry === 'true' ? y`<td style="border:none"> </td>` : ''}
|
15018 | <td colspan="2" style="border:none">
|
15019 | <span class="m-markdown-small">${unsafe_html_o(marked(param.description || ''))}</span>
|
15020 | ${this.exampleListTemplate.call(this, param.name, paramSchema.type, example.exampleList)}
|
15021 | </td>
|
15022 | </tr>
|
15023 | `);
|
15024 | }
|
15025 | return y`
|
15026 | <div class="table-title top-gap">${title}</div>
|
15027 | <div style="display:block; overflow-x:auto; max-width:100%;">
|
15028 | <table role="presentation" class="m-table" style="width:100%; word-break:break-word;">
|
15029 | ${tableRows}
|
15030 | </table>
|
15031 | </div>`;
|
15032 | }
|
15033 |
|
15034 |
|
15035 | async beforeNavigationFocusedMode() {
|
15036 |
|
15037 | }
|
15038 |
|
15039 |
|
15040 | async afterNavigationFocusedMode() {
|
15041 | this.selectedRequestBodyType = '';
|
15042 | this.selectedRequestBodyExample = '';
|
15043 | this.updateExamplesFromDataAttr();
|
15044 | this.clearResponseData();
|
15045 | }
|
15046 |
|
15047 |
|
15048 | onSelectExample(e) {
|
15049 | this.selectedRequestBodyExample = e.target.value;
|
15050 | const exampleDropdownEl = e.target;
|
15051 | window.setTimeout(selectEl => {
|
15052 | const readOnlyExampleEl = selectEl.closest('.example-panel').querySelector('.request-body-param');
|
15053 | const userInputExampleTextareaEl = selectEl.closest('.example-panel').querySelector('.request-body-param-user-input');
|
15054 | userInputExampleTextareaEl.value = readOnlyExampleEl.innerText;
|
15055 | const requestPanelEl = this.getRequestPanel({
|
15056 | target: selectEl
|
15057 | });
|
15058 | this.liveCURLSyntaxUpdate(requestPanelEl);
|
15059 | }, 0, exampleDropdownEl);
|
15060 | }
|
15061 | onMimeTypeChange(e) {
|
15062 | this.selectedRequestBodyType = e.target.value;
|
15063 | const mimeDropdownEl = e.target;
|
15064 | this.selectedRequestBodyExample = '';
|
15065 | window.setTimeout(selectEl => {
|
15066 | const readOnlyExampleEl = selectEl.closest('.request-body-container').querySelector('.request-body-param');
|
15067 | if (readOnlyExampleEl) {
|
15068 | const userInputExampleTextareaEl = selectEl.closest('.request-body-container').querySelector('.request-body-param-user-input');
|
15069 | userInputExampleTextareaEl.value = readOnlyExampleEl.innerText;
|
15070 | }
|
15071 | }, 0, mimeDropdownEl);
|
15072 | }
|
15073 | requestBodyTemplate() {
|
15074 | if (!this.request_body) {
|
15075 | return '';
|
15076 | }
|
15077 | if (Object.keys(this.request_body).length === 0) {
|
15078 | return '';
|
15079 | }
|
15080 |
|
15081 |
|
15082 | let reqBodyTypeSelectorHtml = '';
|
15083 | let reqBodyFileInputHtml = '';
|
15084 | let reqBodyFormHtml = '';
|
15085 | let reqBodySchemaHtml = '';
|
15086 | let reqBodyExampleHtml = '';
|
15087 | const requestBodyTypes = [];
|
15088 | const {
|
15089 | content
|
15090 | } = this.request_body;
|
15091 | for (const mimeType in content) {
|
15092 | requestBodyTypes.push({
|
15093 | mimeType,
|
15094 | schema: content[mimeType].schema,
|
15095 | example: content[mimeType].example,
|
15096 | examples: content[mimeType].examples
|
15097 | });
|
15098 | if (!this.selectedRequestBodyType) {
|
15099 | this.selectedRequestBodyType = mimeType;
|
15100 | }
|
15101 | }
|
15102 |
|
15103 | reqBodyTypeSelectorHtml = requestBodyTypes.length === 1 ? '' : y`
|
15104 | <select style="min-width:100px; max-width:100%; margin-bottom:-1px;" @change = '${e => this.onMimeTypeChange(e)}'>
|
15105 | ${requestBodyTypes.map(reqBody => y`
|
15106 | <option value = '${reqBody.mimeType}' ?selected = '${reqBody.mimeType === this.selectedRequestBodyType}'>
|
15107 | ${reqBody.mimeType}
|
15108 | </option> `)}
|
15109 | </select>
|
15110 | `;
|
15111 |
|
15112 |
|
15113 | requestBodyTypes.forEach(reqBody => {
|
15114 | let schemaAsObj;
|
15115 | let reqBodyExamples = [];
|
15116 | if (this.selectedRequestBodyType.includes('json') || this.selectedRequestBodyType.includes('xml') || this.selectedRequestBodyType.includes('text') || this.selectedRequestBodyType.includes('jose')) {
|
15117 |
|
15118 | if (reqBody.mimeType === this.selectedRequestBodyType) {
|
15119 | reqBodyExamples = generateExample(reqBody.schema, reqBody.mimeType, reqBody.examples, reqBody.example, this.callback === 'true' || this.webhook === 'true' ? true : false,
|
15120 |
|
15121 | this.callback === 'true' || this.webhook === 'true' ? false : true,
|
15122 |
|
15123 | 'text', false);
|
15124 | if (!this.selectedRequestBodyExample) {
|
15125 | this.selectedRequestBodyExample = reqBodyExamples.length > 0 ? reqBodyExamples[0].exampleId : '';
|
15126 | }
|
15127 | reqBodyExampleHtml = y`
|
15128 | ${reqBodyExampleHtml}
|
15129 | <div class = 'example-panel border-top pad-top-8'>
|
15130 | ${reqBodyExamples.length === 1 ? '' : y`
|
15131 | <select style="min-width:100px; max-width:100%; margin-bottom:-1px;" @change='${e => this.onSelectExample(e)}'>
|
15132 | ${reqBodyExamples.map(v => y`<option value="${v.exampleId}" ?selected=${v.exampleId === this.selectedRequestBodyExample} >
|
15133 | ${v.exampleSummary.length > 80 ? v.exampleId : v.exampleSummary ? v.exampleSummary : v.exampleId}
|
15134 | </option>`)}
|
15135 | </select>
|
15136 | `}
|
15137 | ${reqBodyExamples.filter(v => v.exampleId === this.selectedRequestBodyExample).map(v => y`
|
15138 | <div class="example ${v.exampleId === this.selectedRequestBodyExample ? 'example-selected' : ''}" data-example = '${v.exampleId}'>
|
15139 | ${v.exampleSummary && v.exampleSummary.length > 80 ? y`<div style="padding: 4px 0"> ${v.exampleSummary} </div>` : ''}
|
15140 | ${v.exampleDescription ? y`<div class="m-markdown-small" style="padding: 4px 0"> ${unsafe_html_o(marked(v.exampleDescription || ''))} </div>` : ''}
|
15141 | <!-- This pre(hidden) is to store the original example value, this will remain unchanged when users switches from one example to another, its is used to populate the editable textarea -->
|
15142 | <pre
|
15143 | class = "textarea is-hidden request-body-param ${reqBody.mimeType.substring(reqBody.mimeType.indexOf('/') + 1)}"
|
15144 | spellcheck = "false"
|
15145 | data-ptype = "${reqBody.mimeType}"
|
15146 | style="width:100%; resize:vertical; display:none"
|
15147 | >${v.exampleFormat === 'text' ? v.exampleValue : JSON.stringify(v.exampleValue, null, 2)}</pre>
|
15148 |
|
15149 | <!-- this textarea is for user to edit the example -->
|
15150 | <textarea
|
15151 | class = "textarea request-body-param-user-input"
|
15152 | part = "textarea textarea-param"
|
15153 | spellcheck = "false"
|
15154 | data-ptype = "${reqBody.mimeType}"
|
15155 | data-example = "${v.exampleFormat === 'text' ? v.exampleValue : JSON.stringify(v.exampleValue, null, 2)}"
|
15156 | data-example-format = "${v.exampleFormat}"
|
15157 | style="width:100%; resize:vertical;"
|
15158 | .textContent = "${this.fillRequestFieldsWithExample === 'true' ? v.exampleFormat === 'text' ? v.exampleValue : JSON.stringify(v.exampleValue, null, 2) : ''}"
|
15159 | @input=${e => {
|
15160 | const requestPanelEl = this.getRequestPanel(e);
|
15161 | this.liveCURLSyntaxUpdate(requestPanelEl);
|
15162 | }}
|
15163 | ></textarea>
|
15164 | </div>
|
15165 | `)}
|
15166 |
|
15167 | </div>
|
15168 | `;
|
15169 | }
|
15170 | } else if (this.selectedRequestBodyType.includes('form-urlencoded') || this.selectedRequestBodyType.includes('form-data')) {
|
15171 | if (reqBody.mimeType === this.selectedRequestBodyType) {
|
15172 | const ex = generateExample(reqBody.schema, reqBody.mimeType, reqBody.examples, reqBody.example, this.callback === 'true' || this.webhook === 'true' ? true : false,
|
15173 |
|
15174 | this.callback === 'true' || this.webhook === 'true' ? false : true,
|
15175 |
|
15176 | 'text', false);
|
15177 | if (reqBody.schema) {
|
15178 | reqBodyFormHtml = this.formDataTemplate(reqBody.schema, reqBody.mimeType, ex[0] ? ex[0].exampleValue : '');
|
15179 | }
|
15180 | }
|
15181 | } else if (/^audio\/|^image\/|^video\/|^font\/|tar$|zip$|7z$|rtf$|msword$|excel$|\/pdf$|\/octet-stream$/.test(this.selectedRequestBodyType)) {
|
15182 | if (reqBody.mimeType === this.selectedRequestBodyType) {
|
15183 | reqBodyFileInputHtml = y`
|
15184 | <div class = "small-font-size bold-text row">
|
15185 | <input type="file" part="file-input" style="max-width:100%" class="request-body-param-file" data-ptype="${reqBody.mimeType}" spellcheck="false" />
|
15186 | </div>
|
15187 | `;
|
15188 | }
|
15189 | }
|
15190 |
|
15191 |
|
15192 | if (reqBody.mimeType.includes('json') || reqBody.mimeType.includes('xml') || reqBody.mimeType.includes('text') || this.selectedRequestBodyType.includes('jose')) {
|
15193 | schemaAsObj = schemaInObjectNotation(reqBody.schema, {});
|
15194 | if (this.schemaStyle === 'table') {
|
15195 | reqBodySchemaHtml = y`
|
15196 | ${reqBodySchemaHtml}
|
15197 | <schema-table
|
15198 | class = '${reqBody.mimeType.substring(reqBody.mimeType.indexOf('/') + 1)}'
|
15199 | style = 'display: ${this.selectedRequestBodyType === reqBody.mimeType ? 'block' : 'none'};'
|
15200 | .data = '${schemaAsObj}'
|
15201 | schema-expand-level = "${this.schemaExpandLevel}"
|
15202 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
15203 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
15204 | schema-hide-read-only = "${this.schemaHideReadOnly}"
|
15205 | schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
15206 | exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
15207 | > </schema-table>
|
15208 | `;
|
15209 | } else if (this.schemaStyle === 'tree') {
|
15210 | reqBodySchemaHtml = y`
|
15211 | ${reqBodySchemaHtml}
|
15212 | <schema-tree
|
15213 | class = "${reqBody.mimeType.substring(reqBody.mimeType.indexOf('/') + 1)}"
|
15214 | style = "display: ${this.selectedRequestBodyType === reqBody.mimeType ? 'block' : 'none'};"
|
15215 | .data = "${schemaAsObj}"
|
15216 | schema-expand-level = "${this.schemaExpandLevel}"
|
15217 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
15218 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
15219 | schema-hide-read-only = "${this.schemaHideReadOnly}"
|
15220 | schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
15221 | exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
15222 | > </schema-tree>
|
15223 | `;
|
15224 | }
|
15225 | }
|
15226 | });
|
15227 | return y`
|
15228 | <div class='request-body-container' data-selected-request-body-type="${this.selectedRequestBodyType}">
|
15229 | <div class="table-title top-gap row">
|
15230 | REQUEST BODY ${this.request_body.required ? y`<span class="mono-font" style='color:var(--red)'>*</span>` : ''}
|
15231 | <span style = "font-weight:normal; margin-left:5px"> ${this.selectedRequestBodyType}</span>
|
15232 | <span style="flex:1"></span>
|
15233 | ${reqBodyTypeSelectorHtml}
|
15234 | </div>
|
15235 | ${this.request_body.description ? y`<div class="m-markdown" style="margin-bottom:12px">${unsafe_html_o(marked(this.request_body.description))}</div>` : ''}
|
15236 |
|
15237 | ${this.selectedRequestBodyType.includes('json') || this.selectedRequestBodyType.includes('xml') || this.selectedRequestBodyType.includes('text') || this.selectedRequestBodyType.includes('jose') ? y`
|
15238 | <div class="tab-panel col" style="border-width:0 0 1px 0;">
|
15239 | <div class="tab-buttons row" @click="${e => {
|
15240 | if (e.target.tagName.toLowerCase() === 'button') {
|
15241 | this.activeSchemaTab = e.target.dataset.tab;
|
15242 | }
|
15243 | }}">
|
15244 | <button class="tab-btn ${this.activeSchemaTab === 'example' ? 'active' : ''}" data-tab = 'example'>EXAMPLE</button>
|
15245 | <button class="tab-btn ${this.activeSchemaTab !== 'example' ? 'active' : ''}" data-tab = 'schema'>SCHEMA</button>
|
15246 | </div>
|
15247 | ${y`<div class="tab-content col" style="display:${this.activeSchemaTab === 'example' ? 'block' : 'none'};"> ${reqBodyExampleHtml}</div>`}
|
15248 | ${y`<div class="tab-content col" style="display:${this.activeSchemaTab === 'example' ? 'none' : 'block'};"> ${reqBodySchemaHtml}</div>`}
|
15249 | </div>` : y`
|
15250 | ${reqBodyFileInputHtml}
|
15251 | ${reqBodyFormHtml}`}
|
15252 | </div>
|
15253 | `;
|
15254 | }
|
15255 | formDataParamAsObjectTemplate(fieldName, fieldSchema, mimeType) {
|
15256 | var _formdataPartExample$;
|
15257 |
|
15258 | const formdataPartSchema = schemaInObjectNotation(fieldSchema, {});
|
15259 | const formdataPartExample = generateExample(fieldSchema, 'json', fieldSchema.examples, fieldSchema.example, this.callback === 'true' || this.webhook === 'true' ? true : false,
|
15260 |
|
15261 | this.callback === 'true' || this.webhook === 'true' ? false : true,
|
15262 |
|
15263 | 'text', false);
|
15264 | return y`
|
15265 | <div class="tab-panel row" style="min-height:220px; border-left: 6px solid var(--light-border-color); align-items: stretch;">
|
15266 | <div style="width:24px; background-color:var(--light-border-color)">
|
15267 | <div class="row" style="flex-direction:row-reverse; width:160px; height:24px; transform:rotate(270deg) translateX(-160px); transform-origin:top left; display:block;" @click="${e => {
|
15268 | if (e.target.classList.contains('v-tab-btn')) {
|
15269 | const {
|
15270 | tab
|
15271 | } = e.target.dataset;
|
15272 | if (tab) {
|
15273 | const tabPanelEl = e.target.closest('.tab-panel');
|
15274 | const selectedTabBtnEl = tabPanelEl.querySelector(`.v-tab-btn[data-tab="${tab}"]`);
|
15275 | const otherTabBtnEl = [...tabPanelEl.querySelectorAll(`.v-tab-btn:not([data-tab="${tab}"])`)];
|
15276 | const selectedTabContentEl = tabPanelEl.querySelector(`.tab-content[data-tab="${tab}"]`);
|
15277 | const otherTabContentEl = [...tabPanelEl.querySelectorAll(`.tab-content:not([data-tab="${tab}"])`)];
|
15278 | selectedTabBtnEl.classList.add('active');
|
15279 | selectedTabContentEl.style.display = 'block';
|
15280 | otherTabBtnEl.forEach(el => {
|
15281 | el.classList.remove('active');
|
15282 | });
|
15283 | otherTabContentEl.forEach(el => {
|
15284 | el.style.display = 'none';
|
15285 | });
|
15286 | }
|
15287 | }
|
15288 | if (e.target.tagName.toLowerCase() === 'button') {
|
15289 | this.activeSchemaTab = e.target.dataset.tab;
|
15290 | }
|
15291 | }}">
|
15292 | <button class="v-tab-btn ${this.activeSchemaTab === 'example' ? 'active' : ''}" data-tab = 'example'>EXAMPLE</button>
|
15293 | <button class="v-tab-btn ${this.activeSchemaTab !== 'example' ? 'active' : ''}" data-tab = 'schema'>SCHEMA</button>
|
15294 | </div>
|
15295 | </div>
|
15296 | ${y`
|
15297 | <div class="tab-content col" data-tab = 'example' style="display:${this.activeSchemaTab === 'example' ? 'block' : 'none'}; padding-left:5px; width:100%">
|
15298 | <textarea
|
15299 | class = "textarea"
|
15300 | part = "textarea textarea-param"
|
15301 | style = "width:100%; border:none; resize:vertical;"
|
15302 | data-array = "false"
|
15303 | data-ptype = "${mimeType.includes('form-urlencode') ? 'form-urlencode' : 'form-data'}"
|
15304 | data-pname = "${fieldName}"
|
15305 | data-example = "${((_formdataPartExample$ = formdataPartExample[0]) === null || _formdataPartExample$ === void 0 ? void 0 : _formdataPartExample$.exampleValue) || ''}"
|
15306 | .textContent = "${this.fillRequestFieldsWithExample === 'true' ? formdataPartExample[0].exampleValue : ''}"
|
15307 | spellcheck = "false"
|
15308 | ></textarea>
|
15309 | </div>`}
|
15310 | ${y`
|
15311 | <div class="tab-content col" data-tab = 'schema' style="display:${this.activeSchemaTab !== 'example' ? 'block' : 'none'}; padding-left:5px; width:100%;">
|
15312 | <schema-tree
|
15313 | .data = '${formdataPartSchema}'
|
15314 | schema-expand-level = "${this.schemaExpandLevel}"
|
15315 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
15316 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}",
|
15317 | > </schema-tree>
|
15318 | </div>`}
|
15319 | </div>
|
15320 | `;
|
15321 | }
|
15322 | formDataTemplate(schema, mimeType, exampleValue = '') {
|
15323 | const formDataTableRows = [];
|
15324 | if (schema.properties) {
|
15325 | for (const fieldName in schema.properties) {
|
15326 | var _schema$required, _fieldSchema$items;
|
15327 | const fieldSchema = schema.properties[fieldName];
|
15328 | if (fieldSchema.readOnly) {
|
15329 | continue;
|
15330 | }
|
15331 | const fieldExamples = fieldSchema.examples || fieldSchema.example || '';
|
15332 | const fieldType = fieldSchema.type;
|
15333 | const paramSchema = getTypeInfo(fieldSchema);
|
15334 | const labelColWidth = 'read focused'.includes(this.renderStyle) ? '200px' : '160px';
|
15335 | const example = normalizeExamples(paramSchema.examples || paramSchema.example, paramSchema.type);
|
15336 | formDataTableRows.push(y`
|
15337 | <tr title="${fieldSchema.deprecated ? 'Deprecated' : ''}">
|
15338 | <td style="width:${labelColWidth}; min-width:100px;">
|
15339 | <div class="param-name ${fieldSchema.deprecated ? 'deprecated' : ''}">
|
15340 | ${fieldName}${(_schema$required = schema.required) !== null && _schema$required !== void 0 && _schema$required.includes(fieldName) || fieldSchema.required ? y`<span style='color:var(--red);'>*</span>` : ''}
|
15341 | </div>
|
15342 | <div class="param-type">${paramSchema.type}</div>
|
15343 | </td>
|
15344 | <td
|
15345 | style="${fieldType === 'object' ? 'width:100%; padding:0;' : this.allowTry === 'true' ? '' : 'display:none;'} min-width:100px;"
|
15346 | colspan="${fieldType === 'object' ? 2 : 1}">
|
15347 | ${fieldType === 'array' ? ((_fieldSchema$items = fieldSchema.items) === null || _fieldSchema$items === void 0 ? void 0 : _fieldSchema$items.format) === 'binary' ? y`
|
15348 | <div class="file-input-container col" style='align-items:flex-end;' @click="${e => this.onAddRemoveFileInput(e, fieldName, mimeType)}">
|
15349 | <div class='input-set row'>
|
15350 | <input
|
15351 | type = "file"
|
15352 | part = "file-input"
|
15353 | style = "width:100%"
|
15354 | data-pname = "${fieldName}"
|
15355 | data-ptype = "${mimeType.includes('form-urlencode') ? 'form-urlencode' : 'form-data'}"
|
15356 | data-array = "false"
|
15357 | data-file-array = "true"
|
15358 | />
|
15359 | <button class="file-input-remove-btn"> ✕ </button>
|
15360 | </div>
|
15361 | <button class="m-btn primary file-input-add-btn" part="btn btn-fill" style="margin:2px 25px 0 0; padding:2px 6px;">ADD</button>
|
15362 | </div>
|
15363 | ` : y`
|
15364 | <tag-input
|
15365 | style = "width:100%"
|
15366 | data-ptype = "${mimeType.includes('form-urlencode') ? 'form-urlencode' : 'form-data'}"
|
15367 | data-pname = "${fieldName}"
|
15368 | data-example = "${Array.isArray(fieldExamples) ? fieldExamples.join('~|~') : fieldExamples}"
|
15369 | data-array = "true"
|
15370 | placeholder = "add-multiple ↩"
|
15371 | .value = "${Array.isArray(fieldExamples) ? Array.isArray(fieldExamples[0]) ? fieldExamples[0] : [fieldExamples[0]] : [fieldExamples]}"
|
15372 | >
|
15373 | </tag-input>
|
15374 | ` : y`
|
15375 | ${fieldType === 'object' ? this.formDataParamAsObjectTemplate.call(this, fieldName, fieldSchema, mimeType) : y`
|
15376 | ${this.allowTry === 'true' ? y`<input
|
15377 | .value = "${this.fillRequestFieldsWithExample === 'true' ? example.exampleVal : ''}"
|
15378 | spellcheck = "false"
|
15379 | type = "${fieldSchema.format === 'binary' ? 'file' : fieldSchema.format === 'password' ? 'password' : 'text'}"
|
15380 | part = "textbox textbox-param"
|
15381 | style = "width:100%"
|
15382 | data-ptype = "${mimeType.includes('form-urlencode') ? 'form-urlencode' : 'form-data'}"
|
15383 | data-pname = "${fieldName}"
|
15384 | data-example = "${Array.isArray(fieldExamples) ? fieldExamples[0] : fieldExamples}"
|
15385 | data-array = "false"
|
15386 | />` : ''}
|
15387 | `}`}
|
15388 | </td>
|
15389 | ${fieldType === 'object' ? '' : y`
|
15390 | <td>
|
15391 | ${paramSchema.default || paramSchema.constrain || paramSchema.allowedValues || paramSchema.pattern ? y`
|
15392 | <div class="param-constraint">
|
15393 | ${paramSchema.default ? y`<span style="font-weight:bold">Default: </span>${paramSchema.default}<br/>` : ''}
|
15394 | ${paramSchema.pattern ? y`<span style="font-weight:bold">Pattern: </span>${paramSchema.pattern}<br/>` : ''}
|
15395 | ${paramSchema.constrain ? y`${paramSchema.constrain}<br/>` : ''}
|
15396 | ${paramSchema.allowedValues && paramSchema.allowedValues.split('┃').map((v, i) => y`
|
15397 | ${i > 0 ? '┃' : y`<span style="font-weight:bold">Allowed: </span>`}
|
15398 | ${y`
|
15399 | <a part="anchor anchor-param-constraint" class = "${this.allowTry === 'true' ? '' : 'inactive-link'}"
|
15400 | data-type="${paramSchema.type === 'array' ? paramSchema.type : 'string'}"
|
15401 | data-enum="${v.trim()}"
|
15402 | @click="${e => {
|
15403 | const inputEl = e.target.closest('table').querySelector(`[data-pname="${fieldName}"]`);
|
15404 | if (inputEl) {
|
15405 | if (e.target.dataset.type === 'array') {
|
15406 | inputEl.value = [e.target.dataset.enum];
|
15407 | } else {
|
15408 | inputEl.value = e.target.dataset.enum;
|
15409 | }
|
15410 | }
|
15411 | }}"
|
15412 | >
|
15413 | ${v}
|
15414 | </a>`}`)}
|
15415 | </div>` : ''}
|
15416 | </td>`}
|
15417 | </tr>
|
15418 | ${fieldType === 'object' ? '' : y`
|
15419 | <tr>
|
15420 | <td style="border:none"> </td>
|
15421 | <td colspan="2" style="border:none; margin-top:0; padding:0 5px 8px 5px;">
|
15422 | <span class="m-markdown-small">${unsafe_html_o(marked(fieldSchema.description || ''))}</span>
|
15423 | ${this.exampleListTemplate.call(this, fieldName, paramSchema.type, example.exampleList)}
|
15424 | </td>
|
15425 | </tr>
|
15426 | `}`);
|
15427 | }
|
15428 | return y`
|
15429 | <table role="presentation" style="width:100%;" class="m-table">
|
15430 | ${formDataTableRows}
|
15431 | </table>
|
15432 | `;
|
15433 | }
|
15434 | return y`
|
15435 | <textarea
|
15436 | class = "textarea dynamic-form-param ${mimeType}"
|
15437 | part = "textarea textarea-param"
|
15438 | spellcheck = "false"
|
15439 | data-pname="dynamic-form"
|
15440 | data-ptype="${mimeType}"
|
15441 | .textContent = "${exampleValue}"
|
15442 | style="width:100%"
|
15443 | ></textarea>
|
15444 | ${schema.description ? y`<span class="m-markdown-small">${unsafe_html_o(marked(schema.description))}</span>` : ''}
|
15445 | `;
|
15446 | }
|
15447 | curlSyntaxTemplate(display = 'flex') {
|
15448 | return y`
|
15449 | <div class="col m-markdown" style="flex:1; display:${display}; position:relative; max-width: 100%;">
|
15450 | <button class="toolbar-btn" style = "position:absolute; top:12px; right:8px" @click='${e => {
|
15451 | copyToClipboard(this.curlSyntax.replace(/\\$/, ''), e);
|
15452 | }}' part="btn btn-fill"> Copy </button>
|
15453 | <pre style="white-space:pre"><code>${unsafe_html_o(prism_default().highlight(this.curlSyntax.trim().replace(/\\$/, ''), (prism_default()).languages.shell, 'shell'))}</code></pre>
|
15454 | </div>
|
15455 | `;
|
15456 | }
|
15457 | apiResponseTabTemplate() {
|
15458 | let responseFormat = '';
|
15459 | let responseContent = '';
|
15460 | if (!this.responseIsBlob) {
|
15461 | if (this.responseHeaders.includes('application/x-ndjson')) {
|
15462 | responseFormat = 'json';
|
15463 | const prismLines = this.responseText.split('\n').map(q => prism_default().highlight(q, (prism_default()).languages[responseFormat], responseFormat)).join('\n');
|
15464 | responseContent = y`<code>${unsafe_html_o(prismLines)}</code>`;
|
15465 | } else if (this.responseHeaders.includes('json')) {
|
15466 | responseFormat = 'json';
|
15467 | responseContent = y`<code>${unsafe_html_o(prism_default().highlight(this.responseText, (prism_default()).languages[responseFormat], responseFormat))}</code>`;
|
15468 | } else if (this.responseHeaders.includes('html') || this.responseHeaders.includes('xml')) {
|
15469 | responseFormat = 'html';
|
15470 | responseContent = y`<code>${unsafe_html_o(prism_default().highlight(this.responseText, (prism_default()).languages[responseFormat], responseFormat))}</code>`;
|
15471 | } else {
|
15472 | responseFormat = 'text';
|
15473 | responseContent = y`<code>${this.responseText}</code>`;
|
15474 | }
|
15475 | }
|
15476 | return y`
|
15477 | <div class="row" style="font-size:var(--font-size-small); margin:5px 0">
|
15478 | <div class="response-message ${this.responseStatus}">Response Status: ${this.responseMessage}</div>
|
15479 | <div style="flex:1"></div>
|
15480 | <button class="m-btn" part="btn btn-outline btn-clear-response" @click="${this.clearResponseData}">CLEAR RESPONSE</button>
|
15481 | </div>
|
15482 | <div class="tab-panel col" style="border-width:0 0 1px 0;">
|
15483 | <div id="tab_buttons" class="tab-buttons row" @click="${e => {
|
15484 | if (e.target.classList.contains('tab-btn') === false) {
|
15485 | return;
|
15486 | }
|
15487 | this.activeResponseTab = e.target.dataset.tab;
|
15488 | }}">
|
15489 | <button class="tab-btn ${this.activeResponseTab === 'response' ? 'active' : ''}" data-tab = 'response' > RESPONSE</button>
|
15490 | <button class="tab-btn ${this.activeResponseTab === 'headers' ? 'active' : ''}" data-tab = 'headers' > RESPONSE HEADERS</button>
|
15491 | ${this.showCurlBeforeTry === 'true' ? '' : y`<button class="tab-btn ${this.activeResponseTab === 'curl' ? 'active' : ''}" data-tab = 'curl'>CURL</button>`}
|
15492 | </div>
|
15493 | ${this.responseIsBlob ? y`
|
15494 | <div class="tab-content col" style="flex:1; display:${this.activeResponseTab === 'response' ? 'flex' : 'none'};">
|
15495 | <button class="m-btn thin-border mar-top-8" style="width:135px" @click='${e => {
|
15496 | downloadResource(this.responseBlobUrl, this.respContentDisposition, e);
|
15497 | }}' part="btn btn-outline">
|
15498 | DOWNLOAD
|
15499 | </button>
|
15500 | ${this.responseBlobType === 'view' ? y`<button class="m-btn thin-border mar-top-8" style="width:135px" @click='${e => {
|
15501 | viewResource(this.responseBlobUrl, e);
|
15502 | }}' part="btn btn-outline">VIEW (NEW TAB)</button>` : ''}
|
15503 | </div>` : y`
|
15504 | <div class="tab-content col m-markdown" style="flex:1; display:${this.activeResponseTab === 'response' ? 'flex' : 'none'};" >
|
15505 | <button class="toolbar-btn" style="position:absolute; top:12px; right:8px" @click='${e => {
|
15506 | copyToClipboard(this.responseText, e);
|
15507 | }}' part="btn btn-fill"> Copy </button>
|
15508 | <pre style="white-space:pre; min-height:50px; height:var(--resp-area-height, 400px); resize:vertical; overflow:auto">${responseContent}</pre>
|
15509 | </div>`}
|
15510 | <div class="tab-content col m-markdown" style="flex:1; display:${this.activeResponseTab === 'headers' ? 'flex' : 'none'};" >
|
15511 | <button class="toolbar-btn" style = "position:absolute; top:12px; right:8px" @click='${e => {
|
15512 | copyToClipboard(this.responseHeaders, e);
|
15513 | }}' part="btn btn-fill"> Copy </button>
|
15514 | <pre style="white-space:pre"><code>${unsafe_html_o(prism_default().highlight(this.responseHeaders, (prism_default()).languages.css, 'css'))}</code></pre>
|
15515 | </div>
|
15516 | ${this.showCurlBeforeTry === 'true' ? '' : this.curlSyntaxTemplate(this.activeResponseTab === 'curl' ? 'flex' : 'none')}
|
15517 | </div>`;
|
15518 | }
|
15519 | apiCallTemplate() {
|
15520 | var _this$security, _this$api_keys$;
|
15521 | let selectServerDropdownHtml = '';
|
15522 | if (this.servers && this.servers.length > 0) {
|
15523 | selectServerDropdownHtml = y`
|
15524 | <select style="min-width:100px;" @change='${e => {
|
15525 | this.serverUrl = e.target.value;
|
15526 | }}'>
|
15527 | ${this.servers.map(v => y`<option value = "${v.url}"> ${v.url} - ${v.description} </option>`)}
|
15528 | </select>
|
15529 | `;
|
15530 | }
|
15531 | const selectedServerHtml = y`
|
15532 | <div style="display:flex; flex-direction:column;">
|
15533 | ${selectServerDropdownHtml}
|
15534 | ${this.serverUrl ? y`
|
15535 | <div style="display:flex; align-items:baseline;">
|
15536 | <div style="font-weight:bold; padding-right:5px;">API Server</div>
|
15537 | <span class = "gray-text"> ${this.serverUrl} </span>
|
15538 | </div>
|
15539 | ` : ''}
|
15540 | </div>
|
15541 | `;
|
15542 | return y`
|
15543 | <div style="display:flex; align-items:flex-end; margin:16px 0; font-size:var(--font-size-small);" part="wrap-request-btn">
|
15544 | <div class="hide-in-small-screen" style="flex-direction:column; margin:0; width:calc(100% - 60px);">
|
15545 | <div style="display:flex; flex-direction:row; align-items:center; overflow:hidden;">
|
15546 | ${selectedServerHtml}
|
15547 | </div>
|
15548 | <div style="display:flex;">
|
15549 | <div style="font-weight:bold; padding-right:5px;">Authentication</div>
|
15550 | ${((_this$security = this.security) === null || _this$security === void 0 ? void 0 : _this$security.length) > 0 ? y`
|
15551 | ${this.api_keys.length > 0 ? y`<div style="color:var(--blue); overflow:hidden;">
|
15552 | ${this.api_keys.length === 1 ? `${(_this$api_keys$ = this.api_keys[0]) === null || _this$api_keys$ === void 0 ? void 0 : _this$api_keys$.typeDisplay} in ${this.api_keys[0].in}` : `${this.api_keys.length} API keys applied`}
|
15553 | </div>` : y`<div class="gray-text">Required <span style="color:var(--red)">(None Applied)</span>`}` : y`<span class="gray-text"> Not Required </span>`}
|
15554 | </div>
|
15555 | </div>
|
15556 | ${this.parameters.length > 0 || this.request_body ? y`
|
15557 | <button class="m-btn thin-border" part="btn btn-outline btn-fill" style="margin-right:5px;" @click="${this.onFillRequestData}" title="Fills with example data (if provided)">
|
15558 | FILL EXAMPLE
|
15559 | </button>
|
15560 | <button class="m-btn thin-border" part="btn btn-outline btn-clear" style="margin-right:5px;" @click="${this.onClearRequestData}">
|
15561 | CLEAR
|
15562 | </button>` : ''}
|
15563 | <button class="m-btn primary thin-border" part="btn btn-try" @click="${this.onTryClick}">TRY</button>
|
15564 | </div>
|
15565 | <div class="row" style="font-size:var(--font-size-small); margin:5px 0">
|
15566 | ${this.showCurlBeforeTry === 'true' ? this.curlSyntaxTemplate() : ''}
|
15567 | </div>
|
15568 | ${this.responseMessage === '' ? '' : this.apiResponseTabTemplate()}
|
15569 | `;
|
15570 | }
|
15571 |
|
15572 |
|
15573 | async onFillRequestData(e) {
|
15574 | const requestPanelEl = e.target.closest('.request-panel');
|
15575 | const requestPanelInputEls = [...requestPanelEl.querySelectorAll('input, tag-input, textarea:not(.is-hidden)')];
|
15576 | requestPanelInputEls.forEach(el => {
|
15577 | if (el.dataset.example) {
|
15578 | if (el.tagName.toUpperCase() === 'TAG-INPUT') {
|
15579 | el.value = el.dataset.example.split('~|~');
|
15580 | } else {
|
15581 | el.value = el.dataset.example;
|
15582 | }
|
15583 | }
|
15584 | });
|
15585 | }
|
15586 | async onClearRequestData(e) {
|
15587 | const requestPanelEl = e.target.closest('.request-panel');
|
15588 | const requestPanelInputEls = [...requestPanelEl.querySelectorAll('input, tag-input, textarea:not(.is-hidden)')];
|
15589 | requestPanelInputEls.forEach(el => {
|
15590 | el.value = '';
|
15591 | });
|
15592 | }
|
15593 | buildFetchURL(requestPanelEl) {
|
15594 | let fetchUrl;
|
15595 | const pathParamEls = [...requestPanelEl.querySelectorAll("[data-ptype='path']")];
|
15596 | const queryParamEls = [...requestPanelEl.querySelectorAll("[data-ptype='query']")];
|
15597 | const queryParamObjTypeEls = [...requestPanelEl.querySelectorAll("[data-ptype='query-object']")];
|
15598 | fetchUrl = this.path;
|
15599 |
|
15600 | pathParamEls.map(el => {
|
15601 | fetchUrl = fetchUrl.replace(`{${el.dataset.pname}}`, encodeURIComponent(el.value));
|
15602 | });
|
15603 |
|
15604 |
|
15605 | const urlQueryParamsMap = new Map();
|
15606 | const queryParamsWithReservedCharsAllowed = [];
|
15607 | if (queryParamEls.length > 0) {
|
15608 | queryParamEls.forEach(el => {
|
15609 | const queryParam = new URLSearchParams();
|
15610 | if (el.dataset.paramAllowReserved === 'true') {
|
15611 | queryParamsWithReservedCharsAllowed.push(el.dataset.pname);
|
15612 | }
|
15613 | if (el.dataset.array === 'false') {
|
15614 | if (el.value !== '') {
|
15615 | queryParam.append(el.dataset.pname, el.value);
|
15616 | }
|
15617 | } else {
|
15618 | const {
|
15619 | paramSerializeStyle,
|
15620 | paramSerializeExplode
|
15621 | } = el.dataset;
|
15622 | let vals = el.value && Array.isArray(el.value) ? el.value : [];
|
15623 | vals = Array.isArray(vals) ? vals.filter(v => v !== '') : [];
|
15624 | if (vals.length > 0) {
|
15625 | if (paramSerializeStyle === 'spaceDelimited') {
|
15626 | queryParam.append(el.dataset.pname, vals.join(' ').replace(/^\s|\s$/g, ''));
|
15627 | } else if (paramSerializeStyle === 'pipeDelimited') {
|
15628 | queryParam.append(el.dataset.pname, vals.join('|').replace(/^\||\|$/g, ''));
|
15629 | } else {
|
15630 | if (paramSerializeExplode === 'true') {
|
15631 |
|
15632 | vals.forEach(v => {
|
15633 | queryParam.append(el.dataset.pname, v);
|
15634 | });
|
15635 | } else {
|
15636 | queryParam.append(el.dataset.pname, vals.join(',').replace(/^,|,$/g, ''));
|
15637 | }
|
15638 | }
|
15639 | }
|
15640 | }
|
15641 | if (queryParam.toString()) {
|
15642 | urlQueryParamsMap.set(el.dataset.pname, queryParam);
|
15643 | }
|
15644 | });
|
15645 | }
|
15646 |
|
15647 |
|
15648 | if (queryParamObjTypeEls.length > 0) {
|
15649 | queryParamObjTypeEls.map(el => {
|
15650 | const queryParam = new URLSearchParams();
|
15651 | try {
|
15652 | let queryParamObj = {};
|
15653 | const {
|
15654 | paramSerializeStyle,
|
15655 | paramSerializeExplode
|
15656 | } = el.dataset;
|
15657 | queryParamObj = Object.assign(queryParamObj, JSON.parse(el.value.replace(/\s+/g, ' ')));
|
15658 | if (el.dataset.paramAllowReserved === 'true') {
|
15659 | queryParamsWithReservedCharsAllowed.push(el.dataset.pname);
|
15660 | }
|
15661 | if ('json xml'.includes(paramSerializeStyle)) {
|
15662 | if (paramSerializeStyle === 'json') {
|
15663 | queryParam.append(el.dataset.pname, JSON.stringify(queryParamObj));
|
15664 | } else if (paramSerializeStyle === 'xml') {
|
15665 | queryParam.append(el.dataset.pname, json2xml(queryParamObj));
|
15666 | }
|
15667 | } else {
|
15668 | for (const key in queryParamObj) {
|
15669 | if (typeof queryParamObj[key] === 'object') {
|
15670 | if (Array.isArray(queryParamObj[key])) {
|
15671 | if (paramSerializeStyle === 'spaceDelimited') {
|
15672 | queryParam.append(key, queryParamObj[key].join(' '));
|
15673 | } else if (paramSerializeStyle === 'pipeDelimited') {
|
15674 | queryParam.append(key, queryParamObj[key].join('|'));
|
15675 | } else {
|
15676 | if (paramSerializeExplode === 'true') {
|
15677 |
|
15678 | queryParamObj[key].forEach(v => {
|
15679 | queryParam.append(key, v);
|
15680 | });
|
15681 | } else {
|
15682 | queryParam.append(key, queryParamObj[key]);
|
15683 | }
|
15684 | }
|
15685 | }
|
15686 | } else {
|
15687 | queryParam.append(key, queryParamObj[key]);
|
15688 | }
|
15689 | }
|
15690 | }
|
15691 | } catch (err) {
|
15692 | console.error('RapiDoc: unable to parse %s into object', el.value);
|
15693 | }
|
15694 |
|
15695 | if (queryParam.toString()) {
|
15696 | urlQueryParamsMap.set(el.dataset.pname, queryParam);
|
15697 | }
|
15698 | });
|
15699 | }
|
15700 | let urlQueryParamString = '';
|
15701 | if (urlQueryParamsMap.size) {
|
15702 | urlQueryParamsMap.forEach((val, pname) => {
|
15703 | if (queryParamsWithReservedCharsAllowed.includes(pname)) {
|
15704 | urlQueryParamString += `${pname}=`;
|
15705 | urlQueryParamString += val.getAll(pname).join(`&${pname}=`);
|
15706 | urlQueryParamString += '&';
|
15707 | } else {
|
15708 | urlQueryParamString += `${val.toString()}&`;
|
15709 | }
|
15710 | });
|
15711 | urlQueryParamString = urlQueryParamString.slice(0, -1);
|
15712 | }
|
15713 | if (urlQueryParamString.length !== 0) {
|
15714 | fetchUrl = `${fetchUrl}${fetchUrl.includes('?') ? '&' : '?'}${urlQueryParamString}`;
|
15715 | }
|
15716 |
|
15717 |
|
15718 | this.api_keys.filter(v => v.in === 'query').forEach(v => {
|
15719 | fetchUrl = `${fetchUrl}${fetchUrl.includes('?') ? '&' : '?'}${v.name}=${encodeURIComponent(v.finalKeyValue)}`;
|
15720 | });
|
15721 | fetchUrl = `${this.serverUrl.replace(/\/$/, '')}${fetchUrl}`;
|
15722 | return fetchUrl;
|
15723 | }
|
15724 | buildFetchHeaders(requestPanelEl) {
|
15725 | var _this$closest;
|
15726 | const respEl = (_this$closest = this.closest('.expanded-req-resp-container, .req-resp-container')) === null || _this$closest === void 0 ? void 0 : _this$closest.getElementsByTagName('api-response')[0];
|
15727 | const headerParamEls = [...requestPanelEl.querySelectorAll("[data-ptype='header']")];
|
15728 | const requestBodyContainerEl = requestPanelEl.querySelector('.request-body-container');
|
15729 | const acceptHeader = respEl === null || respEl === void 0 ? void 0 : respEl.selectedMimeType;
|
15730 | const reqHeaders = new Headers();
|
15731 | if (acceptHeader) {
|
15732 |
|
15733 | reqHeaders.append('Accept', acceptHeader);
|
15734 | } else if (this.accept) {
|
15735 | reqHeaders.append('Accept', this.accept);
|
15736 | }
|
15737 |
|
15738 |
|
15739 | this.api_keys.filter(v => v.in === 'header').forEach(v => {
|
15740 | reqHeaders.append(v.name, v.finalKeyValue);
|
15741 | });
|
15742 |
|
15743 |
|
15744 | headerParamEls.map(el => {
|
15745 | if (el.value) {
|
15746 | reqHeaders.append(el.dataset.pname, el.value);
|
15747 | }
|
15748 | });
|
15749 | if (requestBodyContainerEl) {
|
15750 | const requestBodyType = requestBodyContainerEl.dataset.selectedRequestBodyType;
|
15751 |
|
15752 | if (!requestBodyType.includes('form-data')) {
|
15753 |
|
15754 | reqHeaders.append('Content-Type', requestBodyType);
|
15755 | }
|
15756 | }
|
15757 | return reqHeaders;
|
15758 | }
|
15759 | buildFetchBodyOptions(requestPanelEl) {
|
15760 | const requestBodyContainerEl = requestPanelEl.querySelector('.request-body-container');
|
15761 | const fetchOptions = {
|
15762 | method: this.method.toUpperCase()
|
15763 | };
|
15764 | if (requestBodyContainerEl) {
|
15765 | const requestBodyType = requestBodyContainerEl.dataset.selectedRequestBodyType;
|
15766 | if (requestBodyType.includes('form-urlencoded')) {
|
15767 |
|
15768 | const formUrlDynamicTextAreaEl = requestPanelEl.querySelector("[data-ptype='dynamic-form']");
|
15769 | if (formUrlDynamicTextAreaEl) {
|
15770 | const val = formUrlDynamicTextAreaEl.value;
|
15771 | const formUrlDynParams = new URLSearchParams();
|
15772 | let proceed = true;
|
15773 | let tmpObj;
|
15774 | if (val) {
|
15775 | try {
|
15776 | tmpObj = JSON.parse(val);
|
15777 | } catch (err) {
|
15778 | proceed = false;
|
15779 | console.warn('RapiDoc: Invalid JSON provided', err);
|
15780 | }
|
15781 | } else {
|
15782 | proceed = false;
|
15783 | }
|
15784 | if (proceed) {
|
15785 | for (const prop in tmpObj) {
|
15786 | formUrlDynParams.append(prop, JSON.stringify(tmpObj[prop]));
|
15787 | }
|
15788 | fetchOptions.body = formUrlDynParams;
|
15789 | }
|
15790 | } else {
|
15791 |
|
15792 | const formUrlEls = [...requestPanelEl.querySelectorAll("[data-ptype='form-urlencode']")];
|
15793 | const formUrlParams = new URLSearchParams();
|
15794 | formUrlEls.filter(v => v.type !== 'file').forEach(el => {
|
15795 | if (el.dataset.array === 'false') {
|
15796 | if (el.value) {
|
15797 | formUrlParams.append(el.dataset.pname, el.value);
|
15798 | }
|
15799 | } else {
|
15800 | const vals = el.value && Array.isArray(el.value) ? el.value.join(',') : '';
|
15801 | formUrlParams.append(el.dataset.pname, vals);
|
15802 | }
|
15803 | });
|
15804 | fetchOptions.body = formUrlParams;
|
15805 | }
|
15806 | } else if (requestBodyType.includes('form-data')) {
|
15807 | const formDataParams = new FormData();
|
15808 | const formDataEls = [...requestPanelEl.querySelectorAll("[data-ptype='form-data']")];
|
15809 | formDataEls.forEach(el => {
|
15810 | if (el.dataset.array === 'false') {
|
15811 | if (el.type === 'file' && el.files[0]) {
|
15812 | formDataParams.append(el.dataset.pname, el.files[0], el.files[0].name);
|
15813 | } else if (el.value) {
|
15814 | formDataParams.append(el.dataset.pname, el.value);
|
15815 | }
|
15816 | } else if (el.value && Array.isArray(el.value)) {
|
15817 | formDataParams.append(el.dataset.pname, el.value.join(','));
|
15818 | }
|
15819 | });
|
15820 | fetchOptions.body = formDataParams;
|
15821 | } else if (/^audio\/|^image\/|^video\/|^font\/|tar$|zip$|7z$|rtf$|msword$|excel$|\/pdf$|\/octet-stream$/.test(requestBodyType)) {
|
15822 | const bodyParamFileEl = requestPanelEl.querySelector('.request-body-param-file');
|
15823 | if (bodyParamFileEl !== null && bodyParamFileEl !== void 0 && bodyParamFileEl.files[0]) {
|
15824 | fetchOptions.body = bodyParamFileEl.files[0];
|
15825 | }
|
15826 | } else if (requestBodyType.includes('json') || requestBodyType.includes('xml') || requestBodyType.includes('text')) {
|
15827 | const exampleTextAreaEl = requestPanelEl.querySelector('.request-body-param-user-input');
|
15828 | if (exampleTextAreaEl !== null && exampleTextAreaEl !== void 0 && exampleTextAreaEl.value) {
|
15829 | fetchOptions.body = exampleTextAreaEl.value;
|
15830 | }
|
15831 | }
|
15832 | }
|
15833 | return fetchOptions;
|
15834 | }
|
15835 | async onTryClick(e) {
|
15836 | const tryBtnEl = e.target;
|
15837 | const requestPanelEl = tryBtnEl.closest('.request-panel');
|
15838 | const fetchUrl = this.buildFetchURL(requestPanelEl);
|
15839 | const fetchOptions = this.buildFetchBodyOptions(requestPanelEl);
|
15840 | const reqHeaders = this.buildFetchHeaders(requestPanelEl);
|
15841 | this.responseUrl = '';
|
15842 | this.responseHeaders = [];
|
15843 | this.curlSyntax = this.generateCURLSyntax(fetchUrl, reqHeaders, fetchOptions, requestPanelEl);
|
15844 | this.responseStatus = 'success';
|
15845 | this.responseIsBlob = false;
|
15846 | this.respContentDisposition = '';
|
15847 | if (this.responseBlobUrl) {
|
15848 | URL.revokeObjectURL(this.responseBlobUrl);
|
15849 | this.responseBlobUrl = '';
|
15850 | }
|
15851 | if (this.fetchCredentials) {
|
15852 | fetchOptions.credentials = this.fetchCredentials;
|
15853 | }
|
15854 | const controller = new AbortController();
|
15855 | const {
|
15856 | signal
|
15857 | } = controller;
|
15858 | fetchOptions.headers = reqHeaders;
|
15859 | const tempRequest = {
|
15860 | url: fetchUrl,
|
15861 | ...fetchOptions
|
15862 | };
|
15863 | this.dispatchEvent(new CustomEvent('before-try', {
|
15864 | bubbles: true,
|
15865 | composed: true,
|
15866 | detail: {
|
15867 | request: tempRequest,
|
15868 | controller
|
15869 | }
|
15870 | }));
|
15871 | const updatedFetchOptions = {
|
15872 | method: tempRequest.method,
|
15873 | headers: tempRequest.headers,
|
15874 | credentials: tempRequest.credentials,
|
15875 | body: tempRequest.body
|
15876 | };
|
15877 | const fetchRequest = new Request(tempRequest.url, updatedFetchOptions);
|
15878 | let fetchResponse;
|
15879 | let responseClone;
|
15880 | try {
|
15881 | let respBlob;
|
15882 | let respJson;
|
15883 | let respText;
|
15884 | tryBtnEl.disabled = true;
|
15885 | this.responseText = '⌛';
|
15886 | this.responseMessage = '';
|
15887 | this.requestUpdate();
|
15888 | const startTime = performance.now();
|
15889 | fetchResponse = await fetch(fetchRequest, {
|
15890 | signal
|
15891 | });
|
15892 | const endTime = performance.now();
|
15893 | responseClone = fetchResponse.clone();
|
15894 | tryBtnEl.disabled = false;
|
15895 | this.responseMessage = y`${fetchResponse.statusText ? `${fetchResponse.statusText}:${fetchResponse.status}` : fetchResponse.status} <div style="color:var(--light-fg)"> Took ${Math.round(endTime - startTime)} milliseconds </div>`;
|
15896 | this.responseUrl = fetchResponse.url;
|
15897 | const respHeadersObj = {};
|
15898 | fetchResponse.headers.forEach((hdrVal, hdr) => {
|
15899 | respHeadersObj[hdr] = hdrVal;
|
15900 | this.responseHeaders = `${this.responseHeaders}${hdr}: ${hdrVal}\n`;
|
15901 | });
|
15902 | const contentType = fetchResponse.headers.get('content-type');
|
15903 | const respEmpty = (await fetchResponse.clone().text()).length === 0;
|
15904 | if (respEmpty) {
|
15905 | this.responseText = '';
|
15906 | } else if (contentType) {
|
15907 | if (contentType === 'application/x-ndjson') {
|
15908 | this.responseText = await fetchResponse.text();
|
15909 | } else if (contentType.includes('json')) {
|
15910 | if (/charset=[^"']+/.test(contentType)) {
|
15911 | const encoding = contentType.split('charset=')[1];
|
15912 | const buffer = await fetchResponse.arrayBuffer();
|
15913 | try {
|
15914 | respText = new TextDecoder(encoding).decode(buffer);
|
15915 | } catch {
|
15916 | respText = new TextDecoder('utf-8').decode(buffer);
|
15917 | }
|
15918 | try {
|
15919 | respJson = JSON.parse(respText);
|
15920 | this.responseText = JSON.stringify(respJson, null, 2);
|
15921 | } catch {
|
15922 | this.responseText = respText;
|
15923 | }
|
15924 | } else {
|
15925 | respJson = await fetchResponse.json();
|
15926 | this.responseText = JSON.stringify(respJson, null, 2);
|
15927 | }
|
15928 |
|
15929 | } else if (/^font\/|tar$|zip$|7z$|rtf$|msword$|excel$|\/pdf$|\/octet-stream$|^application\/vnd\./.test(contentType)) {
|
15930 | this.responseIsBlob = true;
|
15931 | this.responseBlobType = 'download';
|
15932 | } else if (/^audio|^image|^video/.test(contentType)) {
|
15933 | this.responseIsBlob = true;
|
15934 | this.responseBlobType = 'view';
|
15935 | } else {
|
15936 | respText = await fetchResponse.text();
|
15937 | if (contentType.includes('xml')) {
|
15938 | this.responseText = dist_default()(respText, {
|
15939 | textNodesOnSameLine: true,
|
15940 | indentor: ' '
|
15941 | });
|
15942 | } else {
|
15943 | this.responseText = respText;
|
15944 | }
|
15945 | }
|
15946 | if (this.responseIsBlob) {
|
15947 | const contentDisposition = fetchResponse.headers.get('content-disposition');
|
15948 | this.respContentDisposition = contentDisposition ? contentDisposition.split('filename=')[1].replace(/"|'/g, '') : 'filename';
|
15949 | respBlob = await fetchResponse.blob();
|
15950 | this.responseBlobUrl = URL.createObjectURL(respBlob);
|
15951 | }
|
15952 | } else {
|
15953 | respText = await fetchResponse.text();
|
15954 | this.responseText = respText;
|
15955 | }
|
15956 | this.dispatchEvent(new CustomEvent('after-try', {
|
15957 | bubbles: true,
|
15958 | composed: true,
|
15959 | detail: {
|
15960 | request: fetchRequest,
|
15961 | response: responseClone,
|
15962 | responseHeaders: respHeadersObj,
|
15963 | responseBody: respJson || respText || respBlob,
|
15964 | responseStatus: responseClone.ok
|
15965 | }
|
15966 | }));
|
15967 | } catch (err) {
|
15968 | tryBtnEl.disabled = false;
|
15969 | if (err.name === 'AbortError') {
|
15970 | this.dispatchEvent(new CustomEvent('request-aborted', {
|
15971 | bubbles: true,
|
15972 | composed: true,
|
15973 | detail: {
|
15974 | err,
|
15975 | request: fetchRequest
|
15976 | }
|
15977 | }));
|
15978 | this.responseMessage = 'Request Aborted';
|
15979 | this.responseText = 'Request Aborted';
|
15980 | } else {
|
15981 | this.dispatchEvent(new CustomEvent('after-try', {
|
15982 | bubbles: true,
|
15983 | composed: true,
|
15984 | detail: {
|
15985 | err,
|
15986 | request: fetchRequest
|
15987 | }
|
15988 | }));
|
15989 | this.responseMessage = `${err.message} (CORS or Network Issue)`;
|
15990 | }
|
15991 | }
|
15992 | this.requestUpdate();
|
15993 | }
|
15994 | liveCURLSyntaxUpdate(requestPanelEl) {
|
15995 | this.applyCURLSyntax(requestPanelEl);
|
15996 | this.requestUpdate();
|
15997 | }
|
15998 | onGenerateCURLClick(e) {
|
15999 | const requestPanelEl = this.getRequestPanel(e);
|
16000 | this.applyCURLSyntax(requestPanelEl);
|
16001 | }
|
16002 | getRequestPanel(e) {
|
16003 | return e.target.closest('.request-panel');
|
16004 | }
|
16005 | applyCURLSyntax(requestPanelEl) {
|
16006 | const fetchUrl = this.buildFetchURL(requestPanelEl);
|
16007 | const fetchOptions = this.buildFetchBodyOptions(requestPanelEl);
|
16008 | const fetchHeaders = this.buildFetchHeaders(requestPanelEl);
|
16009 | this.curlSyntax = this.generateCURLSyntax(fetchUrl, fetchHeaders, fetchOptions, requestPanelEl);
|
16010 | }
|
16011 | generateCURLSyntax(fetchUrl, fetchHeaders, fetchOptions, requestPanelEl) {
|
16012 | let curlUrl;
|
16013 | let curl = '';
|
16014 | let curlHeaders = '';
|
16015 | let curlData = '';
|
16016 | let curlForm = '';
|
16017 | const requestBodyContainerEl = requestPanelEl.querySelector('.request-body-container');
|
16018 | if (fetchUrl.startsWith('http') === false) {
|
16019 | const url = new URL(fetchUrl, window.location.href);
|
16020 | curlUrl = url.href;
|
16021 | } else {
|
16022 | curlUrl = fetchUrl;
|
16023 | }
|
16024 | curl = `curl -X ${this.method.toUpperCase()} "${curlUrl}" \\\n`;
|
16025 | curlHeaders = Array.from(fetchHeaders).map(([key, value]) => ` -H "${key}: ${value}"`).join('\\\n');
|
16026 | if (curlHeaders) {
|
16027 | curlHeaders = `${curlHeaders} \\\n`;
|
16028 | }
|
16029 | if (fetchOptions.body instanceof URLSearchParams) {
|
16030 | curlData = ` -d ${fetchOptions.body.toString()} \\\n`;
|
16031 | } else if (fetchOptions.body instanceof File) {
|
16032 | curlData = ` --data-binary @${fetchOptions.body.name} \\\n`;
|
16033 | } else if (fetchOptions.body instanceof FormData) {
|
16034 | curlForm = Array.from(fetchOptions.body).reduce((aggregator, [key, value]) => {
|
16035 | if (value instanceof File) {
|
16036 | return [...aggregator, ` -F "${key}=@${value.name}"`];
|
16037 | }
|
16038 | const multiple = value.match(/([^,],)/gm);
|
16039 | if (multiple) {
|
16040 | const multipleResults = multiple.map(one => `-F "${key}[]=${one}"`);
|
16041 | return [...aggregator, ...multipleResults];
|
16042 | }
|
16043 | return [...aggregator, ` -F "${key}=${value}"`];
|
16044 | }, []).join('\\\n');
|
16045 | } else if (requestBodyContainerEl && requestBodyContainerEl.dataset.selectedRequestBodyType) {
|
16046 | const requestBodyType = requestBodyContainerEl.dataset.selectedRequestBodyType;
|
16047 | const exampleTextAreaEl = requestPanelEl.querySelector('.request-body-param-user-input');
|
16048 | if (exampleTextAreaEl !== null && exampleTextAreaEl !== void 0 && exampleTextAreaEl.value) {
|
16049 | fetchOptions.body = exampleTextAreaEl.value;
|
16050 | if (requestBodyType.includes('json')) {
|
16051 | try {
|
16052 | curlData = ` -d '${JSON.stringify(JSON.parse(exampleTextAreaEl.value))}' \\\n`;
|
16053 | } catch (err) {
|
16054 |
|
16055 | }
|
16056 | }
|
16057 | if (!curlData) {
|
16058 | curlData = ` -d '${exampleTextAreaEl.value.replace(/'/g, '\'"\'"\'')}' \\\n`;
|
16059 | }
|
16060 | }
|
16061 | }
|
16062 | return `${curl}${curlHeaders}${curlData}${curlForm}`;
|
16063 | }
|
16064 | onAddRemoveFileInput(e, pname, ptype) {
|
16065 | if (e.target.tagName.toLowerCase() !== 'button') {
|
16066 | return;
|
16067 | }
|
16068 | if (e.target.classList.contains('file-input-remove-btn')) {
|
16069 |
|
16070 | const el = e.target.closest('.input-set');
|
16071 | el.remove();
|
16072 | return;
|
16073 | }
|
16074 | const el = e.target.closest('.file-input-container');
|
16075 |
|
16076 |
|
16077 |
|
16078 |
|
16079 | const newInputContainerEl = document.createElement('div');
|
16080 | newInputContainerEl.setAttribute('class', 'input-set row');
|
16081 |
|
16082 |
|
16083 | const newInputEl = document.createElement('input');
|
16084 | newInputEl.type = 'file';
|
16085 | newInputEl.style = 'width:200px; margin-top:2px;';
|
16086 | newInputEl.setAttribute('data-pname', pname);
|
16087 | newInputEl.setAttribute('data-ptype', ptype.includes('form-urlencode') ? 'form-urlencode' : 'form-data');
|
16088 | newInputEl.setAttribute('data-array', 'false');
|
16089 | newInputEl.setAttribute('data-file-array', 'true');
|
16090 |
|
16091 |
|
16092 | const newRemoveBtnEl = document.createElement('button');
|
16093 | newRemoveBtnEl.setAttribute('class', 'file-input-remove-btn');
|
16094 | newRemoveBtnEl.innerHTML = '✕';
|
16095 | newInputContainerEl.appendChild(newInputEl);
|
16096 | newInputContainerEl.appendChild(newRemoveBtnEl);
|
16097 | el.insertBefore(newInputContainerEl, e.target);
|
16098 |
|
16099 | }
|
16100 |
|
16101 | clearResponseData() {
|
16102 | this.responseUrl = '';
|
16103 | this.responseHeaders = '';
|
16104 | this.responseText = '';
|
16105 | this.responseStatus = 'success';
|
16106 | this.responseMessage = '';
|
16107 | this.responseIsBlob = false;
|
16108 | this.responseBlobType = '';
|
16109 | this.respContentDisposition = '';
|
16110 | if (this.responseBlobUrl) {
|
16111 | URL.revokeObjectURL(this.responseBlobUrl);
|
16112 | this.responseBlobUrl = '';
|
16113 | }
|
16114 | }
|
16115 | disconnectedCallback() {
|
16116 | this.curlSyntax = '';
|
16117 |
|
16118 | if (this.responseBlobUrl) {
|
16119 | URL.revokeObjectURL(this.responseBlobUrl);
|
16120 | this.responseBlobUrl = '';
|
16121 | }
|
16122 | super.disconnectedCallback();
|
16123 | }
|
16124 | }
|
16125 |
|
16126 |
|
16127 | customElements.define('api-request', ApiRequest);
|
16128 | ;
|
16129 |
|
16130 |
|
16131 |
|
16132 |
|
16133 |
|
16134 |
|
16135 | class SchemaTable extends lit_element_s {
|
16136 | static get properties() {
|
16137 | return {
|
16138 | schemaExpandLevel: {
|
16139 | type: Number,
|
16140 | attribute: 'schema-expand-level'
|
16141 | },
|
16142 | schemaDescriptionExpanded: {
|
16143 | type: String,
|
16144 | attribute: 'schema-description-expanded'
|
16145 | },
|
16146 | allowSchemaDescriptionExpandToggle: {
|
16147 | type: String,
|
16148 | attribute: 'allow-schema-description-expand-toggle'
|
16149 | },
|
16150 | schemaHideReadOnly: {
|
16151 | type: String,
|
16152 | attribute: 'schema-hide-read-only'
|
16153 | },
|
16154 | schemaHideWriteOnly: {
|
16155 | type: String,
|
16156 | attribute: 'schema-hide-write-only'
|
16157 | },
|
16158 | data: {
|
16159 | type: Object
|
16160 | }
|
16161 | };
|
16162 | }
|
16163 | connectedCallback() {
|
16164 | super.connectedCallback();
|
16165 | if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) {
|
16166 | this.schemaExpandLevel = 99999;
|
16167 | }
|
16168 | if (!this.schemaDescriptionExpanded || !'true false'.includes(this.schemaDescriptionExpanded)) {
|
16169 | this.schemaDescriptionExpanded = 'false';
|
16170 | }
|
16171 | if (!this.schemaHideReadOnly || !'true false'.includes(this.schemaHideReadOnly)) {
|
16172 | this.schemaHideReadOnly = 'true';
|
16173 | }
|
16174 | if (!this.schemaHideWriteOnly || !'true false'.includes(this.schemaHideWriteOnly)) {
|
16175 | this.schemaHideWriteOnly = 'true';
|
16176 | }
|
16177 | }
|
16178 | static get styles() {
|
16179 | return [font_styles, schema_styles, i`
|
16180 | .table {
|
16181 | font-size: var(--font-size-small);
|
16182 | text-align: left;
|
16183 | line-height: calc(var(--font-size-small) + 6px);
|
16184 | }
|
16185 | .table .tr {
|
16186 | width: calc(100% - 5px);
|
16187 | padding: 0 0 0 5px;
|
16188 | border-bottom: 1px dotted var(--light-border-color);
|
16189 | }
|
16190 | .table .td {
|
16191 | padding: 4px 0;
|
16192 | }
|
16193 | .table .key {
|
16194 | width: 240px;
|
16195 | }
|
16196 | .key .key-label {
|
16197 | font-size: var(--font-size-mono);
|
16198 | }
|
16199 | .key.deprecated .key-label {
|
16200 | color: var(--red);
|
16201 | }
|
16202 |
|
16203 | .table .key-type {
|
16204 | white-space: normal;
|
16205 | width: 150px;
|
16206 | }
|
16207 | .collapsed-all-descr .tr:not(.expanded-descr) {
|
16208 | max-height: calc(var(--font-size-small) + var(--font-size-small));
|
16209 | }
|
16210 |
|
16211 | .obj-toggle {
|
16212 | padding: 0 2px;
|
16213 | border-radius:2px;
|
16214 | border: 1px solid transparent;
|
16215 | display: inline-block;
|
16216 | margin-left: -16px;
|
16217 | color:var(--primary-color);
|
16218 | cursor:pointer;
|
16219 | font-size: calc(var(--font-size-small) + 4px);
|
16220 | font-family: var(--font-mono);
|
16221 | background-clip: border-box;
|
16222 | }
|
16223 | .obj-toggle:hover {
|
16224 | border-color: var(--primary-color);
|
16225 | }
|
16226 | .tr.expanded + .object-body {
|
16227 | display:block;
|
16228 | }
|
16229 | .tr.collapsed + .object-body {
|
16230 | display:none;
|
16231 | }`, custom_styles];
|
16232 | }
|
16233 |
|
16234 |
|
16235 | render() {
|
16236 | var _this$data, _this$data2, _this$data3;
|
16237 | return y`
|
16238 | <div class="table ${this.schemaDescriptionExpanded === 'true' ? 'expanded-all-descr' : 'collapsed-all-descr'}" @click="${e => this.handleAllEvents(e)}">
|
16239 | <div class='toolbar'>
|
16240 | <div class="toolbar-item schema-root-type ${((_this$data = this.data) === null || _this$data === void 0 ? void 0 : _this$data['::type']) || ''} "> ${((_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2['::type']) || ''} </div>
|
16241 | ${this.allowSchemaDescriptionExpandToggle === 'true' ? y`
|
16242 | <div style="flex:1"></div>
|
16243 | <div part="schema-multiline-toggle" class='toolbar-item schema-multiline-toggle' >
|
16244 | ${this.schemaDescriptionExpanded === 'true' ? 'Single line description' : 'Multiline description'}
|
16245 | </div>
|
16246 | ` : ''}
|
16247 | </div>
|
16248 | <span part="schema-description" class='m-markdown'> ${unsafe_html_o(marked(((_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3['::description']) || ''))} </span>
|
16249 | <div style = 'border:1px solid var(--light-border-color)'>
|
16250 | <div style='display:flex; background-color: var(--bg2); padding:8px 4px; border-bottom:1px solid var(--light-border-color);'>
|
16251 | <div class='key' style='font-family:var(--font-regular); font-weight:bold; color:var(--fg);'> Field </div>
|
16252 | <div class='key-type' style='font-family:var(--font-regular); font-weight:bold; color:var(--fg);'> Type </div>
|
16253 | <div class='key-descr' style='font-family:var(--font-regular); font-weight:bold; color:var(--fg);'> Description </div>
|
16254 | </div>
|
16255 | ${this.data ? y`
|
16256 | ${this.generateTree(this.data['::type'] === 'array' ? this.data['::props'] : this.data, this.data['::type'], this.data['::array-type'])}` : ''}
|
16257 | </div>
|
16258 | </div>
|
16259 | `;
|
16260 | }
|
16261 | generateTree(data, dataType = 'object', arrayType = '', key = '', description = '', schemaLevel = 0, indentLevel = 0, readOrWrite = '') {
|
16262 | var _data$Type, _keyLabel;
|
16263 | if (this.schemaHideReadOnly === 'true') {
|
16264 | if (dataType === 'array') {
|
16265 | if (readOrWrite === 'readonly') {
|
16266 | return;
|
16267 | }
|
16268 | }
|
16269 | if (data && data['::readwrite'] === 'readonly') {
|
16270 | return;
|
16271 | }
|
16272 | }
|
16273 | if (this.schemaHideWriteOnly === 'true') {
|
16274 | if (dataType === 'array') {
|
16275 | if (readOrWrite === 'writeonly') {
|
16276 | return;
|
16277 | }
|
16278 | }
|
16279 | if (data && data['::readwrite'] === 'writeonly') {
|
16280 | return;
|
16281 | }
|
16282 | }
|
16283 | if (!data) {
|
16284 | return y`<div class="null" style="display:inline;">
|
16285 | <span style='margin-left:${(schemaLevel + 1) * 16}px'> </span>
|
16286 | <span class="key-label xxx-of-key"> ${key.replace('::OPTION~', '')}</span>
|
16287 | ${dataType === 'array' ? y`<span class='mono-font'> [ ] </span>` : dataType === 'object' ? y`<span class='mono-font'> { } </span>` : y`<span class='mono-font'> schema undefined </span>`}
|
16288 | </div>`;
|
16289 | }
|
16290 | const newSchemaLevel = (_data$Type = data['::type']) !== null && _data$Type !== void 0 && _data$Type.startsWith('xxx-of') ? schemaLevel : schemaLevel + 1;
|
16291 | const newIndentLevel = dataType === 'xxx-of-option' || data['::type'] === 'xxx-of-option' || key.startsWith('::OPTION') ? indentLevel : indentLevel + 1;
|
16292 | const leftPadding = 16 * newIndentLevel;
|
16293 | if (Object.keys(data).length === 0) {
|
16294 | return y`<span class="td key object" style='padding-left:${leftPadding}px'>${key}</span>`;
|
16295 | }
|
16296 | let keyLabel = '';
|
16297 | let keyDescr = '';
|
16298 | let isOneOfLabel = false;
|
16299 | if (key.startsWith('::ONE~OF') || key.startsWith('::ANY~OF')) {
|
16300 | keyLabel = key.replace('::', '').replace('~', ' ');
|
16301 | isOneOfLabel = true;
|
16302 | } else if (key.startsWith('::OPTION')) {
|
16303 | const parts = key.split('~');
|
16304 | keyLabel = parts[1];
|
16305 | keyDescr = parts[2];
|
16306 | } else {
|
16307 | keyLabel = key;
|
16308 | }
|
16309 | let detailObjType = '';
|
16310 | if (data['::type'] === 'object') {
|
16311 | if (dataType === 'array') {
|
16312 | detailObjType = 'array of object';
|
16313 | } else {
|
16314 | detailObjType = data['::dataTypeLabel'] || data['::type'];
|
16315 | }
|
16316 | } else if (data['::type'] === 'array') {
|
16317 | if (dataType === 'array') {
|
16318 |
|
16319 | detailObjType = `array of array ${arrayType !== 'object' ? `of ${arrayType}` : ''}`;
|
16320 | } else {
|
16321 | detailObjType = data['::dataTypeLabel'] || data['::type'];
|
16322 | }
|
16323 | }
|
16324 | if (typeof data === 'object') {
|
16325 | return y`
|
16326 | ${newSchemaLevel >= 0 && key ? y`
|
16327 | <div class='tr ${newSchemaLevel <= this.schemaExpandLevel ? 'expanded' : 'collapsed'} ${data['::type']}' data-obj='${keyLabel}' title="${data['::deprecated'] ? 'Deprecated' : ''}">
|
16328 | <div class="td key ${data['::deprecated'] ? 'deprecated' : ''}" style='padding-left:${leftPadding}px'>
|
16329 | ${keyLabel || keyDescr ? y`
|
16330 | <span class='obj-toggle ${newSchemaLevel < this.schemaExpandLevel ? 'expanded' : 'collapsed'}' data-obj='${keyLabel}'>
|
16331 | ${schemaLevel < this.schemaExpandLevel ? '-' : '+'}
|
16332 | </span>` : ''}
|
16333 | ${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' || key.startsWith('::OPTION') ? y`<span class="xxx-of-key" style="margin-left:-6px">${keyLabel}</span><span class="${isOneOfLabel ? 'xxx-of-key' : 'xxx-of-descr'}">${keyDescr}</span>` : keyLabel.endsWith('*') ? y`<span class="key-label" style="display:inline-block; margin-left:-6px;">${data['::deprecated'] ? '✗' : ''} ${keyLabel.substring(0, keyLabel.length - 1)}</span><span style='color:var(--red);'>*</span>` : y`<span class="key-label" style="display:inline-block; margin-left:-6px;">${data['::deprecated'] ? '✗' : ''} ${keyLabel === '::props' ? '' : keyLabel}</span>`}
|
16334 | ${data['::type'] === 'xxx-of' && dataType === 'array' ? y`<span style="color:var(--primary-color)">ARRAY</span>` : ''}
|
16335 | </div>
|
16336 | <div class='td key-type' title="${data['::readwrite'] === 'readonly' ? 'Read-Only' : data['::readwrite'] === 'writeonly' ? 'Write-Only' : ''}">
|
16337 | ${(data['::type'] || '').includes('xxx-of') ? '' : detailObjType}
|
16338 | ${data['::readwrite'] === 'readonly' ? ' 🆁' : data['::readwrite'] === 'writeonly' ? ' 🆆' : ''}
|
16339 | </div>
|
16340 | <div class='td key-descr m-markdown-small' style='line-height:1.7'>${unsafe_html_o(marked(description || ''))}</div>
|
16341 | </div>` : y`
|
16342 | ${data['::type'] === 'array' && dataType === 'array' ? y`
|
16343 | <div class='tr'>
|
16344 | <div class='td key'></div>
|
16345 | <div class='td key-type'>
|
16346 | ${arrayType && arrayType !== 'object' ? `${dataType} of ${arrayType}` : dataType}
|
16347 | </div>
|
16348 | <div class='td key-descr'></div>
|
16349 | </div>` : ''}`}
|
16350 | <div class='object-body'>
|
16351 | ${Array.isArray(data) && data[0] ? y`${this.generateTree(data[0], 'xxx-of-option', '', '::ARRAY~OF', '', newSchemaLevel, newIndentLevel, '')}` : y`
|
16352 | ${Object.keys(data).map(dataKey => {
|
16353 | var _data$dataKey;
|
16354 | return y`
|
16355 | ${['::title', '::description', '::type', '::props', '::deprecated', '::array-type', '::readwrite', '::dataTypeLabel'].includes(dataKey) ? data[dataKey]['::type'] === 'array' || data[dataKey]['::type'] === 'object' ? y`${this.generateTree(data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey], data[dataKey]['::type'], data[dataKey]['::array-type'] || '', dataKey, data[dataKey]['::description'], newSchemaLevel, newIndentLevel, data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '')}` : '' : y`${this.generateTree(data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey], data[dataKey]['::type'], data[dataKey]['::array-type'] || '', dataKey, ((_data$dataKey = data[dataKey]) === null || _data$dataKey === void 0 ? void 0 : _data$dataKey['::description']) || '', newSchemaLevel, newIndentLevel, data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '')}`}
|
16356 | `;
|
16357 | })}
|
16358 | `}
|
16359 | <div>
|
16360 | `;
|
16361 | }
|
16362 |
|
16363 |
|
16364 |
|
16365 | const [type, readOrWriteOnly, constraint, defaultValue, allowedValues, pattern, schemaDescription, schemaTitle, deprecated] = data.split('~|~');
|
16366 | if (readOrWriteOnly === '🆁' && this.schemaHideReadOnly === 'true') {
|
16367 | return;
|
16368 | }
|
16369 | if (readOrWriteOnly === '🆆' && this.schemaHideWriteOnly === 'true') {
|
16370 | return;
|
16371 | }
|
16372 | const dataTypeCss = type.replace(/┃.*/g, '').replace(/[^a-zA-Z0-9+]/g, '').substring(0, 4).toLowerCase();
|
16373 | const descrExpander = `${constraint || defaultValue || allowedValues || pattern ? '<span class="descr-expand-toggle">➔</span>' : ''}`;
|
16374 | let dataTypeHtml = '';
|
16375 | if (dataType === 'array') {
|
16376 | dataTypeHtml = y`
|
16377 | <div class='td key-type ${dataTypeCss}' title="${readOrWrite === 'readonly' ? 'Read-Only' : readOrWriteOnly === 'writeonly' ? 'Write-Only' : ''}">
|
16378 | [${type}] ${readOrWrite === 'readonly' ? '🆁' : readOrWrite === 'writeonly' ? '🆆' : ''}
|
16379 | </div>`;
|
16380 | } else {
|
16381 | dataTypeHtml = y`
|
16382 | <div class='td key-type ${dataTypeCss}' title="${readOrWriteOnly === '🆁' ? 'Read-Only' : readOrWriteOnly === '🆆' ? 'Write-Only' : ''}">
|
16383 | ${type} ${readOrWriteOnly}
|
16384 | </div>`;
|
16385 | }
|
16386 | return y`
|
16387 | <div class = "tr primitive" title="${deprecated ? 'Deprecated' : ''}">
|
16388 | <div class="td key ${deprecated}" style='padding-left:${leftPadding}px'>
|
16389 | ${deprecated ? y`<span style='color:var(--red);'>✗</span>` : ''}
|
16390 | ${(_keyLabel = keyLabel) !== null && _keyLabel !== void 0 && _keyLabel.endsWith('*') ? y`
|
16391 | <span class="key-label">${keyLabel.substring(0, keyLabel.length - 1)}</span>
|
16392 | <span style='color:var(--red);'>*</span>` : key.startsWith('::OPTION') ? y`<span class='xxx-of-key'>${keyLabel}</span><span class="xxx-of-descr">${keyDescr}</span>` : y`${keyLabel ? y`<span class="key-label"> ${keyLabel}</span>` : y`<span class="xxx-of-descr">${schemaTitle}</span>`}`}
|
16393 | </div>
|
16394 | ${dataTypeHtml}
|
16395 | <div class='td key-descr' style='font-size: var(--font-size-small)'>
|
16396 | ${y`<span class="m-markdown-small">
|
16397 | ${unsafe_html_o(marked(dataType === 'array' ? `${descrExpander} ${description}` : schemaTitle ? `${descrExpander} <b>${schemaTitle}:</b> ${schemaDescription}` : `${descrExpander} ${schemaDescription}`))}
|
16398 | </span>`}
|
16399 | ${constraint ? y`<div class='' style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>Constraints: </span> ${constraint}</div>` : ''}
|
16400 | ${defaultValue ? y`<div style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>Default: </span>${defaultValue}</div>` : ''}
|
16401 | ${allowedValues ? y`<div style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>${type === 'const' ? 'Value' : 'Allowed'}: </span>${allowedValues}</div>` : ''}
|
16402 | ${pattern ? y`<div style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>Pattern: </span>${pattern}</div>` : ''}
|
16403 | </div>
|
16404 | </div>
|
16405 | `;
|
16406 | }
|
16407 |
|
16408 |
|
16409 | handleAllEvents(e) {
|
16410 | if (e.target.classList.contains('obj-toggle')) {
|
16411 | this.toggleObjectExpand(e);
|
16412 | } else if (e.target.classList.contains('schema-multiline-toggle')) {
|
16413 | this.schemaDescriptionExpanded = this.schemaDescriptionExpanded === 'true' ? 'false' : 'true';
|
16414 | } else if (e.target.classList.contains('descr-expand-toggle')) {
|
16415 | const trEl = e.target.closest('.tr');
|
16416 | if (trEl) {
|
16417 | trEl.classList.toggle('expanded-descr');
|
16418 | trEl.style.maxHeight = trEl.scrollHeight;
|
16419 | }
|
16420 | }
|
16421 | }
|
16422 | toggleObjectExpand(e) {
|
16423 | const rowEl = e.target.closest('.tr');
|
16424 | if (rowEl.classList.contains('expanded')) {
|
16425 | rowEl.classList.add('collapsed');
|
16426 | rowEl.classList.remove('expanded');
|
16427 | e.target.innerText = '+';
|
16428 | } else {
|
16429 | rowEl.classList.remove('collapsed');
|
16430 | rowEl.classList.add('expanded');
|
16431 | e.target.innerText = '-';
|
16432 | }
|
16433 | }
|
16434 | }
|
16435 | customElements.define('schema-table', SchemaTable);
|
16436 | ;
|
16437 |
|
16438 |
|
16439 |
|
16440 |
|
16441 |
|
16442 |
|
16443 |
|
16444 |
|
16445 |
|
16446 |
|
16447 |
|
16448 |
|
16449 |
|
16450 |
|
16451 | class ApiResponse extends lit_element_s {
|
16452 | constructor() {
|
16453 | super();
|
16454 | this.selectedStatus = '';
|
16455 | this.headersForEachRespStatus = {};
|
16456 | this.mimeResponsesForEachStatus = {};
|
16457 | this.activeSchemaTab = 'schema';
|
16458 | }
|
16459 | static get properties() {
|
16460 | return {
|
16461 | callback: {
|
16462 | type: String
|
16463 | },
|
16464 | webhook: {
|
16465 | type: String
|
16466 | },
|
16467 | responses: {
|
16468 | type: Object
|
16469 | },
|
16470 | parser: {
|
16471 | type: Object
|
16472 | },
|
16473 | schemaStyle: {
|
16474 | type: String,
|
16475 | attribute: 'schema-style'
|
16476 | },
|
16477 | renderStyle: {
|
16478 | type: String,
|
16479 | attribute: 'render-style'
|
16480 | },
|
16481 | selectedStatus: {
|
16482 | type: String,
|
16483 | attribute: 'selected-status'
|
16484 | },
|
16485 | selectedMimeType: {
|
16486 | type: String,
|
16487 | attribute: 'selected-mime-type'
|
16488 | },
|
16489 | activeSchemaTab: {
|
16490 | type: String,
|
16491 | attribute: 'active-schema-tab'
|
16492 | },
|
16493 | schemaExpandLevel: {
|
16494 | type: Number,
|
16495 | attribute: 'schema-expand-level'
|
16496 | },
|
16497 | schemaDescriptionExpanded: {
|
16498 | type: String,
|
16499 | attribute: 'schema-description-expanded'
|
16500 | },
|
16501 | allowSchemaDescriptionExpandToggle: {
|
16502 | type: String,
|
16503 | attribute: 'allow-schema-description-expand-toggle'
|
16504 | },
|
16505 | schemaHideReadOnly: {
|
16506 | type: String,
|
16507 | attribute: 'schema-hide-read-only'
|
16508 | },
|
16509 | schemaHideWriteOnly: {
|
16510 | type: String,
|
16511 | attribute: 'schema-hide-write-only'
|
16512 | }
|
16513 | };
|
16514 | }
|
16515 | static get styles() {
|
16516 | return [font_styles, flex_styles, tab_styles, table_styles, input_styles, border_styles, i`
|
16517 | :where(button, input[type="checkbox"], [tabindex="0"]):focus-visible { box-shadow: var(--focus-shadow); }
|
16518 | :where(input[type="text"], input[type="password"], select, textarea):focus-visible { border-color: var(--primary-color); }
|
16519 | .resp-head{
|
16520 | vertical-align: middle;
|
16521 | padding:16px 0 8px;
|
16522 | }
|
16523 | .resp-head.divider{
|
16524 | border-top: 1px solid var(--border-color);
|
16525 | margin-top:10px;
|
16526 | }
|
16527 | .resp-status{
|
16528 | font-weight:bold;
|
16529 | font-size:calc(var(--font-size-small) + 1px);
|
16530 | }
|
16531 | .resp-descr{
|
16532 | font-size:calc(var(--font-size-small) + 1px);
|
16533 | color:var(--light-fg);
|
16534 | text-align:left;
|
16535 | }
|
16536 | .top-gap{margin-top:16px;}
|
16537 | .example-panel{
|
16538 | font-size:var(--font-size-small);
|
16539 | margin:0;
|
16540 | }
|
16541 | .focused-mode,
|
16542 | .read-mode {
|
16543 | padding-top:24px;
|
16544 | margin-top:12px;
|
16545 | border-top: 1px dashed var(--border-color);
|
16546 | }`, custom_styles];
|
16547 | }
|
16548 | render() {
|
16549 | return y`
|
16550 | <div class="col regular-font response-panel ${this.renderStyle}-mode">
|
16551 | <div class=" ${this.callback === 'true' ? 'tiny-title' : 'req-res-title'} ">
|
16552 | ${this.callback === 'true' ? 'CALLBACK RESPONSE' : 'RESPONSE'}
|
16553 | </div>
|
16554 | <div>
|
16555 | ${this.responseTemplate()}
|
16556 | <div>
|
16557 | </div>
|
16558 | `;
|
16559 | }
|
16560 | resetSelection() {
|
16561 | this.selectedStatus = '';
|
16562 | this.selectedMimeType = '';
|
16563 | }
|
16564 |
|
16565 |
|
16566 | responseTemplate() {
|
16567 | if (!this.responses) {
|
16568 | return '';
|
16569 | }
|
16570 | for (const statusCode in this.responses) {
|
16571 | if (!this.selectedStatus) {
|
16572 | this.selectedStatus = statusCode;
|
16573 | }
|
16574 | const allMimeResp = {};
|
16575 | for (const mimeResp in (_this$responses$statu = this.responses[statusCode]) === null || _this$responses$statu === void 0 ? void 0 : _this$responses$statu.content) {
|
16576 | var _this$responses$statu, _respExamples$;
|
16577 | const mimeRespObj = this.responses[statusCode].content[mimeResp];
|
16578 | if (!this.selectedMimeType) {
|
16579 | this.selectedMimeType = mimeResp;
|
16580 | }
|
16581 |
|
16582 | const schemaTree = schemaInObjectNotation(mimeRespObj.schema, {});
|
16583 |
|
16584 | const respExamples = generateExample(mimeRespObj.schema, mimeResp, mimeRespObj.examples, mimeRespObj.example, this.callback === 'true' || this.webhook === 'true' ? false : true,
|
16585 |
|
16586 | this.callback === 'true' || this.webhook === 'true' ? true : false,
|
16587 |
|
16588 | mimeResp.includes('json') ? 'json' : 'text');
|
16589 | allMimeResp[mimeResp] = {
|
16590 | description: this.responses[statusCode].description,
|
16591 | examples: respExamples,
|
16592 | selectedExample: ((_respExamples$ = respExamples[0]) === null || _respExamples$ === void 0 ? void 0 : _respExamples$.exampleId) || '',
|
16593 | schemaTree
|
16594 | };
|
16595 | }
|
16596 |
|
16597 | const tempHeaders = [];
|
16598 | for (const key in (_this$responses$statu2 = this.responses[statusCode]) === null || _this$responses$statu2 === void 0 ? void 0 : _this$responses$statu2.headers) {
|
16599 | var _this$responses$statu2;
|
16600 | tempHeaders.push({
|
16601 | name: key,
|
16602 | ...this.responses[statusCode].headers[key]
|
16603 | });
|
16604 | }
|
16605 | this.headersForEachRespStatus[statusCode] = tempHeaders;
|
16606 | this.mimeResponsesForEachStatus[statusCode] = allMimeResp;
|
16607 | }
|
16608 | return y`
|
16609 | ${Object.keys(this.responses).length > 1 ? y`<div class='row' style='flex-wrap:wrap'>
|
16610 | ${Object.keys(this.responses).map(respStatus => y`
|
16611 | ${respStatus === '$$ref' // Swagger-Client parser creates '$$ref' object if JSON references are used to create responses - this should be ignored
|
16612 | ? '' : y`
|
16613 | <button
|
16614 | @click="${() => {
|
16615 | this.selectedStatus = respStatus;
|
16616 | if (this.responses[respStatus].content && Object.keys(this.responses[respStatus].content)[0]) {
|
16617 | this.selectedMimeType = Object.keys(this.responses[respStatus].content)[0]; // eslint-disable-line prefer-destructuring
|
16618 | } else {
|
16619 | this.selectedMimeType = undefined;
|
16620 | }
|
16621 | }}"
|
16622 | class='m-btn small ${this.selectedStatus === respStatus ? 'primary' : ''}'
|
16623 | part="btn ${this.selectedStatus === respStatus ? 'btn-response-status btn-selected-response-status' : ' btn-response-status'}"
|
16624 | style='margin: 8px 4px 0 0'
|
16625 | >
|
16626 | ${respStatus}
|
16627 | </button>`}`)}` : y`<span>${Object.keys(this.responses)[0]}</span>`}
|
16628 | </div>
|
16629 |
|
16630 | ${Object.keys(this.responses).map(status => {
|
16631 | var _this$responses$statu3, _this$headersForEachR;
|
16632 | return y`
|
16633 | <div style = 'display: ${status === this.selectedStatus ? 'block' : 'none'}' >
|
16634 | <div class="top-gap">
|
16635 | <span class="resp-descr m-markdown ">${unsafe_html_o(marked(((_this$responses$statu3 = this.responses[status]) === null || _this$responses$statu3 === void 0 ? void 0 : _this$responses$statu3.description) || ''))}</span>
|
16636 | ${this.headersForEachRespStatus[status] && ((_this$headersForEachR = this.headersForEachRespStatus[status]) === null || _this$headersForEachR === void 0 ? void 0 : _this$headersForEachR.length) > 0 ? y`${this.responseHeaderListTemplate(this.headersForEachRespStatus[status])}` : ''}
|
16637 | </div>
|
16638 | ${Object.keys(this.mimeResponsesForEachStatus[status]).length === 0 ? '' : y`
|
16639 | <div class="tab-panel col">
|
16640 | <div class="tab-buttons row" @click="${e => {
|
16641 | if (e.target.tagName.toLowerCase() === 'button') {
|
16642 | this.activeSchemaTab = e.target.dataset.tab;
|
16643 | }
|
16644 | }}" >
|
16645 | <button class="tab-btn ${this.activeSchemaTab === 'example' ? 'active' : ''}" data-tab = 'example'>EXAMPLE </button>
|
16646 | <button class="tab-btn ${this.activeSchemaTab !== 'example' ? 'active' : ''}" data-tab = 'schema' >SCHEMA</button>
|
16647 | <div style="flex:1"></div>
|
16648 | ${Object.keys(this.mimeResponsesForEachStatus[status]).length === 1 ? y`<span class='small-font-size gray-text' style='align-self:center; margin-top:8px;'> ${Object.keys(this.mimeResponsesForEachStatus[status])[0]} </span>` : y`${this.mimeTypeDropdownTemplate(Object.keys(this.mimeResponsesForEachStatus[status]))}`}
|
16649 | </div>
|
16650 | ${this.activeSchemaTab === 'example' ? y`<div class ='tab-content col' style = 'flex:1;'>
|
16651 | ${this.mimeExampleTemplate(this.mimeResponsesForEachStatus[status][this.selectedMimeType])}
|
16652 | </div>` : y`<div class ='tab-content col' style = 'flex:1;'>
|
16653 | ${this.mimeSchemaTemplate(this.mimeResponsesForEachStatus[status][this.selectedMimeType])}
|
16654 | </div>`}
|
16655 | </div>
|
16656 | `}`;
|
16657 | })}
|
16658 | `;
|
16659 | }
|
16660 | responseHeaderListTemplate(respHeaders) {
|
16661 | return y`
|
16662 | <div style="padding:16px 0 8px 0" class="resp-headers small-font-size bold-text">RESPONSE HEADERS</div>
|
16663 | <table role="presentation" style="border-collapse: collapse; margin-bottom:16px; border:1px solid var(--border-color); border-radius: var(--border-radius)" class="small-font-size mono-font">
|
16664 | ${respHeaders.map(v => {
|
16665 | var _v$schema, _v$schema2;
|
16666 | return y`
|
16667 | <tr>
|
16668 | <td style="padding:8px; vertical-align: baseline; min-width:120px; border-top: 1px solid var(--light-border-color); text-overflow: ellipsis;">
|
16669 | ${v.name || ''}
|
16670 | </td>
|
16671 | <td style="padding:4px; vertical-align: baseline; padding:0 5px; border-top: 1px solid var(--light-border-color); text-overflow: ellipsis;">
|
16672 | ${((_v$schema = v.schema) === null || _v$schema === void 0 ? void 0 : _v$schema.type) || ''}
|
16673 | </td>
|
16674 | <td style="padding:8px; vertical-align: baseline; border-top: 1px solid var(--light-border-color);text-overflow: ellipsis;">
|
16675 | <div class="m-markdown-small regular-font" >${unsafe_html_o(marked(v.description || ''))}</div>
|
16676 | </td>
|
16677 | <td style="padding:8px; vertical-align: baseline; border-top: 1px solid var(--light-border-color); text-overflow: ellipsis;">
|
16678 | ${((_v$schema2 = v.schema) === null || _v$schema2 === void 0 ? void 0 : _v$schema2.example) || ''}
|
16679 | </td>
|
16680 | </tr>
|
16681 | `;
|
16682 | })}
|
16683 | </table>`;
|
16684 | }
|
16685 | mimeTypeDropdownTemplate(mimeTypes) {
|
16686 | return y`
|
16687 | <select aria-label='mime types' @change="${e => {
|
16688 | this.selectedMimeType = e.target.value;
|
16689 | }}" style='margin-bottom: -1px; z-index:1'>
|
16690 | ${mimeTypes.map(mimeType => y`<option value='${mimeType}' ?selected = '${mimeType === this.selectedMimeType}'> ${mimeType} </option>`)}
|
16691 | </select>`;
|
16692 | }
|
16693 | onSelectExample(e) {
|
16694 | const exampleContainerEl = e.target.closest('.example-panel');
|
16695 | const exampleEls = [...exampleContainerEl.querySelectorAll('.example')];
|
16696 | exampleEls.forEach(v => {
|
16697 | v.style.display = v.dataset.example === e.target.value ? 'block' : 'none';
|
16698 | });
|
16699 | }
|
16700 | mimeExampleTemplate(mimeRespDetails) {
|
16701 | if (!mimeRespDetails) {
|
16702 | return y`
|
16703 | <pre style='color:var(--red)' class = '${this.renderStyle === 'read' ? 'read example-panel border pad-8-16' : 'example-panel border-top'}'> No example provided </pre>
|
16704 | `;
|
16705 | }
|
16706 | return y`
|
16707 | ${mimeRespDetails.examples.length === 1 ? y`
|
16708 | ${mimeRespDetails.examples[0].exampleFormat === 'json' ? y`
|
16709 | ${mimeRespDetails.examples[0].exampleSummary && mimeRespDetails.examples[0].exampleSummary.length > 80 ? y`<div style="padding: 4px 0"> ${mimeRespDetails.examples[0].exampleSummary} </div>` : ''}
|
16710 | ${mimeRespDetails.examples[0].exampleDescription ? y`<div class="m-markdown-small" style="padding: 4px 0"> ${unsafe_html_o(marked(mimeRespDetails.examples[0].exampleDescription || ''))} </div>` : ''}
|
16711 | <json-tree
|
16712 | render-style = '${this.renderStyle}'
|
16713 | .data="${mimeRespDetails.examples[0].exampleValue}"
|
16714 | class = 'example-panel ${this.renderStyle === 'read' ? 'border pad-8-16' : 'border-top pad-top-8'}'
|
16715 | exportparts = "btn:btn, btn-fill:btn-fill, btn-copy:btn-copy"
|
16716 | ></json-tree>` : y`
|
16717 | ${mimeRespDetails.examples[0].exampleSummary && mimeRespDetails.examples[0].exampleSummary.length > 80 ? y`<div style="padding: 4px 0"> ${mimeRespDetails.examples[0].exampleSummary} </div>` : ''}
|
16718 | ${mimeRespDetails.examples[0].exampleDescription ? y`<div class="m-markdown-small" style="padding: 4px 0"> ${unsafe_html_o(marked(mimeRespDetails.examples[0].exampleDescription || ''))} </div>` : ''}
|
16719 | <pre class = 'example-panel ${this.renderStyle === 'read' ? 'border pad-8-16' : 'border-top pad-top-8'}'>${mimeRespDetails.examples[0].exampleValue}</pre>
|
16720 | `}` : y`
|
16721 | <span class = 'example-panel ${this.renderStyle === 'read' ? 'border pad-8-16' : 'border-top pad-top-8'}'>
|
16722 | <select aria-label='response examples' style="min-width:100px; max-width:100%" @change='${e => this.onSelectExample(e)}'>
|
16723 | ${mimeRespDetails.examples.map(v => y`<option value="${v.exampleId}" ?selected=${v.exampleId === mimeRespDetails.selectedExample} >
|
16724 | ${v.exampleSummary.length > 80 ? v.exampleId : v.exampleSummary}
|
16725 | </option>`)}
|
16726 | </select>
|
16727 | ${mimeRespDetails.examples.map(v => y`
|
16728 | <div class="example" data-example = '${v.exampleId}' style = "display: ${v.exampleId === mimeRespDetails.selectedExample ? 'block' : 'none'}">
|
16729 | ${v.exampleSummary && v.exampleSummary.length > 80 ? y`<div style="padding: 4px 0"> ${v.exampleSummary} </div>` : ''}
|
16730 | ${v.exampleDescription ? y`<div class="m-markdown-small" style="padding: 4px 0"> ${unsafe_html_o(marked(v.exampleDescription || ''))} </div>` : ''}
|
16731 | ${v.exampleFormat === 'json' ? y`
|
16732 | <json-tree
|
16733 | render-style = '${this.renderStyle}'
|
16734 | .data = '${v.exampleValue}'
|
16735 | exportparts = "btn:btn, btn-fill:btn-fill, btn-copy:btn-copy"
|
16736 | ></json-tree>` : y`<pre>${v.exampleValue}</pre>`}
|
16737 | </div>
|
16738 | `)}
|
16739 | </span>
|
16740 | `}
|
16741 | `;
|
16742 | }
|
16743 | mimeSchemaTemplate(mimeRespDetails) {
|
16744 | if (!mimeRespDetails) {
|
16745 | return y`
|
16746 | <pre style='color:var(--red)' class = '${this.renderStyle === 'read' ? 'border pad-8-16' : 'border-top'}'> Schema not found</pre>
|
16747 | `;
|
16748 | }
|
16749 | return y`
|
16750 | ${this.schemaStyle === 'table' ? y`
|
16751 | <schema-table
|
16752 | .data = "${mimeRespDetails.schemaTree}"
|
16753 | schema-expand-level = "${this.schemaExpandLevel}"
|
16754 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
16755 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
16756 | schema-hide-read-only = "${this.schemaHideReadOnly}"
|
16757 | schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
16758 | exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
16759 | > </schema-table> ` : y`
|
16760 | <schema-tree
|
16761 | .data = '${mimeRespDetails.schemaTree}'
|
16762 | schema-expand-level = "${this.schemaExpandLevel}"
|
16763 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
16764 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
16765 | schema-hide-read-only = "${this.schemaHideReadOnly}"
|
16766 | schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
16767 | exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
16768 | > </schema-tree>`}`;
|
16769 | }
|
16770 |
|
16771 | }
|
16772 |
|
16773 |
|
16774 | customElements.define('api-response', ApiResponse);
|
16775 | ;
|
16776 |
|
16777 |
|
16778 |
|
16779 |
|
16780 |
|
16781 |
|
16782 |
|
16783 |
|
16784 |
|
16785 |
|
16786 |
|
16787 | function headingRenderer(tagElementId) {
|
16788 | const renderer = new marked.Renderer();
|
16789 | renderer.heading = (text, level, raw, slugger) => `<h${level} class="observe-me" id="${tagElementId}--${slugger.slug(raw)}">${text}</h${level}>`;
|
16790 | return renderer;
|
16791 | }
|
16792 | function expandCollapseTagDescription(e) {
|
16793 | const tagDescriptionEl = e.target.closest('.tag-container').querySelector('.tag-description');
|
16794 | const tagIconEl = e.target.closest('.tag-container').querySelector('.tag-icon');
|
16795 | if (tagDescriptionEl && tagIconEl) {
|
16796 | const isExpanded = tagDescriptionEl.classList.contains('expanded');
|
16797 | if (isExpanded) {
|
16798 | tagDescriptionEl.style.maxHeight = 0;
|
16799 | tagDescriptionEl.classList.replace('expanded', 'collapsed');
|
16800 | tagIconEl.classList.replace('expanded', 'collapsed');
|
16801 | } else {
|
16802 | tagDescriptionEl.style.maxHeight = `${tagDescriptionEl.scrollHeight}px`;
|
16803 | tagDescriptionEl.classList.replace('collapsed', 'expanded');
|
16804 | tagIconEl.classList.replace('collapsed', 'expanded');
|
16805 | }
|
16806 | }
|
16807 | }
|
16808 | function expandedEndpointBodyTemplate(path, tagName = '', tagDescription = '') {
|
16809 | var _path$xBadges, _path$externalDocs, _path$externalDocs2, _path$externalDocs3, _path$externalDocs4, _path$externalDocs5, _path$externalDocs6, _path$servers, _path$servers$;
|
16810 | const acceptContentTypes = new Set();
|
16811 | for (const respStatus in path.responses) {
|
16812 | for (const acceptContentType in (_path$responses$respS = path.responses[respStatus]) === null || _path$responses$respS === void 0 ? void 0 : _path$responses$respS.content) {
|
16813 | var _path$responses$respS;
|
16814 | acceptContentTypes.add(acceptContentType.trim());
|
16815 | }
|
16816 | }
|
16817 | const accept = [...acceptContentTypes].join(', ');
|
16818 |
|
16819 |
|
16820 | const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter(v => {
|
16821 | var _path$security;
|
16822 | return v.finalKeyValue && ((_path$security = path.security) === null || _path$security === void 0 ? void 0 : _path$security.some(ps => v.securitySchemeId in ps));
|
16823 | }) || [];
|
16824 |
|
16825 |
|
16826 | const rapiDocApiKey = this.resolvedSpec.securitySchemes.find(v => v.securitySchemeId === rapidocApiKey && v.value !== '-');
|
16827 | if (rapiDocApiKey) {
|
16828 | nonEmptyApiKeys.push(rapiDocApiKey);
|
16829 | }
|
16830 | const codeSampleTabPanel = path.xCodeSamples ? codeSamplesTemplate.call(this, path.xCodeSamples) : '';
|
16831 | return y`
|
16832 | ${this.renderStyle === 'read' ? y`<div class='divider' part="operation-divider"></div>` : ''}
|
16833 | <div class='expanded-endpoint-body observe-me ${path.method} ${path.deprecated ? 'deprecated' : ''} ' part="section-operation ${path.elementId}" id='${path.elementId}'>
|
16834 | ${this.renderStyle === 'focused' && tagName !== 'General ⦂' ? y`
|
16835 | <div class="tag-container" part="section-operation-tag">
|
16836 | <span class="upper" style="font-weight:bold; font-size:18px;"> ${tagName} </span>
|
16837 | ${tagDescription ? y`
|
16838 | <svg class="tag-icon collapsed" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" fill="none" style="stroke:var(--primary-color); vertical-align:top; cursor:pointer"
|
16839 | @click="${e => {
|
16840 | expandCollapseTagDescription.call(this, e);
|
16841 | }}"
|
16842 | >
|
16843 | <path d="M12 20h-6a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h8"></path><path d="M18 4v17"></path><path d="M15 18l3 3l3 -3"></path>
|
16844 | </svg>
|
16845 | <div class="tag-description collapsed" style="max-height:0px; overflow:hidden; margin-top:16px; border:1px solid var(--border-color)">
|
16846 | <div class="m-markdown" style="padding:8px"> ${unsafe_html_o(marked(tagDescription))}</div>
|
16847 | </div>` : ''}
|
16848 | </div>
|
16849 | ` : ''}
|
16850 | ${path.deprecated ? y`<div class="bold-text red-text"> DEPRECATED </div>` : ''}
|
16851 | ${y`
|
16852 | ${path.xBadges && ((_path$xBadges = path.xBadges) === null || _path$xBadges === void 0 ? void 0 : _path$xBadges.length) > 0 ? y`
|
16853 | <div style="display:flex; flex-wrap:wrap; margin-bottom: -24px; font-size: var(--font-size-small);">
|
16854 | ${path.xBadges.map(v => y`<span style="margin:1px; margin-right:5px; padding:1px 8px; font-weight:bold; border-radius:12px; background-color: var(--light-${v.color}, var(--input-bg)); color:var(--${v.color}); border:1px solid var(--${v.color})">${v.label}</span>`)}
|
16855 | </div>
|
16856 | ` : ''}
|
16857 | <h2 part="section-operation-summary"> ${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}</h2>
|
16858 | ${path.isWebhook ? y`<span part="section-operation-webhook" style="color:var(--primary-color); font-weight:bold; font-size: var(--font-size-regular);"> WEBHOOK </span>` : y`
|
16859 | <div part="section-operation-webhook-method" class="mono-font regular-font-size" style="text-align:left; direction:ltr; padding: 8px 0; color:var(--fg3)">
|
16860 | <span part="label-operation-method" class="regular-font upper method-fg bold-text ${path.method}">${path.method}</span>
|
16861 | <span part="label-operation-path">${path.path}</span>
|
16862 | </div>
|
16863 | `}
|
16864 | <slot name="${path.elementId}"></slot>`}
|
16865 | ${path.description ? y`<div class="m-markdown"> ${unsafe_html_o(marked(path.description))}</div>` : ''}
|
16866 | ${pathSecurityTemplate.call(this, path.security)}
|
16867 | ${(_path$externalDocs = path.externalDocs) !== null && _path$externalDocs !== void 0 && _path$externalDocs.url || (_path$externalDocs2 = path.externalDocs) !== null && _path$externalDocs2 !== void 0 && _path$externalDocs2.description ? y`<div style="background-color:var(--bg3); padding:2px 8px 8px 8px; margin:8px 0; border-radius:var(--border-radius)">
|
16868 | <div class="m-markdown"> ${unsafe_html_o(marked(((_path$externalDocs3 = path.externalDocs) === null || _path$externalDocs3 === void 0 ? void 0 : _path$externalDocs3.description) || ''))} </div>
|
16869 | ${(_path$externalDocs4 = path.externalDocs) !== null && _path$externalDocs4 !== void 0 && _path$externalDocs4.url ? y`<a style="font-family:var(--font-mono); font-size:var(--font-size-small)" href="${(_path$externalDocs5 = path.externalDocs) === null || _path$externalDocs5 === void 0 ? void 0 : _path$externalDocs5.url}" target="_blank">
|
16870 | ${(_path$externalDocs6 = path.externalDocs) === null || _path$externalDocs6 === void 0 ? void 0 : _path$externalDocs6.url} <div style="transform: rotate(270deg) scale(1.5); display: inline-block; margin-left:5px">⇲</div>
|
16871 | </a>` : ''}
|
16872 | </div>` : ''}
|
16873 | ${codeSampleTabPanel}
|
16874 | <div class='expanded-req-resp-container'>
|
16875 | <api-request
|
16876 | class = "${this.renderStyle}-mode"
|
16877 | style = "width:100%;"
|
16878 | webhook = "${path.isWebhook}"
|
16879 | method = "${path.method}"
|
16880 | path = "${path.path}"
|
16881 | .security = "${path.security}"
|
16882 | .parameters = "${path.parameters}"
|
16883 | .request_body = "${path.requestBody}"
|
16884 | .api_keys = "${nonEmptyApiKeys}"
|
16885 | .servers = "${path.servers}"
|
16886 | server-url = "${((_path$servers = path.servers) === null || _path$servers === void 0 ? void 0 : (_path$servers$ = _path$servers[0]) === null || _path$servers$ === void 0 ? void 0 : _path$servers$.url) || this.selectedServer.computedUrl}"
|
16887 | fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
|
16888 | allow-try = "${this.allowTry}"
|
16889 | show-curl-before-try = "${this.showCurlBeforeTry}"
|
16890 | accept = "${accept}"
|
16891 | render-style="${this.renderStyle}"
|
16892 | schema-style = "${this.schemaStyle}"
|
16893 | active-schema-tab = "${this.defaultSchemaTab}"
|
16894 | schema-expand-level = "${this.schemaExpandLevel}"
|
16895 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
16896 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
16897 | schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
16898 | schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
16899 | fetch-credentials = "${this.fetchCredentials}"
|
16900 | exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
16901 | file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
16902 | anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
16903 | > </api-request>
|
16904 |
|
16905 | ${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}
|
16906 |
|
16907 | <api-response
|
16908 | class = "${this.renderStyle}-mode"
|
16909 | style = "width:100%;"
|
16910 | webhook = "${path.isWebhook}"
|
16911 | .responses = "${path.responses}"
|
16912 | render-style = "${this.renderStyle}"
|
16913 | schema-style = "${this.schemaStyle}"
|
16914 | active-schema-tab = "${this.defaultSchemaTab}"
|
16915 | schema-expand-level = "${this.schemaExpandLevel}"
|
16916 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
16917 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
16918 | schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
16919 | schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
16920 | selected-status = "${Object.keys(path.responses || {})[0] || ''}"
|
16921 | exportparts = "btn:btn, btn-response-status:btn-response-status, btn-selected-response-status:btn-selected-response-status, btn-fill:btn-fill, btn-copy:btn-copy,
|
16922 | schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
16923 | > </api-response>
|
16924 | </div>
|
16925 | </div>
|
16926 | `;
|
16927 | }
|
16928 | function expandedEndpointTemplate() {
|
16929 | if (!this.resolvedSpec) {
|
16930 | return '';
|
16931 | }
|
16932 | return y`
|
16933 | ${this.resolvedSpec.tags.map(tag => y`
|
16934 | <section id="${tag.elementId}" part="section-tag" class="regular-font section-gap--read-mode observe-me" style="border-top:1px solid var(--primary-color);">
|
16935 | <div class="title tag" part="section-tag-title label-tag-title">${tag.name}</div>
|
16936 | <slot name="${tag.elementId}"></slot>
|
16937 | <div class="regular-font-size">
|
16938 | ${unsafe_html_o(`
|
16939 | <div class="m-markdown regular-font">
|
16940 | ${marked(tag.description || '', this.infoDescriptionHeadingsInNavBar === 'true' ? {
|
16941 | renderer: headingRenderer(tag.elementId)
|
16942 | } : undefined)}
|
16943 | </div>`)}
|
16944 | </div>
|
16945 | </section>
|
16946 | <section class="regular-font section-gap--read-mode" part="section-operations-in-tag">
|
16947 | ${tag.paths.map(path => expandedEndpointBodyTemplate.call(this, path))}
|
16948 | </section>
|
16949 | `)}
|
16950 | `;
|
16951 | }
|
16952 |
|
16953 | ;
|
16954 |
|
16955 |
|
16956 |
|
16957 |
|
16958 |
|
16959 |
|
16960 |
|
16961 | function schemaBodyTemplate(sComponent) {
|
16962 | return y`
|
16963 | <div class='divider'></div>
|
16964 | <div class='expanded-endpoint-body observe-me ${sComponent.name}' id='cmp--${sComponent.id}' >
|
16965 | <div style="font-weight:bold"> ${sComponent.name} <span style="color:var(--light-fg); font-size:var(--font-size-small); font-weight:400;"> Schema </span></div>
|
16966 | ${this.schemaStyle === 'table' ? y`
|
16967 | <schema-table
|
16968 | .data = '${schemaInObjectNotation(sComponent.component, {})}'
|
16969 | schema-expand-level = "${this.schemaExpandLevel}"
|
16970 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
16971 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
16972 | schema-hide-read-only = "false"
|
16973 | schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
16974 | exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
16975 | > </schema-table>` : y`
|
16976 | <schema-tree
|
16977 | .data = '${schemaInObjectNotation(sComponent.component, {})}'
|
16978 | schema-expand-level = "${this.schemaExpandLevel}"
|
16979 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
16980 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
16981 | schema-hide-read-only = "false"
|
16982 | schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
16983 | exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
16984 | > </schema-tree>`}
|
16985 | </div>`;
|
16986 | }
|
16987 | function componentBodyTemplate(sComponent, componentType) {
|
16988 | if (sComponent.id.indexOf('schemas-') !== -1) {
|
16989 | return schemaBodyTemplate.call(this, sComponent);
|
16990 | }
|
16991 | return y`
|
16992 | <div class='divider'></div>
|
16993 | <div class='expanded-endpoint-body observe-me ${sComponent.name}' id='cmp--${sComponent.id}' >
|
16994 | ${y`
|
16995 | <div style="font-weight:bold"> ${sComponent.name} <span style="color:var(--light-fg); font-size:var(--font-size-small); font-weight:400"> ${componentType} </span> </div>
|
16996 | ${sComponent.component ? y`
|
16997 | <div class='mono-font regular-font-size' style='padding: 8px 0; color:var(--fg2)'>
|
16998 | <json-tree class="border tree" render-style='${this.renderStyle}' .data="${sComponent.component}"> </json-tree>
|
16999 | </div>` : ''}
|
17000 | `}
|
17001 | </div>
|
17002 | `;
|
17003 | }
|
17004 | function componentsTemplate() {
|
17005 | if (!this.resolvedSpec) {
|
17006 | return '';
|
17007 | }
|
17008 | return y`
|
17009 | ${this.resolvedSpec.components.map(component => y`
|
17010 | <div id="cmp--${component.name.toLowerCase()}" class='regular-font section-gap--read-mode observe-me' style="border-top:1px solid var(--primary-color);">
|
17011 | <div class="title tag">${component.name}</div>
|
17012 | <div class="regular-font-size">
|
17013 | ${unsafe_html_o(`<div class='m-markdown regular-font'>${marked(component.description ? component.description : '')}</div>`)}
|
17014 | </div>
|
17015 | </div>
|
17016 | <div class='regular-font section-gap--read-mode'>
|
17017 | ${component.subComponents.filter(c => c.expanded !== false).map(sComponent => componentBodyTemplate.call(this, sComponent, component.name))}
|
17018 | </div>
|
17019 | `)}
|
17020 | `;
|
17021 | }
|
17022 |
|
17023 | ;
|
17024 |
|
17025 |
|
17026 |
|
17027 |
|
17028 |
|
17029 |
|
17030 | function overview_template_headingRenderer() {
|
17031 | const renderer = new marked.Renderer();
|
17032 | renderer.heading = (text, level, raw, slugger) => `<h${level} class="observe-me" id="overview--${slugger.slug(raw)}">${text}</h${level}>`;
|
17033 | return renderer;
|
17034 | }
|
17035 | function overviewTemplate() {
|
17036 | var _this$resolvedSpec, _this$resolvedSpec$in, _this$resolvedSpec$in2, _this$specUrl;
|
17037 | return y`
|
17038 | <section id="overview" part="section-overview"
|
17039 | class="observe-me ${this.renderStyle === 'view' ? 'section-gap' : 'section-gap--read-mode'}">
|
17040 | ${(_this$resolvedSpec = this.resolvedSpec) !== null && _this$resolvedSpec !== void 0 && _this$resolvedSpec.info ? y`
|
17041 | <div id="api-title" part="section-overview-title" style="font-size:32px">
|
17042 | ${this.resolvedSpec.info.title}
|
17043 | ${!this.resolvedSpec.info.version ? '' : y`
|
17044 | <span style = 'font-size:var(--font-size-small);font-weight:bold'>
|
17045 | ${this.resolvedSpec.info.version}
|
17046 | </span>`}
|
17047 | </div>
|
17048 | <div id="api-info" style="font-size:calc(var(--font-size-regular) - 1px); margin-top:8px;">
|
17049 | ${(_this$resolvedSpec$in = this.resolvedSpec.info.contact) !== null && _this$resolvedSpec$in !== void 0 && _this$resolvedSpec$in.email ? y`<span>${this.resolvedSpec.info.contact.name || 'Email'}:
|
17050 | <a href="mailto:${this.resolvedSpec.info.contact.email}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.email}</a>
|
17051 | </span>` : ''}
|
17052 | ${(_this$resolvedSpec$in2 = this.resolvedSpec.info.contact) !== null && _this$resolvedSpec$in2 !== void 0 && _this$resolvedSpec$in2.url ? y`<span>URL: <a href="${this.resolvedSpec.info.contact.url}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.url}</a></span>` : ''}
|
17053 | ${this.resolvedSpec.info.license ? y`<span>License:
|
17054 | ${this.resolvedSpec.info.license.url ? y`<a href="${this.resolvedSpec.info.license.url}" part="anchor anchor-overview">${this.resolvedSpec.info.license.name}</a>` : this.resolvedSpec.info.license.name} </span>` : ''}
|
17055 | ${this.resolvedSpec.info.termsOfService ? y`<span><a href="${this.resolvedSpec.info.termsOfService}" part="anchor anchor-overview">Terms of Service</a></span>` : ''}
|
17056 | ${this.specUrl && this.allowSpecFileDownload === 'true' ? y`
|
17057 | <div style="display:flex; margin:12px 0; gap:8px; justify-content: start;">
|
17058 | <button class="m-btn thin-border" style="min-width:170px" part="btn btn-outline" @click='${e => {
|
17059 | downloadResource(this.specUrl, 'openapi-spec', e);
|
17060 | }}'>Download OpenAPI spec</button>
|
17061 | ${(_this$specUrl = this.specUrl) !== null && _this$specUrl !== void 0 && _this$specUrl.trim().toLowerCase().endsWith('json') ? y`<button class="m-btn thin-border" style="width:200px" part="btn btn-outline" @click='${e => {
|
17062 | viewResource(this.specUrl, e);
|
17063 | }}'>View OpenAPI spec (New Tab)</button>` : ''}
|
17064 | </div>` : ''}
|
17065 | </div>
|
17066 | <slot name="overview"></slot>
|
17067 | <div id="api-description">
|
17068 | ${this.resolvedSpec.info.description ? y`${unsafe_html_o(`
|
17069 | <div class="m-markdown regular-font">
|
17070 | ${marked(this.resolvedSpec.info.description, this.infoDescriptionHeadingsInNavBar === 'true' ? {
|
17071 | renderer: overview_template_headingRenderer()
|
17072 | } : undefined)}
|
17073 | </div>`)}` : ''}
|
17074 | </div>
|
17075 | ` : ''}
|
17076 | </section>
|
17077 | `;
|
17078 | }
|
17079 |
|
17080 | ;
|
17081 |
|
17082 |
|
17083 |
|
17084 | function setApiServer(serverUrl) {
|
17085 | var _this$resolvedSpec;
|
17086 | const serverObj = (_this$resolvedSpec = this.resolvedSpec) === null || _this$resolvedSpec === void 0 ? void 0 : _this$resolvedSpec.servers.find(s => s.url === serverUrl);
|
17087 | if (!serverObj) {
|
17088 | return false;
|
17089 | }
|
17090 | this.selectedServer = serverObj;
|
17091 | this.requestUpdate();
|
17092 | this.dispatchEvent(new CustomEvent('api-server-change', {
|
17093 | bubbles: true,
|
17094 | composed: true,
|
17095 | detail: {
|
17096 | selectedServer: serverObj
|
17097 | }
|
17098 | }));
|
17099 | return true;
|
17100 | }
|
17101 | function onApiServerVarChange(e, serverObj) {
|
17102 | const inputEls = [...e.currentTarget.closest('table').querySelectorAll('input, select')];
|
17103 | let tempUrl = serverObj.url;
|
17104 | inputEls.forEach(v => {
|
17105 | const regex = new RegExp(`{${v.dataset.var}}`, 'g');
|
17106 | tempUrl = tempUrl.replace(regex, v.value);
|
17107 | });
|
17108 | serverObj.computedUrl = tempUrl;
|
17109 | this.requestUpdate();
|
17110 | }
|
17111 |
|
17112 |
|
17113 | function serverVarsTemplate() {
|
17114 |
|
17115 | return this.selectedServer && this.selectedServer.variables ? y`
|
17116 | <div class="table-title">SERVER VARIABLES</div>
|
17117 | <table class='m-table' role='presentation'>
|
17118 | ${Object.entries(this.selectedServer.variables).map(kv => y`
|
17119 | <tr>
|
17120 | <td style="vertical-align: middle;" >${kv[0]}</td>
|
17121 | <td>
|
17122 | ${kv[1].enum ? y`
|
17123 | <select
|
17124 | data-var = "${kv[0]}"
|
17125 | @input = ${e => {
|
17126 | onApiServerVarChange.call(this, e, this.selectedServer);
|
17127 | }}
|
17128 | >
|
17129 | ${Object.entries(kv[1].enum).map(e => kv[1].default === e[1] ? y`
|
17130 | <option
|
17131 | selected
|
17132 | label = ${e[1]}
|
17133 | value = ${e[1]}
|
17134 | />` : y`
|
17135 | <option
|
17136 | label = ${e[1]}
|
17137 | value = ${e[1]}
|
17138 | />`)}
|
17139 | </select>` : y`
|
17140 | <input
|
17141 | type = "text"
|
17142 | part="textbox textbox-server-var"
|
17143 | spellcheck = "false"
|
17144 | data-var = "${kv[0]}"
|
17145 | value = "${kv[1].default}"
|
17146 | @input = ${e => {
|
17147 | onApiServerVarChange.call(this, e, this.selectedServer);
|
17148 | }}
|
17149 | />`}
|
17150 | </td>
|
17151 | </tr>
|
17152 | ${kv[1].description ? y`<tr><td colspan="2" style="border:none"><span class="m-markdown-small"> ${unsafe_html_o(marked(kv[1].description))} </span></td></tr>` : ''}
|
17153 | `)}
|
17154 | </table>
|
17155 | ` : '';
|
17156 | }
|
17157 | function serverTemplate() {
|
17158 | var _this$resolvedSpec$se, _this$resolvedSpec2, _this$selectedServer;
|
17159 | if (!this.resolvedSpec || this.resolvedSpec.specLoadError) {
|
17160 | return '';
|
17161 | }
|
17162 | return y`
|
17163 | <section id = 'servers' part="section-servers" style="text-align:left; direction:ltr; margin-top:24px; margin-bottom:24px;" class='regular-font observe-me ${'read focused'.includes(this.renderStyle) ? 'section-gap--read-mode' : 'section-gap'}'>
|
17164 | <div part = "section-servers-title" class = "sub-title">API SERVER</div>
|
17165 | <div class = 'mono-font' style='margin: 12px 0; font-size:calc(var(--font-size-small) + 1px);'>
|
17166 | ${!this.resolvedSpec.servers || ((_this$resolvedSpec$se = this.resolvedSpec.servers) === null || _this$resolvedSpec$se === void 0 ? void 0 : _this$resolvedSpec$se.length) === 0 ? '' : y`
|
17167 | ${(_this$resolvedSpec2 = this.resolvedSpec) === null || _this$resolvedSpec2 === void 0 ? void 0 : _this$resolvedSpec2.servers.map((server, i) => y`
|
17168 | <input type = 'radio'
|
17169 | name = 'api_server'
|
17170 | id = 'srvr-opt-${i}'
|
17171 | value = '${server.url}'
|
17172 | @change = ${() => {
|
17173 | setApiServer.call(this, server.url);
|
17174 | }}
|
17175 | .checked = '${this.selectedServer.url === server.url}'
|
17176 | style = 'margin:4px 0; cursor:pointer'
|
17177 | />
|
17178 | <label style='cursor:pointer' for='srvr-opt-${i}'>
|
17179 | ${server.url} ${server.description ? y`- <span class='regular-font'>${server.description} </span>` : ''}
|
17180 | </label>
|
17181 | <br/>
|
17182 | `)}
|
17183 | `}
|
17184 | <div class="table-title primary-text" part="label-selected-server"> SELECTED: ${((_this$selectedServer = this.selectedServer) === null || _this$selectedServer === void 0 ? void 0 : _this$selectedServer.computedUrl) || 'none'}</div>
|
17185 | </div>
|
17186 | <slot name="servers"></slot>
|
17187 | ${serverVarsTemplate.call(this)}
|
17188 | </section>`;
|
17189 | }
|
17190 |
|
17191 | ;
|
17192 |
|
17193 |
|
17194 |
|
17195 | function expandCollapseNavBarTag(navLinkEl, action = 'toggle') {
|
17196 | const tagAndPathEl = navLinkEl === null || navLinkEl === void 0 ? void 0 : navLinkEl.closest('.nav-bar-tag-and-paths');
|
17197 | const pathsUnderTagEl = tagAndPathEl === null || tagAndPathEl === void 0 ? void 0 : tagAndPathEl.querySelector('.nav-bar-paths-under-tag');
|
17198 | if (tagAndPathEl) {
|
17199 | const isExpanded = tagAndPathEl.classList.contains('expanded');
|
17200 | if (isExpanded && (action === 'toggle' || action === 'collapse')) {
|
17201 | pathsUnderTagEl.style.maxHeight = 0;
|
17202 | tagAndPathEl.classList.replace('expanded', 'collapsed');
|
17203 | } else if (!isExpanded && (action === 'toggle' || action === 'expand')) {
|
17204 | tagAndPathEl.classList.replace('collapsed', 'expanded');
|
17205 | pathsUnderTagEl.style.maxHeight = `${pathsUnderTagEl.scrollHeight}px`;
|
17206 | }
|
17207 | }
|
17208 | }
|
17209 | function expandCollapseAll(event, action = 'expand-all') {
|
17210 | if (!(event.type === 'click' || event.type === 'keyup' && event.keyCode === 13)) {
|
17211 | return;
|
17212 | }
|
17213 | const navEl = event.target.closest('.nav-scroll');
|
17214 | const elList = [...navEl.querySelectorAll('.nav-bar-tag-and-paths')];
|
17215 | if (action === 'expand-all') {
|
17216 | elList.forEach(el => {
|
17217 | const navBarPathsUnderTagEl = el.querySelector('.nav-bar-paths-under-tag');
|
17218 | el.classList.replace('collapsed', 'expanded');
|
17219 | navBarPathsUnderTagEl.style.maxHeight = `${navBarPathsUnderTagEl === null || navBarPathsUnderTagEl === void 0 ? void 0 : navBarPathsUnderTagEl.scrollHeight}px`;
|
17220 | });
|
17221 | } else {
|
17222 | elList.forEach(el => {
|
17223 | el.classList.replace('expanded', 'collapsed');
|
17224 | el.querySelector('.nav-bar-paths-under-tag').style.maxHeight = 0;
|
17225 | });
|
17226 | }
|
17227 | }
|
17228 | function navBarClickAndEnterHandler(event) {
|
17229 | var _navEl$dataset, _navEl$dataset2, _navEl$dataset3, _navEl$dataset4;
|
17230 | if (!(event.type === 'click' || event.type === 'keyup' && event.keyCode === 13)) {
|
17231 | return;
|
17232 | }
|
17233 | const navEl = event.target;
|
17234 | event.stopPropagation();
|
17235 | if (((_navEl$dataset = navEl.dataset) === null || _navEl$dataset === void 0 ? void 0 : _navEl$dataset.action) === 'navigate') {
|
17236 | this.scrollToEventTarget(event, false);
|
17237 | } else if (((_navEl$dataset2 = navEl.dataset) === null || _navEl$dataset2 === void 0 ? void 0 : _navEl$dataset2.action) === 'expand-all' || ((_navEl$dataset3 = navEl.dataset) === null || _navEl$dataset3 === void 0 ? void 0 : _navEl$dataset3.action) === 'collapse-all') {
|
17238 | expandCollapseAll(event, navEl.dataset.action);
|
17239 | } else if (((_navEl$dataset4 = navEl.dataset) === null || _navEl$dataset4 === void 0 ? void 0 : _navEl$dataset4.action) === 'expand-collapse-tag') {
|
17240 | expandCollapseNavBarTag(navEl, 'toggle');
|
17241 | }
|
17242 | }
|
17243 |
|
17244 |
|
17245 | function navbarTemplate() {
|
17246 | var _this$resolvedSpec$in, _this$resolvedSpec$in2, _this$resolvedSpec$in3, _this$resolvedSpec$in4;
|
17247 | if (!this.resolvedSpec || this.resolvedSpec.specLoadError) {
|
17248 | return y`
|
17249 | <nav class='nav-bar' part='section-navbar'>
|
17250 | <slot name='nav-logo' class='logo'></slot>
|
17251 | </nav>
|
17252 | `;
|
17253 | }
|
17254 | return y`
|
17255 | <nav class='nav-bar ${this.renderStyle}' part='section-navbar'>
|
17256 | <slot name='nav-logo' class='logo'></slot>
|
17257 | ${this.allowSearch === 'false' && this.allowAdvancedSearch === 'false' ? '' : y`
|
17258 | <div style='display:flex; flex-direction:row; justify-content:center; align-items:stretch; padding:8px 24px 12px 24px; ${this.allowAdvancedSearch === 'false' ? 'border-bottom: 1px solid var(--nav-hover-bg-color)' : ''}' part='section-navbar-search'>
|
17259 | ${this.allowSearch === 'false' ? '' : y`
|
17260 | <div style = 'display:flex; flex:1; line-height:22px;'>
|
17261 | <input id = 'nav-bar-search'
|
17262 | part = 'textbox textbox-nav-filter'
|
17263 | style = 'width:100%; padding-right:20px; color:var(--nav-hover-text-color); border-color:var(--nav-accent-color); background-color:var(--nav-hover-bg-color)'
|
17264 | type = 'text'
|
17265 | placeholder = 'Filter'
|
17266 | @change = '${this.onSearchChange}'
|
17267 | spellcheck = 'false'
|
17268 | >
|
17269 | <div style='margin: 6px 5px 0 -24px; font-size:var(--font-size-regular); cursor:pointer;'>↩</div>
|
17270 | </div>
|
17271 | ${this.matchPaths ? y`
|
17272 | <button @click = '${this.onClearSearch}' class='m-btn thin-border' style='margin-left:5px; color:var(--nav-text-color); width:75px; padding:6px 8px;' part='btn btn-outline btn-clear-filter'>
|
17273 | CLEAR
|
17274 | </button>` : ''}
|
17275 | `}
|
17276 | ${this.allowAdvancedSearch === 'false' || this.matchPaths ? '' : y`
|
17277 | <button class='m-btn primary' part='btn btn-fill btn-search' style='margin-left:5px; padding:6px 8px; width:75px' @click='${this.onShowSearchModalClicked}'>
|
17278 | SEARCH
|
17279 | </button>
|
17280 | `}
|
17281 | </div>
|
17282 | `}
|
17283 | ${y`<nav class='nav-scroll' tabindex='-1' part='section-navbar-scroll' @click='${e => navBarClickAndEnterHandler.call(this, e)}' @keyup='${e => navBarClickAndEnterHandler.call(this, e)}' >
|
17284 | ${this.showInfo === 'false' || !this.resolvedSpec.info ? '' : y`
|
17285 | ${this.infoDescriptionHeadingsInNavBar === 'true' ? y`
|
17286 | ${this.resolvedSpec.infoDescriptionHeaders.length > 0 ? y`<div class='nav-bar-info ${this.navActiveItemMarker}' id='link-overview' data-content-id='overview' data-action='navigate' tabindex='0' part='section-navbar-item section-navbar-overview'>
|
17287 | ${((_this$resolvedSpec$in = this.resolvedSpec.info) === null || _this$resolvedSpec$in === void 0 ? void 0 : (_this$resolvedSpec$in2 = _this$resolvedSpec$in.title) === null || _this$resolvedSpec$in2 === void 0 ? void 0 : _this$resolvedSpec$in2.trim()) || 'Overview'}
|
17288 | </div>` : ''}
|
17289 | <div class='overview-headers'>
|
17290 | ${this.resolvedSpec.infoDescriptionHeaders.map(header => y`
|
17291 | <div
|
17292 | class='nav-bar-h${header.depth} ${this.navActiveItemMarker}'
|
17293 | id='link-overview--${new marked.Slugger().slug(header.text)}'
|
17294 | data-action='navigate'
|
17295 | data-content-id='overview--${new marked.Slugger().slug(header.text)}'
|
17296 | >
|
17297 | ${header.text}
|
17298 | </div>`)}
|
17299 | </div>
|
17300 | ${this.resolvedSpec.infoDescriptionHeaders.length > 0 ? y`<hr style='border-top: 1px solid var(--nav-hover-bg-color); border-width:1px 0 0 0; margin: 15px 0 0 0'/>` : ''}
|
17301 | ` : y`<div class='nav-bar-info ${this.navActiveItemMarker}' id='link-overview' data-action='navigate' data-content-id='overview' tabindex='0'>
|
17302 | ${((_this$resolvedSpec$in3 = this.resolvedSpec.info) === null || _this$resolvedSpec$in3 === void 0 ? void 0 : (_this$resolvedSpec$in4 = _this$resolvedSpec$in3.title) === null || _this$resolvedSpec$in4 === void 0 ? void 0 : _this$resolvedSpec$in4.trim()) || 'Overview'}
|
17303 | </div>`}
|
17304 | `}
|
17305 |
|
17306 | ${this.allowServerSelection === 'false' ? '' : y`<div class='nav-bar-info ${this.navActiveItemMarker}' id='link-servers' data-action='navigate' data-content-id='servers' tabindex='0' part='section-navbar-item section-navbar-servers'> API Servers </div>`}
|
17307 | ${this.allowAuthentication === 'false' || !this.resolvedSpec.securitySchemes ? '' : y`<div class='nav-bar-info ${this.navActiveItemMarker}' id='link-auth' data-action='navigate' data-content-id='auth' tabindex='0' part='section-navbar-item section-navbar-auth'> Authentication </div>`}
|
17308 |
|
17309 | <div id='link-operations-top' class='nav-bar-section operations' data-action='navigate' data-content-id='${this.renderStyle === 'focused' ? '' : 'operations-top'}' part='section-navbar-item section-navbar-operations-top'>
|
17310 | <div style='font-size:16px; display:flex; margin-left:10px;'>
|
17311 | ${this.renderStyle === 'focused' ? y`
|
17312 | <div class='nav-bar-expand-all'
|
17313 | data-action='expand-all'
|
17314 | tabindex='0'
|
17315 | title='Expand all'
|
17316 | >▸</div>
|
17317 | <div class='nav-bar-collapse-all'
|
17318 | data-action='collapse-all'
|
17319 | tabindex='0'
|
17320 | title='Collapse all'
|
17321 | >▸</div>` : ''}
|
17322 | </div>
|
17323 | <div class='nav-bar-section-title'> OPERATIONS </div>
|
17324 | </div>
|
17325 |
|
17326 | <!-- TAGS AND PATHS-->
|
17327 | ${this.resolvedSpec.tags.filter(tag => tag.paths.filter(path => pathIsInSearch(this.matchPaths, path, this.matchType)).length).map(tag => {
|
17328 | var _tag$paths;
|
17329 | return y`
|
17330 | <div class='nav-bar-tag-and-paths ${this.renderStyle === 'read' ? 'expanded' : tag.expanded ? 'expanded' : 'collapsed'}' >
|
17331 | ${tag.name === 'General ⦂' ? y`<hr style='border:none; border-top: 1px dotted var(--nav-text-color); opacity:0.3; margin:-1px 0 0 0;'/>` : y`
|
17332 | <div
|
17333 | class='nav-bar-tag ${this.navActiveItemMarker}'
|
17334 | part='section-navbar-item section-navbar-tag'
|
17335 | id='link-${tag.elementId}'
|
17336 | data-action='${(this.renderStyle === 'read' ? 'navigate' : this.onNavTagClick === 'show-description') ? 'navigate' : 'expand-collapse-tag'}'
|
17337 | data-content-id='${(this.renderStyle === 'read' ? `${tag.elementId}` : this.onNavTagClick === 'show-description') ? `${tag.elementId}` : ''}'
|
17338 | data-first-path-id='${tag.firstPathId}'
|
17339 | tabindex='0'
|
17340 | >
|
17341 | <div style="pointer-events:none;">${tag.name}</div>
|
17342 | <div class='nav-bar-tag-icon' tabindex='0' data-action='expand-collapse-tag'></div>
|
17343 | </div>
|
17344 | `}
|
17345 | ${this.infoDescriptionHeadingsInNavBar === 'true' ? y`
|
17346 | ${this.renderStyle === 'focused' && this.onNavTagClick === 'expand-collapse' ? '' : y`
|
17347 | <div class='tag-headers'>
|
17348 | ${tag.headers.map(header => y`
|
17349 | <div
|
17350 | class='nav-bar-h${header.depth} ${this.navActiveItemMarker}'
|
17351 | part='section-navbar-item section-navbar-h${header.depth}'
|
17352 | id='link-${tag.elementId}--${new marked.Slugger().slug(header.text)}'
|
17353 | data-action='navigate'
|
17354 | data-content-id='${tag.elementId}--${new marked.Slugger().slug(header.text)}'
|
17355 | tabindex='0'
|
17356 | > ${header.text}</div>`)}
|
17357 | </div>`}` : ''}
|
17358 | <div class='nav-bar-paths-under-tag' style='max-height:${tag.expanded || this.renderStyle === 'read' ? (((_tag$paths = tag.paths) === null || _tag$paths === void 0 ? void 0 : _tag$paths.length) || 1) * 50 : 0}px;'>
|
17359 | <!-- Paths in each tag (endpoints) -->
|
17360 | ${tag.paths.filter(v => {
|
17361 | if (this.matchPaths) {
|
17362 | return pathIsInSearch(this.matchPaths, v, this.matchType);
|
17363 | }
|
17364 | return true;
|
17365 | }).map(p => y`
|
17366 | <div
|
17367 | class='nav-bar-path ${this.navActiveItemMarker} ${this.usePathInNavBar === 'true' ? 'small-font' : ''}'
|
17368 | part='section-navbar-item section-navbar-path'
|
17369 | data-action='navigate'
|
17370 | data-content-id='${p.elementId}'
|
17371 | id='link-${p.elementId}'
|
17372 | tabindex='0'
|
17373 | >
|
17374 | <span style = 'display:flex; pointer-events: none; align-items:start; ${p.deprecated ? 'filter:opacity(0.5)' : ''}'>
|
17375 | ${y`<span class='nav-method ${this.showMethodInNavBar} ${p.method}' style='pointer-events: none;'>
|
17376 | ${this.showMethodInNavBar === 'as-colored-block' ? p.method.substring(0, 3).toUpperCase() : p.method.toUpperCase()}
|
17377 | </span>`}
|
17378 | ${p.isWebhook ? y`<span style='font-weight:bold; pointer-events: none; margin-right:8px; font-size: calc(var(--font-size-small) - 2px)'>WEBHOOK</span>` : ''}
|
17379 | ${this.usePathInNavBar === 'true' ? y`<span style='pointer-events: none;' class='mono-font'>${p.path}</span>` : p.summary || p.shortSummary}
|
17380 | </span>
|
17381 | </div>`)}
|
17382 | </div>
|
17383 | </div>
|
17384 | `;
|
17385 | })}
|
17386 |
|
17387 | <!-- COMPONENTS -->
|
17388 | ${this.resolvedSpec.components && this.showComponents === 'true' && this.renderStyle === 'focused' ? y`
|
17389 | <div id='link-components' class='nav-bar-section components'>
|
17390 | <div></div>
|
17391 | <div class='nav-bar-section-title'>COMPONENTS</div>
|
17392 | </div>
|
17393 | ${this.resolvedSpec.components.map(component => component.subComponents.length ? y`
|
17394 | <div class='nav-bar-tag'
|
17395 | part='section-navbar-item section-navbar-tag'
|
17396 | data-action='navigate'
|
17397 | data-content-id='cmp--${component.name.toLowerCase()}'
|
17398 | id='link-cmp--${component.name.toLowerCase()}'
|
17399 | >
|
17400 | ${component.name}
|
17401 | </div>
|
17402 | ${component.subComponents.filter(p => p.expanded !== false).map(p => y`
|
17403 | <div class='nav-bar-path' data-action='navigate' data-content-id='cmp--${p.id}' id='link-cmp--${p.id}'>
|
17404 | <span> ${p.name} </span>
|
17405 | </div>`)}` : '')}` : ''}
|
17406 | </nav>`}
|
17407 | </nav>
|
17408 | `;
|
17409 | }
|
17410 | /* eslint-enable indent */
|
17411 | ;// CONCATENATED MODULE: ./src/templates/focused-endpoint-template.js
|
17412 |
|
17413 | // eslint-disable-line import/extensions
|
17414 |
|
17415 |
|
17416 |
|
17417 |
|
17418 |
|
17419 |
|
17420 |
|
17421 |
|
17422 |
|
17423 | function focused_endpoint_template_headingRenderer(tagElementId) {
|
17424 | const renderer = new marked.Renderer();
|
17425 | renderer.heading = (text, level, raw, slugger) => `<h${level} class="observe-me" id="${tagElementId}--${slugger.slug(raw)}">${text}</h${level}>`;
|
17426 | return renderer;
|
17427 | }
|
17428 | function wrapFocusedTemplate(templateToWrap) {
|
17429 | return y`
|
17430 | <div class='regular-font section-gap--focused-mode' part="section-operations-in-tag">
|
17431 | ${templateToWrap}
|
17432 | </div>`;
|
17433 | }
|
17434 | function defaultContentTemplate() {
|
17435 | var _this$resolvedSpec$ta;
|
17436 |
|
17437 | if (this.showInfo === 'true') {
|
17438 | return wrapFocusedTemplate(overviewTemplate.call(this));
|
17439 | }
|
17440 | const selectedTagObj = this.resolvedSpec.tags[0];
|
17441 | const selectedPathObj = (_this$resolvedSpec$ta = this.resolvedSpec.tags[0]) === null || _this$resolvedSpec$ta === void 0 ? void 0 : _this$resolvedSpec$ta.paths[0];
|
17442 | return selectedTagObj && selectedPathObj ? wrapFocusedTemplate(expandedEndpointBodyTemplate.call(this, selectedPathObj, selectedTagObj.name)) : wrapFocusedTemplate('');
|
17443 | }
|
17444 |
|
17445 |
|
17446 | function focusedTagBodyTemplate(tag) {
|
17447 | return y`
|
17448 | <h1 id="${tag.elementId}">${tag.name}</h1>
|
17449 | ${this.onNavTagClick === 'show-description' && tag.description ? y`
|
17450 | <div class="m-markdown">
|
17451 | ${unsafe_html_o(`
|
17452 | <div class="m-markdown regular-font">
|
17453 | ${marked(tag.description || '', this.infoDescriptionHeadingsInNavBar === 'true' ? {
|
17454 | renderer: focused_endpoint_template_headingRenderer(tag.elementId)
|
17455 | } : undefined)}
|
17456 | </div>`)}
|
17457 | </div>` : ''}
|
17458 | `;
|
17459 | }
|
17460 | function focusedEndpointTemplate() {
|
17461 | if (!this.focusedElementId || !this.resolvedSpec) {
|
17462 | return;
|
17463 | }
|
17464 | const focusElId = this.focusedElementId;
|
17465 | let selectedPathObj = null;
|
17466 | let selectedTagObj = null;
|
17467 | let focusedTemplate;
|
17468 | let i = 0;
|
17469 | if (focusElId.startsWith('overview') && this.showInfo === 'true') {
|
17470 | focusedTemplate = overviewTemplate.call(this);
|
17471 | } else if (focusElId === 'auth' && this.allowAuthentication === 'true') {
|
17472 | focusedTemplate = securitySchemeTemplate.call(this);
|
17473 | } else if (focusElId === 'servers' && this.allowServerSelection === 'true') {
|
17474 | focusedTemplate = serverTemplate.call(this);
|
17475 | } else if (focusElId === 'operations-top') {
|
17476 | focusedTemplate = y`
|
17477 | <div id="operations-top" class="observe-me">
|
17478 | <slot name="operations-top"></slot>
|
17479 | </div>`;
|
17480 | } else if (focusElId.startsWith('cmp--') && this.showComponents === 'true') {
|
17481 | focusedTemplate = componentsTemplate.call(this);
|
17482 | } else if (focusElId.startsWith('tag--')) {
|
17483 | const idToFocus = focusElId.indexOf('--', 4) > 0 ? focusElId.substring(0, focusElId.indexOf('--', 5)) : focusElId;
|
17484 | selectedTagObj = this.resolvedSpec.tags.find(v => v.elementId === idToFocus);
|
17485 | if (selectedTagObj) {
|
17486 | focusedTemplate = wrapFocusedTemplate.call(this, focusedTagBodyTemplate.call(this, selectedTagObj));
|
17487 | } else {
|
17488 | focusedTemplate = defaultContentTemplate.call(this);
|
17489 | }
|
17490 | } else {
|
17491 | for (i = 0; i < this.resolvedSpec.tags.length; i += 1) {
|
17492 | selectedTagObj = this.resolvedSpec.tags[i];
|
17493 | selectedPathObj = this.resolvedSpec.tags[i].paths.find(v => `${v.elementId}` === focusElId);
|
17494 | if (selectedPathObj) {
|
17495 | break;
|
17496 | }
|
17497 | }
|
17498 | if (selectedPathObj) {
|
17499 |
|
17500 | const newNavEl = this.shadowRoot.getElementById(`link-${focusElId}`);
|
17501 | expandCollapseNavBarTag(newNavEl, 'expand');
|
17502 | focusedTemplate = wrapFocusedTemplate.call(this, expandedEndpointBodyTemplate.call(this, selectedPathObj, selectedTagObj.name || '', selectedTagObj.description || ''));
|
17503 | } else {
|
17504 |
|
17505 | focusedTemplate = defaultContentTemplate.call(this);
|
17506 | }
|
17507 | }
|
17508 | return focusedTemplate;
|
17509 | }
|
17510 |
|
17511 | ;
|
17512 |
|
17513 |
|
17514 |
|
17515 |
|
17516 |
|
17517 |
|
17518 |
|
17519 |
|
17520 |
|
17521 | function toggleExpand(path) {
|
17522 | if (path.expanded) {
|
17523 | path.expanded = false;
|
17524 | if (this.updateRoute === 'true') {
|
17525 | this.replaceHistoryState('');
|
17526 | }
|
17527 | } else {
|
17528 | path.expanded = true;
|
17529 | if (this.updateRoute === 'true') {
|
17530 | const newHash = `${this.routePrefix || '#'}${path.elementId}`;
|
17531 | if (window.location.hash !== newHash) {
|
17532 | this.replaceHistoryState(path.elementId);
|
17533 | }
|
17534 | }
|
17535 | }
|
17536 | this.requestUpdate();
|
17537 | }
|
17538 | function endpoint_template_expandCollapseAll(operationsRootEl, action = 'expand-all') {
|
17539 | const elList = [...operationsRootEl.querySelectorAll('.section-tag')];
|
17540 | if (action === 'expand-all') {
|
17541 | elList.map(el => {
|
17542 | el.classList.replace('collapsed', 'expanded');
|
17543 | });
|
17544 | } else {
|
17545 | elList.map(el => {
|
17546 | el.classList.replace('expanded', 'collapsed');
|
17547 | });
|
17548 | }
|
17549 | }
|
17550 | function onExpandCollapseAll(e, action = 'expand-all') {
|
17551 | endpoint_template_expandCollapseAll.call(this, e.target.closest('.operations-root'), action);
|
17552 | }
|
17553 |
|
17554 |
|
17555 | function endpointHeadTemplate(path, pathsExpanded = false) {
|
17556 | return y`
|
17557 | <summary @click="${e => {
|
17558 | toggleExpand.call(this, path, e);
|
17559 | }}" part="section-endpoint-head-${path.expanded ? 'expanded' : 'collapsed'}" class='endpoint-head ${path.method} ${path.deprecated ? 'deprecated' : ''} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>
|
17560 | <div part="section-endpoint-head-method" class="method ${path.method} ${path.deprecated ? 'deprecated' : ''}"> ${path.method} </div>
|
17561 | <div part="section-endpoint-head-path" class="path ${path.deprecated ? 'deprecated' : ''}">
|
17562 | ${path.path}
|
17563 | ${path.isWebhook ? y`<span style="font-family: var(--font-regular); font-size: var(--); font-size: var(--font-size-small); color:var(--primary-color); margin-left: 16px"> Webhook</span>` : ''}
|
17564 | </div>
|
17565 | ${path.deprecated ? y`
|
17566 | <span style="font-size:var(--font-size-small); text-transform:uppercase; font-weight:bold; color:var(--red); margin:2px 0 0 5px;">
|
17567 | deprecated
|
17568 | </span>` : ''}
|
17569 | ${this.showSummaryWhenCollapsed ? y`
|
17570 | <div class="only-large-screen" style="min-width:60px; flex:1"></div>
|
17571 | <div part="section-endpoint-head-description" class="descr">${path.summary || path.shortSummary} </div>` : ''}
|
17572 | </summary>
|
17573 | `;
|
17574 | }
|
17575 | function endpointBodyTemplate(path) {
|
17576 | var _path$xBadges, _path$externalDocs, _path$externalDocs2, _path$externalDocs3, _path$externalDocs4, _path$externalDocs5, _path$externalDocs6;
|
17577 | const acceptContentTypes = new Set();
|
17578 | for (const respStatus in path.responses) {
|
17579 | for (const acceptContentType in (_path$responses$respS = path.responses[respStatus]) === null || _path$responses$respS === void 0 ? void 0 : _path$responses$respS.content) {
|
17580 | var _path$responses$respS;
|
17581 | acceptContentTypes.add(acceptContentType.trim());
|
17582 | }
|
17583 | }
|
17584 | const accept = [...acceptContentTypes].join(', ');
|
17585 |
|
17586 | const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter(v => {
|
17587 | var _path$security;
|
17588 | return v.finalKeyValue && ((_path$security = path.security) === null || _path$security === void 0 ? void 0 : _path$security.some(ps => v.securitySchemeId in ps));
|
17589 | }) || [];
|
17590 |
|
17591 |
|
17592 | const rapiDocApiKey = this.resolvedSpec.securitySchemes.find(v => v.securitySchemeId === rapidocApiKey && v.value !== '-');
|
17593 | if (rapiDocApiKey) {
|
17594 | nonEmptyApiKeys.push(rapiDocApiKey);
|
17595 | }
|
17596 | const codeSampleTabPanel = path.xCodeSamples ? codeSamplesTemplate(path.xCodeSamples) : '';
|
17597 | return y`
|
17598 | <div part="section-endpoint-body-${path.expanded ? 'expanded' : 'collapsed'}" class='endpoint-body ${path.method} ${path.deprecated ? 'deprecated' : ''}'>
|
17599 | <div class="summary">
|
17600 | ${path.summary ? y`<div class="title" part="section-endpoint-body-title">${path.summary}<div>` : path.shortSummary !== path.description ? y`<div class="title" part="section-endpoint-body-title">${path.shortSummary}</div>` : ''}
|
17601 | ${path.xBadges && ((_path$xBadges = path.xBadges) === null || _path$xBadges === void 0 ? void 0 : _path$xBadges.length) > 0 ? y`
|
17602 | <div style="display:flex; flex-wrap:wrap;font-size: var(--font-size-small);">
|
17603 | ${path.xBadges.map(v => y`<span part="endpoint-badge" style="margin:1px; margin-right:5px; padding:1px 8px; font-weight:bold; border-radius:12px; background-color: var(--light-${v.color}, var(--input-bg)); color:var(--${v.color}); border:1px solid var(--${v.color})">${v.label}</span>`)}
|
17604 | </div>
|
17605 | ` : ''}
|
17606 |
|
17607 | ${path.description ? y`<div part="section-endpoint-body-description" class="m-markdown"> ${unsafe_html_o(marked(path.description))}</div>` : ''}
|
17608 | ${(_path$externalDocs = path.externalDocs) !== null && _path$externalDocs !== void 0 && _path$externalDocs.url || (_path$externalDocs2 = path.externalDocs) !== null && _path$externalDocs2 !== void 0 && _path$externalDocs2.description ? y`<div style="background-color:var(--bg3); padding:2px 8px 8px 8px; margin:8px 0; border-radius:var(--border-radius)">
|
17609 | <div class="m-markdown"> ${unsafe_html_o(marked(((_path$externalDocs3 = path.externalDocs) === null || _path$externalDocs3 === void 0 ? void 0 : _path$externalDocs3.description) || ''))} </div>
|
17610 | ${(_path$externalDocs4 = path.externalDocs) !== null && _path$externalDocs4 !== void 0 && _path$externalDocs4.url ? y`<a style="font-family:var(--font-mono); font-size:var(--font-size-small)" href="${(_path$externalDocs5 = path.externalDocs) === null || _path$externalDocs5 === void 0 ? void 0 : _path$externalDocs5.url}" target="_blank">
|
17611 | ${(_path$externalDocs6 = path.externalDocs) === null || _path$externalDocs6 === void 0 ? void 0 : _path$externalDocs6.url} <div style="transform: rotate(270deg) scale(1.5); display: inline-block; margin-left:5px">⇲</div>
|
17612 | </a>` : ''}
|
17613 | </div>` : ''}
|
17614 | <slot name="${path.elementId}"></slot>
|
17615 | ${pathSecurityTemplate.call(this, path.security)}
|
17616 | ${codeSampleTabPanel}
|
17617 | </div>
|
17618 | <div class='req-resp-container'>
|
17619 | <div style="display:flex; flex-direction:column" class="view-mode-request ${this.layout}-layout">
|
17620 | <api-request
|
17621 | class = "${this.renderStyle}-mode ${this.layout}-layout"
|
17622 | style = "width:100%;"
|
17623 | webhook = "${path.isWebhook}"
|
17624 | method = "${path.method}"
|
17625 | path = "${path.path}"
|
17626 | .security = "${path.security}"
|
17627 | .parameters = "${path.parameters}"
|
17628 | .request_body = "${path.requestBody}"
|
17629 | .api_keys = "${nonEmptyApiKeys}"
|
17630 | .servers = "${path.servers}"
|
17631 | server-url = "${path.servers && path.servers.length > 0 ? path.servers[0].url : this.selectedServer.computedUrl}"
|
17632 | active-schema-tab = "${this.defaultSchemaTab}"
|
17633 | fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
|
17634 | allow-try = "${this.allowTry}"
|
17635 | show-curl-before-try = "${this.showCurlBeforeTry}"
|
17636 | accept = "${accept}"
|
17637 | render-style="${this.renderStyle}"
|
17638 | schema-style = "${this.schemaStyle}"
|
17639 | schema-expand-level = "${this.schemaExpandLevel}"
|
17640 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
17641 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
17642 | schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
17643 | schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
17644 | fetch-credentials = "${this.fetchCredentials}"
|
17645 | exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
17646 | file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
17647 | anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
17648 | > </api-request>
|
17649 |
|
17650 | ${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}
|
17651 | </div>
|
17652 |
|
17653 | <api-response
|
17654 | class = "${this.renderStyle}-mode"
|
17655 | style = "width:100%;"
|
17656 | webhook = "${path.isWebhook}"
|
17657 | .responses="${path.responses}"
|
17658 | active-schema-tab = "${this.defaultSchemaTab}"
|
17659 | render-style="${this.renderStyle}"
|
17660 | schema-style="${this.schemaStyle}"
|
17661 | schema-expand-level = "${this.schemaExpandLevel}"
|
17662 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
17663 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
17664 | schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
17665 | schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
17666 | selected-status = "${Object.keys(path.responses || {})[0] || ''}"
|
17667 | exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, file-input:file-input,
|
17668 | textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param, anchor:anchor, anchor-param-example:anchor-param-example, btn-clear-resp:btn-clear-resp,
|
17669 | schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
17670 | > </api-response>
|
17671 | </div>
|
17672 | </div>`;
|
17673 | }
|
17674 | function endpointTemplate(showExpandCollapse = true, showTags = true, pathsExpanded = false) {
|
17675 | if (!this.resolvedSpec) {
|
17676 | return '';
|
17677 | }
|
17678 | return y`
|
17679 | ${showExpandCollapse ? y`
|
17680 | <div style="display:flex; justify-content:flex-end;">
|
17681 | <span @click="${e => onExpandCollapseAll(e, 'expand-all')}" style="color:var(--primary-color); cursor:pointer;">
|
17682 | Expand all
|
17683 | </span>
|
17684 | |
|
17685 | <span @click="${e => onExpandCollapseAll(e, 'collapse-all')}" style="color:var(--primary-color); cursor:pointer;" >
|
17686 | Collapse all
|
17687 | </span>
|
17688 | sections
|
17689 | </div>` : ''}
|
17690 | ${this.resolvedSpec.tags.map(tag => y`
|
17691 | ${showTags ? y`
|
17692 | <div class='regular-font section-gap section-tag ${tag.expanded ? 'expanded' : 'collapsed'}'>
|
17693 | <div class='section-tag-header' @click="${() => {
|
17694 | tag.expanded = !tag.expanded;
|
17695 | this.requestUpdate();
|
17696 | }}">
|
17697 | <div id='${tag.elementId}' class="sub-title tag" style="color:var(--primary-color)">${tag.name}</div>
|
17698 | </div>
|
17699 | <div class='section-tag-body'>
|
17700 | <slot name="${tag.elementId}"></slot>
|
17701 | <div class="regular-font regular-font-size m-markdown" style="padding-bottom:12px">
|
17702 | ${unsafe_html_o(marked(tag.description || ''))}
|
17703 | </div>
|
17704 | ${tag.paths.filter(v => {
|
17705 | if (this.matchPaths) {
|
17706 | return pathIsInSearch(this.matchPaths, v, this.matchType);
|
17707 | }
|
17708 | return true;
|
17709 | }).map(path => y`
|
17710 | <section part="section-endpoint" id='${path.elementId}' class='m-endpoint regular-font ${path.method} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>
|
17711 | ${endpointHeadTemplate.call(this, path, pathsExpanded)}
|
17712 | ${pathsExpanded || path.expanded ? endpointBodyTemplate.call(this, path) : ''}
|
17713 | </section>`)}
|
17714 | </div>
|
17715 | </div>` : y`
|
17716 | <div class='section-tag-body'>
|
17717 | ${tag.paths.filter(v => {
|
17718 | if (this.matchPaths) {
|
17719 | return pathIsInSearch(this.matchPaths, v, this.matchType);
|
17720 | }
|
17721 | return true;
|
17722 | }).map(path => y`
|
17723 | <section id='${path.elementId}' class='m-endpoint regular-font ${path.method} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>
|
17724 | ${endpointHeadTemplate.call(this, path, pathsExpanded)}
|
17725 | ${pathsExpanded || path.expanded ? endpointBodyTemplate.call(this, path) : ''}
|
17726 | </section>`)}
|
17727 | </div>
|
17728 | `}
|
17729 | `)}`;
|
17730 | }
|
17731 | /* eslint-enable indent */
|
17732 | ;// CONCATENATED MODULE: ./src/templates/logo-template.js
|
17733 |
|
17734 |
|
17735 | /* eslint-disable indent */
|
17736 | function logoTemplate(style) {
|
17737 | return y`
|
17738 | <div style=${style}>
|
17739 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="1 0 511 512">
|
17740 | <path d="M351 411a202 202 0 01-350 0 203 203 0 01333-24 203 203 0 0117 24zm0 0" fill="#adc165"/>
|
17741 | <path d="M334 387a202 202 0 01-216-69 202 202 0 01216 69zm78 32H85a8 8 0 01-8-8 8 8 0 018-8h327a8 8 0 017 8 8 8 0 01-7 8zm0 0" fill="#99aa52"/>
|
17742 | <path d="M374 338l-5 30a202 202 0 01-248-248 203 203 0 01253 218zm0 0" fill="#ffc73b"/>
|
17743 | <path d="M374 338a202 202 0 01-100-197 203 203 0 01100 197zm38 81l-6-2-231-231a8 8 0 0111-11l231 230a8 8 0 01-5 14zm0 0" fill="#efb025"/>
|
17744 | <path d="M311 175c0 75 40 140 101 175a202 202 0 000-350 202 202 0 00-101 175zm0 0" fill="#ff903e"/>
|
17745 | <path d="M412 419a8 8 0 01-8-8V85a8 8 0 0115 0v326a8 8 0 01-7 8zm0 0" fill="#e87425"/>
|
17746 | </svg>
|
17747 | </div>
|
17748 | `;
|
17749 | }
|
17750 | /* eslint-enable indent */
|
17751 | ;// CONCATENATED MODULE: ./src/templates/header-template.js
|
17752 |
|
17753 |
|
17754 |
|
17755 | /* eslint-disable indent */
|
17756 | function headerTemplate() {
|
17757 | return y`
|
17758 | <header class="row main-header regular-font" part="section-header" style="padding:8px 4px 8px 4px;min-height:48px;">
|
17759 | <div class="only-large-screen-flex" style="align-items: center;">
|
17760 | <slot name="logo" class="logo" part="section-logo">
|
17761 | ${logoTemplate('height:36px;width:36px;margin-left:5px')}
|
17762 | <!-- m-logo style="height:36px;width:36px;margin-left:5px"></m-logo -->
|
17763 | </slot>
|
17764 | <div class="header-title" part="label-header-title">${this.headingText}</div>
|
17765 | </div>
|
17766 | <div style="margin: 0px 8px;display:flex;flex:1">
|
17767 | ${this.allowSpecUrlLoad === 'false' ? '' : y`
|
17768 | <input id="spec-url"
|
17769 | type="text"
|
17770 | style="font-size:var(--font-size-small)"
|
17771 | class="header-input mono-font"
|
17772 | part="textbox textbox-spec-url"
|
17773 | placeholder="Spec URL"
|
17774 | value="${this.specUrl || ''}"
|
17775 | @change="${this.onSpecUrlChange}"
|
17776 | spellcheck="false"
|
17777 | >
|
17778 | <div style="margin: 6px 5px 0 -24px; font-size:var(--font-size-regular); cursor:pointer;">↩</div>
|
17779 | `}
|
17780 | ${this.allowSpecFileLoad === 'false' ? '' : y`
|
17781 | <input id="spec-file"
|
17782 | part = "file-input"
|
17783 | type="file"
|
17784 | style="display:none"
|
17785 | value="${this.specFile || ''}"
|
17786 | @change="${this.onSpecFileChange}"
|
17787 | spellcheck="false"
|
17788 | >
|
17789 | <button class="m-btn primary only-large-screen" style="margin-left:10px;" part="btn btn-fill" @click="${this.onFileLoadClick}"> LOCAL JSON FILE </button>
|
17790 | `}
|
17791 | <slot name="header"></slot>
|
17792 | ${this.allowSearch === 'false' || 'read focused'.includes(this.renderStyle) ? '' : y`
|
17793 | <input id="search" class="header-input" type="text" part="textbox textbox-header-filter" placeholder="Filter" @change="${this.onSearchChange}" style="max-width:130px;margin-left:10px;" spellcheck="false" >
|
17794 | <div style="margin: 6px 5px 0 -24px; font-size:var(--font-size-regular); cursor:pointer;">↩</div>
|
17795 | `}
|
17796 |
|
17797 | ${this.allowAdvancedSearch === 'false' || 'read focused'.includes(this.renderStyle) ? '' : y`
|
17798 | <button class="m-btn primary only-large-screen" part="btn btn-fill btn-search" style="margin-left:10px;" @click="${this.onShowSearchModalClicked}">
|
17799 | Search
|
17800 | </button>
|
17801 | `}
|
17802 | </div>
|
17803 | </header>`;
|
17804 | }
|
17805 |
|
17806 | ;
|
17807 |
|
17808 | const dialog_box_styles = (i`
|
17809 | *, *:before, *:after { box-sizing: border-box; }
|
17810 |
|
17811 | .dialog-box-overlay {
|
17812 | background-color: var(--overlay-bg);
|
17813 | position: fixed;
|
17814 | left: 0;
|
17815 | top: 0;
|
17816 | width: 100vw;
|
17817 | height: 100vh;
|
17818 | overflow: hidden;
|
17819 | z-index: var(--dialog-z-index);
|
17820 | }
|
17821 |
|
17822 | .dialog-box {
|
17823 | position: fixed;
|
17824 | top: 100px;
|
17825 | left: 50%;
|
17826 | transform: translate(-50%, 0%);
|
17827 | display: flex;
|
17828 | flex-direction: column;
|
17829 | width: 70vw;
|
17830 | background-color: var(--bg2);
|
17831 | color: var(--fg2);
|
17832 | border-radius: 4px;
|
17833 | max-height: 500px;
|
17834 | overflow: hidden;
|
17835 | border: 1px solid var(--border-color);
|
17836 | box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
|
17837 | }
|
17838 |
|
17839 | .dialog-box-header {
|
17840 | position: sticky;
|
17841 | top: 0;
|
17842 | align-self: stretch;
|
17843 | display: flex;
|
17844 | align-items: center;
|
17845 | padding: 0px 16px;
|
17846 | min-height: 60px;
|
17847 | max-height: 60px;
|
17848 | border-bottom: 1px solid var(--light-border-color);
|
17849 | overflow: hidden;
|
17850 | }
|
17851 |
|
17852 | .dialog-box-header button {
|
17853 | font-size: 1.5rem;
|
17854 | font-weight: 700;
|
17855 | line-height: 1;
|
17856 | color: var(--fg);
|
17857 | border: none;
|
17858 | outline: none;
|
17859 | background-color: transparent;
|
17860 | cursor:pointer;
|
17861 | border: 1px solid transparent;
|
17862 | border-radius: 50%;
|
17863 | margin-right: -8px;
|
17864 | }
|
17865 | .dialog-box-header button:hover {
|
17866 | border-color: var(--primary-color);
|
17867 | }
|
17868 |
|
17869 | .dialog-box-content {
|
17870 | padding: 16px;
|
17871 | display:block;
|
17872 | overflow: auto;
|
17873 | height: 100%;
|
17874 | }
|
17875 |
|
17876 | .dialog-box-title {
|
17877 | flex-grow: 1;
|
17878 | font-size:24px;
|
17879 | }
|
17880 | `);
|
17881 | ;
|
17882 |
|
17883 |
|
17884 | class DialogBox extends lit_element_s {
|
17885 | static get properties() {
|
17886 | return {
|
17887 | heading: {
|
17888 | type: String,
|
17889 | attribute: 'heading'
|
17890 | },
|
17891 | show: {
|
17892 | type: String,
|
17893 | attribute: 'show'
|
17894 | }
|
17895 | };
|
17896 | }
|
17897 | static get styles() {
|
17898 | return [dialog_box_styles];
|
17899 | }
|
17900 | connectedCallback() {
|
17901 | super.connectedCallback();
|
17902 | document.addEventListener('keydown', e => {
|
17903 | if (e.code === 'Escape') {
|
17904 | this.onClose();
|
17905 | }
|
17906 | });
|
17907 | }
|
17908 | attributeChangedCallback(name, oldVal, newVal) {
|
17909 | if (oldVal !== newVal) {
|
17910 | if (name === 'heading') {
|
17911 | this.heading = newVal;
|
17912 | }
|
17913 | if (name === 'show') {
|
17914 | this.show = newVal;
|
17915 | if (newVal === 'true') {
|
17916 | document.dispatchEvent(new CustomEvent('open', {
|
17917 | bubbles: true,
|
17918 | composed: true,
|
17919 | detail: this
|
17920 | }));
|
17921 | }
|
17922 | }
|
17923 | }
|
17924 | super.attributeChangedCallback(name, oldVal, newVal);
|
17925 | }
|
17926 |
|
17927 |
|
17928 | render() {
|
17929 | return y`
|
17930 | ${this.show === 'true' ? y`
|
17931 | <div class="dialog-box-overlay">
|
17932 | <div class="dialog-box">
|
17933 | <header class="dialog-box-header">
|
17934 | <span class="dialog-box-title">${this.heading}</span>
|
17935 | <button type="button" @click="${this.onClose}">×</button>
|
17936 | </header>
|
17937 | <div class="dialog-box-content">
|
17938 | <slot></slot>
|
17939 | </div>
|
17940 | </div>
|
17941 | </div>` : ''}`;
|
17942 | }
|
17943 |
|
17944 |
|
17945 | onClose() {
|
17946 | document.dispatchEvent(new CustomEvent('close', {
|
17947 | bubbles: true,
|
17948 | composed: true
|
17949 | }));
|
17950 | }
|
17951 | }
|
17952 | customElements.define('dialog-box', DialogBox);
|
17953 | ;
|
17954 |
|
17955 |
|
17956 |
|
17957 |
|
17958 | function searchByPropertiesModalTemplate() {
|
17959 | var _this$advancedSearchM;
|
17960 | document.addEventListener('close', () => {
|
17961 | this.showAdvancedSearchDialog = false;
|
17962 | });
|
17963 | document.addEventListener('open', this.onOpenSearchDialog);
|
17964 | return y`
|
17965 | <dialog-box
|
17966 | heading="Search"
|
17967 | show="${!!this.showAdvancedSearchDialog}"
|
17968 | >
|
17969 | <span class="advanced-search-options">
|
17970 | <input
|
17971 | style="width:100%; padding-right:20px;"
|
17972 | type="text"
|
17973 | part="textbox textbox-search-dialog"
|
17974 | placeholder="search text..."
|
17975 | spellcheck="false"
|
17976 | @keyup = "${e => this.onAdvancedSearch(e, 400)}"
|
17977 | >
|
17978 | <div style="display:flex; margin:8px 0 24px;">
|
17979 | <div>
|
17980 | <input style="cursor:pointer;" type="checkbox" part="checkbox checkbox-search-dialog" id="search-api-path" checked @change = "${e => this.onAdvancedSearch(e, 0)}">
|
17981 | <label for="search-api-path" style="cursor:pointer;"> API Path </label>
|
17982 | </div>
|
17983 | <div style="margin-left: 16px;">
|
17984 | <input style="cursor:pointer;" type="checkbox" part="checkbox checkbox-search-dialog" id="search-api-descr" checked @change = "${e => this.onAdvancedSearch(e, 0)}">
|
17985 | <label style="cursor:pointer;" for="search-api-descr"> API Description </label>
|
17986 | </div>
|
17987 | <div style="margin-left: 16px;">
|
17988 | <input style="cursor:pointer;" type="checkbox" part="checkbox checkbox-search-dialog" id="search-api-params" @change = "${e => this.onAdvancedSearch(e, 0)}">
|
17989 | <label style="cursor:pointer;" for="search-api-params"> API Parameters </label>
|
17990 | </div>
|
17991 | <div style="margin-left: 16px;">
|
17992 | <input style="cursor:pointer;" type="checkbox" part="checkbox checkbox-search-dialog" id="search-api-request-body" @change = "${e => this.onAdvancedSearch(e, 0)}">
|
17993 | <label style="cursor:pointer;" for="search-api-request-body"> Request Body Parameters </label>
|
17994 | </div>
|
17995 | <div style="margin-left: 16px;">
|
17996 | <input style="cursor:pointer;" type="checkbox" part="checkbox checkbox-search-dialog" id="search-api-resp-descr" @change = "${e => this.onAdvancedSearch(e, 0)}">
|
17997 | <label style="cursor:pointer;" for="search-api-resp-descr"> Response Description </label>
|
17998 | </div>
|
17999 | </div>
|
18000 | </span>
|
18001 |
|
18002 | ${(_this$advancedSearchM = this.advancedSearchMatches) === null || _this$advancedSearchM === void 0 ? void 0 : _this$advancedSearchM.map(path => y`
|
18003 | <div
|
18004 | class="mono-font small-font-size hover-bg"
|
18005 | style='padding: 5px; cursor: pointer; border-bottom: 1px solid var(--light-border-color); ${path.deprecated ? 'filter:opacity(0.5);' : ''}'
|
18006 | data-content-id='${path.elementId}'
|
18007 | tabindex = '0'
|
18008 | @click="${e => {
|
18009 | this.matchPaths = ''; // clear quick filter if applied
|
18010 | this.showAdvancedSearchDialog = false; // Hide Search Dialog
|
18011 | this.requestUpdate();
|
18012 | this.scrollToEventTarget(e, true);
|
18013 | }}"
|
18014 | >
|
18015 | <span class="upper bold-text method-fg ${path.method}">${path.method}</span>
|
18016 | <span>${path.path}</span>
|
18017 | <span class="regular-font gray-text">${path.summary}</span>
|
18018 | </div>
|
18019 | `)}
|
18020 | </dialog-box>
|
18021 | `;
|
18022 | }
|
18023 |
|
18024 | ;
|
18025 | const color_utils = ({
|
18026 | color: {
|
18027 | inputReverseFg: '#fff',
|
18028 | inputReverseBg: '#333',
|
18029 | headerBg: '#444',
|
18030 | getRgb(hex) {
|
18031 | if (hex.indexOf('#') === 0) {
|
18032 | hex = hex.slice(1, 7);
|
18033 | }
|
18034 |
|
18035 | if (hex.length === 3 || hex.length === 4) {
|
18036 | hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
18037 | }
|
18038 | if (hex.length !== 6) {
|
18039 | throw new Error('Invalid HEX color.');
|
18040 | }
|
18041 | return {
|
18042 | r: parseInt(hex.slice(0, 2), 16),
|
18043 | g: parseInt(hex.slice(2, 4), 16),
|
18044 | b: parseInt(hex.slice(4, 6), 16)
|
18045 | };
|
18046 | },
|
18047 | luminanace(hexColorCode) {
|
18048 | const rgb = this.getRgb(hexColorCode);
|
18049 | return rgb.r * 0.299 + rgb.g * 0.587 + rgb.b * 0.114;
|
18050 | },
|
18051 | invert(hexColorCode) {
|
18052 | return this.luminanace(hexColorCode) > 135 ? '#000' : '#fff';
|
18053 | },
|
18054 |
|
18055 | opacity(hex, opacity) {
|
18056 | const rgb = this.getRgb(hex);
|
18057 | return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${opacity})`;
|
18058 | },
|
18059 | brightness(hex, amt) {
|
18060 | const rgb = this.getRgb(hex);
|
18061 | rgb.r += amt;
|
18062 | rgb.g += amt;
|
18063 | rgb.b += amt;
|
18064 | if (rgb.r > 255) rgb.r = 255;else if (rgb.r < 0) rgb.r = 0;
|
18065 | if (rgb.g > 255) rgb.g = 255;else if (rgb.g < 0) rgb.g = 0;
|
18066 | if (rgb.b > 255) rgb.b = 255;else if (rgb.b < 0) rgb.b = 0;
|
18067 | return `#${rgb.r.toString(16).padStart(2, '0')}${rgb.g.toString(16).padStart(2, '0')}${rgb.b.toString(16).padStart(2, '0')}`;
|
18068 | },
|
18069 | hasGoodContrast(hexColorCode1, hexColorCode2) {
|
18070 | const lum1 = this.luminanace(hexColorCode1);
|
18071 | const lum2 = this.luminanace(hexColorCode2);
|
18072 | return lum1 - lum2;
|
18073 | }
|
18074 | }
|
18075 | });
|
18076 | function isValidHexColor(colorCode) {
|
18077 | return /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/i.test(colorCode);
|
18078 | }
|
18079 | ;
|
18080 |
|
18081 |
|
18082 |
|
18083 | function setTheme(baseTheme, theme = {}) {
|
18084 | let newTheme = {};
|
18085 |
|
18086 |
|
18087 | const primaryColor = theme.primaryColor ? theme.primaryColor : baseTheme === 'dark' ? '#f76b39' : '#ff591e';
|
18088 | const primaryColorInvert = color_utils.color.invert(primaryColor);
|
18089 | const primaryColorTrans = color_utils.color.opacity(primaryColor, '0.4');
|
18090 |
|
18091 |
|
18092 | if (baseTheme === 'dark') {
|
18093 | const bg1 = theme.bg1 ? theme.bg1 : '#2a2b2c';
|
18094 | const fg1 = theme.fg1 ? theme.fg1 : '#bbb';
|
18095 | const bg2 = theme.bg2 ? theme.bg2 : color_utils.color.brightness(bg1, 5);
|
18096 | const bg3 = theme.bg3 ? theme.bg3 : color_utils.color.brightness(bg1, 17);
|
18097 | const lightBg = theme.bg3 ? theme.bg3 : color_utils.color.brightness(bg1, 35);
|
18098 | const fg2 = theme.fg2 ? theme.fg2 : color_utils.color.brightness(fg1, -15);
|
18099 | const fg3 = theme.fg3 ? theme.fg3 : color_utils.color.brightness(fg1, -20);
|
18100 | const lightFg = theme.fg3 ? theme.fg3 : color_utils.color.brightness(fg1, -65);
|
18101 | const inlineCodeFg = theme.inlineCodeFg ? theme.inlineCodeFg : '#aaa';
|
18102 | const selectionBg = '#bbb';
|
18103 | const selectionFg = '#eee';
|
18104 | const headerColor = theme.headerColor ? theme.headerColor : color_utils.color.brightness(bg1, 10);
|
18105 | const navBgColor = theme.navBgColor ? theme.navBgColor : color_utils.color.brightness(bg1, 10);
|
18106 | const navTextColor = theme.navTextColor ? theme.navTextColor : color_utils.color.opacity(color_utils.color.invert(navBgColor), '0.50');
|
18107 | const navHoverBgColor = theme.navHoverBgColor ? theme.navHoverBgColor : color_utils.color.brightness(navBgColor, -15);
|
18108 | const navHoverTextColor = theme.navHoverTextColor ? theme.navHoverTextColor : color_utils.color.invert(navBgColor);
|
18109 | const navAccentColor = theme.navAccentColor ? theme.navAccentColor : color_utils.color.brightness(primaryColor, 25);
|
18110 | const navAccentTextColor = theme.navAccentTextColor ? theme.navAccenttextColor : color_utils.color.invert(navAccentColor);
|
18111 | const overlayBg = 'rgba(80, 80, 80, 0.4)';
|
18112 | newTheme = {
|
18113 | bg1,
|
18114 | bg2,
|
18115 | bg3,
|
18116 | lightBg,
|
18117 | fg1,
|
18118 | fg2,
|
18119 | fg3,
|
18120 | lightFg,
|
18121 | inlineCodeFg,
|
18122 | primaryColor,
|
18123 | primaryColorTrans,
|
18124 | primaryColorInvert,
|
18125 | selectionBg,
|
18126 | selectionFg,
|
18127 | overlayBg,
|
18128 | navBgColor,
|
18129 | navTextColor,
|
18130 | navHoverBgColor,
|
18131 | navHoverTextColor,
|
18132 | navAccentColor,
|
18133 | navAccentTextColor,
|
18134 | headerColor,
|
18135 | headerColorInvert: color_utils.color.invert(headerColor),
|
18136 | headerColorDarker: color_utils.color.brightness(headerColor, -20),
|
18137 | headerColorBorder: color_utils.color.brightness(headerColor, 10),
|
18138 | borderColor: theme.borderColor || color_utils.color.brightness(bg1, 20),
|
18139 |
|
18140 | lightBorderColor: theme.lightBorderColor || color_utils.color.brightness(bg1, 15),
|
18141 |
|
18142 | codeBorderColor: theme.codeBorderColor || color_utils.color.brightness(bg1, 30),
|
18143 | inputBg: theme.inputBg || color_utils.color.brightness(bg1, -5),
|
18144 |
|
18145 | placeHolder: theme.placeHolder || color_utils.color.opacity(fg1, '0.3'),
|
18146 | hoverColor: theme.hoverColor || color_utils.color.brightness(bg1, -10),
|
18147 |
|
18148 |
|
18149 | red: theme.red ? theme.red : '#F06560',
|
18150 | lightRed: theme.lightRed ? theme.lightRed : color_utils.color.brightness(bg1, -10),
|
18151 |
|
18152 |
|
18153 | pink: theme.pink ? theme.pink : '#ffb2b2',
|
18154 | lightPink: theme.lightPink || color_utils.color.brightness(bg1, -10),
|
18155 | green: theme.green || '#7ec699',
|
18156 | lightGreen: theme.lightGreen || color_utils.color.brightness(bg1, -10),
|
18157 |
|
18158 |
|
18159 | blue: theme.blue || '#71b7ff',
|
18160 | lightBlue: theme.lightBlue || color_utils.color.brightness(bg1, -10),
|
18161 |
|
18162 |
|
18163 | orange: theme.orange ? theme.orange : '#f08d49',
|
18164 | lightOrange: theme.lightOrange || color_utils.color.brightness(bg1, -10),
|
18165 |
|
18166 |
|
18167 | yellow: theme.yellow || '#827717',
|
18168 | lightYellow: theme.lightYellow || color_utils.color.brightness(bg1, -10),
|
18169 |
|
18170 |
|
18171 | purple: theme.purple || '#786FF1',
|
18172 | brown: theme.brown || '#D4AC0D',
|
18173 | codeBg: theme.codeBg || color_utils.color.opacity(color_utils.color.brightness(bg1, -15), 0.7),
|
18174 | codeFg: theme.codeFg || '#aaa',
|
18175 | codePropertyColor: theme.codePropertyColor || '#f8c555',
|
18176 | codeKeywordColor: theme.codeKeywordColor || '#cc99cd',
|
18177 | codeOperatorColor: theme.codeOperatorColor || '#67cdcc'
|
18178 | };
|
18179 | } else {
|
18180 | const bg1 = theme.bg1 ? theme.bg1 : '#fafbfc';
|
18181 | const fg1 = theme.fg1 ? theme.fg1 : '#444444';
|
18182 | const bg2 = theme.bg2 ? theme.bg2 : color_utils.color.brightness(bg1, -5);
|
18183 | const bg3 = theme.bg3 ? theme.bg3 : color_utils.color.brightness(bg1, -15);
|
18184 | const lightBg = theme.bg3 ? theme.bg3 : color_utils.color.brightness(bg1, -45);
|
18185 | const fg2 = theme.fg2 ? theme.fg2 : color_utils.color.brightness(fg1, 17);
|
18186 | const fg3 = theme.fg3 ? theme.fg3 : color_utils.color.brightness(fg1, 30);
|
18187 | const lightFg = theme.fg3 ? theme.fg3 : color_utils.color.brightness(fg1, 70);
|
18188 | const inlineCodeFg = theme.inlineCodeFg ? theme.inlineCodeFg : 'brown';
|
18189 | const selectionBg = '#444';
|
18190 | const selectionFg = '#eee';
|
18191 | const headerColor = theme.headerColor ? theme.headerColor : color_utils.color.brightness(bg1, -180);
|
18192 |
|
18193 | |
18194 |
|
18195 |
|
18196 |
|
18197 |
|
18198 |
|
18199 |
|
18200 | const navBgColor = theme.navBgColor ? theme.navBgColor : color_utils.color.brightness(bg1, -200);
|
18201 | const navTextColor = theme.navTextColor ? theme.navTextColor : color_utils.color.opacity(color_utils.color.invert(navBgColor), '0.65');
|
18202 | const navHoverBgColor = theme.navHoverBgColor ? theme.navHoverBgColor : color_utils.color.brightness(navBgColor, -15);
|
18203 | const navHoverTextColor = theme.navHoverTextColor ? theme.navHoverTextColor : color_utils.color.invert(navBgColor);
|
18204 | const navAccentColor = theme.navAccentColor ? theme.navAccentColor : color_utils.color.brightness(primaryColor, 25);
|
18205 | const navAccentTextColor = theme.navAccentTextColor ? theme.navAccenttextColor : color_utils.color.invert(navAccentColor);
|
18206 | const overlayBg = 'rgba(0, 0, 0, 0.4)';
|
18207 | newTheme = {
|
18208 | bg1,
|
18209 | bg2,
|
18210 | bg3,
|
18211 | lightBg,
|
18212 | fg1,
|
18213 | fg2,
|
18214 | fg3,
|
18215 | lightFg,
|
18216 | inlineCodeFg,
|
18217 | primaryColor,
|
18218 | primaryColorTrans,
|
18219 | primaryColorInvert,
|
18220 | selectionBg,
|
18221 | selectionFg,
|
18222 | overlayBg,
|
18223 | navBgColor,
|
18224 | navTextColor,
|
18225 | navHoverBgColor,
|
18226 | navHoverTextColor,
|
18227 | navAccentColor,
|
18228 | navAccentTextColor,
|
18229 | headerColor,
|
18230 | headerColorInvert: color_utils.color.invert(headerColor),
|
18231 | headerColorDarker: color_utils.color.brightness(headerColor, -20),
|
18232 | headerColorBorder: color_utils.color.brightness(headerColor, 10),
|
18233 | borderColor: theme.borderColor || color_utils.color.brightness(bg1, -38),
|
18234 | lightBorderColor: theme.lightBorderColor || color_utils.color.brightness(bg1, -23),
|
18235 | codeBorderColor: theme.codeBorderColor || 'transparent',
|
18236 | inputBg: theme.inputBg || color_utils.color.brightness(bg1, 10),
|
18237 |
|
18238 | placeHolder: theme.placeHolder || color_utils.color.brightness(lightFg, 20),
|
18239 |
|
18240 | hoverColor: theme.hoverColor || color_utils.color.brightness(bg1, -5),
|
18241 |
|
18242 |
|
18243 | red: theme.red || '#F06560',
|
18244 | lightRed: theme.lightRed || '#fff0f0',
|
18245 | pink: theme.pink ? theme.pink : '#990055',
|
18246 | lightPink: theme.lightPink ? theme.lightPink : '#ffb2b2',
|
18247 | green: theme.green || '#690',
|
18248 | lightGreen: theme.lightGreen || '#fbfff0',
|
18249 | blue: theme.blue || '#47AFE8',
|
18250 | lightBlue: theme.lightBlue || '#eff8fd',
|
18251 | orange: theme.orange || '#FF9900',
|
18252 | lightOrange: theme.lightOrange || '#fff5e6',
|
18253 | yellow: theme.yellow || '#827717',
|
18254 | lightYellow: theme.lightYellow || '#fff5cc',
|
18255 | purple: theme.purple || '#786FF1',
|
18256 | brown: theme.brown || '#D4AC0D',
|
18257 | codeBg: theme.codeBg || color_utils.color.opacity(color_utils.color.brightness(bg1, -15), 0.7),
|
18258 | codeFg: theme.codeFg || '#666',
|
18259 | codePropertyColor: theme.codePropertyColor || '#905',
|
18260 | codeKeywordColor: theme.codeKeywordColor || '#07a',
|
18261 | codeOperatorColor: theme.codeOperatorColor || '#9a6e3a'
|
18262 | };
|
18263 | }
|
18264 | return y`
|
18265 | <style>
|
18266 | *, *:before, *:after { box-sizing: border-box; }
|
18267 |
|
18268 | :host {
|
18269 | /* Common Styles - irrespective of themes */
|
18270 | --border-radius: 2px;
|
18271 | --layout: ${this.layout || 'row'};
|
18272 | --font-mono: ${this.monoFont || 'Monaco, "Andale Mono", "Roboto Mono", Consolas, monospace'};
|
18273 | --font-regular: ${this.regularFont || '"Open Sans", Avenir, "Segoe UI", Arial, sans-serif'};
|
18274 | --scroll-bar-width: 8px;
|
18275 | --nav-item-padding: ${this.navItemSpacing === 'relaxed' ? '10px 16px 10px 10px' : this.navItemSpacing === 'compact' ? '5px 16px 5px 10px' : '7px 16px 7px 10px'};
|
18276 |
|
18277 | --resp-area-height: ${this.responseAreaHeight};
|
18278 | --font-size-small: ${this.fontSize === 'default' ? '12px' : this.fontSize === 'large' ? '13px' : '14px'};
|
18279 | --font-size-mono: ${this.fontSize === 'default' ? '13px' : this.fontSize === 'large' ? '14px' : '15px'};
|
18280 | --font-size-regular: ${this.fontSize === 'default' ? '14px' : this.fontSize === 'large' ? '15px' : '16px'};
|
18281 | --dialog-z-index: 1000;
|
18282 |
|
18283 | --focus-shadow: 0 0 0 1px transparent, 0 0 0 3px ${newTheme.primaryColorTrans};
|
18284 |
|
18285 | /* Theme specific styles */
|
18286 | --bg:${newTheme.bg1};
|
18287 | --bg2:${newTheme.bg2};
|
18288 | --bg3:${newTheme.bg3};
|
18289 | --light-bg:${newTheme.lightBg};
|
18290 | --fg:${newTheme.fg1};
|
18291 | --fg2:${newTheme.fg2};
|
18292 | --fg3:${newTheme.fg3};
|
18293 | --light-fg:${newTheme.lightFg};
|
18294 | --selection-bg:${newTheme.selectionBg};
|
18295 | --selection-fg:${newTheme.selectionFg};
|
18296 | --overlay-bg:${newTheme.overlayBg};
|
18297 |
|
18298 | /* Border Colors */
|
18299 | --border-color:${newTheme.borderColor};
|
18300 | --light-border-color:${newTheme.lightBorderColor};
|
18301 | --code-border-color:${newTheme.codeBorderColor};
|
18302 |
|
18303 | --input-bg:${newTheme.inputBg};
|
18304 | --placeholder-color:${newTheme.placeHolder};
|
18305 | --hover-color:${newTheme.hoverColor};
|
18306 | --red:${newTheme.red};
|
18307 | --light-red:${newTheme.lightRed};
|
18308 | --pink:${newTheme.pink};
|
18309 | --light-pink:${newTheme.lightPink};
|
18310 | --green:${newTheme.green};
|
18311 | --light-green:${newTheme.lightGreen};
|
18312 | --blue:${newTheme.blue};
|
18313 | --light-blue:${newTheme.lightBlue};
|
18314 | --orange:${newTheme.orange};
|
18315 | --light-orange:${newTheme.lightOrange};
|
18316 | --yellow:${newTheme.yellow};
|
18317 | --light-yellow:${newTheme.lightYellow};
|
18318 | --purple:${newTheme.purple};
|
18319 | --brown:${newTheme.brown};
|
18320 |
|
18321 | /* Header Color */
|
18322 | --header-bg:${newTheme.headerColor};
|
18323 | --header-fg:${newTheme.headerColorInvert};
|
18324 | --header-color-darker:${newTheme.headerColorDarker};
|
18325 | --header-color-border:${newTheme.headerColorBorder};
|
18326 |
|
18327 | /* Nav Colors */
|
18328 | --nav-bg-color:${newTheme.navBgColor};
|
18329 | --nav-text-color:${newTheme.navTextColor};
|
18330 | --nav-hover-bg-color:${newTheme.navHoverBgColor};
|
18331 | --nav-hover-text-color:${newTheme.navHoverTextColor};
|
18332 | --nav-accent-color:${newTheme.navAccentColor};
|
18333 | --nav-accent-text-color:${newTheme.navAccentTextColor};
|
18334 |
|
18335 | /* Nav API Method Colors*/
|
18336 | --nav-get-color:${newTheme.blue};
|
18337 | --nav-put-color:${newTheme.orange};
|
18338 | --nav-post-color:${newTheme.green};
|
18339 | --nav-delete-color:${newTheme.red};
|
18340 | --nav-head-color:${newTheme.yellow};
|
18341 |
|
18342 | /* Primary Colors */
|
18343 | --primary-color:${newTheme.primaryColor};
|
18344 | --primary-color-invert:${newTheme.primaryColorInvert};
|
18345 | --primary-color-trans:${newTheme.primaryColorTrans};
|
18346 |
|
18347 | /*Code Syntax Color*/
|
18348 | --code-bg:${newTheme.codeBg};
|
18349 | --code-fg:${newTheme.codeFg};
|
18350 | --inline-code-fg:${newTheme.inlineCodeFg};
|
18351 | --code-property-color:${newTheme.codePropertyColor};
|
18352 | --code-keyword-color:${newTheme.codeKeywordColor};
|
18353 | --code-operator-color:${newTheme.codeOperatorColor};
|
18354 | }
|
18355 | </style>`;
|
18356 | }
|
18357 | ;
|
18358 |
|
18359 |
|
18360 |
|
18361 |
|
18362 |
|
18363 |
|
18364 |
|
18365 |
|
18366 |
|
18367 |
|
18368 |
|
18369 |
|
18370 |
|
18371 |
|
18372 | function mainBodyTemplate(isMini = false, showExpandCollapse = true, showTags = true, pathsExpanded = false) {
|
18373 | if (!this.resolvedSpec) {
|
18374 | return '';
|
18375 | }
|
18376 | if (this.persistAuth === 'true') {
|
18377 | recoverPersistedApiKeys.call(this);
|
18378 | }
|
18379 | const newTheme = {
|
18380 | bg1: isValidHexColor(this.bgColor) ? this.bgColor : '',
|
18381 | fg1: isValidHexColor(this.textColor) ? this.textColor : '',
|
18382 | headerColor: isValidHexColor(this.headerColor) ? this.headerColor : '',
|
18383 | primaryColor: isValidHexColor(this.primaryColor) ? this.primaryColor : '',
|
18384 | navBgColor: isValidHexColor(this.navBgColor) ? this.navBgColor : '',
|
18385 | navTextColor: isValidHexColor(this.navTextColor) ? this.navTextColor : '',
|
18386 | navHoverBgColor: isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',
|
18387 | navHoverTextColor: isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : '',
|
18388 | navAccentColor: isValidHexColor(this.navAccentColor) ? this.navAccentColor : '',
|
18389 | navAccentTextColor: isValidHexColor(this.navAccentTextColor) ? this.navAccentTextColor : ''
|
18390 | };
|
18391 |
|
18392 | if (this.resolvedSpec.specLoadError) {
|
18393 | if (isMini) {
|
18394 | return y`
|
18395 | ${this.theme === 'dark' ? setTheme.call(this, 'dark', newTheme) : setTheme.call(this, 'light', newTheme)}
|
18396 | <div style='display:flex; align-items:center; border:1px dashed var(--border-color); height:42px; padding:5px; font-size:var(--font-size-small); color:var(--red); font-family:var(--font-mono)'> ${this.resolvedSpec.info.description} </div>
|
18397 | `;
|
18398 | }
|
18399 | return y`
|
18400 | ${this.theme === 'dark' ? setTheme.call(this, 'dark', newTheme) : setTheme.call(this, 'light', newTheme)}
|
18401 | <!-- Header -->
|
18402 | ${headerTemplate.call(this)}
|
18403 | <main class='main-content regular-font' part='section-main-content'>
|
18404 | <slot></slot>
|
18405 | <div style='margin:24px; text-align: center;'>
|
18406 | <h1 style='color: var(--red)'> ${this.resolvedSpec.info.title} </h1>
|
18407 | <div style='font-family:var(--font-mono)'> ${this.resolvedSpec.info.description} </div>
|
18408 | </div>
|
18409 | </main>
|
18410 | `;
|
18411 | }
|
18412 | if (this.resolvedSpec.isSpecLoading) {
|
18413 | return y`
|
18414 | ${this.theme === 'dark' ? setTheme.call(this, 'dark', newTheme) : setTheme.call(this, 'light', newTheme)}
|
18415 | <main class='main-content regular-font' part='section-main-content'>
|
18416 | <slot></slot>
|
18417 | <div class='main-content-inner--${this.renderStyle}-mode'>
|
18418 | <div class='loader'></div>
|
18419 | </div>
|
18420 | </main>
|
18421 | `;
|
18422 | }
|
18423 | return y`
|
18424 | ${this.theme === 'dark' ? setTheme.call(this, 'dark', newTheme) : setTheme.call(this, 'light', newTheme)}
|
18425 |
|
18426 | <!-- Header -->
|
18427 | ${this.showHeader === 'false' ? '' : headerTemplate.call(this)}
|
18428 |
|
18429 | <!-- Advanced Search -->
|
18430 | ${this.allowAdvancedSearch === 'false' ? '' : searchByPropertiesModalTemplate.call(this)}
|
18431 |
|
18432 | <div id='the-main-body' class='body ${this.cssClasses}' dir='${this.pageDirection}' >
|
18433 | <!-- Side Nav -->
|
18434 | ${(this.renderStyle === 'read' || this.renderStyle === 'focused') && this.showSideNav === 'true' && this.resolvedSpec ? navbarTemplate.call(this) : ''}
|
18435 |
|
18436 | <!-- Main Content -->
|
18437 | <main class='main-content regular-font' tabindex='-1' part='section-main-content'>
|
18438 | <slot></slot>
|
18439 | <div class='main-content-inner--${this.renderStyle}-mode'>
|
18440 | ${this.loading === true ? y`<div class='loader'></div>` : y`
|
18441 | ${this.loadFailed === true ? y`<div style='text-align: center;margin: 16px;'> Unable to load the Spec</div>` : y`
|
18442 | <div class='operations-root' @click='${e => {
|
18443 | this.handleHref(e);
|
18444 | }}'>
|
18445 | ${this.renderStyle === 'focused' ? y`${focusedEndpointTemplate.call(this)}` : y`
|
18446 | ${this.showInfo === 'true' ? overviewTemplate.call(this) : ''}
|
18447 | ${this.allowServerSelection === 'true' ? serverTemplate.call(this) : ''}
|
18448 | ${this.allowAuthentication === 'true' ? securitySchemeTemplate.call(this) : ''}
|
18449 | <div id='operations-top' class='observe-me'>
|
18450 | <slot name='operations-top'></slot>
|
18451 | </div>
|
18452 | ${this.renderStyle === 'read' ? expandedEndpointTemplate.call(this) : endpointTemplate.call(this, showExpandCollapse, showTags, pathsExpanded)}
|
18453 | `}
|
18454 | </div>
|
18455 | `}`}
|
18456 | </div>
|
18457 | <slot name='footer'></slot>
|
18458 | </main>
|
18459 | </div>
|
18460 | `;
|
18461 | }
|
18462 |
|
18463 | ;
|
18464 |
|
18465 |
|
18466 |
|
18467 |
|
18468 |
|
18469 |
|
18470 |
|
18471 |
|
18472 |
|
18473 |
|
18474 |
|
18475 |
|
18476 |
|
18477 |
|
18478 |
|
18479 |
|
18480 |
|
18481 |
|
18482 |
|
18483 |
|
18484 |
|
18485 |
|
18486 |
|
18487 |
|
18488 |
|
18489 |
|
18490 |
|
18491 |
|
18492 |
|
18493 |
|
18494 | class RapiDoc extends lit_element_s {
|
18495 | constructor() {
|
18496 | super();
|
18497 | const intersectionObserverOptions = {
|
18498 | root: this.getRootNode().host,
|
18499 | rootMargin: '-50px 0px -50px 0px',
|
18500 |
|
18501 | threshold: 0
|
18502 | };
|
18503 | this.showSummaryWhenCollapsed = true;
|
18504 |
|
18505 |
|
18506 | this.isIntersectionObserverActive = false;
|
18507 | this.intersectionObserver = new IntersectionObserver(entries => {
|
18508 | this.onIntersect(entries);
|
18509 | }, intersectionObserverOptions);
|
18510 | }
|
18511 | static get properties() {
|
18512 | return {
|
18513 |
|
18514 | headingText: {
|
18515 | type: String,
|
18516 | attribute: 'heading-text'
|
18517 | },
|
18518 | gotoPath: {
|
18519 | type: String,
|
18520 | attribute: 'goto-path'
|
18521 | },
|
18522 |
|
18523 | updateRoute: {
|
18524 | type: String,
|
18525 | attribute: 'update-route'
|
18526 | },
|
18527 | routePrefix: {
|
18528 | type: String,
|
18529 | attribute: 'route-prefix'
|
18530 | },
|
18531 | specUrl: {
|
18532 | type: String,
|
18533 | attribute: 'spec-url'
|
18534 | },
|
18535 | sortTags: {
|
18536 | type: String,
|
18537 | attribute: 'sort-tags'
|
18538 | },
|
18539 | generateMissingTags: {
|
18540 | type: String,
|
18541 | attribute: 'generate-missing-tags'
|
18542 | },
|
18543 | sortEndpointsBy: {
|
18544 | type: String,
|
18545 | attribute: 'sort-endpoints-by'
|
18546 | },
|
18547 | specFile: {
|
18548 | type: String,
|
18549 | attribute: false
|
18550 | },
|
18551 |
|
18552 | layout: {
|
18553 | type: String
|
18554 | },
|
18555 | renderStyle: {
|
18556 | type: String,
|
18557 | attribute: 'render-style'
|
18558 | },
|
18559 | defaultSchemaTab: {
|
18560 | type: String,
|
18561 | attribute: 'default-schema-tab'
|
18562 | },
|
18563 | responseAreaHeight: {
|
18564 | type: String,
|
18565 | attribute: 'response-area-height'
|
18566 | },
|
18567 | fillRequestFieldsWithExample: {
|
18568 | type: String,
|
18569 | attribute: 'fill-request-fields-with-example'
|
18570 | },
|
18571 | persistAuth: {
|
18572 | type: String,
|
18573 | attribute: 'persist-auth'
|
18574 | },
|
18575 | onNavTagClick: {
|
18576 | type: String,
|
18577 | attribute: 'on-nav-tag-click'
|
18578 | },
|
18579 |
|
18580 | schemaStyle: {
|
18581 | type: String,
|
18582 | attribute: 'schema-style'
|
18583 | },
|
18584 | schemaExpandLevel: {
|
18585 | type: Number,
|
18586 | attribute: 'schema-expand-level'
|
18587 | },
|
18588 | schemaDescriptionExpanded: {
|
18589 | type: String,
|
18590 | attribute: 'schema-description-expanded'
|
18591 | },
|
18592 | schemaHideReadOnly: {
|
18593 | type: String,
|
18594 | attribute: 'schema-hide-read-only'
|
18595 | },
|
18596 | schemaHideWriteOnly: {
|
18597 | type: String,
|
18598 | attribute: 'schema-hide-write-only'
|
18599 | },
|
18600 |
|
18601 | apiKeyName: {
|
18602 | type: String,
|
18603 | attribute: 'api-key-name'
|
18604 | },
|
18605 | apiKeyLocation: {
|
18606 | type: String,
|
18607 | attribute: 'api-key-location'
|
18608 | },
|
18609 | apiKeyValue: {
|
18610 | type: String,
|
18611 | attribute: 'api-key-value'
|
18612 | },
|
18613 | defaultApiServerUrl: {
|
18614 | type: String,
|
18615 | attribute: 'default-api-server'
|
18616 | },
|
18617 | serverUrl: {
|
18618 | type: String,
|
18619 | attribute: 'server-url'
|
18620 | },
|
18621 | oauthReceiver: {
|
18622 | type: String,
|
18623 | attribute: 'oauth-receiver'
|
18624 | },
|
18625 |
|
18626 | showHeader: {
|
18627 | type: String,
|
18628 | attribute: 'show-header'
|
18629 | },
|
18630 | showSideNav: {
|
18631 | type: String,
|
18632 | attribute: 'show-side-nav'
|
18633 | },
|
18634 | showInfo: {
|
18635 | type: String,
|
18636 | attribute: 'show-info'
|
18637 | },
|
18638 | allowAuthentication: {
|
18639 | type: String,
|
18640 | attribute: 'allow-authentication'
|
18641 | },
|
18642 | allowTry: {
|
18643 | type: String,
|
18644 | attribute: 'allow-try'
|
18645 | },
|
18646 | showCurlBeforeTry: {
|
18647 | type: String,
|
18648 | attribute: 'show-curl-before-try'
|
18649 | },
|
18650 | allowSpecUrlLoad: {
|
18651 | type: String,
|
18652 | attribute: 'allow-spec-url-load'
|
18653 | },
|
18654 | allowSpecFileLoad: {
|
18655 | type: String,
|
18656 | attribute: 'allow-spec-file-load'
|
18657 | },
|
18658 | allowSpecFileDownload: {
|
18659 | type: String,
|
18660 | attribute: 'allow-spec-file-download'
|
18661 | },
|
18662 | allowSearch: {
|
18663 | type: String,
|
18664 | attribute: 'allow-search'
|
18665 | },
|
18666 | allowAdvancedSearch: {
|
18667 | type: String,
|
18668 | attribute: 'allow-advanced-search'
|
18669 | },
|
18670 | allowServerSelection: {
|
18671 | type: String,
|
18672 | attribute: 'allow-server-selection'
|
18673 | },
|
18674 | allowSchemaDescriptionExpandToggle: {
|
18675 | type: String,
|
18676 | attribute: 'allow-schema-description-expand-toggle'
|
18677 | },
|
18678 | showComponents: {
|
18679 | type: String,
|
18680 | attribute: 'show-components'
|
18681 | },
|
18682 | pageDirection: {
|
18683 | type: String,
|
18684 | attribute: 'page-direction'
|
18685 | },
|
18686 |
|
18687 | theme: {
|
18688 | type: String
|
18689 | },
|
18690 | bgColor: {
|
18691 | type: String,
|
18692 | attribute: 'bg-color'
|
18693 | },
|
18694 | textColor: {
|
18695 | type: String,
|
18696 | attribute: 'text-color'
|
18697 | },
|
18698 | headerColor: {
|
18699 | type: String,
|
18700 | attribute: 'header-color'
|
18701 | },
|
18702 | primaryColor: {
|
18703 | type: String,
|
18704 | attribute: 'primary-color'
|
18705 | },
|
18706 | fontSize: {
|
18707 | type: String,
|
18708 | attribute: 'font-size'
|
18709 | },
|
18710 | regularFont: {
|
18711 | type: String,
|
18712 | attribute: 'regular-font'
|
18713 | },
|
18714 | monoFont: {
|
18715 | type: String,
|
18716 | attribute: 'mono-font'
|
18717 | },
|
18718 | loadFonts: {
|
18719 | type: String,
|
18720 | attribute: 'load-fonts'
|
18721 | },
|
18722 | cssFile: {
|
18723 | type: String,
|
18724 | attribute: 'css-file'
|
18725 | },
|
18726 | cssClasses: {
|
18727 | type: String,
|
18728 | attribute: 'css-classes'
|
18729 | },
|
18730 |
|
18731 | navBgColor: {
|
18732 | type: String,
|
18733 | attribute: 'nav-bg-color'
|
18734 | },
|
18735 | navTextColor: {
|
18736 | type: String,
|
18737 | attribute: 'nav-text-color'
|
18738 | },
|
18739 | navHoverBgColor: {
|
18740 | type: String,
|
18741 | attribute: 'nav-hover-bg-color'
|
18742 | },
|
18743 | navHoverTextColor: {
|
18744 | type: String,
|
18745 | attribute: 'nav-hover-text-color'
|
18746 | },
|
18747 | navAccentColor: {
|
18748 | type: String,
|
18749 | attribute: 'nav-accent-color'
|
18750 | },
|
18751 | navAccentTextColor: {
|
18752 | type: String,
|
18753 | attribute: 'nav-accent-text-color'
|
18754 | },
|
18755 | navActiveItemMarker: {
|
18756 | type: String,
|
18757 | attribute: 'nav-active-item-marker'
|
18758 | },
|
18759 | navItemSpacing: {
|
18760 | type: String,
|
18761 | attribute: 'nav-item-spacing'
|
18762 | },
|
18763 | showMethodInNavBar: {
|
18764 | type: String,
|
18765 | attribute: 'show-method-in-nav-bar'
|
18766 | },
|
18767 | usePathInNavBar: {
|
18768 | type: String,
|
18769 | attribute: 'use-path-in-nav-bar'
|
18770 | },
|
18771 | infoDescriptionHeadingsInNavBar: {
|
18772 | type: String,
|
18773 | attribute: 'info-description-headings-in-navbar'
|
18774 | },
|
18775 |
|
18776 | fetchCredentials: {
|
18777 | type: String,
|
18778 | attribute: 'fetch-credentials'
|
18779 | },
|
18780 |
|
18781 | matchPaths: {
|
18782 | type: String,
|
18783 | attribute: 'match-paths'
|
18784 | },
|
18785 | matchType: {
|
18786 | type: String,
|
18787 | attribute: 'match-type'
|
18788 | },
|
18789 |
|
18790 | loading: {
|
18791 | type: Boolean
|
18792 | },
|
18793 |
|
18794 | focusedElementId: {
|
18795 | type: String
|
18796 | },
|
18797 |
|
18798 | showAdvancedSearchDialog: {
|
18799 | type: Boolean
|
18800 | },
|
18801 | advancedSearchMatches: {
|
18802 | type: Object
|
18803 | }
|
18804 | };
|
18805 | }
|
18806 | static get styles() {
|
18807 | return [font_styles, input_styles, flex_styles, table_styles, endpoint_styles, prism_styles, tab_styles, nav_styles, info_styles, i`
|
18808 | :host {
|
18809 | display:flex;
|
18810 | flex-direction: column;
|
18811 | min-width:360px;
|
18812 | width:100%;
|
18813 | height:100%;
|
18814 | margin:0;
|
18815 | padding:0;
|
18816 | overflow: hidden;
|
18817 | letter-spacing:normal;
|
18818 | color:var(--fg);
|
18819 | background-color:var(--bg);
|
18820 | font-family:var(--font-regular);
|
18821 | }
|
18822 | :where(button, input[type="checkbox"], [tabindex="0"]):focus-visible { box-shadow: var(--focus-shadow); }
|
18823 | :where(input[type="text"], input[type="password"], select, textarea):focus-visible { border-color: var(--primary-color); }
|
18824 | .body {
|
18825 | display:flex;
|
18826 | height:100%;
|
18827 | width:100%;
|
18828 | overflow:hidden;
|
18829 | }
|
18830 | .main-content {
|
18831 | margin:0;
|
18832 | padding: 0;
|
18833 | display:block;
|
18834 | flex:1;
|
18835 | height:100%;
|
18836 | overflow-y: auto;
|
18837 | overflow-x: hidden;
|
18838 | scrollbar-width: thin;
|
18839 | scrollbar-color: var(--border-color) transparent;
|
18840 | }
|
18841 |
|
18842 | .main-content-inner--view-mode {
|
18843 | padding: 0 8px;
|
18844 | }
|
18845 | .main-content::-webkit-scrollbar {
|
18846 | width: 8px;
|
18847 | height: 8px;
|
18848 | }
|
18849 | .main-content::-webkit-scrollbar-track {
|
18850 | background:transparent;
|
18851 | }
|
18852 | .main-content::-webkit-scrollbar-thumb {
|
18853 | background-color: var(--border-color);
|
18854 | }
|
18855 |
|
18856 | .section-gap.section-tag {
|
18857 | border-bottom:1px solid var(--border-color);
|
18858 | }
|
18859 | .section-gap,
|
18860 | .section-gap--focused-mode,
|
18861 | .section-gap--read-mode {
|
18862 | padding: 0px 4px;
|
18863 | }
|
18864 | .section-tag-header {
|
18865 | position:relative;
|
18866 | cursor: n-resize;
|
18867 | padding: 12px 0;
|
18868 | }
|
18869 | .collapsed .section-tag-header:hover{
|
18870 | cursor: s-resize;
|
18871 | }
|
18872 |
|
18873 | .section-tag-header:hover{
|
18874 | background-image: linear-gradient(to right, rgba(0,0,0,0), var(--border-color), rgba(0,0,0,0));
|
18875 | }
|
18876 |
|
18877 | .section-tag-header:hover::after {
|
18878 | position:absolute;
|
18879 | margin-left:-24px;
|
18880 | font-size:20px;
|
18881 | top: calc(50% - 14px);
|
18882 | color:var(--primary-color);
|
18883 | content: '⬆';
|
18884 | }
|
18885 |
|
18886 | .collapsed .section-tag-header::after {
|
18887 | position:absolute;
|
18888 | margin-left:-24px;
|
18889 | font-size:20px;
|
18890 | top: calc(50% - 14px);
|
18891 | color: var(--border-color);
|
18892 | content: '⬇';
|
18893 | }
|
18894 | .collapsed .section-tag-header:hover::after {
|
18895 | color:var(--primary-color);
|
18896 | }
|
18897 |
|
18898 | .collapsed .section-tag-body {
|
18899 | display:none;
|
18900 | }
|
18901 |
|
18902 | .logo {
|
18903 | height:36px;
|
18904 | width:36px;
|
18905 | margin-left:5px;
|
18906 | }
|
18907 | .only-large-screen-flex,
|
18908 | .only-large-screen{
|
18909 | display:none;
|
18910 | }
|
18911 | .tag.title {
|
18912 | text-transform: uppercase;
|
18913 | }
|
18914 | .main-header {
|
18915 | background-color:var(--header-bg);
|
18916 | color:var(--header-fg);
|
18917 | width:100%;
|
18918 | }
|
18919 | .header-title {
|
18920 | font-size:calc(var(--font-size-regular) + 8px);
|
18921 | padding:0 8px;
|
18922 | }
|
18923 | input.header-input{
|
18924 | background:var(--header-color-darker);
|
18925 | color:var(--header-fg);
|
18926 | border:1px solid var(--header-color-border);
|
18927 | flex:1;
|
18928 | padding-right:24px;
|
18929 | border-radius:3px;
|
18930 | }
|
18931 | input.header-input::placeholder {
|
18932 | opacity:0.4;
|
18933 | }
|
18934 | .loader {
|
18935 | margin: 16px auto 16px auto;
|
18936 | border: 4px solid var(--bg3);
|
18937 | border-radius: 50%;
|
18938 | border-top: 4px solid var(--primary-color);
|
18939 | width: 36px;
|
18940 | height: 36px;
|
18941 | animation: spin 2s linear infinite;
|
18942 | }
|
18943 | .expanded-endpoint-body {
|
18944 | position: relative;
|
18945 | padding: 6px 0px;
|
18946 | }
|
18947 | .expanded-endpoint-body .tag-description {
|
18948 | background: var(--code-bg);
|
18949 | border-radius: var(--border-radius);
|
18950 | transition: max-height .2s ease-out;
|
18951 | }
|
18952 | .expanded-endpoint-body .tag-icon {
|
18953 | transition: transform .2s ease-out;
|
18954 | }
|
18955 | .expanded-endpoint-body .tag-icon.expanded {
|
18956 | transform: rotate(180deg);
|
18957 | }
|
18958 | .divider {
|
18959 | border-top: 2px solid var(--border-color);
|
18960 | margin: 24px 0;
|
18961 | width:100%;
|
18962 | }
|
18963 |
|
18964 | .tooltip {
|
18965 | cursor:pointer;
|
18966 | border: 1px solid var(--border-color);
|
18967 | border-left-width: 4px;
|
18968 | margin-left:2px;
|
18969 | }
|
18970 | .tooltip a {
|
18971 | color: var(--fg2);
|
18972 | text-decoration: none;
|
18973 | }
|
18974 | .tooltip-text {
|
18975 | color: var(--fg2);
|
18976 | max-width: 400px;
|
18977 | position: absolute;
|
18978 | z-index:1;
|
18979 | background-color: var(--bg2);
|
18980 | visibility: hidden;
|
18981 |
|
18982 | overflow-wrap: break-word;
|
18983 | }
|
18984 | .tooltip:hover {
|
18985 | color: var(--primary-color);
|
18986 | border-color: var(--primary-color);
|
18987 | }
|
18988 | .tooltip:hover a:hover {
|
18989 | color: var(--primary-color);
|
18990 | }
|
18991 |
|
18992 | .tooltip:hover .tooltip-text {
|
18993 | visibility: visible;
|
18994 | }
|
18995 |
|
18996 | @keyframes spin {
|
18997 | 0% { transform: rotate(0deg); }
|
18998 | 100% { transform: rotate(360deg); }
|
18999 | }
|
19000 |
|
19001 | .nav-method { font-weight: bold; margin-right: 4px; font-size: calc(var(--font-size-small) - 2px); white-space: nowrap; }
|
19002 | .nav-method.false { display: none; }
|
19003 |
|
19004 | .nav-method.as-colored-text.get { color:var(--nav-get-color); }
|
19005 | .nav-method.as-colored-text.put { color:var(--nav-put-color); }
|
19006 | .nav-method.as-colored-text.post { color:var(--nav-post-color); }
|
19007 | .nav-method.as-colored-text.delete { color:var(--nav-delete-color); }
|
19008 | .nav-method.as-colored-text.head, .nav-method.as-colored-text.patch, .nav-method.as-colored-text.options { color:var(--nav-head-color); }
|
19009 |
|
19010 | .nav-method.as-colored-block {
|
19011 | padding: 1px 4px;
|
19012 | min-width: 30px;
|
19013 | border-radius: 4px 0 0 4px;
|
19014 | color: #000;
|
19015 | }
|
19016 | .colored-block .nav-method.as-colored-block {
|
19017 | outline: 1px solid;
|
19018 | }
|
19019 |
|
19020 | .nav-method.as-colored-block.get { background-color: var(--blue); }
|
19021 | .nav-method.as-colored-block.put { background-color: var(--orange); }
|
19022 | .nav-method.as-colored-block.post { background-color: var(--green); }
|
19023 | .nav-method.as-colored-block.delete { background-color: var(--red); }
|
19024 | .nav-method.as-colored-block.head, .nav-method.as-colored-block.patch , .nav-method.as-colored-block.options {
|
19025 | background-color: var(--yellow);
|
19026 | }
|
19027 |
|
19028 | @media only screen and (min-width: 768px) {
|
19029 | .nav-bar {
|
19030 | width: 260px;
|
19031 | display:flex;
|
19032 | }
|
19033 | .only-large-screen{
|
19034 | display:block;
|
19035 | }
|
19036 | .only-large-screen-flex{
|
19037 | display:flex;
|
19038 | }
|
19039 | .section-gap {
|
19040 | padding: 0 0 0 24px;
|
19041 | }
|
19042 | .section-gap--focused-mode {
|
19043 | padding: 24px 8px;
|
19044 | }
|
19045 | .section-gap--read-mode {
|
19046 | padding: 24px 8px;
|
19047 | }
|
19048 | .endpoint-body {
|
19049 | position: relative;
|
19050 | padding:36px 0 48px 0;
|
19051 | }
|
19052 | }
|
19053 |
|
19054 | @media only screen and (min-width: 1024px) {
|
19055 | .nav-bar {
|
19056 | width: ${r(this.fontSize === 'default' ? '300px' : this.fontSize === 'large' ? '315px' : '330px')};
|
19057 | display:flex;
|
19058 | }
|
19059 | .section-gap--focused-mode {
|
19060 | padding: 12px 80px 12px 80px;
|
19061 | }
|
19062 | .section-gap--read-mode {
|
19063 | padding: 24px 80px 12px 80px;
|
19064 | }
|
19065 | }`, custom_styles];
|
19066 | }
|
19067 |
|
19068 |
|
19069 | connectedCallback() {
|
19070 | super.connectedCallback();
|
19071 | const parent = this.parentElement;
|
19072 | if (parent) {
|
19073 | if (parent.offsetWidth === 0 && parent.style.width === '') {
|
19074 | parent.style.width = '100vw';
|
19075 | }
|
19076 | if (parent.offsetHeight === 0 && parent.style.height === '') {
|
19077 | parent.style.height = '100vh';
|
19078 | }
|
19079 | if (parent.tagName === 'BODY') {
|
19080 | if (!parent.style.marginTop) {
|
19081 | parent.style.marginTop = '0';
|
19082 | }
|
19083 | if (!parent.style.marginRight) {
|
19084 | parent.style.marginRight = '0';
|
19085 | }
|
19086 | if (!parent.style.marginBottom) {
|
19087 | parent.style.marginBottom = '0';
|
19088 | }
|
19089 | if (!parent.style.marginLeft) {
|
19090 | parent.style.marginLeft = '0';
|
19091 | }
|
19092 | }
|
19093 | }
|
19094 | if (this.loadFonts !== 'false') {
|
19095 | const fontDescriptor = {
|
19096 | family: 'Open Sans',
|
19097 | style: 'normal',
|
19098 | weight: '300',
|
19099 | 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'
|
19100 | };
|
19101 | const fontWeight300 = new FontFace('Open Sans', "url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UN_r8OUuhpKKSTjw.woff2) format('woff2')", fontDescriptor);
|
19102 | fontDescriptor.weight = '600';
|
19103 | const fontWeight600 = new FontFace('Open Sans', "url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UNirkOUuhpKKSTjw.woff2) format('woff2')", fontDescriptor);
|
19104 | fontWeight300.load().then(font => {
|
19105 | document.fonts.add(font);
|
19106 | });
|
19107 | fontWeight600.load().then(font => {
|
19108 | document.fonts.add(font);
|
19109 | });
|
19110 | }
|
19111 | if (!this.layout || !'row, column,'.includes(`${this.layout},`)) {
|
19112 | this.layout = 'row';
|
19113 | }
|
19114 | if (!this.renderStyle || !'read, view, focused,'.includes(`${this.renderStyle},`)) {
|
19115 | this.renderStyle = 'focused';
|
19116 | }
|
19117 | if (!this.schemaStyle || !'tree, table,'.includes(`${this.schemaStyle},`)) {
|
19118 | this.schemaStyle = 'tree';
|
19119 | }
|
19120 | if (!this.theme || !'light, dark,'.includes(`${this.theme},`)) {
|
19121 | this.theme = window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
|
19122 | }
|
19123 | if (!this.defaultSchemaTab || !'example, schema, model,'.includes(`${this.defaultSchemaTab},`)) {
|
19124 | this.defaultSchemaTab = 'example';
|
19125 | } else if (this.defaultSchemaTab === 'model') {
|
19126 | this.defaultSchemaTab = 'schema';
|
19127 | }
|
19128 | if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) {
|
19129 | this.schemaExpandLevel = 99999;
|
19130 | }
|
19131 | if (!this.schemaDescriptionExpanded || !'true, false,'.includes(`${this.schemaDescriptionExpanded},`)) {
|
19132 | this.schemaDescriptionExpanded = 'false';
|
19133 | }
|
19134 | if (!this.schemaHideReadOnly || !'default, never,'.includes(`${this.schemaHideReadOnly},`)) {
|
19135 | this.schemaHideReadOnly = 'default';
|
19136 | }
|
19137 | if (!this.schemaHideWriteOnly || !'default, never,'.includes(`${this.schemaHideWriteOnly},`)) {
|
19138 | this.schemaHideWriteOnly = 'default';
|
19139 | }
|
19140 | if (!this.fillRequestFieldsWithExample || !'true, false,'.includes(`${this.fillRequestFieldsWithExample},`)) {
|
19141 | this.fillRequestFieldsWithExample = 'true';
|
19142 | }
|
19143 | if (!this.persistAuth || !'true, false,'.includes(`${this.persistAuth},`)) {
|
19144 | this.persistAuth = 'false';
|
19145 | }
|
19146 | if (!this.responseAreaHeight) {
|
19147 | this.responseAreaHeight = '400px';
|
19148 | }
|
19149 | if (!this.allowSearch || !'true, false,'.includes(`${this.allowSearch},`)) {
|
19150 | this.allowSearch = 'true';
|
19151 | }
|
19152 | if (!this.allowAdvancedSearch || !'true, false,'.includes(`${this.allowAdvancedSearch},`)) {
|
19153 | this.allowAdvancedSearch = 'true';
|
19154 | }
|
19155 | if (!this.allowTry || !'true, false,'.includes(`${this.allowTry},`)) {
|
19156 | this.allowTry = 'true';
|
19157 | }
|
19158 | if (!this.apiKeyValue) {
|
19159 | this.apiKeyValue = '-';
|
19160 | }
|
19161 | if (!this.apiKeyLocation) {
|
19162 | this.apiKeyLocation = 'header';
|
19163 | }
|
19164 | if (!this.apiKeyName) {
|
19165 | this.apiKeyName = '';
|
19166 | }
|
19167 | if (!this.oauthReceiver) {
|
19168 | this.oauthReceiver = 'oauth-receiver.html';
|
19169 | }
|
19170 | if (!this.updateRoute || !'true, false,'.includes(`${this.updateRoute},`)) {
|
19171 | this.updateRoute = 'true';
|
19172 | }
|
19173 | if (!this.routePrefix) {
|
19174 | this.routePrefix = '#';
|
19175 | }
|
19176 | if (!this.sortTags || !'true, false,'.includes(`${this.sortTags},`)) {
|
19177 | this.sortTags = 'false';
|
19178 | }
|
19179 | if (!this.generateMissingTags || !'true, false,'.includes(`${this.generateMissingTags},`)) {
|
19180 | this.generateMissingTags = 'false';
|
19181 | }
|
19182 | if (!this.sortEndpointsBy || !'method, path, summary, none,'.includes(`${this.sortEndpointsBy},`)) {
|
19183 | this.sortEndpointsBy = 'path';
|
19184 | }
|
19185 | if (!this.onNavTagClick || !'expand-collapse, show-description,'.includes(`${this.onNavTagClick},`)) {
|
19186 | this.onNavTagClick = 'expand-collapse';
|
19187 | }
|
19188 | if (!this.navItemSpacing || !'compact, relaxed, default,'.includes(`${this.navItemSpacing},`)) {
|
19189 | this.navItemSpacing = 'default';
|
19190 | }
|
19191 | if (!this.showMethodInNavBar || !'false, as-plain-text, as-colored-text, as-colored-block,'.includes(`${this.showMethodInNavBar},`)) {
|
19192 | this.showMethodInNavBar = 'false';
|
19193 | }
|
19194 | if (!this.usePathInNavBar || !'true, false,'.includes(`${this.usePathInNavBar},`)) {
|
19195 | this.usePathInNavBar = 'false';
|
19196 | }
|
19197 | if (!this.navActiveItemMarker || !'left-bar, colored-block'.includes(`${this.navActiveItemMarker},`)) {
|
19198 | this.navActiveItemMarker = 'left-bar';
|
19199 | }
|
19200 | if (!this.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) {
|
19201 | this.fontSize = 'default';
|
19202 | }
|
19203 | if (!this.showInfo || !'true, false,'.includes(`${this.showInfo},`)) {
|
19204 | this.showInfo = 'true';
|
19205 | }
|
19206 | if (!this.allowServerSelection || !'true, false,'.includes(`${this.allowServerSelection},`)) {
|
19207 | this.allowServerSelection = 'true';
|
19208 | }
|
19209 | if (!this.allowAuthentication || !'true, false,'.includes(`${this.allowAuthentication},`)) {
|
19210 | this.allowAuthentication = 'true';
|
19211 | }
|
19212 | if (!this.allowSchemaDescriptionExpandToggle || !'true, false,'.includes(`${this.allowSchemaDescriptionExpandToggle},`)) {
|
19213 | this.allowSchemaDescriptionExpandToggle = 'true';
|
19214 | }
|
19215 | if (!this.showSideNav || !'true false'.includes(this.showSideNav)) {
|
19216 | this.showSideNav = 'true';
|
19217 | }
|
19218 | if (!this.showComponents || !'true false'.includes(this.showComponents)) {
|
19219 | this.showComponents = 'false';
|
19220 | }
|
19221 | if (!this.infoDescriptionHeadingsInNavBar || !'true, false,'.includes(`${this.infoDescriptionHeadingsInNavBar},`)) {
|
19222 | this.infoDescriptionHeadingsInNavBar = 'false';
|
19223 | }
|
19224 | if (!this.fetchCredentials || !'omit, same-origin, include,'.includes(`${this.fetchCredentials},`)) {
|
19225 | this.fetchCredentials = '';
|
19226 | }
|
19227 | if (!this.matchType || !'includes regex'.includes(this.matchType)) {
|
19228 | this.matchType = 'includes';
|
19229 | }
|
19230 | if (!this.showAdvancedSearchDialog) {
|
19231 | this.showAdvancedSearchDialog = false;
|
19232 | }
|
19233 | if (!this.cssFile) {
|
19234 | this.cssFile = null;
|
19235 | }
|
19236 | if (!this.cssClasses) {
|
19237 | this.cssClasses = '';
|
19238 | }
|
19239 | marked.setOptions({
|
19240 | highlight: (code, lang) => {
|
19241 | if ((prism_default()).languages[lang]) {
|
19242 | return prism_default().highlight(code, (prism_default()).languages[lang], lang);
|
19243 | }
|
19244 | return code;
|
19245 | }
|
19246 | });
|
19247 | window.addEventListener('hashchange', () => {
|
19248 | this.scrollToPath(this.getElementIDFromURL());
|
19249 | }, true);
|
19250 | }
|
19251 |
|
19252 |
|
19253 | disconnectedCallback() {
|
19254 | if (this.intersectionObserver) {
|
19255 | this.intersectionObserver.disconnect();
|
19256 | }
|
19257 | super.disconnectedCallback();
|
19258 | }
|
19259 | infoDescriptionHeadingRenderer() {
|
19260 | const renderer = new marked.Renderer();
|
19261 | renderer.heading = (text, level, raw, slugger) => `<h${level} class="observe-me" id="${slugger.slug(raw)}">${text}</h${level}>`;
|
19262 | return renderer;
|
19263 | }
|
19264 | render() {
|
19265 |
|
19266 | const cssLinkEl = document.querySelector(`link[href*="${this.cssFile}"]`);
|
19267 |
|
19268 | if (cssLinkEl) {
|
19269 | this.shadowRoot.appendChild(cssLinkEl.cloneNode());
|
19270 | }
|
19271 | return mainBodyTemplate.call(this);
|
19272 | }
|
19273 | observeExpandedContent() {
|
19274 |
|
19275 | const observeOverviewEls = this.shadowRoot.querySelectorAll('.observe-me');
|
19276 | observeOverviewEls.forEach(targetEl => {
|
19277 | this.intersectionObserver.observe(targetEl);
|
19278 | });
|
19279 | }
|
19280 | attributeChangedCallback(name, oldVal, newVal) {
|
19281 | if (name === 'spec-url') {
|
19282 | if (oldVal !== newVal) {
|
19283 |
|
19284 | window.setTimeout(async () => {
|
19285 | await this.loadSpec(newVal);
|
19286 |
|
19287 | if (this.gotoPath && !window.location.hash) {
|
19288 | this.scrollToPath(this.gotoPath);
|
19289 | }
|
19290 | }, 0);
|
19291 | }
|
19292 | }
|
19293 | if (name === 'render-style') {
|
19294 | if (newVal === 'read') {
|
19295 | window.setTimeout(() => {
|
19296 | this.observeExpandedContent();
|
19297 | }, 100);
|
19298 | } else {
|
19299 | this.intersectionObserver.disconnect();
|
19300 | }
|
19301 | }
|
19302 | if (name === 'api-key-name' || name === 'api-key-location' || name === 'api-key-value') {
|
19303 | let updateSelectedApiKey = false;
|
19304 | let apiKeyName = '';
|
19305 | let apiKeyLocation = '';
|
19306 | let apiKeyValue = '';
|
19307 | if (name === 'api-key-name') {
|
19308 | if (this.getAttribute('api-key-location') && this.getAttribute('api-key-value')) {
|
19309 | apiKeyName = newVal;
|
19310 | apiKeyLocation = this.getAttribute('api-key-location');
|
19311 | apiKeyValue = this.getAttribute('api-key-value');
|
19312 | updateSelectedApiKey = true;
|
19313 | }
|
19314 | } else if (name === 'api-key-location') {
|
19315 | if (this.getAttribute('api-key-name') && this.getAttribute('api-key-value')) {
|
19316 | apiKeyLocation = newVal;
|
19317 | apiKeyName = this.getAttribute('api-key-name');
|
19318 | apiKeyValue = this.getAttribute('api-key-value');
|
19319 | updateSelectedApiKey = true;
|
19320 | }
|
19321 | } else if (name === 'api-key-value') {
|
19322 | if (this.getAttribute('api-key-name') && this.getAttribute('api-key-location')) {
|
19323 | apiKeyValue = newVal;
|
19324 | apiKeyLocation = this.getAttribute('api-key-location');
|
19325 | apiKeyName = this.getAttribute('api-key-name');
|
19326 | updateSelectedApiKey = true;
|
19327 | }
|
19328 | }
|
19329 | if (updateSelectedApiKey) {
|
19330 | if (this.resolvedSpec) {
|
19331 | const rapiDocApiKey = this.resolvedSpec.securitySchemes.find(v => v.securitySchemeId === rapidocApiKey);
|
19332 | if (!rapiDocApiKey) {
|
19333 | this.resolvedSpec.securitySchemes.push({
|
19334 | securitySchemeId: rapidocApiKey,
|
19335 | description: 'api-key provided in rapidoc element attributes',
|
19336 | type: 'apiKey',
|
19337 | name: apiKeyName,
|
19338 | in: apiKeyLocation,
|
19339 | value: apiKeyValue,
|
19340 | finalKeyValue: apiKeyValue
|
19341 | });
|
19342 | } else {
|
19343 | rapiDocApiKey.name = apiKeyName;
|
19344 | rapiDocApiKey.in = apiKeyLocation;
|
19345 | rapiDocApiKey.value = apiKeyValue;
|
19346 | rapiDocApiKey.finalKeyValue = apiKeyValue;
|
19347 | }
|
19348 | this.requestUpdate();
|
19349 | }
|
19350 | }
|
19351 | }
|
19352 | super.attributeChangedCallback(name, oldVal, newVal);
|
19353 | }
|
19354 | onSpecUrlChange() {
|
19355 | this.setAttribute('spec-url', this.shadowRoot.getElementById('spec-url').value);
|
19356 | }
|
19357 | onSpecFileChange(e) {
|
19358 | this.setAttribute('spec-file', this.shadowRoot.getElementById('spec-file').value);
|
19359 | const specFile = e.target.files[0];
|
19360 | const reader = new FileReader();
|
19361 | reader.onload = () => {
|
19362 | try {
|
19363 | const specObj = JSON.parse(reader.result);
|
19364 | this.loadSpec(specObj);
|
19365 | this.shadowRoot.getElementById('spec-url').value = '';
|
19366 | } catch (err) {
|
19367 | console.error('RapiDoc: Unable to read or parse json');
|
19368 | }
|
19369 | };
|
19370 |
|
19371 | reader.readAsText(specFile);
|
19372 | }
|
19373 | onFileLoadClick() {
|
19374 | this.shadowRoot.getElementById('spec-file').click();
|
19375 | }
|
19376 | onSearchChange(e) {
|
19377 | this.matchPaths = e.target.value;
|
19378 | this.resolvedSpec.tags.forEach(tag => tag.paths.filter(v => {
|
19379 | if (this.matchPaths) {
|
19380 |
|
19381 | if (pathIsInSearch(this.matchPaths, v, this.matchType)) {
|
19382 | tag.expanded = true;
|
19383 | }
|
19384 | }
|
19385 | }));
|
19386 | this.resolvedSpec.components.forEach(component => component.subComponents.filter(v => {
|
19387 | v.expanded = false;
|
19388 | if (!this.matchPaths || componentIsInSearch(this.matchPaths, v)) {
|
19389 | v.expanded = true;
|
19390 | }
|
19391 | }));
|
19392 | this.requestUpdate();
|
19393 | }
|
19394 | onClearSearch() {
|
19395 | const searchEl = this.shadowRoot.getElementById('nav-bar-search');
|
19396 | searchEl.value = '';
|
19397 | this.matchPaths = '';
|
19398 | this.resolvedSpec.components.forEach(component => component.subComponents.filter(v => {
|
19399 | v.expanded = true;
|
19400 | }));
|
19401 | }
|
19402 | onShowSearchModalClicked() {
|
19403 | this.showAdvancedSearchDialog = true;
|
19404 | }
|
19405 |
|
19406 |
|
19407 | async onOpenSearchDialog(e) {
|
19408 |
|
19409 | const inputEl = e.detail.querySelector('input');
|
19410 | await sleep(0);
|
19411 | if (inputEl) {
|
19412 | inputEl.focus();
|
19413 | }
|
19414 | }
|
19415 |
|
19416 |
|
19417 | async loadSpec(specUrl) {
|
19418 | if (!specUrl) {
|
19419 | return;
|
19420 | }
|
19421 | this.matchPaths = '';
|
19422 | try {
|
19423 | this.resolvedSpec = {
|
19424 | specLoadError: false,
|
19425 | isSpecLoading: true,
|
19426 | tags: []
|
19427 | };
|
19428 | this.loading = true;
|
19429 | this.loadFailed = false;
|
19430 | const spec = await ProcessSpec.call(this, specUrl, this.generateMissingTags === 'true', this.sortTags === 'true', this.getAttribute('sort-endpoints-by'), this.getAttribute('api-key-name'), this.getAttribute('api-key-location'), this.getAttribute('api-key-value'), this.getAttribute('server-url'));
|
19431 | this.loading = false;
|
19432 | this.afterSpecParsedAndValidated(spec);
|
19433 | } catch (err) {
|
19434 | this.loading = false;
|
19435 | this.loadFailed = true;
|
19436 | this.resolvedSpec = null;
|
19437 | console.error(`RapiDoc: Unable to resolve the API spec.. ${err.message}`);
|
19438 | }
|
19439 | }
|
19440 |
|
19441 | async afterSpecParsedAndValidated(spec) {
|
19442 | this.resolvedSpec = spec;
|
19443 | this.selectedServer = undefined;
|
19444 | if (this.defaultApiServerUrl) {
|
19445 | if (this.defaultApiServerUrl === this.serverUrl) {
|
19446 | this.selectedServer = {
|
19447 | url: this.serverUrl,
|
19448 | computedUrl: this.serverUrl
|
19449 | };
|
19450 | } else if (this.resolvedSpec.servers) {
|
19451 | this.selectedServer = this.resolvedSpec.servers.find(v => v.url === this.defaultApiServerUrl);
|
19452 | }
|
19453 | }
|
19454 | if (!this.selectedServer) {
|
19455 | if (this.resolvedSpec.servers) {
|
19456 | this.selectedServer = this.resolvedSpec.servers[0];
|
19457 | }
|
19458 | }
|
19459 |
|
19460 | this.requestUpdate();
|
19461 |
|
19462 | while (!(await this.updateComplete));
|
19463 | const specLoadedEvent = new CustomEvent('spec-loaded', {
|
19464 | detail: spec
|
19465 | });
|
19466 | this.dispatchEvent(specLoadedEvent);
|
19467 |
|
19468 |
|
19469 | this.intersectionObserver.disconnect();
|
19470 | if (this.renderStyle === 'read') {
|
19471 | await sleep(100);
|
19472 | this.observeExpandedContent();
|
19473 | }
|
19474 |
|
19475 | this.isIntersectionObserverActive = true;
|
19476 |
|
19477 |
|
19478 | const elementId = this.getElementIDFromURL();
|
19479 | if (elementId) {
|
19480 | if (this.renderStyle === 'view') {
|
19481 | this.expandAndGotoOperation(elementId, true, true);
|
19482 | } else {
|
19483 | this.scrollToPath(elementId);
|
19484 | }
|
19485 | } else if (this.renderStyle === 'focused') {
|
19486 |
|
19487 | if (!this.gotoPath) {
|
19488 | var _this$resolvedSpec$ta;
|
19489 | const defaultElementId = this.showInfo ? 'overview' : (_this$resolvedSpec$ta = this.resolvedSpec.tags[0]) === null || _this$resolvedSpec$ta === void 0 ? void 0 : _this$resolvedSpec$ta.paths[0];
|
19490 | this.scrollToPath(defaultElementId);
|
19491 | }
|
19492 | }
|
19493 | }
|
19494 |
|
19495 | |
19496 |
|
19497 |
|
19498 | getComponentBaseURL() {
|
19499 | const {
|
19500 | href
|
19501 | } = window.location;
|
19502 |
|
19503 |
|
19504 | const cleanRouterPrefix = this.routePrefix.replace(/(#|\/)$/, '');
|
19505 | if (!cleanRouterPrefix) {
|
19506 | return href.split('#')[0];
|
19507 | }
|
19508 | const indexOfRoutePrefix = href.lastIndexOf(cleanRouterPrefix);
|
19509 | if (indexOfRoutePrefix === -1) {
|
19510 | return href;
|
19511 | }
|
19512 | return href.slice(0, indexOfRoutePrefix);
|
19513 | }
|
19514 |
|
19515 | |
19516 |
|
19517 |
|
19518 | getElementIDFromURL() {
|
19519 | const baseURL = this.getComponentBaseURL();
|
19520 | const elementId = window.location.href.replace(baseURL + this.routePrefix, '');
|
19521 | return elementId;
|
19522 | }
|
19523 | replaceHistoryState(hashId) {
|
19524 | const baseURL = this.getComponentBaseURL();
|
19525 | window.history.replaceState(null, null, `${baseURL}${this.routePrefix || '#'}${hashId}`);
|
19526 | }
|
19527 | expandAndGotoOperation(elementId, scrollToElement = true) {
|
19528 | if (!this.resolvedSpec) {
|
19529 | return;
|
19530 | }
|
19531 |
|
19532 | let isExpandingNeeded = true;
|
19533 | const tmpElementId = elementId.indexOf('#') === -1 ? elementId : elementId.substring(1);
|
19534 | if (tmpElementId.startsWith('overview') || tmpElementId === 'servers' || tmpElementId === 'auth') {
|
19535 | isExpandingNeeded = false;
|
19536 | } else {
|
19537 | for (let i = 0; i < ((_this$resolvedSpec$ta2 = this.resolvedSpec.tags) === null || _this$resolvedSpec$ta2 === void 0 ? void 0 : _this$resolvedSpec$ta2.length); i++) {
|
19538 | var _this$resolvedSpec$ta2, _tag$paths;
|
19539 | const tag = this.resolvedSpec.tags[i];
|
19540 | const path = (_tag$paths = tag.paths) === null || _tag$paths === void 0 ? void 0 : _tag$paths.find(p => p.elementId === elementId);
|
19541 | if (path) {
|
19542 | if (path.expanded && tag.expanded) {
|
19543 | isExpandingNeeded = false;
|
19544 | } else {
|
19545 | path.expanded = true;
|
19546 | tag.expanded = true;
|
19547 | }
|
19548 | }
|
19549 | }
|
19550 | }
|
19551 | if (scrollToElement) {
|
19552 |
|
19553 | if (isExpandingNeeded) {
|
19554 | this.requestUpdate();
|
19555 | }
|
19556 | window.setTimeout(() => {
|
19557 | const gotoEl = this.shadowRoot.getElementById(tmpElementId);
|
19558 | if (gotoEl) {
|
19559 | gotoEl.scrollIntoView({
|
19560 | behavior: 'auto',
|
19561 | block: 'start'
|
19562 | });
|
19563 | if (this.updateRoute === 'true') {
|
19564 | this.replaceHistoryState(tmpElementId);
|
19565 | }
|
19566 | }
|
19567 | }, isExpandingNeeded ? 150 : 0);
|
19568 | }
|
19569 | }
|
19570 | isValidTopId(id) {
|
19571 | return id.startsWith('overview') || id === 'servers' || id === 'auth';
|
19572 | }
|
19573 | isValidPathId(id) {
|
19574 | var _this$resolvedSpec2, _this$resolvedSpec2$t;
|
19575 | if (id === 'overview' && this.showInfo) {
|
19576 | return true;
|
19577 | }
|
19578 | if (id === 'servers' && this.allowServerSelection) {
|
19579 | return true;
|
19580 | }
|
19581 | if (id === 'auth' && this.allowAuthentication) {
|
19582 | return true;
|
19583 | }
|
19584 | if (id.startsWith('tag--')) {
|
19585 | var _this$resolvedSpec, _this$resolvedSpec$ta3;
|
19586 | return (_this$resolvedSpec = this.resolvedSpec) === null || _this$resolvedSpec === void 0 ? void 0 : (_this$resolvedSpec$ta3 = _this$resolvedSpec.tags) === null || _this$resolvedSpec$ta3 === void 0 ? void 0 : _this$resolvedSpec$ta3.find(tag => tag.elementId === id);
|
19587 | }
|
19588 | return (_this$resolvedSpec2 = this.resolvedSpec) === null || _this$resolvedSpec2 === void 0 ? void 0 : (_this$resolvedSpec2$t = _this$resolvedSpec2.tags) === null || _this$resolvedSpec2$t === void 0 ? void 0 : _this$resolvedSpec2$t.find(tag => tag.paths.find(path => path.elementId === id));
|
19589 | }
|
19590 | onIntersect(entries) {
|
19591 | if (this.isIntersectionObserverActive === false) {
|
19592 | return;
|
19593 | }
|
19594 | entries.forEach(entry => {
|
19595 | if (entry.isIntersecting && entry.intersectionRatio > 0) {
|
19596 | 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');
|
19597 | const newNavEl = this.shadowRoot.getElementById(`link-${entry.target.id}`);
|
19598 |
|
19599 |
|
19600 | if (newNavEl) {
|
19601 | if (this.updateRoute === 'true') {
|
19602 | this.replaceHistoryState(entry.target.id);
|
19603 | }
|
19604 | newNavEl.scrollIntoView({
|
19605 | behavior: 'auto',
|
19606 | block: 'center'
|
19607 | });
|
19608 | newNavEl.classList.add('active');
|
19609 | newNavEl.part.add('section-navbar-active-item');
|
19610 | }
|
19611 |
|
19612 |
|
19613 |
|
19614 | if (oldNavEl && oldNavEl !== newNavEl) {
|
19615 | oldNavEl.classList.remove('active');
|
19616 | oldNavEl.part.remove('section-navbar-active-item');
|
19617 | }
|
19618 | }
|
19619 | });
|
19620 | }
|
19621 |
|
19622 |
|
19623 | handleHref(e) {
|
19624 | if (e.target.tagName.toLowerCase() === 'a') {
|
19625 | if (e.target.getAttribute('href').startsWith('#')) {
|
19626 | const gotoEl = this.shadowRoot.getElementById(e.target.getAttribute('href').replace('#', ''));
|
19627 | if (gotoEl) {
|
19628 | gotoEl.scrollIntoView({
|
19629 | behavior: 'auto',
|
19630 | block: 'start'
|
19631 | });
|
19632 | }
|
19633 | }
|
19634 | }
|
19635 | }
|
19636 |
|
19637 | |
19638 |
|
19639 |
|
19640 |
|
19641 |
|
19642 |
|
19643 |
|
19644 |
|
19645 |
|
19646 |
|
19647 |
|
19648 | async scrollToEventTarget(event, scrollNavItemToView = true) {
|
19649 | if (!(event.type === 'click' || event.type === 'keyup' && event.keyCode === 13)) {
|
19650 | return;
|
19651 | }
|
19652 | const navEl = event.target;
|
19653 | if (!navEl.dataset.contentId) {
|
19654 | return;
|
19655 | }
|
19656 | this.isIntersectionObserverActive = false;
|
19657 | if (this.renderStyle === 'focused') {
|
19658 | const requestEl = this.shadowRoot.querySelector('api-request');
|
19659 | if (requestEl) {
|
19660 | requestEl.beforeNavigationFocusedMode();
|
19661 | }
|
19662 | }
|
19663 | this.scrollToPath(navEl.dataset.contentId, true, scrollNavItemToView);
|
19664 | setTimeout(() => {
|
19665 | this.isIntersectionObserverActive = true;
|
19666 | }, 300);
|
19667 | }
|
19668 |
|
19669 |
|
19670 | async scrollToPath(elementId, expandPath = true, scrollNavItemToView = true) {
|
19671 | if (this.renderStyle === 'focused') {
|
19672 |
|
19673 |
|
19674 | this.focusedElementId = elementId;
|
19675 | await sleep(0);
|
19676 | }
|
19677 | if (this.renderStyle === 'view') {
|
19678 | this.expandAndGotoOperation(elementId, expandPath, true);
|
19679 | } else {
|
19680 | let isValidElementId = false;
|
19681 | const contentEl = this.shadowRoot.getElementById(elementId);
|
19682 | if (contentEl) {
|
19683 | isValidElementId = true;
|
19684 | contentEl.scrollIntoView({
|
19685 | behavior: 'auto',
|
19686 | block: 'start'
|
19687 | });
|
19688 | } else {
|
19689 | isValidElementId = false;
|
19690 | }
|
19691 | if (isValidElementId) {
|
19692 |
|
19693 | if (this.renderStyle === 'focused') {
|
19694 | const requestEl = this.shadowRoot.querySelector('api-request');
|
19695 | if (requestEl) {
|
19696 | requestEl.afterNavigationFocusedMode();
|
19697 | }
|
19698 | const responseEl = this.shadowRoot.querySelector('api-response');
|
19699 | if (responseEl) {
|
19700 | responseEl.resetSelection();
|
19701 | }
|
19702 | }
|
19703 |
|
19704 |
|
19705 | if (this.updateRoute === 'true') {
|
19706 | this.replaceHistoryState(elementId);
|
19707 | }
|
19708 |
|
19709 |
|
19710 | const newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);
|
19711 | if (newNavEl) {
|
19712 | if (scrollNavItemToView) {
|
19713 | newNavEl.scrollIntoView({
|
19714 | behavior: 'auto',
|
19715 | block: 'center'
|
19716 | });
|
19717 | }
|
19718 | await sleep(0);
|
19719 | 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');
|
19720 | if (oldNavEl) {
|
19721 | oldNavEl.classList.remove('active');
|
19722 | oldNavEl.part.remove('active');
|
19723 | oldNavEl.part.remove('section-navbar-active-item');
|
19724 | }
|
19725 | newNavEl.classList.add('active');
|
19726 | newNavEl.part.add('section-navbar-active-item');
|
19727 |
|
19728 | }
|
19729 | }
|
19730 | }
|
19731 | }
|
19732 |
|
19733 |
|
19734 | setHttpUserNameAndPassword(securitySchemeId, username, password) {
|
19735 | return applyApiKey.call(this, securitySchemeId, username, password);
|
19736 | }
|
19737 |
|
19738 |
|
19739 | setApiKey(securitySchemeId, apiKeyValue) {
|
19740 | return applyApiKey.call(this, securitySchemeId, '', '', apiKeyValue);
|
19741 | }
|
19742 |
|
19743 |
|
19744 | removeAllSecurityKeys() {
|
19745 | return onClearAllApiKeys.call(this);
|
19746 | }
|
19747 |
|
19748 |
|
19749 | setApiServer(apiServerUrl) {
|
19750 |
|
19751 | return setApiServer.call(this, apiServerUrl);
|
19752 | }
|
19753 |
|
19754 |
|
19755 | onAdvancedSearch(ev, delay) {
|
19756 | const eventTargetEl = ev.target;
|
19757 | clearTimeout(this.timeoutId);
|
19758 | this.timeoutId = setTimeout(() => {
|
19759 | let searchInputEl;
|
19760 | if (eventTargetEl.type === 'text') {
|
19761 | searchInputEl = eventTargetEl;
|
19762 | } else {
|
19763 | searchInputEl = eventTargetEl.closest('.advanced-search-options').querySelector('input[type=text]');
|
19764 | }
|
19765 | const searchOptions = [...eventTargetEl.closest('.advanced-search-options').querySelectorAll('input:checked')].map(v => v.id);
|
19766 | this.advancedSearchMatches = advancedSearch(searchInputEl.value, this.resolvedSpec.tags, searchOptions);
|
19767 | }, delay);
|
19768 | }
|
19769 | }
|
19770 | customElements.define('rapi-doc', RapiDoc);
|
19771 | ;
|
19772 |
|
19773 |
|
19774 |
|
19775 |
|
19776 |
|
19777 |
|
19778 |
|
19779 |
|
19780 |
|
19781 |
|
19782 |
|
19783 |
|
19784 |
|
19785 |
|
19786 |
|
19787 |
|
19788 |
|
19789 |
|
19790 |
|
19791 |
|
19792 |
|
19793 |
|
19794 |
|
19795 |
|
19796 |
|
19797 |
|
19798 |
|
19799 |
|
19800 | class RapiDocMini extends lit_element_s {
|
19801 | constructor() {
|
19802 | super();
|
19803 | this.isMini = true;
|
19804 | this.updateRoute = 'false';
|
19805 | this.renderStyle = 'view';
|
19806 | this.showHeader = 'false';
|
19807 | this.allowAdvancedSearch = 'false';
|
19808 | }
|
19809 | static get properties() {
|
19810 | return {
|
19811 |
|
19812 | specUrl: {
|
19813 | type: String,
|
19814 | attribute: 'spec-url'
|
19815 | },
|
19816 | sortEndpointsBy: {
|
19817 | type: String,
|
19818 | attribute: 'sort-endpoints-by'
|
19819 | },
|
19820 |
|
19821 | layout: {
|
19822 | type: String
|
19823 | },
|
19824 | pathsExpanded: {
|
19825 | type: String,
|
19826 | attribute: 'paths-expanded'
|
19827 | },
|
19828 | defaultSchemaTab: {
|
19829 | type: String,
|
19830 | attribute: 'default-schema-tab'
|
19831 | },
|
19832 | responseAreaHeight: {
|
19833 | type: String,
|
19834 | attribute: 'response-area-height'
|
19835 | },
|
19836 | showSummaryWhenCollapsed: {
|
19837 | type: String,
|
19838 | attribute: 'show-summary-when-collapsed'
|
19839 | },
|
19840 | fillRequestFieldsWithExample: {
|
19841 | type: String,
|
19842 | attribute: 'fill-request-fields-with-example'
|
19843 | },
|
19844 | persistAuth: {
|
19845 | type: String,
|
19846 | attribute: 'persist-auth'
|
19847 | },
|
19848 |
|
19849 | schemaStyle: {
|
19850 | type: String,
|
19851 | attribute: 'schema-style'
|
19852 | },
|
19853 | schemaExpandLevel: {
|
19854 | type: Number,
|
19855 | attribute: 'schema-expand-level'
|
19856 | },
|
19857 | schemaDescriptionExpanded: {
|
19858 | type: String,
|
19859 | attribute: 'schema-description-expanded'
|
19860 | },
|
19861 |
|
19862 | apiKeyName: {
|
19863 | type: String,
|
19864 | attribute: 'api-key-name'
|
19865 | },
|
19866 | apiKeyLocation: {
|
19867 | type: String,
|
19868 | attribute: 'api-key-location'
|
19869 | },
|
19870 | apiKeyValue: {
|
19871 | type: String,
|
19872 | attribute: 'api-key-value'
|
19873 | },
|
19874 | defaultApiServerUrl: {
|
19875 | type: String,
|
19876 | attribute: 'default-api-server'
|
19877 | },
|
19878 | serverUrl: {
|
19879 | type: String,
|
19880 | attribute: 'server-url'
|
19881 | },
|
19882 | oauthReceiver: {
|
19883 | type: String,
|
19884 | attribute: 'oauth-receiver'
|
19885 | },
|
19886 | allowTry: {
|
19887 | type: String,
|
19888 | attribute: 'allow-try'
|
19889 | },
|
19890 |
|
19891 | theme: {
|
19892 | type: String
|
19893 | },
|
19894 | bgColor: {
|
19895 | type: String,
|
19896 | attribute: 'bg-color'
|
19897 | },
|
19898 | textColor: {
|
19899 | type: String,
|
19900 | attribute: 'text-color'
|
19901 | },
|
19902 | primaryColor: {
|
19903 | type: String,
|
19904 | attribute: 'primary-color'
|
19905 | },
|
19906 | fontSize: {
|
19907 | type: String,
|
19908 | attribute: 'font-size'
|
19909 | },
|
19910 | regularFont: {
|
19911 | type: String,
|
19912 | attribute: 'regular-font'
|
19913 | },
|
19914 | monoFont: {
|
19915 | type: String,
|
19916 | attribute: 'mono-font'
|
19917 | },
|
19918 | loadFonts: {
|
19919 | type: String,
|
19920 | attribute: 'load-fonts'
|
19921 | },
|
19922 |
|
19923 | fetchCredentials: {
|
19924 | type: String,
|
19925 | attribute: 'fetch-credentials'
|
19926 | },
|
19927 |
|
19928 | matchPaths: {
|
19929 | type: String,
|
19930 | attribute: 'match-paths'
|
19931 | },
|
19932 | matchType: {
|
19933 | type: String,
|
19934 | attribute: 'match-type'
|
19935 | },
|
19936 |
|
19937 | loading: {
|
19938 | type: Boolean
|
19939 | }
|
19940 | };
|
19941 | }
|
19942 |
|
19943 | static get styles() {
|
19944 | return [font_styles, input_styles, flex_styles, table_styles, endpoint_styles, prism_styles, tab_styles, nav_styles, info_styles, i`
|
19945 | :host {
|
19946 | display:flex;
|
19947 | flex-direction: column;
|
19948 | min-width:360px;
|
19949 | width:100%;
|
19950 | height:100%;
|
19951 | margin:0;
|
19952 | padding:0;
|
19953 | overflow: hidden;
|
19954 | letter-spacing:normal;
|
19955 | color:var(--fg);
|
19956 | background-color:var(--bg);
|
19957 | font-family:var(--font-regular);
|
19958 | }
|
19959 |
|
19960 | @media only screen and (min-width: 768px) {
|
19961 | .only-large-screen{
|
19962 | display:block;
|
19963 | }
|
19964 | .only-large-screen-flex{
|
19965 | display:flex;
|
19966 | }
|
19967 | }`];
|
19968 | }
|
19969 |
|
19970 |
|
19971 | connectedCallback() {
|
19972 | super.connectedCallback();
|
19973 | if (this.loadFonts !== 'false') {
|
19974 | const fontDescriptor = {
|
19975 | family: 'Open Sans',
|
19976 | style: 'normal',
|
19977 | weight: '300',
|
19978 | 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'
|
19979 | };
|
19980 | const fontWeight300 = new FontFace('Open Sans', "url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UN_r8OUuhpKKSTjw.woff2) format('woff2')", fontDescriptor);
|
19981 | fontDescriptor.weight = '600';
|
19982 | const fontWeight600 = new FontFace('Open Sans', "url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UNirkOUuhpKKSTjw.woff2) format('woff2')", fontDescriptor);
|
19983 | fontWeight300.load().then(font => {
|
19984 | document.fonts.add(font);
|
19985 | });
|
19986 | fontWeight600.load().then(font => {
|
19987 | document.fonts.add(font);
|
19988 | });
|
19989 | }
|
19990 | if (!this.showSummaryWhenCollapsed || !'true, false,'.includes(`${this.showSummaryWhenCollapsed},`)) {
|
19991 | this.showSummaryWhenCollapsed = 'true';
|
19992 | }
|
19993 | if (!this.layout || !'row, column,'.includes(`${this.layout},`)) {
|
19994 | this.layout = 'row';
|
19995 | }
|
19996 | if (!this.schemaStyle || !'tree, table,'.includes(`${this.schemaStyle},`)) {
|
19997 | this.schemaStyle = 'tree';
|
19998 | }
|
19999 | if (!this.theme || !'light, dark,'.includes(`${this.theme},`)) {
|
20000 | this.theme = window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
|
20001 | }
|
20002 | if (!this.defaultSchemaTab || !'example, schema, model,'.includes(`${this.defaultSchemaTab},`)) {
|
20003 | this.defaultSchemaTab = 'example';
|
20004 | } else if (this.defaultSchemaTab === 'model') {
|
20005 | this.defaultSchemaTab = 'schema';
|
20006 | }
|
20007 | this.pathsExpanded = this.pathsExpanded === 'true';
|
20008 | if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) {
|
20009 | this.schemaExpandLevel = 99999;
|
20010 | }
|
20011 | if (!this.schemaDescriptionExpanded || !'true, false,'.includes(`${this.schemaDescriptionExpanded},`)) {
|
20012 | this.schemaDescriptionExpanded = 'false';
|
20013 | }
|
20014 | if (!this.fillRequestFieldsWithExample || !'true, false,'.includes(`${this.fillRequestFieldsWithExample},`)) {
|
20015 | this.fillRequestFieldsWithExample = 'true';
|
20016 | }
|
20017 | if (!this.persistAuth || !'true, false,'.includes(`${this.persistAuth},`)) {
|
20018 | this.persistAuth = 'false';
|
20019 | }
|
20020 | if (!this.responseAreaHeight) {
|
20021 | this.responseAreaHeight = '300px';
|
20022 | }
|
20023 | if (!this.allowTry || !'true, false,'.includes(`${this.allowTry},`)) {
|
20024 | this.allowTry = 'true';
|
20025 | }
|
20026 | if (!this.apiKeyValue) {
|
20027 | this.apiKeyValue = '-';
|
20028 | }
|
20029 | if (!this.apiKeyLocation) {
|
20030 | this.apiKeyLocation = 'header';
|
20031 | }
|
20032 | if (!this.apiKeyName) {
|
20033 | this.apiKeyName = '';
|
20034 | }
|
20035 | if (!this.oauthReceiver) {
|
20036 | this.oauthReceiver = 'oauth-receiver.html';
|
20037 | }
|
20038 | if (!this.sortTags || !'true, false,'.includes(`${this.sortTags},`)) {
|
20039 | this.sortTags = 'false';
|
20040 | }
|
20041 | if (!this.sortEndpointsBy || !'method, path, summary,'.includes(`${this.sortEndpointsBy},`)) {
|
20042 | this.sortEndpointsBy = 'path';
|
20043 | }
|
20044 | if (!this.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) {
|
20045 | this.fontSize = 'default';
|
20046 | }
|
20047 | if (!this.matchType || !'includes regex'.includes(this.matchType)) {
|
20048 | this.matchType = 'includes';
|
20049 | }
|
20050 | if (!this.allowSchemaDescriptionExpandToggle || !'true, false,'.includes(`${this.allowSchemaDescriptionExpandToggle},`)) {
|
20051 | this.allowSchemaDescriptionExpandToggle = 'true';
|
20052 | }
|
20053 | if (!this.fetchCredentials || !'omit, same-origin, include,'.includes(`${this.fetchCredentials},`)) {
|
20054 | this.fetchCredentials = '';
|
20055 | }
|
20056 | marked.setOptions({
|
20057 | highlight: (code, lang) => {
|
20058 | if ((prism_default()).languages[lang]) {
|
20059 | return prism_default().highlight(code, (prism_default()).languages[lang], lang);
|
20060 | }
|
20061 | return code;
|
20062 | }
|
20063 | });
|
20064 | }
|
20065 | render() {
|
20066 | return mainBodyTemplate.call(this, true, false, false, this.pathsExpanded);
|
20067 | }
|
20068 | attributeChangedCallback(name, oldVal, newVal) {
|
20069 | if (name === 'spec-url') {
|
20070 | if (oldVal !== newVal) {
|
20071 |
|
20072 | window.setTimeout(async () => {
|
20073 | await this.loadSpec(newVal);
|
20074 | }, 0);
|
20075 | }
|
20076 | }
|
20077 | if (name === 'api-key-name' || name === 'api-key-location' || name === 'api-key-value') {
|
20078 | let updateSelectedApiKey = false;
|
20079 | let apiKeyName = '';
|
20080 | let apiKeyLocation = '';
|
20081 | let apiKeyValue = '';
|
20082 | if (name === 'api-key-name') {
|
20083 | if (this.getAttribute('api-key-location') && this.getAttribute('api-key-value')) {
|
20084 | apiKeyName = newVal;
|
20085 | apiKeyLocation = this.getAttribute('api-key-location');
|
20086 | apiKeyValue = this.getAttribute('api-key-value');
|
20087 | updateSelectedApiKey = true;
|
20088 | }
|
20089 | } else if (name === 'api-key-location') {
|
20090 | if (this.getAttribute('api-key-name') && this.getAttribute('api-key-value')) {
|
20091 | apiKeyLocation = newVal;
|
20092 | apiKeyName = this.getAttribute('api-key-name');
|
20093 | apiKeyValue = this.getAttribute('api-key-value');
|
20094 | updateSelectedApiKey = true;
|
20095 | }
|
20096 | } else if (name === 'api-key-value') {
|
20097 | if (this.getAttribute('api-key-name') && this.getAttribute('api-key-location')) {
|
20098 | apiKeyValue = newVal;
|
20099 | apiKeyLocation = this.getAttribute('api-key-location');
|
20100 | apiKeyName = this.getAttribute('api-key-name');
|
20101 | updateSelectedApiKey = true;
|
20102 | }
|
20103 | }
|
20104 | if (updateSelectedApiKey) {
|
20105 | if (this.resolvedSpec) {
|
20106 | const rapiDocApiKey = this.resolvedSpec.securitySchemes.find(v => v.securitySchemeId === rapidocApiKey);
|
20107 | if (!rapiDocApiKey) {
|
20108 | this.resolvedSpec.securitySchemes.push({
|
20109 | apiKeyId: rapidocApiKey,
|
20110 | description: 'api-key provided in rapidoc element attributes',
|
20111 | type: 'apiKey',
|
20112 | name: apiKeyName,
|
20113 | in: apiKeyLocation,
|
20114 | value: apiKeyValue,
|
20115 | finalKeyValue: apiKeyValue
|
20116 | });
|
20117 | } else {
|
20118 | rapiDocApiKey.name = apiKeyName;
|
20119 | rapiDocApiKey.in = apiKeyLocation;
|
20120 | rapiDocApiKey.value = apiKeyValue;
|
20121 | rapiDocApiKey.finalKeyValue = apiKeyValue;
|
20122 | }
|
20123 | this.requestUpdate();
|
20124 | }
|
20125 | }
|
20126 | }
|
20127 | super.attributeChangedCallback(name, oldVal, newVal);
|
20128 | }
|
20129 | onSpecUrlChange() {
|
20130 | this.setAttribute('spec-url', this.shadowRoot.getElementById('spec-url').value);
|
20131 | }
|
20132 |
|
20133 |
|
20134 | async loadSpec(specUrl) {
|
20135 | if (!specUrl) {
|
20136 | return;
|
20137 | }
|
20138 | try {
|
20139 | this.resolvedSpec = {
|
20140 | specLoadError: false,
|
20141 | isSpecLoading: true,
|
20142 | tags: []
|
20143 | };
|
20144 | this.loading = true;
|
20145 | this.loadFailed = false;
|
20146 | this.requestUpdate();
|
20147 | const spec = await ProcessSpec.call(this, specUrl, this.generateMissingTags === 'true', this.sortTags === 'true', this.getAttribute('sort-endpoints-by'), this.getAttribute('api-key-name'), this.getAttribute('api-key-location'), this.getAttribute('api-key-value'), this.getAttribute('server-url'));
|
20148 | this.loading = false;
|
20149 | this.afterSpecParsedAndValidated(spec);
|
20150 | } catch (err) {
|
20151 | this.loading = false;
|
20152 | this.loadFailed = true;
|
20153 | this.resolvedSpec = null;
|
20154 | console.error(`RapiDoc: Unable to resolve the API spec.. ${err.message}`);
|
20155 | }
|
20156 | }
|
20157 |
|
20158 |
|
20159 | setHttpUserNameAndPassword(securitySchemeId, username, password) {
|
20160 | return applyApiKey.call(this, securitySchemeId, username, password);
|
20161 | }
|
20162 |
|
20163 |
|
20164 | setApiKey(securitySchemeId, apiKeyValue) {
|
20165 | return applyApiKey.call(this, securitySchemeId, '', '', apiKeyValue);
|
20166 | }
|
20167 |
|
20168 |
|
20169 | removeAllSecurityKeys() {
|
20170 | return onClearAllApiKeys.call(this);
|
20171 | }
|
20172 |
|
20173 |
|
20174 | setApiServer(apiServerUrl) {
|
20175 |
|
20176 | return setApiServer.call(this, apiServerUrl);
|
20177 | }
|
20178 | async afterSpecParsedAndValidated(spec) {
|
20179 | this.resolvedSpec = spec;
|
20180 | this.selectedServer = undefined;
|
20181 | if (this.defaultApiServerUrl) {
|
20182 | if (this.defaultApiServerUrl === this.serverUrl) {
|
20183 | this.selectedServer = {
|
20184 | url: this.serverUrl,
|
20185 | computedUrl: this.serverUrl
|
20186 | };
|
20187 | } else if (this.resolvedSpec.servers) {
|
20188 | this.selectedServer = this.resolvedSpec.servers.find(v => v.url === this.defaultApiServerUrl);
|
20189 | }
|
20190 | }
|
20191 | if (!this.selectedServer) {
|
20192 | if (this.resolvedSpec.servers) {
|
20193 | this.selectedServer = this.resolvedSpec.servers[0];
|
20194 | }
|
20195 | }
|
20196 |
|
20197 | this.requestUpdate();
|
20198 |
|
20199 | while (!(await this.updateComplete));
|
20200 | const specLoadedEvent = new CustomEvent('spec-loaded', {
|
20201 | detail: spec
|
20202 | });
|
20203 | this.dispatchEvent(specLoadedEvent);
|
20204 | }
|
20205 |
|
20206 |
|
20207 | handleHref(e) {
|
20208 | if (e.target.tagName.toLowerCase() === 'a') {
|
20209 | if (e.target.getAttribute('href').startsWith('#')) {
|
20210 | const gotoEl = this.shadowRoot.getElementById(e.target.getAttribute('href').replace('#', ''));
|
20211 | if (gotoEl) {
|
20212 | gotoEl.scrollIntoView({
|
20213 | behavior: 'auto',
|
20214 | block: 'start'
|
20215 | });
|
20216 | }
|
20217 | }
|
20218 | }
|
20219 | }
|
20220 | }
|
20221 | customElements.define('rapi-doc-mini', RapiDocMini);
|
20222 | ;
|
20223 | class OauthReceiver extends HTMLElement {
|
20224 | connectedCallback() {
|
20225 | this.receiveAuthParms();
|
20226 | window.addEventListener('storage', e => this.receiveStorage(e), true);
|
20227 | }
|
20228 |
|
20229 | |
20230 |
|
20231 |
|
20232 |
|
20233 | receiveAuthParms() {
|
20234 | let authData = {};
|
20235 | if (document.location.search) {
|
20236 |
|
20237 | const params = new URLSearchParams(document.location.search);
|
20238 | const code = params.get('code');
|
20239 | const error = params.get('error');
|
20240 | const state = params.get('state');
|
20241 | authData = {
|
20242 | code,
|
20243 | error,
|
20244 | state,
|
20245 | responseType: 'code'
|
20246 | };
|
20247 | } else if (window.location.hash) {
|
20248 |
|
20249 | const token_type = this.parseQueryString(window.location.hash.substring(1), 'token_type');
|
20250 | const access_token = this.parseQueryString(window.location.hash.substring(1), 'access_token');
|
20251 | authData = {
|
20252 | token_type,
|
20253 | access_token,
|
20254 | responseType: 'token'
|
20255 | };
|
20256 | }
|
20257 |
|
20258 | if (window.opener) {
|
20259 | window.opener.postMessage(authData, this.target);
|
20260 | return;
|
20261 | }
|
20262 | sessionStorage.setItem('rapidoc-oauth-data', JSON.stringify(authData));
|
20263 | }
|
20264 |
|
20265 | relayAuthParams(e) {
|
20266 | if (window.parent) {
|
20267 | if (e.key === 'rapidoc-oauth-data') {
|
20268 | const authData = JSON.parse(e.newValue);
|
20269 | window.parent.postMessage(authData, this.target);
|
20270 | }
|
20271 | }
|
20272 | }
|
20273 | parseQueryString(queryString, key) {
|
20274 | const vars = queryString.split('&');
|
20275 | for (let i = 0; i < vars.length; i++) {
|
20276 | const pair = vars[i].split('=');
|
20277 | if (decodeURIComponent(pair[0]) === key) {
|
20278 | return decodeURIComponent(pair[1]);
|
20279 | }
|
20280 | }
|
20281 | }
|
20282 | }
|
20283 | customElements.define('oauth-receiver', OauthReceiver);
|
20284 | ;
|
20285 |
|
20286 |
|
20287 |
|
20288 |
|
20289 |
|
20290 |
|
20291 |
|
20292 |
|
20293 |
|
20294 |
|
20295 |
|
20296 |
|
20297 |
|
20298 |
|
20299 |
|
20300 | function jsonSchemaNavTemplate() {
|
20301 | return y`
|
20302 | <nav class='nav-bar' part="section-navbar">
|
20303 | <slot name="nav-logo" class="logo"></slot>
|
20304 | <div style="display:flex;line-height:22px; padding:8px">
|
20305 | <input id="nav-bar-search"
|
20306 | part = "textbox textbox-nav-filter"
|
20307 | style = "width:100%; height: 26px; padding-right:20px; color:var(--nav-hover-text-color); border-color:var(--nav-accent-color); background-color:var(--nav-hover-bg-color)"
|
20308 | type = "text"
|
20309 | placeholder = "Filter"
|
20310 | @change = "${this.onSearchChange}"
|
20311 | spellcheck = "false"
|
20312 | >
|
20313 | <div style="margin: 6px 5px 0 -24px; font-size:var(--font-size-regular); cursor:pointer;">↩</div>
|
20314 | </div>
|
20315 | <nav style="flex:1" class='nav-scroll' part="section-navbar-scroll">
|
20316 | ${this.resolvedSpec.schemaAndExamples.map(v => y`
|
20317 | <div class='nav-bar-path' data-content-id='${v.elementId}' id='link-${v.elementId}'
|
20318 | @click = '${e => {
|
20319 | this.scrollToEventTarget(e, false);
|
20320 | }}'
|
20321 | >
|
20322 | ${v.name}
|
20323 | </div>`)}
|
20324 | </nav>
|
20325 | </nav>
|
20326 | `;
|
20327 | }
|
20328 |
|
20329 |
|
20330 | function jsonSchemaBodyTemplate() {
|
20331 | return y`
|
20332 | ${this.showInfo === 'true' ? overviewTemplate.call(this) : ''}
|
20333 | <div style="font-size:var(--font-size-regular);">
|
20334 | ${this.resolvedSpec.schemaAndExamples.map(jSchemaBody => {
|
20335 | var _examplesObj$;
|
20336 | const examplesObj = generateExample(jSchemaBody.schema, 'json', jSchemaBody.examples, jSchemaBody.example, true, false, 'json', true);
|
20337 | jSchemaBody.selectedExample = (_examplesObj$ = examplesObj[0]) === null || _examplesObj$ === void 0 ? void 0 : _examplesObj$.exampleId;
|
20338 | return y`
|
20339 | <section id='${jSchemaBody.elementId}' class='json-schema-and-example regular-font' style="display:flex; flex-direction: column; border:1px solid var(--border-color); margin-bottom:32px; border-top: 5px solid var(--border-color)">
|
20340 | <div style="padding:16px; border-bottom: 1px solid var(--border-color)">
|
20341 | <div style="font-size:var(--font-size-small); font-weight:bold">${jSchemaBody.name}</div>
|
20342 | <span class="json-schema-description m-markdown ">${unsafe_html_o(marked(jSchemaBody.description || ''))}</span>
|
20343 | </div>
|
20344 | <div style="display:flex; flex-direction: row; gap:16px;">
|
20345 | <div class="json-schema-def" style="flex:1; padding:16px 0 16px 16px; ">
|
20346 | <schema-tree
|
20347 | .data = "${schemaInObjectNotation(jSchemaBody.schema, {})}"
|
20348 | schema-expand-level = "${this.schemaExpandLevel}"
|
20349 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
20350 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
20351 | schema-hide-read-only = "false"
|
20352 | schema-hide-write-only = "false"
|
20353 | > </schema-tree>
|
20354 | </div>
|
20355 | <div class="json-schema-example-panel" style="width:400px; background-color: var(--input-bg); padding:16px 0 16px 16px; border-left: 1px dashed var(--border-color);">
|
20356 | ${examplesObj.length > 1 ? y`<select style="min-width:100px; max-width:100%" @change='${e => this.onSelectExample(e, jSchemaBody)}'>
|
20357 | ${examplesObj.map(v => y`
|
20358 | <option value="${v.exampleId}" ?selected=${v.exampleId === jSchemaBody.selectedExample}>
|
20359 | ${v.exampleSummary.length > 80 ? v.exampleId : v.exampleSummary}
|
20360 | </option>`)}
|
20361 | </select>` : y`<div style="font-size: var(--font-size-small);font-weight:700; margin:5px 0"> ${examplesObj[0].exampleSummary}</div>`}
|
20362 | ${examplesObj.map(v => y`
|
20363 | <json-tree
|
20364 | .data = "${v.exampleValue}"
|
20365 | data-example = "${v.exampleId}"
|
20366 | class = "example"
|
20367 | style = "margin-top:16px; display: ${v.exampleId === jSchemaBody.selectedExample ? 'flex' : 'none'}"
|
20368 | ></json-tree>`)}
|
20369 | </div>
|
20370 | </div>
|
20371 | </section>`;
|
20372 | })}
|
20373 | </div>
|
20374 | `;
|
20375 | }
|
20376 |
|
20377 |
|
20378 |
|
20379 | function jsonSchemaViewerTemplate(isMini = false) {
|
20380 |
|
20381 | if (!this.resolvedSpec) {
|
20382 | return '';
|
20383 | }
|
20384 | const newTheme = {
|
20385 | bg1: isValidHexColor(this.bgColor) ? this.bgColor : '',
|
20386 | fg1: isValidHexColor(this.textColor) ? this.textColor : '',
|
20387 | headerColor: isValidHexColor(this.headerColor) ? this.headerColor : '',
|
20388 | primaryColor: isValidHexColor(this.primaryColor) ? this.primaryColor : '',
|
20389 | navBgColor: isValidHexColor(this.navBgColor) ? this.navBgColor : '',
|
20390 | navTextColor: isValidHexColor(this.navTextColor) ? this.navTextColor : '',
|
20391 | navHoverBgColor: isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',
|
20392 | navHoverTextColor: isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : '',
|
20393 | navAccentColor: isValidHexColor(this.navAccentColor) ? this.navAccentColor : '',
|
20394 | navAccenttextColor: isValidHexColor(this.navAccentTextColor) ? this.navAccentTextColor : ''
|
20395 | };
|
20396 |
|
20397 | if (this.resolvedSpec.specLoadError) {
|
20398 | if (isMini) {
|
20399 | return y`
|
20400 | ${this.theme === 'dark' ? setTheme.call(this, 'dark', newTheme) : setTheme.call(this, 'light', newTheme)}
|
20401 | <div style="display:flex; align-items:center; border:1px dashed var(--border-color); height:42px; padding:5px; font-size:var(--font-size-small); color:var(--red); font-family:var(--font-mono)"> ${this.resolvedSpec.info.description} </div>
|
20402 | `;
|
20403 | }
|
20404 | return y`
|
20405 | ${this.theme === 'dark' ? setTheme.call(this, 'dark', newTheme) : setTheme.call(this, 'light', newTheme)}
|
20406 | <!-- Header -->
|
20407 | ${headerTemplate.call(this)}
|
20408 | <h1> Header </h1>
|
20409 | <main class="main-content regular-font" part="section-main-content">
|
20410 | <slot></slot>
|
20411 | <div style="margin:24px; text-align: center;">
|
20412 | <h1 style="color: var(--red)"> ${this.resolvedSpec.info.title} </h1>
|
20413 | <div style="font-family:var(--font-mono)"> ${this.resolvedSpec.info.description} </div>
|
20414 | </div>
|
20415 | </main>
|
20416 | `;
|
20417 | }
|
20418 | if (this.resolvedSpec.isSpecLoading) {
|
20419 | return y`
|
20420 | ${this.theme === 'dark' ? setTheme.call(this, 'dark', newTheme) : setTheme.call(this, 'light', newTheme)}
|
20421 | <main class="main-content regular-font" part="section-main-content">
|
20422 | <slot></slot>
|
20423 | <div class="main-content-inner--${this.renderStyle}-mode">
|
20424 | <div class="loader"></div>
|
20425 | </div>
|
20426 | </main>
|
20427 | `;
|
20428 | }
|
20429 | return y`
|
20430 | ${this.theme === 'dark' ? setTheme.call(this, 'dark', newTheme) : setTheme.call(this, 'light', newTheme)}
|
20431 |
|
20432 | <!-- Header -->
|
20433 | ${this.showHeader === 'false' ? '' : headerTemplate.call(this)}
|
20434 |
|
20435 | <div id='the-main-body' class="body ${this.cssClasses}" dir= ${this.pageDirection}>
|
20436 |
|
20437 | <!-- Side Nav -->
|
20438 | ${jsonSchemaNavTemplate.call(this)}
|
20439 |
|
20440 | <!-- Main Content -->
|
20441 | <main class="main-content regular-font" part="section-main-content">
|
20442 | <slot></slot>
|
20443 | <div class="main-content-inner--${this.renderStyle}-mode">
|
20444 | ${this.loading === true ? y`<div class="loader"></div>` : y`
|
20445 | ${this.loadFailed === true ? y`<div style="text-align: center;margin: 16px;"> Unable to load the Spec</div>` : y`
|
20446 | <div class="operations-root" @click="${e => {
|
20447 | this.handleHref(e);
|
20448 | }}">
|
20449 | ${jsonSchemaBodyTemplate.call(this)}
|
20450 | </div>
|
20451 | `}`}
|
20452 | </div>
|
20453 | <slot name="footer"></slot>
|
20454 | </main>
|
20455 | </div>
|
20456 | `;
|
20457 | }
|
20458 |
|
20459 | ;
|
20460 |
|
20461 |
|
20462 |
|
20463 |
|
20464 |
|
20465 |
|
20466 |
|
20467 |
|
20468 |
|
20469 |
|
20470 |
|
20471 |
|
20472 |
|
20473 |
|
20474 |
|
20475 |
|
20476 |
|
20477 |
|
20478 |
|
20479 |
|
20480 |
|
20481 |
|
20482 |
|
20483 |
|
20484 |
|
20485 | class JsonSchemaViewer extends lit_element_s {
|
20486 | constructor() {
|
20487 | super();
|
20488 | this.isMini = false;
|
20489 | this.updateRoute = 'false';
|
20490 | this.renderStyle = 'focused';
|
20491 | this.showHeader = 'true';
|
20492 | this.allowAdvancedSearch = 'false';
|
20493 | this.selectedExampleForEachSchema = {};
|
20494 | }
|
20495 | static get properties() {
|
20496 | return {
|
20497 |
|
20498 | specUrl: {
|
20499 | type: String,
|
20500 | attribute: 'spec-url'
|
20501 | },
|
20502 |
|
20503 | schemaStyle: {
|
20504 | type: String,
|
20505 | attribute: 'schema-style'
|
20506 | },
|
20507 | schemaExpandLevel: {
|
20508 | type: Number,
|
20509 | attribute: 'schema-expand-level'
|
20510 | },
|
20511 | schemaDescriptionExpanded: {
|
20512 | type: String,
|
20513 | attribute: 'schema-description-expanded'
|
20514 | },
|
20515 | allowSchemaDescriptionExpandToggle: {
|
20516 | type: String,
|
20517 | attribute: 'allow-schema-description-expand-toggle'
|
20518 | },
|
20519 |
|
20520 | showHeader: {
|
20521 | type: String,
|
20522 | attribute: 'show-header'
|
20523 | },
|
20524 | showSideNav: {
|
20525 | type: String,
|
20526 | attribute: 'show-side-nav'
|
20527 | },
|
20528 | showInfo: {
|
20529 | type: String,
|
20530 | attribute: 'show-info'
|
20531 | },
|
20532 |
|
20533 | allowSpecUrlLoad: {
|
20534 | type: String,
|
20535 | attribute: 'allow-spec-url-load'
|
20536 | },
|
20537 | allowSpecFileLoad: {
|
20538 | type: String,
|
20539 | attribute: 'allow-spec-file-load'
|
20540 | },
|
20541 | allowSpecFileDownload: {
|
20542 | type: String,
|
20543 | attribute: 'allow-spec-file-download'
|
20544 | },
|
20545 | allowSearch: {
|
20546 | type: String,
|
20547 | attribute: 'allow-search'
|
20548 | },
|
20549 |
|
20550 | theme: {
|
20551 | type: String
|
20552 | },
|
20553 | bgColor: {
|
20554 | type: String,
|
20555 | attribute: 'bg-color'
|
20556 | },
|
20557 | textColor: {
|
20558 | type: String,
|
20559 | attribute: 'text-color'
|
20560 | },
|
20561 | primaryColor: {
|
20562 | type: String,
|
20563 | attribute: 'primary-color'
|
20564 | },
|
20565 | fontSize: {
|
20566 | type: String,
|
20567 | attribute: 'font-size'
|
20568 | },
|
20569 | regularFont: {
|
20570 | type: String,
|
20571 | attribute: 'regular-font'
|
20572 | },
|
20573 | monoFont: {
|
20574 | type: String,
|
20575 | attribute: 'mono-font'
|
20576 | },
|
20577 | loadFonts: {
|
20578 | type: String,
|
20579 | attribute: 'load-fonts'
|
20580 | },
|
20581 |
|
20582 | loading: {
|
20583 | type: Boolean
|
20584 | }
|
20585 | };
|
20586 | }
|
20587 |
|
20588 | static get styles() {
|
20589 | return [font_styles, input_styles, flex_styles, table_styles, endpoint_styles, prism_styles, tab_styles, nav_styles, info_styles, i`
|
20590 | :host {
|
20591 | display:flex;
|
20592 | flex-direction: column;
|
20593 | min-width:360px;
|
20594 | width:100%;
|
20595 | height:100%;
|
20596 | margin:0;
|
20597 | padding:0;
|
20598 | overflow: hidden;
|
20599 | letter-spacing:normal;
|
20600 | color:var(--fg);
|
20601 | background-color:var(--bg);
|
20602 | font-family:var(--font-regular);
|
20603 | }
|
20604 | .body {
|
20605 | display:flex;
|
20606 | height:100%;
|
20607 | width:100%;
|
20608 | overflow:hidden;
|
20609 | }
|
20610 | .nav-bar {
|
20611 | width: 230px;
|
20612 | display:flex;
|
20613 | }
|
20614 |
|
20615 | .main-content {
|
20616 | margin:0;
|
20617 | padding: 16px;
|
20618 | display:block;
|
20619 | flex:1;
|
20620 | height:100%;
|
20621 | overflow-y: auto;
|
20622 | overflow-x: hidden;
|
20623 | scrollbar-width: thin;
|
20624 | scrollbar-color: var(--border-color) transparent;
|
20625 | }
|
20626 | .main-content-inner--view-mode {
|
20627 | padding: 0 8px;
|
20628 | }
|
20629 | .main-content::-webkit-scrollbar {
|
20630 | width: 8px;
|
20631 | height: 8px;
|
20632 | }
|
20633 | .main-content::-webkit-scrollbar-track {
|
20634 | background:transparent;
|
20635 | }
|
20636 | .main-content::-webkit-scrollbar-thumb {
|
20637 | background-color: var(--border-color);
|
20638 | }
|
20639 | .main-header {
|
20640 | background-color:var(--header-bg);
|
20641 | color:var(--header-fg);
|
20642 | width:100%;
|
20643 | }
|
20644 | .header-title {
|
20645 | font-size:calc(var(--font-size-regular) + 8px);
|
20646 | padding:0 8px;
|
20647 | }
|
20648 | input.header-input{
|
20649 | background:var(--header-color-darker);
|
20650 | color:var(--header-fg);
|
20651 | border:1px solid var(--header-color-border);
|
20652 | flex:1;
|
20653 | padding-right:24px;
|
20654 | border-radius:3px;
|
20655 | }
|
20656 | input.header-input::placeholder {
|
20657 | opacity:0.4;
|
20658 | }
|
20659 | .loader {
|
20660 | margin: 16px auto 16px auto;
|
20661 | border: 4px solid var(--bg3);
|
20662 | border-radius: 50%;
|
20663 | border-top: 4px solid var(--primary-color);
|
20664 | width: 36px;
|
20665 | height: 36px;
|
20666 | animation: spin 2s linear infinite;
|
20667 | }
|
20668 | @media only screen and (min-width: 768px) {
|
20669 | .only-large-screen{
|
20670 | display:block;
|
20671 | }
|
20672 | .only-large-screen-flex{
|
20673 | display:flex;
|
20674 | }
|
20675 | }`];
|
20676 | }
|
20677 |
|
20678 |
|
20679 | connectedCallback() {
|
20680 | super.connectedCallback();
|
20681 | const parent = this.parentElement;
|
20682 | if (parent) {
|
20683 | if (parent.offsetWidth === 0 && parent.style.width === '') {
|
20684 | parent.style.width = '100vw';
|
20685 | }
|
20686 | if (parent.offsetHeight === 0 && parent.style.height === '') {
|
20687 | parent.style.height = '100vh';
|
20688 | }
|
20689 | if (parent.tagName === 'BODY') {
|
20690 | if (!parent.style.marginTop) {
|
20691 | parent.style.marginTop = '0';
|
20692 | }
|
20693 | if (!parent.style.marginRight) {
|
20694 | parent.style.marginRight = '0';
|
20695 | }
|
20696 | if (!parent.style.marginBottom) {
|
20697 | parent.style.marginBottom = '0';
|
20698 | }
|
20699 | if (!parent.style.marginLeft) {
|
20700 | parent.style.marginLeft = '0';
|
20701 | }
|
20702 | }
|
20703 | }
|
20704 | if (this.loadFonts !== 'false') {
|
20705 | const fontDescriptor = {
|
20706 | family: 'Open Sans',
|
20707 | style: 'normal',
|
20708 | weight: '300',
|
20709 | 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'
|
20710 | };
|
20711 | const fontWeight300 = new FontFace('Open Sans', "url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UN_r8OUuhpKKSTjw.woff2) format('woff2')", fontDescriptor);
|
20712 | fontDescriptor.weight = '600';
|
20713 | const fontWeight600 = new FontFace('Open Sans', "url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UNirkOUuhpKKSTjw.woff2) format('woff2')", fontDescriptor);
|
20714 | fontWeight300.load().then(font => {
|
20715 | document.fonts.add(font);
|
20716 | });
|
20717 | fontWeight600.load().then(font => {
|
20718 | document.fonts.add(font);
|
20719 | });
|
20720 | }
|
20721 | this.renderStyle = 'focused';
|
20722 | this.pathsExpanded = this.pathsExpanded === 'true';
|
20723 | if (!this.showInfo || !'true, false,'.includes(`${this.showInfo},`)) {
|
20724 | this.showInfo = 'true';
|
20725 | }
|
20726 | if (!this.showSideNav || !'true false'.includes(this.showSideNav)) {
|
20727 | this.showSideNav = 'true';
|
20728 | }
|
20729 | if (!this.showHeader || !'true, false,'.includes(`${this.showHeader},`)) {
|
20730 | this.showHeader = 'true';
|
20731 | }
|
20732 | if (!this.schemaStyle || !'tree, table,'.includes(`${this.schemaStyle},`)) {
|
20733 | this.schemaStyle = 'tree';
|
20734 | }
|
20735 | if (!this.theme || !'light, dark,'.includes(`${this.theme},`)) {
|
20736 | this.theme = window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
|
20737 | }
|
20738 | if (!this.allowSearch || !'true, false,'.includes(`${this.allowSearch},`)) {
|
20739 | this.allowSearch = 'true';
|
20740 | }
|
20741 | if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) {
|
20742 | this.schemaExpandLevel = 99999;
|
20743 | }
|
20744 | if (!this.schemaDescriptionExpanded || !'true, false,'.includes(`${this.schemaDescriptionExpanded},`)) {
|
20745 | this.schemaDescriptionExpanded = 'false';
|
20746 | }
|
20747 | if (!this.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) {
|
20748 | this.fontSize = 'default';
|
20749 | }
|
20750 | if (!this.matchType || !'includes regex'.includes(this.matchType)) {
|
20751 | this.matchType = 'includes';
|
20752 | }
|
20753 | if (!this.allowSchemaDescriptionExpandToggle || !'true, false,'.includes(`${this.allowSchemaDescriptionExpandToggle},`)) {
|
20754 | this.allowSchemaDescriptionExpandToggle = 'true';
|
20755 | }
|
20756 | marked.setOptions({
|
20757 | highlight: (code, lang) => {
|
20758 | if ((prism_default()).languages[lang]) {
|
20759 | return prism_default().highlight(code, (prism_default()).languages[lang], lang);
|
20760 | }
|
20761 | return code;
|
20762 | }
|
20763 | });
|
20764 | }
|
20765 | render() {
|
20766 | return jsonSchemaViewerTemplate.call(this, true, false, false, this.pathsExpanded);
|
20767 | }
|
20768 | attributeChangedCallback(name, oldVal, newVal) {
|
20769 | if (name === 'spec-url') {
|
20770 | if (oldVal !== newVal) {
|
20771 |
|
20772 | window.setTimeout(async () => {
|
20773 | await this.loadSpec(newVal);
|
20774 | }, 0);
|
20775 | }
|
20776 | }
|
20777 | super.attributeChangedCallback(name, oldVal, newVal);
|
20778 | }
|
20779 | onSpecUrlChange() {
|
20780 | this.setAttribute('spec-url', this.shadowRoot.getElementById('spec-url').value);
|
20781 | }
|
20782 | onSearchChange(e) {
|
20783 |
|
20784 | this.matchPaths = e.target.value;
|
20785 | }
|
20786 |
|
20787 |
|
20788 | async loadSpec(specUrl) {
|
20789 | if (!specUrl) {
|
20790 | return;
|
20791 | }
|
20792 | try {
|
20793 | this.resolvedSpec = {
|
20794 | specLoadError: false,
|
20795 | isSpecLoading: true,
|
20796 | tags: []
|
20797 | };
|
20798 | this.loading = true;
|
20799 | this.loadFailed = false;
|
20800 | this.requestUpdate();
|
20801 | const spec = await ProcessSpec.call(this, specUrl, this.generateMissingTags === 'true', this.sortTags === 'true', this.getAttribute('sort-endpoints-by'));
|
20802 | this.loading = false;
|
20803 | this.afterSpecParsedAndValidated(spec);
|
20804 | } catch (err) {
|
20805 | this.loading = false;
|
20806 | this.loadFailed = true;
|
20807 | this.resolvedSpec = null;
|
20808 | console.error(`RapiDoc: Unable to resolve the API spec.. ${err.message}`);
|
20809 | }
|
20810 | }
|
20811 |
|
20812 | async afterSpecParsedAndValidated(spec) {
|
20813 | this.resolvedSpec = spec;
|
20814 | const specLoadedEvent = new CustomEvent('spec-loaded', {
|
20815 | detail: spec
|
20816 | });
|
20817 | this.dispatchEvent(specLoadedEvent);
|
20818 | }
|
20819 |
|
20820 |
|
20821 | handleHref(e) {
|
20822 | if (e.target.tagName.toLowerCase() === 'a') {
|
20823 | if (e.target.getAttribute('href').startsWith('#')) {
|
20824 | const gotoEl = this.shadowRoot.getElementById(e.target.getAttribute('href').replace('#', ''));
|
20825 | if (gotoEl) {
|
20826 | gotoEl.scrollIntoView({
|
20827 | behavior: 'auto',
|
20828 | block: 'start'
|
20829 | });
|
20830 | }
|
20831 | }
|
20832 | }
|
20833 | }
|
20834 |
|
20835 |
|
20836 | onSelectExample(e) {
|
20837 | const exampleContainerEl = e.target.closest('.json-schema-example-panel');
|
20838 | const exampleEls = [...exampleContainerEl.querySelectorAll('.example')];
|
20839 | exampleEls.forEach(v => {
|
20840 | v.style.display = v.dataset.example === e.target.value ? 'flex' : 'none';
|
20841 | });
|
20842 | }
|
20843 | async scrollToEventTarget(event) {
|
20844 | const navEl = event.currentTarget;
|
20845 | if (!navEl.dataset.contentId) {
|
20846 | return;
|
20847 | }
|
20848 | const contentEl = this.shadowRoot.getElementById(navEl.dataset.contentId);
|
20849 | if (contentEl) {
|
20850 | contentEl.scrollIntoView({
|
20851 | behavior: 'auto',
|
20852 | block: 'start'
|
20853 | });
|
20854 | }
|
20855 | }
|
20856 | }
|
20857 | customElements.define('json-schema-viewer', JsonSchemaViewer);
|
20858 | ;
|
20859 |
|
20860 |
|
20861 |
|
20862 |
|
20863 | const src = ({
|
20864 | RapiDoc: RapiDoc
|
20865 | });
|
20866 |
|
20867 |
|
20868 | }),
|
20869 |
|
20870 | 742:
|
20871 | ((__unused_webpack_module, exports) => {
|
20872 |
|
20873 | "use strict";
|
20874 |
|
20875 |
|
20876 | exports.byteLength = byteLength
|
20877 | exports.toByteArray = toByteArray
|
20878 | exports.fromByteArray = fromByteArray
|
20879 |
|
20880 | var lookup = []
|
20881 | var revLookup = []
|
20882 | var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
20883 |
|
20884 | var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
20885 | for (var i = 0, len = code.length; i < len; ++i) {
|
20886 | lookup[i] = code[i]
|
20887 | revLookup[code.charCodeAt(i)] = i
|
20888 | }
|
20889 |
|
20890 |
|
20891 |
|
20892 | revLookup['-'.charCodeAt(0)] = 62
|
20893 | revLookup['_'.charCodeAt(0)] = 63
|
20894 |
|
20895 | function getLens (b64) {
|
20896 | var len = b64.length
|
20897 |
|
20898 | if (len % 4 > 0) {
|
20899 | throw new Error('Invalid string. Length must be a multiple of 4')
|
20900 | }
|
20901 |
|
20902 |
|
20903 |
|
20904 | var validLen = b64.indexOf('=')
|
20905 | if (validLen === -1) validLen = len
|
20906 |
|
20907 | var placeHoldersLen = validLen === len
|
20908 | ? 0
|
20909 | : 4 - (validLen % 4)
|
20910 |
|
20911 | return [validLen, placeHoldersLen]
|
20912 | }
|
20913 |
|
20914 |
|
20915 | function byteLength (b64) {
|
20916 | var lens = getLens(b64)
|
20917 | var validLen = lens[0]
|
20918 | var placeHoldersLen = lens[1]
|
20919 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
20920 | }
|
20921 |
|
20922 | function _byteLength (b64, validLen, placeHoldersLen) {
|
20923 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
20924 | }
|
20925 |
|
20926 | function toByteArray (b64) {
|
20927 | var tmp
|
20928 | var lens = getLens(b64)
|
20929 | var validLen = lens[0]
|
20930 | var placeHoldersLen = lens[1]
|
20931 |
|
20932 | var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
20933 |
|
20934 | var curByte = 0
|
20935 |
|
20936 |
|
20937 | var len = placeHoldersLen > 0
|
20938 | ? validLen - 4
|
20939 | : validLen
|
20940 |
|
20941 | var i
|
20942 | for (i = 0; i < len; i += 4) {
|
20943 | tmp =
|
20944 | (revLookup[b64.charCodeAt(i)] << 18) |
|
20945 | (revLookup[b64.charCodeAt(i + 1)] << 12) |
|
20946 | (revLookup[b64.charCodeAt(i + 2)] << 6) |
|
20947 | revLookup[b64.charCodeAt(i + 3)]
|
20948 | arr[curByte++] = (tmp >> 16) & 0xFF
|
20949 | arr[curByte++] = (tmp >> 8) & 0xFF
|
20950 | arr[curByte++] = tmp & 0xFF
|
20951 | }
|
20952 |
|
20953 | if (placeHoldersLen === 2) {
|
20954 | tmp =
|
20955 | (revLookup[b64.charCodeAt(i)] << 2) |
|
20956 | (revLookup[b64.charCodeAt(i + 1)] >> 4)
|
20957 | arr[curByte++] = tmp & 0xFF
|
20958 | }
|
20959 |
|
20960 | if (placeHoldersLen === 1) {
|
20961 | tmp =
|
20962 | (revLookup[b64.charCodeAt(i)] << 10) |
|
20963 | (revLookup[b64.charCodeAt(i + 1)] << 4) |
|
20964 | (revLookup[b64.charCodeAt(i + 2)] >> 2)
|
20965 | arr[curByte++] = (tmp >> 8) & 0xFF
|
20966 | arr[curByte++] = tmp & 0xFF
|
20967 | }
|
20968 |
|
20969 | return arr
|
20970 | }
|
20971 |
|
20972 | function tripletToBase64 (num) {
|
20973 | return lookup[num >> 18 & 0x3F] +
|
20974 | lookup[num >> 12 & 0x3F] +
|
20975 | lookup[num >> 6 & 0x3F] +
|
20976 | lookup[num & 0x3F]
|
20977 | }
|
20978 |
|
20979 | function encodeChunk (uint8, start, end) {
|
20980 | var tmp
|
20981 | var output = []
|
20982 | for (var i = start; i < end; i += 3) {
|
20983 | tmp =
|
20984 | ((uint8[i] << 16) & 0xFF0000) +
|
20985 | ((uint8[i + 1] << 8) & 0xFF00) +
|
20986 | (uint8[i + 2] & 0xFF)
|
20987 | output.push(tripletToBase64(tmp))
|
20988 | }
|
20989 | return output.join('')
|
20990 | }
|
20991 |
|
20992 | function fromByteArray (uint8) {
|
20993 | var tmp
|
20994 | var len = uint8.length
|
20995 | var extraBytes = len % 3
|
20996 | var parts = []
|
20997 | var maxChunkLength = 16383
|
20998 |
|
20999 |
|
21000 | for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
21001 | parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
21002 | }
|
21003 |
|
21004 |
|
21005 | if (extraBytes === 1) {
|
21006 | tmp = uint8[len - 1]
|
21007 | parts.push(
|
21008 | lookup[tmp >> 2] +
|
21009 | lookup[(tmp << 4) & 0x3F] +
|
21010 | '=='
|
21011 | )
|
21012 | } else if (extraBytes === 2) {
|
21013 | tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
21014 | parts.push(
|
21015 | lookup[tmp >> 10] +
|
21016 | lookup[(tmp >> 4) & 0x3F] +
|
21017 | lookup[(tmp << 2) & 0x3F] +
|
21018 | '='
|
21019 | )
|
21020 | }
|
21021 |
|
21022 | return parts.join('')
|
21023 | }
|
21024 |
|
21025 |
|
21026 | }),
|
21027 |
|
21028 | 764:
|
21029 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
21030 |
|
21031 | "use strict";
|
21032 | var __webpack_unused_export__;
|
21033 |
|
21034 |
|
21035 |
|
21036 |
|
21037 |
|
21038 |
|
21039 |
|
21040 |
|
21041 |
|
21042 |
|
21043 | const base64 = __webpack_require__(742)
|
21044 | const ieee754 = __webpack_require__(645)
|
21045 | const customInspectSymbol =
|
21046 | (typeof Symbol === 'function' && typeof Symbol['for'] === 'function')
|
21047 | ? Symbol['for']('nodejs.util.inspect.custom')
|
21048 | : null
|
21049 |
|
21050 | exports.lW = Buffer
|
21051 | __webpack_unused_export__ = SlowBuffer
|
21052 | exports.h2 = 50
|
21053 |
|
21054 | const K_MAX_LENGTH = 0x7fffffff
|
21055 | __webpack_unused_export__ = K_MAX_LENGTH
|
21056 |
|
21057 |
|
21058 |
|
21059 |
|
21060 |
|
21061 |
|
21062 |
|
21063 |
|
21064 |
|
21065 |
|
21066 |
|
21067 |
|
21068 |
|
21069 |
|
21070 |
|
21071 | Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
|
21072 |
|
21073 | if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
|
21074 | typeof console.error === 'function') {
|
21075 | console.error(
|
21076 | 'This browser lacks typed array (Uint8Array) support which is required by ' +
|
21077 | '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
|
21078 | )
|
21079 | }
|
21080 |
|
21081 | function typedArraySupport () {
|
21082 |
|
21083 | try {
|
21084 | const arr = new Uint8Array(1)
|
21085 | const proto = { foo: function () { return 42 } }
|
21086 | Object.setPrototypeOf(proto, Uint8Array.prototype)
|
21087 | Object.setPrototypeOf(arr, proto)
|
21088 | return arr.foo() === 42
|
21089 | } catch (e) {
|
21090 | return false
|
21091 | }
|
21092 | }
|
21093 |
|
21094 | Object.defineProperty(Buffer.prototype, 'parent', {
|
21095 | enumerable: true,
|
21096 | get: function () {
|
21097 | if (!Buffer.isBuffer(this)) return undefined
|
21098 | return this.buffer
|
21099 | }
|
21100 | })
|
21101 |
|
21102 | Object.defineProperty(Buffer.prototype, 'offset', {
|
21103 | enumerable: true,
|
21104 | get: function () {
|
21105 | if (!Buffer.isBuffer(this)) return undefined
|
21106 | return this.byteOffset
|
21107 | }
|
21108 | })
|
21109 |
|
21110 | function createBuffer (length) {
|
21111 | if (length > K_MAX_LENGTH) {
|
21112 | throw new RangeError('The value "' + length + '" is invalid for option "size"')
|
21113 | }
|
21114 |
|
21115 | const buf = new Uint8Array(length)
|
21116 | Object.setPrototypeOf(buf, Buffer.prototype)
|
21117 | return buf
|
21118 | }
|
21119 |
|
21120 |
|
21121 |
|
21122 |
|
21123 |
|
21124 |
|
21125 |
|
21126 |
|
21127 |
|
21128 |
|
21129 |
|
21130 | function Buffer (arg, encodingOrOffset, length) {
|
21131 |
|
21132 | if (typeof arg === 'number') {
|
21133 | if (typeof encodingOrOffset === 'string') {
|
21134 | throw new TypeError(
|
21135 | 'The "string" argument must be of type string. Received type number'
|
21136 | )
|
21137 | }
|
21138 | return allocUnsafe(arg)
|
21139 | }
|
21140 | return from(arg, encodingOrOffset, length)
|
21141 | }
|
21142 |
|
21143 | Buffer.poolSize = 8192
|
21144 |
|
21145 | function from (value, encodingOrOffset, length) {
|
21146 | if (typeof value === 'string') {
|
21147 | return fromString(value, encodingOrOffset)
|
21148 | }
|
21149 |
|
21150 | if (ArrayBuffer.isView(value)) {
|
21151 | return fromArrayView(value)
|
21152 | }
|
21153 |
|
21154 | if (value == null) {
|
21155 | throw new TypeError(
|
21156 | 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
21157 | 'or Array-like Object. Received type ' + (typeof value)
|
21158 | )
|
21159 | }
|
21160 |
|
21161 | if (isInstance(value, ArrayBuffer) ||
|
21162 | (value && isInstance(value.buffer, ArrayBuffer))) {
|
21163 | return fromArrayBuffer(value, encodingOrOffset, length)
|
21164 | }
|
21165 |
|
21166 | if (typeof SharedArrayBuffer !== 'undefined' &&
|
21167 | (isInstance(value, SharedArrayBuffer) ||
|
21168 | (value && isInstance(value.buffer, SharedArrayBuffer)))) {
|
21169 | return fromArrayBuffer(value, encodingOrOffset, length)
|
21170 | }
|
21171 |
|
21172 | if (typeof value === 'number') {
|
21173 | throw new TypeError(
|
21174 | 'The "value" argument must not be of type number. Received type number'
|
21175 | )
|
21176 | }
|
21177 |
|
21178 | const valueOf = value.valueOf && value.valueOf()
|
21179 | if (valueOf != null && valueOf !== value) {
|
21180 | return Buffer.from(valueOf, encodingOrOffset, length)
|
21181 | }
|
21182 |
|
21183 | const b = fromObject(value)
|
21184 | if (b) return b
|
21185 |
|
21186 | if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
|
21187 | typeof value[Symbol.toPrimitive] === 'function') {
|
21188 | return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)
|
21189 | }
|
21190 |
|
21191 | throw new TypeError(
|
21192 | 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
21193 | 'or Array-like Object. Received type ' + (typeof value)
|
21194 | )
|
21195 | }
|
21196 |
|
21197 |
|
21198 |
|
21199 |
|
21200 |
|
21201 |
|
21202 |
|
21203 |
|
21204 |
|
21205 | Buffer.from = function (value, encodingOrOffset, length) {
|
21206 | return from(value, encodingOrOffset, length)
|
21207 | }
|
21208 |
|
21209 |
|
21210 |
|
21211 | Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)
|
21212 | Object.setPrototypeOf(Buffer, Uint8Array)
|
21213 |
|
21214 | function assertSize (size) {
|
21215 | if (typeof size !== 'number') {
|
21216 | throw new TypeError('"size" argument must be of type number')
|
21217 | } else if (size < 0) {
|
21218 | throw new RangeError('The value "' + size + '" is invalid for option "size"')
|
21219 | }
|
21220 | }
|
21221 |
|
21222 | function alloc (size, fill, encoding) {
|
21223 | assertSize(size)
|
21224 | if (size <= 0) {
|
21225 | return createBuffer(size)
|
21226 | }
|
21227 | if (fill !== undefined) {
|
21228 |
|
21229 |
|
21230 |
|
21231 | return typeof encoding === 'string'
|
21232 | ? createBuffer(size).fill(fill, encoding)
|
21233 | : createBuffer(size).fill(fill)
|
21234 | }
|
21235 | return createBuffer(size)
|
21236 | }
|
21237 |
|
21238 |
|
21239 |
|
21240 |
|
21241 |
|
21242 | Buffer.alloc = function (size, fill, encoding) {
|
21243 | return alloc(size, fill, encoding)
|
21244 | }
|
21245 |
|
21246 | function allocUnsafe (size) {
|
21247 | assertSize(size)
|
21248 | return createBuffer(size < 0 ? 0 : checked(size) | 0)
|
21249 | }
|
21250 |
|
21251 |
|
21252 |
|
21253 |
|
21254 | Buffer.allocUnsafe = function (size) {
|
21255 | return allocUnsafe(size)
|
21256 | }
|
21257 |
|
21258 |
|
21259 |
|
21260 | Buffer.allocUnsafeSlow = function (size) {
|
21261 | return allocUnsafe(size)
|
21262 | }
|
21263 |
|
21264 | function fromString (string, encoding) {
|
21265 | if (typeof encoding !== 'string' || encoding === '') {
|
21266 | encoding = 'utf8'
|
21267 | }
|
21268 |
|
21269 | if (!Buffer.isEncoding(encoding)) {
|
21270 | throw new TypeError('Unknown encoding: ' + encoding)
|
21271 | }
|
21272 |
|
21273 | const length = byteLength(string, encoding) | 0
|
21274 | let buf = createBuffer(length)
|
21275 |
|
21276 | const actual = buf.write(string, encoding)
|
21277 |
|
21278 | if (actual !== length) {
|
21279 |
|
21280 |
|
21281 |
|
21282 | buf = buf.slice(0, actual)
|
21283 | }
|
21284 |
|
21285 | return buf
|
21286 | }
|
21287 |
|
21288 | function fromArrayLike (array) {
|
21289 | const length = array.length < 0 ? 0 : checked(array.length) | 0
|
21290 | const buf = createBuffer(length)
|
21291 | for (let i = 0; i < length; i += 1) {
|
21292 | buf[i] = array[i] & 255
|
21293 | }
|
21294 | return buf
|
21295 | }
|
21296 |
|
21297 | function fromArrayView (arrayView) {
|
21298 | if (isInstance(arrayView, Uint8Array)) {
|
21299 | const copy = new Uint8Array(arrayView)
|
21300 | return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
|
21301 | }
|
21302 | return fromArrayLike(arrayView)
|
21303 | }
|
21304 |
|
21305 | function fromArrayBuffer (array, byteOffset, length) {
|
21306 | if (byteOffset < 0 || array.byteLength < byteOffset) {
|
21307 | throw new RangeError('"offset" is outside of buffer bounds')
|
21308 | }
|
21309 |
|
21310 | if (array.byteLength < byteOffset + (length || 0)) {
|
21311 | throw new RangeError('"length" is outside of buffer bounds')
|
21312 | }
|
21313 |
|
21314 | let buf
|
21315 | if (byteOffset === undefined && length === undefined) {
|
21316 | buf = new Uint8Array(array)
|
21317 | } else if (length === undefined) {
|
21318 | buf = new Uint8Array(array, byteOffset)
|
21319 | } else {
|
21320 | buf = new Uint8Array(array, byteOffset, length)
|
21321 | }
|
21322 |
|
21323 |
|
21324 | Object.setPrototypeOf(buf, Buffer.prototype)
|
21325 |
|
21326 | return buf
|
21327 | }
|
21328 |
|
21329 | function fromObject (obj) {
|
21330 | if (Buffer.isBuffer(obj)) {
|
21331 | const len = checked(obj.length) | 0
|
21332 | const buf = createBuffer(len)
|
21333 |
|
21334 | if (buf.length === 0) {
|
21335 | return buf
|
21336 | }
|
21337 |
|
21338 | obj.copy(buf, 0, 0, len)
|
21339 | return buf
|
21340 | }
|
21341 |
|
21342 | if (obj.length !== undefined) {
|
21343 | if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
|
21344 | return createBuffer(0)
|
21345 | }
|
21346 | return fromArrayLike(obj)
|
21347 | }
|
21348 |
|
21349 | if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
|
21350 | return fromArrayLike(obj.data)
|
21351 | }
|
21352 | }
|
21353 |
|
21354 | function checked (length) {
|
21355 |
|
21356 |
|
21357 | if (length >= K_MAX_LENGTH) {
|
21358 | throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
21359 | 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
|
21360 | }
|
21361 | return length | 0
|
21362 | }
|
21363 |
|
21364 | function SlowBuffer (length) {
|
21365 | if (+length != length) {
|
21366 | length = 0
|
21367 | }
|
21368 | return Buffer.alloc(+length)
|
21369 | }
|
21370 |
|
21371 | Buffer.isBuffer = function isBuffer (b) {
|
21372 | return b != null && b._isBuffer === true &&
|
21373 | b !== Buffer.prototype
|
21374 | }
|
21375 |
|
21376 | Buffer.compare = function compare (a, b) {
|
21377 | if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
|
21378 | if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
|
21379 | if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
21380 | throw new TypeError(
|
21381 | 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
21382 | )
|
21383 | }
|
21384 |
|
21385 | if (a === b) return 0
|
21386 |
|
21387 | let x = a.length
|
21388 | let y = b.length
|
21389 |
|
21390 | for (let i = 0, len = Math.min(x, y); i < len; ++i) {
|
21391 | if (a[i] !== b[i]) {
|
21392 | x = a[i]
|
21393 | y = b[i]
|
21394 | break
|
21395 | }
|
21396 | }
|
21397 |
|
21398 | if (x < y) return -1
|
21399 | if (y < x) return 1
|
21400 | return 0
|
21401 | }
|
21402 |
|
21403 | Buffer.isEncoding = function isEncoding (encoding) {
|
21404 | switch (String(encoding).toLowerCase()) {
|
21405 | case 'hex':
|
21406 | case 'utf8':
|
21407 | case 'utf-8':
|
21408 | case 'ascii':
|
21409 | case 'latin1':
|
21410 | case 'binary':
|
21411 | case 'base64':
|
21412 | case 'ucs2':
|
21413 | case 'ucs-2':
|
21414 | case 'utf16le':
|
21415 | case 'utf-16le':
|
21416 | return true
|
21417 | default:
|
21418 | return false
|
21419 | }
|
21420 | }
|
21421 |
|
21422 | Buffer.concat = function concat (list, length) {
|
21423 | if (!Array.isArray(list)) {
|
21424 | throw new TypeError('"list" argument must be an Array of Buffers')
|
21425 | }
|
21426 |
|
21427 | if (list.length === 0) {
|
21428 | return Buffer.alloc(0)
|
21429 | }
|
21430 |
|
21431 | let i
|
21432 | if (length === undefined) {
|
21433 | length = 0
|
21434 | for (i = 0; i < list.length; ++i) {
|
21435 | length += list[i].length
|
21436 | }
|
21437 | }
|
21438 |
|
21439 | const buffer = Buffer.allocUnsafe(length)
|
21440 | let pos = 0
|
21441 | for (i = 0; i < list.length; ++i) {
|
21442 | let buf = list[i]
|
21443 | if (isInstance(buf, Uint8Array)) {
|
21444 | if (pos + buf.length > buffer.length) {
|
21445 | if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)
|
21446 | buf.copy(buffer, pos)
|
21447 | } else {
|
21448 | Uint8Array.prototype.set.call(
|
21449 | buffer,
|
21450 | buf,
|
21451 | pos
|
21452 | )
|
21453 | }
|
21454 | } else if (!Buffer.isBuffer(buf)) {
|
21455 | throw new TypeError('"list" argument must be an Array of Buffers')
|
21456 | } else {
|
21457 | buf.copy(buffer, pos)
|
21458 | }
|
21459 | pos += buf.length
|
21460 | }
|
21461 | return buffer
|
21462 | }
|
21463 |
|
21464 | function byteLength (string, encoding) {
|
21465 | if (Buffer.isBuffer(string)) {
|
21466 | return string.length
|
21467 | }
|
21468 | if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
|
21469 | return string.byteLength
|
21470 | }
|
21471 | if (typeof string !== 'string') {
|
21472 | throw new TypeError(
|
21473 | 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
|
21474 | 'Received type ' + typeof string
|
21475 | )
|
21476 | }
|
21477 |
|
21478 | const len = string.length
|
21479 | const mustMatch = (arguments.length > 2 && arguments[2] === true)
|
21480 | if (!mustMatch && len === 0) return 0
|
21481 |
|
21482 |
|
21483 | let loweredCase = false
|
21484 | for (;;) {
|
21485 | switch (encoding) {
|
21486 | case 'ascii':
|
21487 | case 'latin1':
|
21488 | case 'binary':
|
21489 | return len
|
21490 | case 'utf8':
|
21491 | case 'utf-8':
|
21492 | return utf8ToBytes(string).length
|
21493 | case 'ucs2':
|
21494 | case 'ucs-2':
|
21495 | case 'utf16le':
|
21496 | case 'utf-16le':
|
21497 | return len * 2
|
21498 | case 'hex':
|
21499 | return len >>> 1
|
21500 | case 'base64':
|
21501 | return base64ToBytes(string).length
|
21502 | default:
|
21503 | if (loweredCase) {
|
21504 | return mustMatch ? -1 : utf8ToBytes(string).length
|
21505 | }
|
21506 | encoding = ('' + encoding).toLowerCase()
|
21507 | loweredCase = true
|
21508 | }
|
21509 | }
|
21510 | }
|
21511 | Buffer.byteLength = byteLength
|
21512 |
|
21513 | function slowToString (encoding, start, end) {
|
21514 | let loweredCase = false
|
21515 |
|
21516 |
|
21517 |
|
21518 |
|
21519 |
|
21520 |
|
21521 |
|
21522 |
|
21523 | if (start === undefined || start < 0) {
|
21524 | start = 0
|
21525 | }
|
21526 |
|
21527 |
|
21528 | if (start > this.length) {
|
21529 | return ''
|
21530 | }
|
21531 |
|
21532 | if (end === undefined || end > this.length) {
|
21533 | end = this.length
|
21534 | }
|
21535 |
|
21536 | if (end <= 0) {
|
21537 | return ''
|
21538 | }
|
21539 |
|
21540 |
|
21541 | end >>>= 0
|
21542 | start >>>= 0
|
21543 |
|
21544 | if (end <= start) {
|
21545 | return ''
|
21546 | }
|
21547 |
|
21548 | if (!encoding) encoding = 'utf8'
|
21549 |
|
21550 | while (true) {
|
21551 | switch (encoding) {
|
21552 | case 'hex':
|
21553 | return hexSlice(this, start, end)
|
21554 |
|
21555 | case 'utf8':
|
21556 | case 'utf-8':
|
21557 | return utf8Slice(this, start, end)
|
21558 |
|
21559 | case 'ascii':
|
21560 | return asciiSlice(this, start, end)
|
21561 |
|
21562 | case 'latin1':
|
21563 | case 'binary':
|
21564 | return latin1Slice(this, start, end)
|
21565 |
|
21566 | case 'base64':
|
21567 | return base64Slice(this, start, end)
|
21568 |
|
21569 | case 'ucs2':
|
21570 | case 'ucs-2':
|
21571 | case 'utf16le':
|
21572 | case 'utf-16le':
|
21573 | return utf16leSlice(this, start, end)
|
21574 |
|
21575 | default:
|
21576 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
21577 | encoding = (encoding + '').toLowerCase()
|
21578 | loweredCase = true
|
21579 | }
|
21580 | }
|
21581 | }
|
21582 |
|
21583 |
|
21584 |
|
21585 |
|
21586 |
|
21587 |
|
21588 |
|
21589 | Buffer.prototype._isBuffer = true
|
21590 |
|
21591 | function swap (b, n, m) {
|
21592 | const i = b[n]
|
21593 | b[n] = b[m]
|
21594 | b[m] = i
|
21595 | }
|
21596 |
|
21597 | Buffer.prototype.swap16 = function swap16 () {
|
21598 | const len = this.length
|
21599 | if (len % 2 !== 0) {
|
21600 | throw new RangeError('Buffer size must be a multiple of 16-bits')
|
21601 | }
|
21602 | for (let i = 0; i < len; i += 2) {
|
21603 | swap(this, i, i + 1)
|
21604 | }
|
21605 | return this
|
21606 | }
|
21607 |
|
21608 | Buffer.prototype.swap32 = function swap32 () {
|
21609 | const len = this.length
|
21610 | if (len % 4 !== 0) {
|
21611 | throw new RangeError('Buffer size must be a multiple of 32-bits')
|
21612 | }
|
21613 | for (let i = 0; i < len; i += 4) {
|
21614 | swap(this, i, i + 3)
|
21615 | swap(this, i + 1, i + 2)
|
21616 | }
|
21617 | return this
|
21618 | }
|
21619 |
|
21620 | Buffer.prototype.swap64 = function swap64 () {
|
21621 | const len = this.length
|
21622 | if (len % 8 !== 0) {
|
21623 | throw new RangeError('Buffer size must be a multiple of 64-bits')
|
21624 | }
|
21625 | for (let i = 0; i < len; i += 8) {
|
21626 | swap(this, i, i + 7)
|
21627 | swap(this, i + 1, i + 6)
|
21628 | swap(this, i + 2, i + 5)
|
21629 | swap(this, i + 3, i + 4)
|
21630 | }
|
21631 | return this
|
21632 | }
|
21633 |
|
21634 | Buffer.prototype.toString = function toString () {
|
21635 | const length = this.length
|
21636 | if (length === 0) return ''
|
21637 | if (arguments.length === 0) return utf8Slice(this, 0, length)
|
21638 | return slowToString.apply(this, arguments)
|
21639 | }
|
21640 |
|
21641 | Buffer.prototype.toLocaleString = Buffer.prototype.toString
|
21642 |
|
21643 | Buffer.prototype.equals = function equals (b) {
|
21644 | if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
21645 | if (this === b) return true
|
21646 | return Buffer.compare(this, b) === 0
|
21647 | }
|
21648 |
|
21649 | Buffer.prototype.inspect = function inspect () {
|
21650 | let str = ''
|
21651 | const max = exports.h2
|
21652 | str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
|
21653 | if (this.length > max) str += ' ... '
|
21654 | return '<Buffer ' + str + '>'
|
21655 | }
|
21656 | if (customInspectSymbol) {
|
21657 | Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect
|
21658 | }
|
21659 |
|
21660 | Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
21661 | if (isInstance(target, Uint8Array)) {
|
21662 | target = Buffer.from(target, target.offset, target.byteLength)
|
21663 | }
|
21664 | if (!Buffer.isBuffer(target)) {
|
21665 | throw new TypeError(
|
21666 | 'The "target" argument must be one of type Buffer or Uint8Array. ' +
|
21667 | 'Received type ' + (typeof target)
|
21668 | )
|
21669 | }
|
21670 |
|
21671 | if (start === undefined) {
|
21672 | start = 0
|
21673 | }
|
21674 | if (end === undefined) {
|
21675 | end = target ? target.length : 0
|
21676 | }
|
21677 | if (thisStart === undefined) {
|
21678 | thisStart = 0
|
21679 | }
|
21680 | if (thisEnd === undefined) {
|
21681 | thisEnd = this.length
|
21682 | }
|
21683 |
|
21684 | if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
21685 | throw new RangeError('out of range index')
|
21686 | }
|
21687 |
|
21688 | if (thisStart >= thisEnd && start >= end) {
|
21689 | return 0
|
21690 | }
|
21691 | if (thisStart >= thisEnd) {
|
21692 | return -1
|
21693 | }
|
21694 | if (start >= end) {
|
21695 | return 1
|
21696 | }
|
21697 |
|
21698 | start >>>= 0
|
21699 | end >>>= 0
|
21700 | thisStart >>>= 0
|
21701 | thisEnd >>>= 0
|
21702 |
|
21703 | if (this === target) return 0
|
21704 |
|
21705 | let x = thisEnd - thisStart
|
21706 | let y = end - start
|
21707 | const len = Math.min(x, y)
|
21708 |
|
21709 | const thisCopy = this.slice(thisStart, thisEnd)
|
21710 | const targetCopy = target.slice(start, end)
|
21711 |
|
21712 | for (let i = 0; i < len; ++i) {
|
21713 | if (thisCopy[i] !== targetCopy[i]) {
|
21714 | x = thisCopy[i]
|
21715 | y = targetCopy[i]
|
21716 | break
|
21717 | }
|
21718 | }
|
21719 |
|
21720 | if (x < y) return -1
|
21721 | if (y < x) return 1
|
21722 | return 0
|
21723 | }
|
21724 |
|
21725 |
|
21726 |
|
21727 |
|
21728 |
|
21729 |
|
21730 |
|
21731 |
|
21732 |
|
21733 |
|
21734 | function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
21735 |
|
21736 | if (buffer.length === 0) return -1
|
21737 |
|
21738 |
|
21739 | if (typeof byteOffset === 'string') {
|
21740 | encoding = byteOffset
|
21741 | byteOffset = 0
|
21742 | } else if (byteOffset > 0x7fffffff) {
|
21743 | byteOffset = 0x7fffffff
|
21744 | } else if (byteOffset < -0x80000000) {
|
21745 | byteOffset = -0x80000000
|
21746 | }
|
21747 | byteOffset = +byteOffset
|
21748 | if (numberIsNaN(byteOffset)) {
|
21749 |
|
21750 | byteOffset = dir ? 0 : (buffer.length - 1)
|
21751 | }
|
21752 |
|
21753 |
|
21754 | if (byteOffset < 0) byteOffset = buffer.length + byteOffset
|
21755 | if (byteOffset >= buffer.length) {
|
21756 | if (dir) return -1
|
21757 | else byteOffset = buffer.length - 1
|
21758 | } else if (byteOffset < 0) {
|
21759 | if (dir) byteOffset = 0
|
21760 | else return -1
|
21761 | }
|
21762 |
|
21763 |
|
21764 | if (typeof val === 'string') {
|
21765 | val = Buffer.from(val, encoding)
|
21766 | }
|
21767 |
|
21768 |
|
21769 | if (Buffer.isBuffer(val)) {
|
21770 |
|
21771 | if (val.length === 0) {
|
21772 | return -1
|
21773 | }
|
21774 | return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
21775 | } else if (typeof val === 'number') {
|
21776 | val = val & 0xFF
|
21777 | if (typeof Uint8Array.prototype.indexOf === 'function') {
|
21778 | if (dir) {
|
21779 | return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
21780 | } else {
|
21781 | return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
21782 | }
|
21783 | }
|
21784 | return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
|
21785 | }
|
21786 |
|
21787 | throw new TypeError('val must be string, number or Buffer')
|
21788 | }
|
21789 |
|
21790 | function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
21791 | let indexSize = 1
|
21792 | let arrLength = arr.length
|
21793 | let valLength = val.length
|
21794 |
|
21795 | if (encoding !== undefined) {
|
21796 | encoding = String(encoding).toLowerCase()
|
21797 | if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
21798 | encoding === 'utf16le' || encoding === 'utf-16le') {
|
21799 | if (arr.length < 2 || val.length < 2) {
|
21800 | return -1
|
21801 | }
|
21802 | indexSize = 2
|
21803 | arrLength /= 2
|
21804 | valLength /= 2
|
21805 | byteOffset /= 2
|
21806 | }
|
21807 | }
|
21808 |
|
21809 | function read (buf, i) {
|
21810 | if (indexSize === 1) {
|
21811 | return buf[i]
|
21812 | } else {
|
21813 | return buf.readUInt16BE(i * indexSize)
|
21814 | }
|
21815 | }
|
21816 |
|
21817 | let i
|
21818 | if (dir) {
|
21819 | let foundIndex = -1
|
21820 | for (i = byteOffset; i < arrLength; i++) {
|
21821 | if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
21822 | if (foundIndex === -1) foundIndex = i
|
21823 | if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
21824 | } else {
|
21825 | if (foundIndex !== -1) i -= i - foundIndex
|
21826 | foundIndex = -1
|
21827 | }
|
21828 | }
|
21829 | } else {
|
21830 | if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
21831 | for (i = byteOffset; i >= 0; i--) {
|
21832 | let found = true
|
21833 | for (let j = 0; j < valLength; j++) {
|
21834 | if (read(arr, i + j) !== read(val, j)) {
|
21835 | found = false
|
21836 | break
|
21837 | }
|
21838 | }
|
21839 | if (found) return i
|
21840 | }
|
21841 | }
|
21842 |
|
21843 | return -1
|
21844 | }
|
21845 |
|
21846 | Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
21847 | return this.indexOf(val, byteOffset, encoding) !== -1
|
21848 | }
|
21849 |
|
21850 | Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
21851 | return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
21852 | }
|
21853 |
|
21854 | Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
21855 | return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
21856 | }
|
21857 |
|
21858 | function hexWrite (buf, string, offset, length) {
|
21859 | offset = Number(offset) || 0
|
21860 | const remaining = buf.length - offset
|
21861 | if (!length) {
|
21862 | length = remaining
|
21863 | } else {
|
21864 | length = Number(length)
|
21865 | if (length > remaining) {
|
21866 | length = remaining
|
21867 | }
|
21868 | }
|
21869 |
|
21870 | const strLen = string.length
|
21871 |
|
21872 | if (length > strLen / 2) {
|
21873 | length = strLen / 2
|
21874 | }
|
21875 | let i
|
21876 | for (i = 0; i < length; ++i) {
|
21877 | const parsed = parseInt(string.substr(i * 2, 2), 16)
|
21878 | if (numberIsNaN(parsed)) return i
|
21879 | buf[offset + i] = parsed
|
21880 | }
|
21881 | return i
|
21882 | }
|
21883 |
|
21884 | function utf8Write (buf, string, offset, length) {
|
21885 | return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
21886 | }
|
21887 |
|
21888 | function asciiWrite (buf, string, offset, length) {
|
21889 | return blitBuffer(asciiToBytes(string), buf, offset, length)
|
21890 | }
|
21891 |
|
21892 | function base64Write (buf, string, offset, length) {
|
21893 | return blitBuffer(base64ToBytes(string), buf, offset, length)
|
21894 | }
|
21895 |
|
21896 | function ucs2Write (buf, string, offset, length) {
|
21897 | return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
21898 | }
|
21899 |
|
21900 | Buffer.prototype.write = function write (string, offset, length, encoding) {
|
21901 |
|
21902 | if (offset === undefined) {
|
21903 | encoding = 'utf8'
|
21904 | length = this.length
|
21905 | offset = 0
|
21906 |
|
21907 | } else if (length === undefined && typeof offset === 'string') {
|
21908 | encoding = offset
|
21909 | length = this.length
|
21910 | offset = 0
|
21911 |
|
21912 | } else if (isFinite(offset)) {
|
21913 | offset = offset >>> 0
|
21914 | if (isFinite(length)) {
|
21915 | length = length >>> 0
|
21916 | if (encoding === undefined) encoding = 'utf8'
|
21917 | } else {
|
21918 | encoding = length
|
21919 | length = undefined
|
21920 | }
|
21921 | } else {
|
21922 | throw new Error(
|
21923 | 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
21924 | )
|
21925 | }
|
21926 |
|
21927 | const remaining = this.length - offset
|
21928 | if (length === undefined || length > remaining) length = remaining
|
21929 |
|
21930 | if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
21931 | throw new RangeError('Attempt to write outside buffer bounds')
|
21932 | }
|
21933 |
|
21934 | if (!encoding) encoding = 'utf8'
|
21935 |
|
21936 | let loweredCase = false
|
21937 | for (;;) {
|
21938 | switch (encoding) {
|
21939 | case 'hex':
|
21940 | return hexWrite(this, string, offset, length)
|
21941 |
|
21942 | case 'utf8':
|
21943 | case 'utf-8':
|
21944 | return utf8Write(this, string, offset, length)
|
21945 |
|
21946 | case 'ascii':
|
21947 | case 'latin1':
|
21948 | case 'binary':
|
21949 | return asciiWrite(this, string, offset, length)
|
21950 |
|
21951 | case 'base64':
|
21952 |
|
21953 | return base64Write(this, string, offset, length)
|
21954 |
|
21955 | case 'ucs2':
|
21956 | case 'ucs-2':
|
21957 | case 'utf16le':
|
21958 | case 'utf-16le':
|
21959 | return ucs2Write(this, string, offset, length)
|
21960 |
|
21961 | default:
|
21962 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
21963 | encoding = ('' + encoding).toLowerCase()
|
21964 | loweredCase = true
|
21965 | }
|
21966 | }
|
21967 | }
|
21968 |
|
21969 | Buffer.prototype.toJSON = function toJSON () {
|
21970 | return {
|
21971 | type: 'Buffer',
|
21972 | data: Array.prototype.slice.call(this._arr || this, 0)
|
21973 | }
|
21974 | }
|
21975 |
|
21976 | function base64Slice (buf, start, end) {
|
21977 | if (start === 0 && end === buf.length) {
|
21978 | return base64.fromByteArray(buf)
|
21979 | } else {
|
21980 | return base64.fromByteArray(buf.slice(start, end))
|
21981 | }
|
21982 | }
|
21983 |
|
21984 | function utf8Slice (buf, start, end) {
|
21985 | end = Math.min(buf.length, end)
|
21986 | const res = []
|
21987 |
|
21988 | let i = start
|
21989 | while (i < end) {
|
21990 | const firstByte = buf[i]
|
21991 | let codePoint = null
|
21992 | let bytesPerSequence = (firstByte > 0xEF)
|
21993 | ? 4
|
21994 | : (firstByte > 0xDF)
|
21995 | ? 3
|
21996 | : (firstByte > 0xBF)
|
21997 | ? 2
|
21998 | : 1
|
21999 |
|
22000 | if (i + bytesPerSequence <= end) {
|
22001 | let secondByte, thirdByte, fourthByte, tempCodePoint
|
22002 |
|
22003 | switch (bytesPerSequence) {
|
22004 | case 1:
|
22005 | if (firstByte < 0x80) {
|
22006 | codePoint = firstByte
|
22007 | }
|
22008 | break
|
22009 | case 2:
|
22010 | secondByte = buf[i + 1]
|
22011 | if ((secondByte & 0xC0) === 0x80) {
|
22012 | tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
|
22013 | if (tempCodePoint > 0x7F) {
|
22014 | codePoint = tempCodePoint
|
22015 | }
|
22016 | }
|
22017 | break
|
22018 | case 3:
|
22019 | secondByte = buf[i + 1]
|
22020 | thirdByte = buf[i + 2]
|
22021 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
22022 | tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
|
22023 | if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
22024 | codePoint = tempCodePoint
|
22025 | }
|
22026 | }
|
22027 | break
|
22028 | case 4:
|
22029 | secondByte = buf[i + 1]
|
22030 | thirdByte = buf[i + 2]
|
22031 | fourthByte = buf[i + 3]
|
22032 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
22033 | tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
|
22034 | if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
22035 | codePoint = tempCodePoint
|
22036 | }
|
22037 | }
|
22038 | }
|
22039 | }
|
22040 |
|
22041 | if (codePoint === null) {
|
22042 |
|
22043 |
|
22044 | codePoint = 0xFFFD
|
22045 | bytesPerSequence = 1
|
22046 | } else if (codePoint > 0xFFFF) {
|
22047 |
|
22048 | codePoint -= 0x10000
|
22049 | res.push(codePoint >>> 10 & 0x3FF | 0xD800)
|
22050 | codePoint = 0xDC00 | codePoint & 0x3FF
|
22051 | }
|
22052 |
|
22053 | res.push(codePoint)
|
22054 | i += bytesPerSequence
|
22055 | }
|
22056 |
|
22057 | return decodeCodePointsArray(res)
|
22058 | }
|
22059 |
|
22060 |
|
22061 |
|
22062 |
|
22063 | const MAX_ARGUMENTS_LENGTH = 0x1000
|
22064 |
|
22065 | function decodeCodePointsArray (codePoints) {
|
22066 | const len = codePoints.length
|
22067 | if (len <= MAX_ARGUMENTS_LENGTH) {
|
22068 | return String.fromCharCode.apply(String, codePoints)
|
22069 | }
|
22070 |
|
22071 |
|
22072 | let res = ''
|
22073 | let i = 0
|
22074 | while (i < len) {
|
22075 | res += String.fromCharCode.apply(
|
22076 | String,
|
22077 | codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
22078 | )
|
22079 | }
|
22080 | return res
|
22081 | }
|
22082 |
|
22083 | function asciiSlice (buf, start, end) {
|
22084 | let ret = ''
|
22085 | end = Math.min(buf.length, end)
|
22086 |
|
22087 | for (let i = start; i < end; ++i) {
|
22088 | ret += String.fromCharCode(buf[i] & 0x7F)
|
22089 | }
|
22090 | return ret
|
22091 | }
|
22092 |
|
22093 | function latin1Slice (buf, start, end) {
|
22094 | let ret = ''
|
22095 | end = Math.min(buf.length, end)
|
22096 |
|
22097 | for (let i = start; i < end; ++i) {
|
22098 | ret += String.fromCharCode(buf[i])
|
22099 | }
|
22100 | return ret
|
22101 | }
|
22102 |
|
22103 | function hexSlice (buf, start, end) {
|
22104 | const len = buf.length
|
22105 |
|
22106 | if (!start || start < 0) start = 0
|
22107 | if (!end || end < 0 || end > len) end = len
|
22108 |
|
22109 | let out = ''
|
22110 | for (let i = start; i < end; ++i) {
|
22111 | out += hexSliceLookupTable[buf[i]]
|
22112 | }
|
22113 | return out
|
22114 | }
|
22115 |
|
22116 | function utf16leSlice (buf, start, end) {
|
22117 | const bytes = buf.slice(start, end)
|
22118 | let res = ''
|
22119 |
|
22120 | for (let i = 0; i < bytes.length - 1; i += 2) {
|
22121 | res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
|
22122 | }
|
22123 | return res
|
22124 | }
|
22125 |
|
22126 | Buffer.prototype.slice = function slice (start, end) {
|
22127 | const len = this.length
|
22128 | start = ~~start
|
22129 | end = end === undefined ? len : ~~end
|
22130 |
|
22131 | if (start < 0) {
|
22132 | start += len
|
22133 | if (start < 0) start = 0
|
22134 | } else if (start > len) {
|
22135 | start = len
|
22136 | }
|
22137 |
|
22138 | if (end < 0) {
|
22139 | end += len
|
22140 | if (end < 0) end = 0
|
22141 | } else if (end > len) {
|
22142 | end = len
|
22143 | }
|
22144 |
|
22145 | if (end < start) end = start
|
22146 |
|
22147 | const newBuf = this.subarray(start, end)
|
22148 |
|
22149 | Object.setPrototypeOf(newBuf, Buffer.prototype)
|
22150 |
|
22151 | return newBuf
|
22152 | }
|
22153 |
|
22154 |
|
22155 |
|
22156 |
|
22157 | function checkOffset (offset, ext, length) {
|
22158 | if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
22159 | if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
22160 | }
|
22161 |
|
22162 | Buffer.prototype.readUintLE =
|
22163 | Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
22164 | offset = offset >>> 0
|
22165 | byteLength = byteLength >>> 0
|
22166 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
22167 |
|
22168 | let val = this[offset]
|
22169 | let mul = 1
|
22170 | let i = 0
|
22171 | while (++i < byteLength && (mul *= 0x100)) {
|
22172 | val += this[offset + i] * mul
|
22173 | }
|
22174 |
|
22175 | return val
|
22176 | }
|
22177 |
|
22178 | Buffer.prototype.readUintBE =
|
22179 | Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
22180 | offset = offset >>> 0
|
22181 | byteLength = byteLength >>> 0
|
22182 | if (!noAssert) {
|
22183 | checkOffset(offset, byteLength, this.length)
|
22184 | }
|
22185 |
|
22186 | let val = this[offset + --byteLength]
|
22187 | let mul = 1
|
22188 | while (byteLength > 0 && (mul *= 0x100)) {
|
22189 | val += this[offset + --byteLength] * mul
|
22190 | }
|
22191 |
|
22192 | return val
|
22193 | }
|
22194 |
|
22195 | Buffer.prototype.readUint8 =
|
22196 | Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
22197 | offset = offset >>> 0
|
22198 | if (!noAssert) checkOffset(offset, 1, this.length)
|
22199 | return this[offset]
|
22200 | }
|
22201 |
|
22202 | Buffer.prototype.readUint16LE =
|
22203 | Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
22204 | offset = offset >>> 0
|
22205 | if (!noAssert) checkOffset(offset, 2, this.length)
|
22206 | return this[offset] | (this[offset + 1] << 8)
|
22207 | }
|
22208 |
|
22209 | Buffer.prototype.readUint16BE =
|
22210 | Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
22211 | offset = offset >>> 0
|
22212 | if (!noAssert) checkOffset(offset, 2, this.length)
|
22213 | return (this[offset] << 8) | this[offset + 1]
|
22214 | }
|
22215 |
|
22216 | Buffer.prototype.readUint32LE =
|
22217 | Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
22218 | offset = offset >>> 0
|
22219 | if (!noAssert) checkOffset(offset, 4, this.length)
|
22220 |
|
22221 | return ((this[offset]) |
|
22222 | (this[offset + 1] << 8) |
|
22223 | (this[offset + 2] << 16)) +
|
22224 | (this[offset + 3] * 0x1000000)
|
22225 | }
|
22226 |
|
22227 | Buffer.prototype.readUint32BE =
|
22228 | Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
22229 | offset = offset >>> 0
|
22230 | if (!noAssert) checkOffset(offset, 4, this.length)
|
22231 |
|
22232 | return (this[offset] * 0x1000000) +
|
22233 | ((this[offset + 1] << 16) |
|
22234 | (this[offset + 2] << 8) |
|
22235 | this[offset + 3])
|
22236 | }
|
22237 |
|
22238 | Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {
|
22239 | offset = offset >>> 0
|
22240 | validateNumber(offset, 'offset')
|
22241 | const first = this[offset]
|
22242 | const last = this[offset + 7]
|
22243 | if (first === undefined || last === undefined) {
|
22244 | boundsError(offset, this.length - 8)
|
22245 | }
|
22246 |
|
22247 | const lo = first +
|
22248 | this[++offset] * 2 ** 8 +
|
22249 | this[++offset] * 2 ** 16 +
|
22250 | this[++offset] * 2 ** 24
|
22251 |
|
22252 | const hi = this[++offset] +
|
22253 | this[++offset] * 2 ** 8 +
|
22254 | this[++offset] * 2 ** 16 +
|
22255 | last * 2 ** 24
|
22256 |
|
22257 | return BigInt(lo) + (BigInt(hi) << BigInt(32))
|
22258 | })
|
22259 |
|
22260 | Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {
|
22261 | offset = offset >>> 0
|
22262 | validateNumber(offset, 'offset')
|
22263 | const first = this[offset]
|
22264 | const last = this[offset + 7]
|
22265 | if (first === undefined || last === undefined) {
|
22266 | boundsError(offset, this.length - 8)
|
22267 | }
|
22268 |
|
22269 | const hi = first * 2 ** 24 +
|
22270 | this[++offset] * 2 ** 16 +
|
22271 | this[++offset] * 2 ** 8 +
|
22272 | this[++offset]
|
22273 |
|
22274 | const lo = this[++offset] * 2 ** 24 +
|
22275 | this[++offset] * 2 ** 16 +
|
22276 | this[++offset] * 2 ** 8 +
|
22277 | last
|
22278 |
|
22279 | return (BigInt(hi) << BigInt(32)) + BigInt(lo)
|
22280 | })
|
22281 |
|
22282 | Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
22283 | offset = offset >>> 0
|
22284 | byteLength = byteLength >>> 0
|
22285 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
22286 |
|
22287 | let val = this[offset]
|
22288 | let mul = 1
|
22289 | let i = 0
|
22290 | while (++i < byteLength && (mul *= 0x100)) {
|
22291 | val += this[offset + i] * mul
|
22292 | }
|
22293 | mul *= 0x80
|
22294 |
|
22295 | if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
22296 |
|
22297 | return val
|
22298 | }
|
22299 |
|
22300 | Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
22301 | offset = offset >>> 0
|
22302 | byteLength = byteLength >>> 0
|
22303 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
22304 |
|
22305 | let i = byteLength
|
22306 | let mul = 1
|
22307 | let val = this[offset + --i]
|
22308 | while (i > 0 && (mul *= 0x100)) {
|
22309 | val += this[offset + --i] * mul
|
22310 | }
|
22311 | mul *= 0x80
|
22312 |
|
22313 | if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
22314 |
|
22315 | return val
|
22316 | }
|
22317 |
|
22318 | Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
22319 | offset = offset >>> 0
|
22320 | if (!noAssert) checkOffset(offset, 1, this.length)
|
22321 | if (!(this[offset] & 0x80)) return (this[offset])
|
22322 | return ((0xff - this[offset] + 1) * -1)
|
22323 | }
|
22324 |
|
22325 | Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
22326 | offset = offset >>> 0
|
22327 | if (!noAssert) checkOffset(offset, 2, this.length)
|
22328 | const val = this[offset] | (this[offset + 1] << 8)
|
22329 | return (val & 0x8000) ? val | 0xFFFF0000 : val
|
22330 | }
|
22331 |
|
22332 | Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
22333 | offset = offset >>> 0
|
22334 | if (!noAssert) checkOffset(offset, 2, this.length)
|
22335 | const val = this[offset + 1] | (this[offset] << 8)
|
22336 | return (val & 0x8000) ? val | 0xFFFF0000 : val
|
22337 | }
|
22338 |
|
22339 | Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
22340 | offset = offset >>> 0
|
22341 | if (!noAssert) checkOffset(offset, 4, this.length)
|
22342 |
|
22343 | return (this[offset]) |
|
22344 | (this[offset + 1] << 8) |
|
22345 | (this[offset + 2] << 16) |
|
22346 | (this[offset + 3] << 24)
|
22347 | }
|
22348 |
|
22349 | Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
22350 | offset = offset >>> 0
|
22351 | if (!noAssert) checkOffset(offset, 4, this.length)
|
22352 |
|
22353 | return (this[offset] << 24) |
|
22354 | (this[offset + 1] << 16) |
|
22355 | (this[offset + 2] << 8) |
|
22356 | (this[offset + 3])
|
22357 | }
|
22358 |
|
22359 | Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {
|
22360 | offset = offset >>> 0
|
22361 | validateNumber(offset, 'offset')
|
22362 | const first = this[offset]
|
22363 | const last = this[offset + 7]
|
22364 | if (first === undefined || last === undefined) {
|
22365 | boundsError(offset, this.length - 8)
|
22366 | }
|
22367 |
|
22368 | const val = this[offset + 4] +
|
22369 | this[offset + 5] * 2 ** 8 +
|
22370 | this[offset + 6] * 2 ** 16 +
|
22371 | (last << 24)
|
22372 |
|
22373 | return (BigInt(val) << BigInt(32)) +
|
22374 | BigInt(first +
|
22375 | this[++offset] * 2 ** 8 +
|
22376 | this[++offset] * 2 ** 16 +
|
22377 | this[++offset] * 2 ** 24)
|
22378 | })
|
22379 |
|
22380 | Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {
|
22381 | offset = offset >>> 0
|
22382 | validateNumber(offset, 'offset')
|
22383 | const first = this[offset]
|
22384 | const last = this[offset + 7]
|
22385 | if (first === undefined || last === undefined) {
|
22386 | boundsError(offset, this.length - 8)
|
22387 | }
|
22388 |
|
22389 | const val = (first << 24) +
|
22390 | this[++offset] * 2 ** 16 +
|
22391 | this[++offset] * 2 ** 8 +
|
22392 | this[++offset]
|
22393 |
|
22394 | return (BigInt(val) << BigInt(32)) +
|
22395 | BigInt(this[++offset] * 2 ** 24 +
|
22396 | this[++offset] * 2 ** 16 +
|
22397 | this[++offset] * 2 ** 8 +
|
22398 | last)
|
22399 | })
|
22400 |
|
22401 | Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
22402 | offset = offset >>> 0
|
22403 | if (!noAssert) checkOffset(offset, 4, this.length)
|
22404 | return ieee754.read(this, offset, true, 23, 4)
|
22405 | }
|
22406 |
|
22407 | Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
22408 | offset = offset >>> 0
|
22409 | if (!noAssert) checkOffset(offset, 4, this.length)
|
22410 | return ieee754.read(this, offset, false, 23, 4)
|
22411 | }
|
22412 |
|
22413 | Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
22414 | offset = offset >>> 0
|
22415 | if (!noAssert) checkOffset(offset, 8, this.length)
|
22416 | return ieee754.read(this, offset, true, 52, 8)
|
22417 | }
|
22418 |
|
22419 | Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
22420 | offset = offset >>> 0
|
22421 | if (!noAssert) checkOffset(offset, 8, this.length)
|
22422 | return ieee754.read(this, offset, false, 52, 8)
|
22423 | }
|
22424 |
|
22425 | function checkInt (buf, value, offset, ext, max, min) {
|
22426 | if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
22427 | if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
22428 | if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
22429 | }
|
22430 |
|
22431 | Buffer.prototype.writeUintLE =
|
22432 | Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
22433 | value = +value
|
22434 | offset = offset >>> 0
|
22435 | byteLength = byteLength >>> 0
|
22436 | if (!noAssert) {
|
22437 | const maxBytes = Math.pow(2, 8 * byteLength) - 1
|
22438 | checkInt(this, value, offset, byteLength, maxBytes, 0)
|
22439 | }
|
22440 |
|
22441 | let mul = 1
|
22442 | let i = 0
|
22443 | this[offset] = value & 0xFF
|
22444 | while (++i < byteLength && (mul *= 0x100)) {
|
22445 | this[offset + i] = (value / mul) & 0xFF
|
22446 | }
|
22447 |
|
22448 | return offset + byteLength
|
22449 | }
|
22450 |
|
22451 | Buffer.prototype.writeUintBE =
|
22452 | Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
22453 | value = +value
|
22454 | offset = offset >>> 0
|
22455 | byteLength = byteLength >>> 0
|
22456 | if (!noAssert) {
|
22457 | const maxBytes = Math.pow(2, 8 * byteLength) - 1
|
22458 | checkInt(this, value, offset, byteLength, maxBytes, 0)
|
22459 | }
|
22460 |
|
22461 | let i = byteLength - 1
|
22462 | let mul = 1
|
22463 | this[offset + i] = value & 0xFF
|
22464 | while (--i >= 0 && (mul *= 0x100)) {
|
22465 | this[offset + i] = (value / mul) & 0xFF
|
22466 | }
|
22467 |
|
22468 | return offset + byteLength
|
22469 | }
|
22470 |
|
22471 | Buffer.prototype.writeUint8 =
|
22472 | Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
22473 | value = +value
|
22474 | offset = offset >>> 0
|
22475 | if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
|
22476 | this[offset] = (value & 0xff)
|
22477 | return offset + 1
|
22478 | }
|
22479 |
|
22480 | Buffer.prototype.writeUint16LE =
|
22481 | Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
22482 | value = +value
|
22483 | offset = offset >>> 0
|
22484 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
22485 | this[offset] = (value & 0xff)
|
22486 | this[offset + 1] = (value >>> 8)
|
22487 | return offset + 2
|
22488 | }
|
22489 |
|
22490 | Buffer.prototype.writeUint16BE =
|
22491 | Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
22492 | value = +value
|
22493 | offset = offset >>> 0
|
22494 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
22495 | this[offset] = (value >>> 8)
|
22496 | this[offset + 1] = (value & 0xff)
|
22497 | return offset + 2
|
22498 | }
|
22499 |
|
22500 | Buffer.prototype.writeUint32LE =
|
22501 | Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
22502 | value = +value
|
22503 | offset = offset >>> 0
|
22504 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
22505 | this[offset + 3] = (value >>> 24)
|
22506 | this[offset + 2] = (value >>> 16)
|
22507 | this[offset + 1] = (value >>> 8)
|
22508 | this[offset] = (value & 0xff)
|
22509 | return offset + 4
|
22510 | }
|
22511 |
|
22512 | Buffer.prototype.writeUint32BE =
|
22513 | Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
22514 | value = +value
|
22515 | offset = offset >>> 0
|
22516 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
22517 | this[offset] = (value >>> 24)
|
22518 | this[offset + 1] = (value >>> 16)
|
22519 | this[offset + 2] = (value >>> 8)
|
22520 | this[offset + 3] = (value & 0xff)
|
22521 | return offset + 4
|
22522 | }
|
22523 |
|
22524 | function wrtBigUInt64LE (buf, value, offset, min, max) {
|
22525 | checkIntBI(value, min, max, buf, offset, 7)
|
22526 |
|
22527 | let lo = Number(value & BigInt(0xffffffff))
|
22528 | buf[offset++] = lo
|
22529 | lo = lo >> 8
|
22530 | buf[offset++] = lo
|
22531 | lo = lo >> 8
|
22532 | buf[offset++] = lo
|
22533 | lo = lo >> 8
|
22534 | buf[offset++] = lo
|
22535 | let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
|
22536 | buf[offset++] = hi
|
22537 | hi = hi >> 8
|
22538 | buf[offset++] = hi
|
22539 | hi = hi >> 8
|
22540 | buf[offset++] = hi
|
22541 | hi = hi >> 8
|
22542 | buf[offset++] = hi
|
22543 | return offset
|
22544 | }
|
22545 |
|
22546 | function wrtBigUInt64BE (buf, value, offset, min, max) {
|
22547 | checkIntBI(value, min, max, buf, offset, 7)
|
22548 |
|
22549 | let lo = Number(value & BigInt(0xffffffff))
|
22550 | buf[offset + 7] = lo
|
22551 | lo = lo >> 8
|
22552 | buf[offset + 6] = lo
|
22553 | lo = lo >> 8
|
22554 | buf[offset + 5] = lo
|
22555 | lo = lo >> 8
|
22556 | buf[offset + 4] = lo
|
22557 | let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
|
22558 | buf[offset + 3] = hi
|
22559 | hi = hi >> 8
|
22560 | buf[offset + 2] = hi
|
22561 | hi = hi >> 8
|
22562 | buf[offset + 1] = hi
|
22563 | hi = hi >> 8
|
22564 | buf[offset] = hi
|
22565 | return offset + 8
|
22566 | }
|
22567 |
|
22568 | Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {
|
22569 | return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
|
22570 | })
|
22571 |
|
22572 | Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {
|
22573 | return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
|
22574 | })
|
22575 |
|
22576 | Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
22577 | value = +value
|
22578 | offset = offset >>> 0
|
22579 | if (!noAssert) {
|
22580 | const limit = Math.pow(2, (8 * byteLength) - 1)
|
22581 |
|
22582 | checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
22583 | }
|
22584 |
|
22585 | let i = 0
|
22586 | let mul = 1
|
22587 | let sub = 0
|
22588 | this[offset] = value & 0xFF
|
22589 | while (++i < byteLength && (mul *= 0x100)) {
|
22590 | if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
22591 | sub = 1
|
22592 | }
|
22593 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
22594 | }
|
22595 |
|
22596 | return offset + byteLength
|
22597 | }
|
22598 |
|
22599 | Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
22600 | value = +value
|
22601 | offset = offset >>> 0
|
22602 | if (!noAssert) {
|
22603 | const limit = Math.pow(2, (8 * byteLength) - 1)
|
22604 |
|
22605 | checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
22606 | }
|
22607 |
|
22608 | let i = byteLength - 1
|
22609 | let mul = 1
|
22610 | let sub = 0
|
22611 | this[offset + i] = value & 0xFF
|
22612 | while (--i >= 0 && (mul *= 0x100)) {
|
22613 | if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
22614 | sub = 1
|
22615 | }
|
22616 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
22617 | }
|
22618 |
|
22619 | return offset + byteLength
|
22620 | }
|
22621 |
|
22622 | Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
22623 | value = +value
|
22624 | offset = offset >>> 0
|
22625 | if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
|
22626 | if (value < 0) value = 0xff + value + 1
|
22627 | this[offset] = (value & 0xff)
|
22628 | return offset + 1
|
22629 | }
|
22630 |
|
22631 | Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
22632 | value = +value
|
22633 | offset = offset >>> 0
|
22634 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
22635 | this[offset] = (value & 0xff)
|
22636 | this[offset + 1] = (value >>> 8)
|
22637 | return offset + 2
|
22638 | }
|
22639 |
|
22640 | Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
22641 | value = +value
|
22642 | offset = offset >>> 0
|
22643 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
22644 | this[offset] = (value >>> 8)
|
22645 | this[offset + 1] = (value & 0xff)
|
22646 | return offset + 2
|
22647 | }
|
22648 |
|
22649 | Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
22650 | value = +value
|
22651 | offset = offset >>> 0
|
22652 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
22653 | this[offset] = (value & 0xff)
|
22654 | this[offset + 1] = (value >>> 8)
|
22655 | this[offset + 2] = (value >>> 16)
|
22656 | this[offset + 3] = (value >>> 24)
|
22657 | return offset + 4
|
22658 | }
|
22659 |
|
22660 | Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
22661 | value = +value
|
22662 | offset = offset >>> 0
|
22663 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
22664 | if (value < 0) value = 0xffffffff + value + 1
|
22665 | this[offset] = (value >>> 24)
|
22666 | this[offset + 1] = (value >>> 16)
|
22667 | this[offset + 2] = (value >>> 8)
|
22668 | this[offset + 3] = (value & 0xff)
|
22669 | return offset + 4
|
22670 | }
|
22671 |
|
22672 | Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {
|
22673 | return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
|
22674 | })
|
22675 |
|
22676 | Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {
|
22677 | return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
|
22678 | })
|
22679 |
|
22680 | function checkIEEE754 (buf, value, offset, ext, max, min) {
|
22681 | if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
22682 | if (offset < 0) throw new RangeError('Index out of range')
|
22683 | }
|
22684 |
|
22685 | function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
22686 | value = +value
|
22687 | offset = offset >>> 0
|
22688 | if (!noAssert) {
|
22689 | checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
|
22690 | }
|
22691 | ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
22692 | return offset + 4
|
22693 | }
|
22694 |
|
22695 | Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
22696 | return writeFloat(this, value, offset, true, noAssert)
|
22697 | }
|
22698 |
|
22699 | Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
22700 | return writeFloat(this, value, offset, false, noAssert)
|
22701 | }
|
22702 |
|
22703 | function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
22704 | value = +value
|
22705 | offset = offset >>> 0
|
22706 | if (!noAssert) {
|
22707 | checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
|
22708 | }
|
22709 | ieee754.write(buf, value, offset, littleEndian, 52, 8)
|
22710 | return offset + 8
|
22711 | }
|
22712 |
|
22713 | Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
22714 | return writeDouble(this, value, offset, true, noAssert)
|
22715 | }
|
22716 |
|
22717 | Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
22718 | return writeDouble(this, value, offset, false, noAssert)
|
22719 | }
|
22720 |
|
22721 |
|
22722 | Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
22723 | if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
|
22724 | if (!start) start = 0
|
22725 | if (!end && end !== 0) end = this.length
|
22726 | if (targetStart >= target.length) targetStart = target.length
|
22727 | if (!targetStart) targetStart = 0
|
22728 | if (end > 0 && end < start) end = start
|
22729 |
|
22730 |
|
22731 | if (end === start) return 0
|
22732 | if (target.length === 0 || this.length === 0) return 0
|
22733 |
|
22734 |
|
22735 | if (targetStart < 0) {
|
22736 | throw new RangeError('targetStart out of bounds')
|
22737 | }
|
22738 | if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
|
22739 | if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
22740 |
|
22741 |
|
22742 | if (end > this.length) end = this.length
|
22743 | if (target.length - targetStart < end - start) {
|
22744 | end = target.length - targetStart + start
|
22745 | }
|
22746 |
|
22747 | const len = end - start
|
22748 |
|
22749 | if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
|
22750 |
|
22751 | this.copyWithin(targetStart, start, end)
|
22752 | } else {
|
22753 | Uint8Array.prototype.set.call(
|
22754 | target,
|
22755 | this.subarray(start, end),
|
22756 | targetStart
|
22757 | )
|
22758 | }
|
22759 |
|
22760 | return len
|
22761 | }
|
22762 |
|
22763 |
|
22764 |
|
22765 |
|
22766 |
|
22767 | Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
22768 |
|
22769 | if (typeof val === 'string') {
|
22770 | if (typeof start === 'string') {
|
22771 | encoding = start
|
22772 | start = 0
|
22773 | end = this.length
|
22774 | } else if (typeof end === 'string') {
|
22775 | encoding = end
|
22776 | end = this.length
|
22777 | }
|
22778 | if (encoding !== undefined && typeof encoding !== 'string') {
|
22779 | throw new TypeError('encoding must be a string')
|
22780 | }
|
22781 | if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
22782 | throw new TypeError('Unknown encoding: ' + encoding)
|
22783 | }
|
22784 | if (val.length === 1) {
|
22785 | const code = val.charCodeAt(0)
|
22786 | if ((encoding === 'utf8' && code < 128) ||
|
22787 | encoding === 'latin1') {
|
22788 |
|
22789 | val = code
|
22790 | }
|
22791 | }
|
22792 | } else if (typeof val === 'number') {
|
22793 | val = val & 255
|
22794 | } else if (typeof val === 'boolean') {
|
22795 | val = Number(val)
|
22796 | }
|
22797 |
|
22798 |
|
22799 | if (start < 0 || this.length < start || this.length < end) {
|
22800 | throw new RangeError('Out of range index')
|
22801 | }
|
22802 |
|
22803 | if (end <= start) {
|
22804 | return this
|
22805 | }
|
22806 |
|
22807 | start = start >>> 0
|
22808 | end = end === undefined ? this.length : end >>> 0
|
22809 |
|
22810 | if (!val) val = 0
|
22811 |
|
22812 | let i
|
22813 | if (typeof val === 'number') {
|
22814 | for (i = start; i < end; ++i) {
|
22815 | this[i] = val
|
22816 | }
|
22817 | } else {
|
22818 | const bytes = Buffer.isBuffer(val)
|
22819 | ? val
|
22820 | : Buffer.from(val, encoding)
|
22821 | const len = bytes.length
|
22822 | if (len === 0) {
|
22823 | throw new TypeError('The value "' + val +
|
22824 | '" is invalid for argument "value"')
|
22825 | }
|
22826 | for (i = 0; i < end - start; ++i) {
|
22827 | this[i + start] = bytes[i % len]
|
22828 | }
|
22829 | }
|
22830 |
|
22831 | return this
|
22832 | }
|
22833 |
|
22834 |
|
22835 |
|
22836 |
|
22837 |
|
22838 | const errors = {}
|
22839 | function E (sym, getMessage, Base) {
|
22840 | errors[sym] = class NodeError extends Base {
|
22841 | constructor () {
|
22842 | super()
|
22843 |
|
22844 | Object.defineProperty(this, 'message', {
|
22845 | value: getMessage.apply(this, arguments),
|
22846 | writable: true,
|
22847 | configurable: true
|
22848 | })
|
22849 |
|
22850 |
|
22851 | this.name = `${this.name} [${sym}]`
|
22852 |
|
22853 |
|
22854 | this.stack
|
22855 |
|
22856 | delete this.name
|
22857 | }
|
22858 |
|
22859 | get code () {
|
22860 | return sym
|
22861 | }
|
22862 |
|
22863 | set code (value) {
|
22864 | Object.defineProperty(this, 'code', {
|
22865 | configurable: true,
|
22866 | enumerable: true,
|
22867 | value,
|
22868 | writable: true
|
22869 | })
|
22870 | }
|
22871 |
|
22872 | toString () {
|
22873 | return `${this.name} [${sym}]: ${this.message}`
|
22874 | }
|
22875 | }
|
22876 | }
|
22877 |
|
22878 | E('ERR_BUFFER_OUT_OF_BOUNDS',
|
22879 | function (name) {
|
22880 | if (name) {
|
22881 | return `${name} is outside of buffer bounds`
|
22882 | }
|
22883 |
|
22884 | return 'Attempt to access memory outside buffer bounds'
|
22885 | }, RangeError)
|
22886 | E('ERR_INVALID_ARG_TYPE',
|
22887 | function (name, actual) {
|
22888 | return `The "${name}" argument must be of type number. Received type ${typeof actual}`
|
22889 | }, TypeError)
|
22890 | E('ERR_OUT_OF_RANGE',
|
22891 | function (str, range, input) {
|
22892 | let msg = `The value of "${str}" is out of range.`
|
22893 | let received = input
|
22894 | if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
|
22895 | received = addNumericalSeparator(String(input))
|
22896 | } else if (typeof input === 'bigint') {
|
22897 | received = String(input)
|
22898 | if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
|
22899 | received = addNumericalSeparator(received)
|
22900 | }
|
22901 | received += 'n'
|
22902 | }
|
22903 | msg += ` It must be ${range}. Received ${received}`
|
22904 | return msg
|
22905 | }, RangeError)
|
22906 |
|
22907 | function addNumericalSeparator (val) {
|
22908 | let res = ''
|
22909 | let i = val.length
|
22910 | const start = val[0] === '-' ? 1 : 0
|
22911 | for (; i >= start + 4; i -= 3) {
|
22912 | res = `_${val.slice(i - 3, i)}${res}`
|
22913 | }
|
22914 | return `${val.slice(0, i)}${res}`
|
22915 | }
|
22916 |
|
22917 |
|
22918 |
|
22919 |
|
22920 | function checkBounds (buf, offset, byteLength) {
|
22921 | validateNumber(offset, 'offset')
|
22922 | if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {
|
22923 | boundsError(offset, buf.length - (byteLength + 1))
|
22924 | }
|
22925 | }
|
22926 |
|
22927 | function checkIntBI (value, min, max, buf, offset, byteLength) {
|
22928 | if (value > max || value < min) {
|
22929 | const n = typeof min === 'bigint' ? 'n' : ''
|
22930 | let range
|
22931 | if (byteLength > 3) {
|
22932 | if (min === 0 || min === BigInt(0)) {
|
22933 | range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`
|
22934 | } else {
|
22935 | range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +
|
22936 | `${(byteLength + 1) * 8 - 1}${n}`
|
22937 | }
|
22938 | } else {
|
22939 | range = `>= ${min}${n} and <= ${max}${n}`
|
22940 | }
|
22941 | throw new errors.ERR_OUT_OF_RANGE('value', range, value)
|
22942 | }
|
22943 | checkBounds(buf, offset, byteLength)
|
22944 | }
|
22945 |
|
22946 | function validateNumber (value, name) {
|
22947 | if (typeof value !== 'number') {
|
22948 | throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)
|
22949 | }
|
22950 | }
|
22951 |
|
22952 | function boundsError (value, length, type) {
|
22953 | if (Math.floor(value) !== value) {
|
22954 | validateNumber(value, type)
|
22955 | throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)
|
22956 | }
|
22957 |
|
22958 | if (length < 0) {
|
22959 | throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()
|
22960 | }
|
22961 |
|
22962 | throw new errors.ERR_OUT_OF_RANGE(type || 'offset',
|
22963 | `>= ${type ? 1 : 0} and <= ${length}`,
|
22964 | value)
|
22965 | }
|
22966 |
|
22967 |
|
22968 |
|
22969 |
|
22970 | const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
|
22971 |
|
22972 | function base64clean (str) {
|
22973 |
|
22974 | str = str.split('=')[0]
|
22975 |
|
22976 | str = str.trim().replace(INVALID_BASE64_RE, '')
|
22977 |
|
22978 | if (str.length < 2) return ''
|
22979 |
|
22980 | while (str.length % 4 !== 0) {
|
22981 | str = str + '='
|
22982 | }
|
22983 | return str
|
22984 | }
|
22985 |
|
22986 | function utf8ToBytes (string, units) {
|
22987 | units = units || Infinity
|
22988 | let codePoint
|
22989 | const length = string.length
|
22990 | let leadSurrogate = null
|
22991 | const bytes = []
|
22992 |
|
22993 | for (let i = 0; i < length; ++i) {
|
22994 | codePoint = string.charCodeAt(i)
|
22995 |
|
22996 |
|
22997 | if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
22998 |
|
22999 | if (!leadSurrogate) {
|
23000 |
|
23001 | if (codePoint > 0xDBFF) {
|
23002 |
|
23003 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
23004 | continue
|
23005 | } else if (i + 1 === length) {
|
23006 |
|
23007 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
23008 | continue
|
23009 | }
|
23010 |
|
23011 |
|
23012 | leadSurrogate = codePoint
|
23013 |
|
23014 | continue
|
23015 | }
|
23016 |
|
23017 |
|
23018 | if (codePoint < 0xDC00) {
|
23019 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
23020 | leadSurrogate = codePoint
|
23021 | continue
|
23022 | }
|
23023 |
|
23024 |
|
23025 | codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
|
23026 | } else if (leadSurrogate) {
|
23027 |
|
23028 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
23029 | }
|
23030 |
|
23031 | leadSurrogate = null
|
23032 |
|
23033 |
|
23034 | if (codePoint < 0x80) {
|
23035 | if ((units -= 1) < 0) break
|
23036 | bytes.push(codePoint)
|
23037 | } else if (codePoint < 0x800) {
|
23038 | if ((units -= 2) < 0) break
|
23039 | bytes.push(
|
23040 | codePoint >> 0x6 | 0xC0,
|
23041 | codePoint & 0x3F | 0x80
|
23042 | )
|
23043 | } else if (codePoint < 0x10000) {
|
23044 | if ((units -= 3) < 0) break
|
23045 | bytes.push(
|
23046 | codePoint >> 0xC | 0xE0,
|
23047 | codePoint >> 0x6 & 0x3F | 0x80,
|
23048 | codePoint & 0x3F | 0x80
|
23049 | )
|
23050 | } else if (codePoint < 0x110000) {
|
23051 | if ((units -= 4) < 0) break
|
23052 | bytes.push(
|
23053 | codePoint >> 0x12 | 0xF0,
|
23054 | codePoint >> 0xC & 0x3F | 0x80,
|
23055 | codePoint >> 0x6 & 0x3F | 0x80,
|
23056 | codePoint & 0x3F | 0x80
|
23057 | )
|
23058 | } else {
|
23059 | throw new Error('Invalid code point')
|
23060 | }
|
23061 | }
|
23062 |
|
23063 | return bytes
|
23064 | }
|
23065 |
|
23066 | function asciiToBytes (str) {
|
23067 | const byteArray = []
|
23068 | for (let i = 0; i < str.length; ++i) {
|
23069 |
|
23070 | byteArray.push(str.charCodeAt(i) & 0xFF)
|
23071 | }
|
23072 | return byteArray
|
23073 | }
|
23074 |
|
23075 | function utf16leToBytes (str, units) {
|
23076 | let c, hi, lo
|
23077 | const byteArray = []
|
23078 | for (let i = 0; i < str.length; ++i) {
|
23079 | if ((units -= 2) < 0) break
|
23080 |
|
23081 | c = str.charCodeAt(i)
|
23082 | hi = c >> 8
|
23083 | lo = c % 256
|
23084 | byteArray.push(lo)
|
23085 | byteArray.push(hi)
|
23086 | }
|
23087 |
|
23088 | return byteArray
|
23089 | }
|
23090 |
|
23091 | function base64ToBytes (str) {
|
23092 | return base64.toByteArray(base64clean(str))
|
23093 | }
|
23094 |
|
23095 | function blitBuffer (src, dst, offset, length) {
|
23096 | let i
|
23097 | for (i = 0; i < length; ++i) {
|
23098 | if ((i + offset >= dst.length) || (i >= src.length)) break
|
23099 | dst[i + offset] = src[i]
|
23100 | }
|
23101 | return i
|
23102 | }
|
23103 |
|
23104 |
|
23105 |
|
23106 |
|
23107 | function isInstance (obj, type) {
|
23108 | return obj instanceof type ||
|
23109 | (obj != null && obj.constructor != null && obj.constructor.name != null &&
|
23110 | obj.constructor.name === type.name)
|
23111 | }
|
23112 | function numberIsNaN (obj) {
|
23113 |
|
23114 | return obj !== obj
|
23115 | }
|
23116 |
|
23117 |
|
23118 |
|
23119 | const hexSliceLookupTable = (function () {
|
23120 | const alphabet = '0123456789abcdef'
|
23121 | const table = new Array(256)
|
23122 | for (let i = 0; i < 16; ++i) {
|
23123 | const i16 = i * 16
|
23124 | for (let j = 0; j < 16; ++j) {
|
23125 | table[i16 + j] = alphabet[i] + alphabet[j]
|
23126 | }
|
23127 | }
|
23128 | return table
|
23129 | })()
|
23130 |
|
23131 |
|
23132 | function defineBigIntMethod (fn) {
|
23133 | return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn
|
23134 | }
|
23135 |
|
23136 | function BufferBigIntNotDefined () {
|
23137 | throw new Error('BigInt not supported')
|
23138 | }
|
23139 |
|
23140 |
|
23141 | }),
|
23142 |
|
23143 | 645:
|
23144 | ((__unused_webpack_module, exports) => {
|
23145 |
|
23146 |
|
23147 | exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
23148 | var e, m
|
23149 | var eLen = (nBytes * 8) - mLen - 1
|
23150 | var eMax = (1 << eLen) - 1
|
23151 | var eBias = eMax >> 1
|
23152 | var nBits = -7
|
23153 | var i = isLE ? (nBytes - 1) : 0
|
23154 | var d = isLE ? -1 : 1
|
23155 | var s = buffer[offset + i]
|
23156 |
|
23157 | i += d
|
23158 |
|
23159 | e = s & ((1 << (-nBits)) - 1)
|
23160 | s >>= (-nBits)
|
23161 | nBits += eLen
|
23162 | for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
23163 |
|
23164 | m = e & ((1 << (-nBits)) - 1)
|
23165 | e >>= (-nBits)
|
23166 | nBits += mLen
|
23167 | for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
23168 |
|
23169 | if (e === 0) {
|
23170 | e = 1 - eBias
|
23171 | } else if (e === eMax) {
|
23172 | return m ? NaN : ((s ? -1 : 1) * Infinity)
|
23173 | } else {
|
23174 | m = m + Math.pow(2, mLen)
|
23175 | e = e - eBias
|
23176 | }
|
23177 | return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
23178 | }
|
23179 |
|
23180 | exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
23181 | var e, m, c
|
23182 | var eLen = (nBytes * 8) - mLen - 1
|
23183 | var eMax = (1 << eLen) - 1
|
23184 | var eBias = eMax >> 1
|
23185 | var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
|
23186 | var i = isLE ? 0 : (nBytes - 1)
|
23187 | var d = isLE ? 1 : -1
|
23188 | var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
|
23189 |
|
23190 | value = Math.abs(value)
|
23191 |
|
23192 | if (isNaN(value) || value === Infinity) {
|
23193 | m = isNaN(value) ? 1 : 0
|
23194 | e = eMax
|
23195 | } else {
|
23196 | e = Math.floor(Math.log(value) / Math.LN2)
|
23197 | if (value * (c = Math.pow(2, -e)) < 1) {
|
23198 | e--
|
23199 | c *= 2
|
23200 | }
|
23201 | if (e + eBias >= 1) {
|
23202 | value += rt / c
|
23203 | } else {
|
23204 | value += rt * Math.pow(2, 1 - eBias)
|
23205 | }
|
23206 | if (value * c >= 2) {
|
23207 | e++
|
23208 | c /= 2
|
23209 | }
|
23210 |
|
23211 | if (e + eBias >= eMax) {
|
23212 | m = 0
|
23213 | e = eMax
|
23214 | } else if (e + eBias >= 1) {
|
23215 | m = ((value * c) - 1) * Math.pow(2, mLen)
|
23216 | e = e + eBias
|
23217 | } else {
|
23218 | m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
|
23219 | e = 0
|
23220 | }
|
23221 | }
|
23222 |
|
23223 | for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
23224 |
|
23225 | e = (e << mLen) | m
|
23226 | eLen += mLen
|
23227 | for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
23228 |
|
23229 | buffer[offset + i - d] |= s * 128
|
23230 | }
|
23231 |
|
23232 |
|
23233 | }),
|
23234 |
|
23235 | 874:
|
23236 | (() => {
|
23237 |
|
23238 | (function (Prism) {
|
23239 |
|
23240 |
|
23241 |
|
23242 |
|
23243 | var envVars = '\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b';
|
23244 |
|
23245 | var commandAfterHeredoc = {
|
23246 | pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
|
23247 | lookbehind: true,
|
23248 | alias: 'punctuation',
|
23249 | inside: null
|
23250 | };
|
23251 |
|
23252 | var insideString = {
|
23253 | 'bash': commandAfterHeredoc,
|
23254 | 'environment': {
|
23255 | pattern: RegExp('\\$' + envVars),
|
23256 | alias: 'constant'
|
23257 | },
|
23258 | 'variable': [
|
23259 |
|
23260 | {
|
23261 | pattern: /\$?\(\([\s\S]+?\)\)/,
|
23262 | greedy: true,
|
23263 | inside: {
|
23264 |
|
23265 | 'variable': [
|
23266 | {
|
23267 | pattern: /(^\$\(\([\s\S]+)\)\)/,
|
23268 | lookbehind: true
|
23269 | },
|
23270 | /^\$\(\(/
|
23271 | ],
|
23272 | 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
|
23273 |
|
23274 | 'operator': /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
|
23275 |
|
23276 | 'punctuation': /\(\(?|\)\)?|,|;/
|
23277 | }
|
23278 | },
|
23279 |
|
23280 | {
|
23281 | pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
|
23282 | greedy: true,
|
23283 | inside: {
|
23284 | 'variable': /^\$\(|^`|\)$|`$/
|
23285 | }
|
23286 | },
|
23287 |
|
23288 | {
|
23289 | pattern: /\$\{[^}]+\}/,
|
23290 | greedy: true,
|
23291 | inside: {
|
23292 | 'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
|
23293 | 'punctuation': /[\[\]]/,
|
23294 | 'environment': {
|
23295 | pattern: RegExp('(\\{)' + envVars),
|
23296 | lookbehind: true,
|
23297 | alias: 'constant'
|
23298 | }
|
23299 | }
|
23300 | },
|
23301 | /\$(?:\w+|[#?*!@$])/
|
23302 | ],
|
23303 |
|
23304 | 'entity': /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
|
23305 | };
|
23306 |
|
23307 | Prism.languages.bash = {
|
23308 | 'shebang': {
|
23309 | pattern: /^#!\s*\/.*/,
|
23310 | alias: 'important'
|
23311 | },
|
23312 | 'comment': {
|
23313 | pattern: /(^|[^"{\\$])#.*/,
|
23314 | lookbehind: true
|
23315 | },
|
23316 | 'function-name': [
|
23317 |
|
23318 |
|
23319 |
|
23320 |
|
23321 | {
|
23322 |
|
23323 | pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
|
23324 | lookbehind: true,
|
23325 | alias: 'function'
|
23326 | },
|
23327 | {
|
23328 |
|
23329 | pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
|
23330 | alias: 'function'
|
23331 | }
|
23332 | ],
|
23333 |
|
23334 | 'for-or-select': {
|
23335 | pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
|
23336 | alias: 'variable',
|
23337 | lookbehind: true
|
23338 | },
|
23339 |
|
23340 |
|
23341 | 'assign-left': {
|
23342 | pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
|
23343 | inside: {
|
23344 | 'environment': {
|
23345 | pattern: RegExp('(^|[\\s;|&]|[<>]\\()' + envVars),
|
23346 | lookbehind: true,
|
23347 | alias: 'constant'
|
23348 | }
|
23349 | },
|
23350 | alias: 'variable',
|
23351 | lookbehind: true
|
23352 | },
|
23353 |
|
23354 | 'parameter': {
|
23355 | pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
|
23356 | alias: 'variable',
|
23357 | lookbehind: true
|
23358 | },
|
23359 | 'string': [
|
23360 |
|
23361 | {
|
23362 | pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
|
23363 | lookbehind: true,
|
23364 | greedy: true,
|
23365 | inside: insideString
|
23366 | },
|
23367 |
|
23368 |
|
23369 | {
|
23370 | pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
|
23371 | lookbehind: true,
|
23372 | greedy: true,
|
23373 | inside: {
|
23374 | 'bash': commandAfterHeredoc
|
23375 | }
|
23376 | },
|
23377 |
|
23378 | {
|
23379 |
|
23380 | pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
|
23381 | lookbehind: true,
|
23382 | greedy: true,
|
23383 | inside: insideString
|
23384 | },
|
23385 | {
|
23386 |
|
23387 | pattern: /(^|[^$\\])'[^']*'/,
|
23388 | lookbehind: true,
|
23389 | greedy: true
|
23390 | },
|
23391 | {
|
23392 |
|
23393 | pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
|
23394 | greedy: true,
|
23395 | inside: {
|
23396 | 'entity': insideString.entity
|
23397 | }
|
23398 | }
|
23399 | ],
|
23400 | 'environment': {
|
23401 | pattern: RegExp('\\$?' + envVars),
|
23402 | alias: 'constant'
|
23403 | },
|
23404 | 'variable': insideString.variable,
|
23405 | 'function': {
|
23406 | pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
|
23407 | lookbehind: true
|
23408 | },
|
23409 | 'keyword': {
|
23410 | pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
|
23411 | lookbehind: true
|
23412 | },
|
23413 |
|
23414 | 'builtin': {
|
23415 | pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
|
23416 | lookbehind: true,
|
23417 |
|
23418 | alias: 'class-name'
|
23419 | },
|
23420 | 'boolean': {
|
23421 | pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
|
23422 | lookbehind: true
|
23423 | },
|
23424 | 'file-descriptor': {
|
23425 | pattern: /\B&\d\b/,
|
23426 | alias: 'important'
|
23427 | },
|
23428 | 'operator': {
|
23429 |
|
23430 | pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
|
23431 | inside: {
|
23432 | 'file-descriptor': {
|
23433 | pattern: /^\d/,
|
23434 | alias: 'important'
|
23435 | }
|
23436 | }
|
23437 | },
|
23438 | 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
|
23439 | 'number': {
|
23440 | pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
|
23441 | lookbehind: true
|
23442 | }
|
23443 | };
|
23444 |
|
23445 | commandAfterHeredoc.inside = Prism.languages.bash;
|
23446 |
|
23447 |
|
23448 | var toBeCopied = [
|
23449 | 'comment',
|
23450 | 'function-name',
|
23451 | 'for-or-select',
|
23452 | 'assign-left',
|
23453 | 'parameter',
|
23454 | 'string',
|
23455 | 'environment',
|
23456 | 'function',
|
23457 | 'keyword',
|
23458 | 'builtin',
|
23459 | 'boolean',
|
23460 | 'file-descriptor',
|
23461 | 'operator',
|
23462 | 'punctuation',
|
23463 | 'number'
|
23464 | ];
|
23465 | var inside = insideString.variable[1].inside;
|
23466 | for (var i = 0; i < toBeCopied.length; i++) {
|
23467 | inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
|
23468 | }
|
23469 |
|
23470 | Prism.languages.sh = Prism.languages.bash;
|
23471 | Prism.languages.shell = Prism.languages.bash;
|
23472 | }(Prism));
|
23473 |
|
23474 |
|
23475 | }),
|
23476 |
|
23477 | 16:
|
23478 | (() => {
|
23479 |
|
23480 | (function (Prism) {
|
23481 |
|
23482 | |
23483 |
|
23484 |
|
23485 |
|
23486 |
|
23487 |
|
23488 |
|
23489 |
|
23490 |
|
23491 |
|
23492 | function replace(pattern, replacements) {
|
23493 | return pattern.replace(/<<(\d+)>>/g, function (m, index) {
|
23494 | return '(?:' + replacements[+index] + ')';
|
23495 | });
|
23496 | }
|
23497 | |
23498 |
|
23499 |
|
23500 |
|
23501 |
|
23502 |
|
23503 | function re(pattern, replacements, flags) {
|
23504 | return RegExp(replace(pattern, replacements), flags || '');
|
23505 | }
|
23506 |
|
23507 | |
23508 |
|
23509 |
|
23510 |
|
23511 |
|
23512 |
|
23513 |
|
23514 | function nested(pattern, depthLog2) {
|
23515 | for (var i = 0; i < depthLog2; i++) {
|
23516 | pattern = pattern.replace(/<<self>>/g, function () { return '(?:' + pattern + ')'; });
|
23517 | }
|
23518 | return pattern.replace(/<<self>>/g, '[^\\s\\S]');
|
23519 | }
|
23520 |
|
23521 |
|
23522 | var keywordKinds = {
|
23523 |
|
23524 | type: 'bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void',
|
23525 |
|
23526 | typeDeclaration: 'class enum interface record struct',
|
23527 |
|
23528 |
|
23529 | contextual: 'add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)',
|
23530 |
|
23531 | other: 'abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield'
|
23532 | };
|
23533 |
|
23534 |
|
23535 | function keywordsToPattern(words) {
|
23536 | return '\\b(?:' + words.trim().replace(/ /g, '|') + ')\\b';
|
23537 | }
|
23538 | var typeDeclarationKeywords = keywordsToPattern(keywordKinds.typeDeclaration);
|
23539 | var keywords = RegExp(keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other));
|
23540 | var nonTypeKeywords = keywordsToPattern(keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other);
|
23541 | var nonContextualKeywords = keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.other);
|
23542 |
|
23543 |
|
23544 | var generic = nested(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source, 2);
|
23545 | var nestedRound = nested(/\((?:[^()]|<<self>>)*\)/.source, 2);
|
23546 | var name = /@?\b[A-Za-z_]\w*\b/.source;
|
23547 | var genericName = replace(/<<0>>(?:\s*<<1>>)?/.source, [name, generic]);
|
23548 | var identifier = replace(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [nonTypeKeywords, genericName]);
|
23549 | var array = /\[\s*(?:,\s*)*\]/.source;
|
23550 | var typeExpressionWithoutTuple = replace(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source, [identifier, array]);
|
23551 | var tupleElement = replace(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, [generic, nestedRound, array]);
|
23552 | var tuple = replace(/\(<<0>>+(?:,<<0>>+)+\)/.source, [tupleElement]);
|
23553 | var typeExpression = replace(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source, [tuple, identifier, array]);
|
23554 |
|
23555 | var typeInside = {
|
23556 | 'keyword': keywords,
|
23557 | 'punctuation': /[<>()?,.:[\]]/
|
23558 | };
|
23559 |
|
23560 |
|
23561 |
|
23562 |
|
23563 | var character = /'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source;
|
23564 | var regularString = /"(?:\\.|[^\\"\r\n])*"/.source;
|
23565 | var verbatimString = /@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;
|
23566 |
|
23567 |
|
23568 | Prism.languages.csharp = Prism.languages.extend('clike', {
|
23569 | 'string': [
|
23570 | {
|
23571 | pattern: re(/(^|[^$\\])<<0>>/.source, [verbatimString]),
|
23572 | lookbehind: true,
|
23573 | greedy: true
|
23574 | },
|
23575 | {
|
23576 | pattern: re(/(^|[^@$\\])<<0>>/.source, [regularString]),
|
23577 | lookbehind: true,
|
23578 | greedy: true
|
23579 | }
|
23580 | ],
|
23581 | 'class-name': [
|
23582 | {
|
23583 |
|
23584 |
|
23585 | pattern: re(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source, [identifier]),
|
23586 | lookbehind: true,
|
23587 | inside: typeInside
|
23588 | },
|
23589 | {
|
23590 |
|
23591 |
|
23592 | pattern: re(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source, [name, typeExpression]),
|
23593 | lookbehind: true,
|
23594 | inside: typeInside
|
23595 | },
|
23596 | {
|
23597 |
|
23598 |
|
23599 | pattern: re(/(\busing\s+)<<0>>(?=\s*=)/.source, [name]),
|
23600 | lookbehind: true
|
23601 | },
|
23602 | {
|
23603 |
|
23604 |
|
23605 |
|
23606 | pattern: re(/(\b<<0>>\s+)<<1>>/.source, [typeDeclarationKeywords, genericName]),
|
23607 | lookbehind: true,
|
23608 | inside: typeInside
|
23609 | },
|
23610 | {
|
23611 |
|
23612 |
|
23613 |
|
23614 | pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier]),
|
23615 | lookbehind: true,
|
23616 | inside: typeInside
|
23617 | },
|
23618 | {
|
23619 |
|
23620 |
|
23621 | pattern: re(/(\bwhere\s+)<<0>>/.source, [name]),
|
23622 | lookbehind: true
|
23623 | },
|
23624 | {
|
23625 |
|
23626 |
|
23627 |
|
23628 | pattern: re(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source, [typeExpressionWithoutTuple]),
|
23629 | lookbehind: true,
|
23630 | inside: typeInside
|
23631 | },
|
23632 | {
|
23633 |
|
23634 |
|
23635 | pattern: re(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source, [typeExpression, nonContextualKeywords, name]),
|
23636 | inside: typeInside
|
23637 | }
|
23638 | ],
|
23639 | 'keyword': keywords,
|
23640 |
|
23641 | 'number': /(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,
|
23642 | 'operator': />>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,
|
23643 | 'punctuation': /\?\.?|::|[{}[\];(),.:]/
|
23644 | });
|
23645 |
|
23646 | Prism.languages.insertBefore('csharp', 'number', {
|
23647 | 'range': {
|
23648 | pattern: /\.\./,
|
23649 | alias: 'operator'
|
23650 | }
|
23651 | });
|
23652 |
|
23653 | Prism.languages.insertBefore('csharp', 'punctuation', {
|
23654 | 'named-parameter': {
|
23655 | pattern: re(/([(,]\s*)<<0>>(?=\s*:)/.source, [name]),
|
23656 | lookbehind: true,
|
23657 | alias: 'punctuation'
|
23658 | }
|
23659 | });
|
23660 |
|
23661 | Prism.languages.insertBefore('csharp', 'class-name', {
|
23662 | 'namespace': {
|
23663 |
|
23664 |
|
23665 | pattern: re(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source, [name]),
|
23666 | lookbehind: true,
|
23667 | inside: {
|
23668 | 'punctuation': /\./
|
23669 | }
|
23670 | },
|
23671 | 'type-expression': {
|
23672 |
|
23673 | pattern: re(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source, [nestedRound]),
|
23674 | lookbehind: true,
|
23675 | alias: 'class-name',
|
23676 | inside: typeInside
|
23677 | },
|
23678 | 'return-type': {
|
23679 |
|
23680 |
|
23681 |
|
23682 | pattern: re(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source, [typeExpression, identifier]),
|
23683 | inside: typeInside,
|
23684 | alias: 'class-name'
|
23685 | },
|
23686 | 'constructor-invocation': {
|
23687 |
|
23688 | pattern: re(/(\bnew\s+)<<0>>(?=\s*[[({])/.source, [typeExpression]),
|
23689 | lookbehind: true,
|
23690 | inside: typeInside,
|
23691 | alias: 'class-name'
|
23692 | },
|
23693 | |
23694 |
|
23695 |
|
23696 |
|
23697 |
|
23698 |
|
23699 | 'generic-method': {
|
23700 |
|
23701 | pattern: re(/<<0>>\s*<<1>>(?=\s*\()/.source, [name, generic]),
|
23702 | inside: {
|
23703 | 'function': re(/^<<0>>/.source, [name]),
|
23704 | 'generic': {
|
23705 | pattern: RegExp(generic),
|
23706 | alias: 'class-name',
|
23707 | inside: typeInside
|
23708 | }
|
23709 | }
|
23710 | },
|
23711 | 'type-list': {
|
23712 |
|
23713 |
|
23714 |
|
23715 | pattern: re(
|
23716 | /\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,
|
23717 | [typeDeclarationKeywords, genericName, name, typeExpression, keywords.source, nestedRound, /\bnew\s*\(\s*\)/.source]
|
23718 | ),
|
23719 | lookbehind: true,
|
23720 | inside: {
|
23721 | 'record-arguments': {
|
23722 | pattern: re(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source, [genericName, nestedRound]),
|
23723 | lookbehind: true,
|
23724 | greedy: true,
|
23725 | inside: Prism.languages.csharp
|
23726 | },
|
23727 | 'keyword': keywords,
|
23728 | 'class-name': {
|
23729 | pattern: RegExp(typeExpression),
|
23730 | greedy: true,
|
23731 | inside: typeInside
|
23732 | },
|
23733 | 'punctuation': /[,()]/
|
23734 | }
|
23735 | },
|
23736 | 'preprocessor': {
|
23737 | pattern: /(^[\t ]*)#.*/m,
|
23738 | lookbehind: true,
|
23739 | alias: 'property',
|
23740 | inside: {
|
23741 | // highlight preprocessor directives as keywords
|
23742 | 'directive': {
|
23743 | pattern: /(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,
|
23744 | lookbehind: true,
|
23745 | alias: 'keyword'
|
23746 | }
|
23747 | }
|
23748 | }
|
23749 | });
|
23750 |
|
23751 | // attributes
|
23752 | var regularStringOrCharacter = regularString + '|' + character;
|
23753 | var regularStringCharacterOrComment = replace(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source, [regularStringOrCharacter]);
|
23754 | var roundExpression = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
|
23755 |
|
23756 | // https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/attributes/#attribute-targets
|
23757 | var attrTarget = /\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source;
|
23758 | var attr = replace(/<<0>>(?:\s*\(<<1>>*\))?/.source, [identifier, roundExpression]);
|
23759 |
|
23760 | Prism.languages.insertBefore('csharp', 'class-name', {
|
23761 | 'attribute': {
|
23762 | // Attributes
|
23763 | // [Foo], [Foo(1), Bar(2, Prop = "foo")], [return: Foo(1), Bar(2)], [assembly: Foo(Bar)]
|
23764 | pattern: re(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source, [attrTarget, attr]),
|
23765 | lookbehind: true,
|
23766 | greedy: true,
|
23767 | inside: {
|
23768 | 'target': {
|
23769 | pattern: re(/^<<0>>(?=\s*:)/.source, [attrTarget]),
|
23770 | alias: 'keyword'
|
23771 | },
|
23772 | 'attribute-arguments': {
|
23773 | pattern: re(/\(<<0>>*\)/.source, [roundExpression]),
|
23774 | inside: Prism.languages.csharp
|
23775 | },
|
23776 | 'class-name': {
|
23777 | pattern: RegExp(identifier),
|
23778 | inside: {
|
23779 | 'punctuation': /\./
|
23780 | }
|
23781 | },
|
23782 | 'punctuation': /[:,]/
|
23783 | }
|
23784 | }
|
23785 | });
|
23786 |
|
23787 |
|
23788 | // string interpolation
|
23789 | var formatString = /:[^}\r\n]+/.source;
|
23790 | // multi line
|
23791 | var mInterpolationRound = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
|
23792 | var mInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [mInterpolationRound, formatString]);
|
23793 | // single line
|
23794 | var sInterpolationRound = nested(replace(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source, [regularStringOrCharacter]), 2);
|
23795 | var sInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [sInterpolationRound, formatString]);
|
23796 |
|
23797 | function createInterpolationInside(interpolation, interpolationRound) {
|
23798 | return {
|
23799 | 'interpolation': {
|
23800 | pattern: re(/((?:^|[^{])(?:\{\{)*)<<0>>/.source, [interpolation]),
|
23801 | lookbehind: true,
|
23802 | inside: {
|
23803 | 'format-string': {
|
23804 | pattern: re(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source, [interpolationRound, formatString]),
|
23805 | lookbehind: true,
|
23806 | inside: {
|
23807 | 'punctuation': /^:/
|
23808 | }
|
23809 | },
|
23810 | 'punctuation': /^\{|\}$/,
|
23811 | 'expression': {
|
23812 | pattern: /[\s\S]+/,
|
23813 | alias: 'language-csharp',
|
23814 | inside: Prism.languages.csharp
|
23815 | }
|
23816 | }
|
23817 | },
|
23818 | 'string': /[\s\S]+/
|
23819 | };
|
23820 | }
|
23821 |
|
23822 | Prism.languages.insertBefore('csharp', 'string', {
|
23823 | 'interpolation-string': [
|
23824 | {
|
23825 | pattern: re(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source, [mInterpolation]),
|
23826 | lookbehind: true,
|
23827 | greedy: true,
|
23828 | inside: createInterpolationInside(mInterpolation, mInterpolationRound),
|
23829 | },
|
23830 | {
|
23831 | pattern: re(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source, [sInterpolation]),
|
23832 | lookbehind: true,
|
23833 | greedy: true,
|
23834 | inside: createInterpolationInside(sInterpolation, sInterpolationRound),
|
23835 | }
|
23836 | ],
|
23837 | 'char': {
|
23838 | pattern: RegExp(character),
|
23839 | greedy: true
|
23840 | }
|
23841 | });
|
23842 |
|
23843 | Prism.languages.dotnet = Prism.languages.cs = Prism.languages.csharp;
|
23844 |
|
23845 | }(Prism));
|
23846 |
|
23847 |
|
23848 | /***/ }),
|
23849 |
|
23850 | /***/ 251:
|
23851 | /***/ (() => {
|
23852 |
|
23853 | (function (Prism) {
|
23854 |
|
23855 | var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
23856 |
|
23857 | Prism.languages.css = {
|
23858 | 'comment': /\/\*[\s\S]*?\*\//,
|
23859 | 'atrule': {
|
23860 | pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
|
23861 | inside: {
|
23862 | 'rule': /^@[\w-]+/,
|
23863 | 'selector-function-argument': {
|
23864 | pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
23865 | lookbehind: true,
|
23866 | alias: 'selector'
|
23867 | },
|
23868 | 'keyword': {
|
23869 | pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
23870 | lookbehind: true
|
23871 | }
|
23872 | // See rest below
|
23873 | }
|
23874 | },
|
23875 | 'url': {
|
23876 | // https://drafts.csswg.org/css-values-3/#urls
|
23877 | pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
|
23878 | greedy: true,
|
23879 | inside: {
|
23880 | 'function': /^url/i,
|
23881 | 'punctuation': /^\(|\)$/,
|
23882 | 'string': {
|
23883 | pattern: RegExp('^' + string.source + '$'),
|
23884 | alias: 'url'
|
23885 | }
|
23886 | }
|
23887 | },
|
23888 | 'selector': {
|
23889 | pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
|
23890 | lookbehind: true
|
23891 | },
|
23892 | 'string': {
|
23893 | pattern: string,
|
23894 | greedy: true
|
23895 | },
|
23896 | 'property': {
|
23897 | pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
23898 | lookbehind: true
|
23899 | },
|
23900 | 'important': /!important\b/i,
|
23901 | 'function': {
|
23902 | pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
23903 | lookbehind: true
|
23904 | },
|
23905 | 'punctuation': /[(){};:,]/
|
23906 | };
|
23907 |
|
23908 | Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
|
23909 |
|
23910 | var markup = Prism.languages.markup;
|
23911 | if (markup) {
|
23912 | markup.tag.addInlined('style', 'css');
|
23913 | markup.tag.addAttribute('style', 'css');
|
23914 | }
|
23915 |
|
23916 | }(Prism));
|
23917 |
|
23918 |
|
23919 | /***/ }),
|
23920 |
|
23921 | /***/ 46:
|
23922 | /***/ (() => {
|
23923 |
|
23924 | Prism.languages.go = Prism.languages.extend('clike', {
|
23925 | 'string': {
|
23926 | pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,
|
23927 | lookbehind: true,
|
23928 | greedy: true
|
23929 | },
|
23930 | 'keyword': /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
|
23931 | 'boolean': /\b(?:_|false|iota|nil|true)\b/,
|
23932 | 'number': [
|
23933 | // binary and octal integers
|
23934 | /\b0(?:b[01_]+|o[0-7_]+)i?\b/i,
|
23935 | // hexadecimal integers and floats
|
23936 | /\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,
|
23937 | // decimal integers and floats
|
23938 | /(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i
|
23939 | ],
|
23940 | 'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
|
23941 | 'builtin': /\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/
|
23942 | });
|
23943 |
|
23944 | Prism.languages.insertBefore('go', 'string', {
|
23945 | 'char': {
|
23946 | pattern: /'(?:\\.|[^'\\\r\n]){0,10}'/,
|
23947 | greedy: true
|
23948 | }
|
23949 | });
|
23950 |
|
23951 | delete Prism.languages.go['class-name'];
|
23952 |
|
23953 |
|
23954 | /***/ }),
|
23955 |
|
23956 | /***/ 57:
|
23957 | /***/ (() => {
|
23958 |
|
23959 | (function (Prism) {
|
23960 |
|
23961 | /**
|
23962 | * @param {string} name
|
23963 | * @returns {RegExp}
|
23964 | */
|
23965 | function headerValueOf(name) {
|
23966 | return RegExp('(^(?:' + name + '):[ \t]*(?![ \t]))[^]+', 'i');
|
23967 | }
|
23968 |
|
23969 | Prism.languages.http = {
|
23970 | 'request-line': {
|
23971 | pattern: /^(?:CONNECT|DELETE|GET|HEAD|OPTIONS|PATCH|POST|PRI|PUT|SEARCH|TRACE)\s(?:https?:\/\/|\/)\S*\sHTTP\/[\d.]+/m,
|
23972 | inside: {
|
23973 | // HTTP Method
|
23974 | 'method': {
|
23975 | pattern: /^[A-Z]+\b/,
|
23976 | alias: 'property'
|
23977 | },
|
23978 | // Request Target e.g. http://example.com, /path/to/file
|
23979 | 'request-target': {
|
23980 | pattern: /^(\s)(?:https?:\/\/|\/)\S*(?=\s)/,
|
23981 | lookbehind: true,
|
23982 | alias: 'url',
|
23983 | inside: Prism.languages.uri
|
23984 | },
|
23985 | // HTTP Version
|
23986 | 'http-version': {
|
23987 | pattern: /^(\s)HTTP\/[\d.]+/,
|
23988 | lookbehind: true,
|
23989 | alias: 'property'
|
23990 | },
|
23991 | }
|
23992 | },
|
23993 | 'response-status': {
|
23994 | pattern: /^HTTP\/[\d.]+ \d+ .+/m,
|
23995 | inside: {
|
23996 | // HTTP Version
|
23997 | 'http-version': {
|
23998 | pattern: /^HTTP\/[\d.]+/,
|
23999 | alias: 'property'
|
24000 | },
|
24001 | // Status Code
|
24002 | 'status-code': {
|
24003 | pattern: /^(\s)\d+(?=\s)/,
|
24004 | lookbehind: true,
|
24005 | alias: 'number'
|
24006 | },
|
24007 | // Reason Phrase
|
24008 | 'reason-phrase': {
|
24009 | pattern: /^(\s).+/,
|
24010 | lookbehind: true,
|
24011 | alias: 'string'
|
24012 | }
|
24013 | }
|
24014 | },
|
24015 | 'header': {
|
24016 | pattern: /^[\w-]+:.+(?:(?:\r\n?|\n)[ \t].+)*/m,
|
24017 | inside: {
|
24018 | 'header-value': [
|
24019 | {
|
24020 | pattern: headerValueOf(/Content-Security-Policy/.source),
|
24021 | lookbehind: true,
|
24022 | alias: ['csp', 'languages-csp'],
|
24023 | inside: Prism.languages.csp
|
24024 | },
|
24025 | {
|
24026 | pattern: headerValueOf(/Public-Key-Pins(?:-Report-Only)?/.source),
|
24027 | lookbehind: true,
|
24028 | alias: ['hpkp', 'languages-hpkp'],
|
24029 | inside: Prism.languages.hpkp
|
24030 | },
|
24031 | {
|
24032 | pattern: headerValueOf(/Strict-Transport-Security/.source),
|
24033 | lookbehind: true,
|
24034 | alias: ['hsts', 'languages-hsts'],
|
24035 | inside: Prism.languages.hsts
|
24036 | },
|
24037 | {
|
24038 | pattern: headerValueOf(/[^:]+/.source),
|
24039 | lookbehind: true
|
24040 | }
|
24041 | ],
|
24042 | 'header-name': {
|
24043 | pattern: /^[^:]+/,
|
24044 | alias: 'keyword'
|
24045 | },
|
24046 | 'punctuation': /^:/
|
24047 | }
|
24048 | }
|
24049 | };
|
24050 |
|
24051 | // Create a mapping of Content-Type headers to language definitions
|
24052 | var langs = Prism.languages;
|
24053 | var httpLanguages = {
|
24054 | 'application/javascript': langs.javascript,
|
24055 | 'application/json': langs.json || langs.javascript,
|
24056 | 'application/xml': langs.xml,
|
24057 | 'text/xml': langs.xml,
|
24058 | 'text/html': langs.html,
|
24059 | 'text/css': langs.css,
|
24060 | 'text/plain': langs.plain
|
24061 | };
|
24062 |
|
24063 | // Declare which types can also be suffixes
|
24064 | var suffixTypes = {
|
24065 | 'application/json': true,
|
24066 | 'application/xml': true
|
24067 | };
|
24068 |
|
24069 | /**
|
24070 | * Returns a pattern for the given content type which matches it and any type which has it as a suffix.
|
24071 | *
|
24072 | * @param {string} contentType
|
24073 | * @returns {string}
|
24074 | */
|
24075 | function getSuffixPattern(contentType) {
|
24076 | var suffix = contentType.replace(/^[a-z]+\//, '');
|
24077 | var suffixPattern = '\\w+/(?:[\\w.-]+\\+)+' + suffix + '(?![+\\w.-])';
|
24078 | return '(?:' + contentType + '|' + suffixPattern + ')';
|
24079 | }
|
24080 |
|
24081 | // Insert each content type parser that has its associated language
|
24082 | // currently loaded.
|
24083 | var options;
|
24084 | for (var contentType in httpLanguages) {
|
24085 | if (httpLanguages[contentType]) {
|
24086 | options = options || {};
|
24087 |
|
24088 | var pattern = suffixTypes[contentType] ? getSuffixPattern(contentType) : contentType;
|
24089 | options[contentType.replace(/\//g, '-')] = {
|
24090 | pattern: RegExp(
|
24091 | '(' + /content-type:\s*/.source + pattern + /(?:(?:\r\n?|\n)[\w-].*)*(?:\r(?:\n|(?!\n))|\n)/.source + ')' +
|
24092 | // This is a little interesting:
|
24093 | // The HTTP format spec required 1 empty line before the body to make everything unambiguous.
|
24094 | // However, when writing code by hand (e.g. to display on a website) people can forget about this,
|
24095 | // so we want to be liberal here. We will allow the empty line to be omitted if the first line of
|
24096 | // the body does not start with a [\w-] character (as headers do).
|
24097 | /[^ \t\w-][\s\S]*/.source,
|
24098 | 'i'
|
24099 | ),
|
24100 | lookbehind: true,
|
24101 | inside: httpLanguages[contentType]
|
24102 | };
|
24103 | }
|
24104 | }
|
24105 | if (options) {
|
24106 | Prism.languages.insertBefore('http', 'header', options);
|
24107 | }
|
24108 |
|
24109 | }(Prism));
|
24110 |
|
24111 |
|
24112 | /***/ }),
|
24113 |
|
24114 | /***/ 503:
|
24115 | /***/ (() => {
|
24116 |
|
24117 | (function (Prism) {
|
24118 |
|
24119 | var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/;
|
24120 |
|
24121 | // full package (optional) + parent classes (optional)
|
24122 | var classNamePrefix = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
|
24123 |
|
24124 | // based on the java naming conventions
|
24125 | var className = {
|
24126 | pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
|
24127 | lookbehind: true,
|
24128 | inside: {
|
24129 | 'namespace': {
|
24130 | pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
|
24131 | inside: {
|
24132 | 'punctuation': /\./
|
24133 | }
|
24134 | },
|
24135 | 'punctuation': /\./
|
24136 | }
|
24137 | };
|
24138 |
|
24139 | Prism.languages.java = Prism.languages.extend('clike', {
|
24140 | 'string': {
|
24141 | pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
|
24142 | lookbehind: true,
|
24143 | greedy: true
|
24144 | },
|
24145 | 'class-name': [
|
24146 | className,
|
24147 | {
|
24148 | // variables, parameters, and constructor references
|
24149 | // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
24150 | pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
|
24151 | lookbehind: true,
|
24152 | inside: className.inside
|
24153 | },
|
24154 | {
|
24155 | // class names based on keyword
|
24156 | // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
24157 | pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + classNamePrefix + /[A-Z]\w*\b/.source),
|
24158 | lookbehind: true,
|
24159 | inside: className.inside
|
24160 | }
|
24161 | ],
|
24162 | 'keyword': keywords,
|
24163 | 'function': [
|
24164 | Prism.languages.clike.function,
|
24165 | {
|
24166 | pattern: /(::\s*)[a-z_]\w*/,
|
24167 | lookbehind: true
|
24168 | }
|
24169 | ],
|
24170 | 'number': /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
|
24171 | 'operator': {
|
24172 | pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
|
24173 | lookbehind: true
|
24174 | },
|
24175 | 'constant': /\b[A-Z][A-Z_\d]+\b/
|
24176 | });
|
24177 |
|
24178 | Prism.languages.insertBefore('java', 'string', {
|
24179 | 'triple-quoted-string': {
|
24180 | // http://openjdk.java.net/jeps/355#Description
|
24181 | pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
|
24182 | greedy: true,
|
24183 | alias: 'string'
|
24184 | },
|
24185 | 'char': {
|
24186 | pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
|
24187 | greedy: true
|
24188 | }
|
24189 | });
|
24190 |
|
24191 | Prism.languages.insertBefore('java', 'class-name', {
|
24192 | 'annotation': {
|
24193 | pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
|
24194 | lookbehind: true,
|
24195 | alias: 'punctuation'
|
24196 | },
|
24197 | 'generics': {
|
24198 | pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
|
24199 | inside: {
|
24200 | 'class-name': className,
|
24201 | 'keyword': keywords,
|
24202 | 'punctuation': /[<>(),.:]/,
|
24203 | 'operator': /[?&|]/
|
24204 | }
|
24205 | },
|
24206 | 'import': [
|
24207 | {
|
24208 | pattern: RegExp(/(\bimport\s+)/.source + classNamePrefix + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
|
24209 | lookbehind: true,
|
24210 | inside: {
|
24211 | 'namespace': className.inside.namespace,
|
24212 | 'punctuation': /\./,
|
24213 | 'operator': /\*/,
|
24214 | 'class-name': /\w+/
|
24215 | }
|
24216 | },
|
24217 | {
|
24218 | pattern: RegExp(/(\bimport\s+static\s+)/.source + classNamePrefix + /(?:\w+|\*)(?=\s*;)/.source),
|
24219 | lookbehind: true,
|
24220 | alias: 'static',
|
24221 | inside: {
|
24222 | 'namespace': className.inside.namespace,
|
24223 | 'static': /\b\w+$/,
|
24224 | 'punctuation': /\./,
|
24225 | 'operator': /\*/,
|
24226 | 'class-name': /\w+/
|
24227 | }
|
24228 | }
|
24229 | ],
|
24230 | 'namespace': {
|
24231 | pattern: RegExp(
|
24232 | /(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/
|
24233 | .source.replace(/<keyword>/g, function () { return keywords.source; })),
|
24234 | lookbehind: true,
|
24235 | inside: {
|
24236 | 'punctuation': /\./,
|
24237 | }
|
24238 | }
|
24239 | });
|
24240 | }(Prism));
|
24241 |
|
24242 |
|
24243 | /***/ }),
|
24244 |
|
24245 | /***/ 277:
|
24246 | /***/ (() => {
|
24247 |
|
24248 | // https://www.json.org/json-en.html
|
24249 | Prism.languages.json = {
|
24250 | 'property': {
|
24251 | pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
|
24252 | lookbehind: true,
|
24253 | greedy: true
|
24254 | },
|
24255 | 'string': {
|
24256 | pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
|
24257 | lookbehind: true,
|
24258 | greedy: true
|
24259 | },
|
24260 | 'comment': {
|
24261 | pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
|
24262 | greedy: true
|
24263 | },
|
24264 | 'number': /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
24265 | 'punctuation': /[{}[\],]/,
|
24266 | 'operator': /:/,
|
24267 | 'boolean': /\b(?:false|true)\b/,
|
24268 | 'null': {
|
24269 | pattern: /\bnull\b/,
|
24270 | alias: 'keyword'
|
24271 | }
|
24272 | };
|
24273 |
|
24274 | Prism.languages.webmanifest = Prism.languages.json;
|
24275 |
|
24276 |
|
24277 | /***/ }),
|
24278 |
|
24279 | /***/ 366:
|
24280 | /***/ (() => {
|
24281 |
|
24282 | Prism.languages.python = {
|
24283 | 'comment': {
|
24284 | pattern: /(^|[^\\])#.*/,
|
24285 | lookbehind: true,
|
24286 | greedy: true
|
24287 | },
|
24288 | 'string-interpolation': {
|
24289 | pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
|
24290 | greedy: true,
|
24291 | inside: {
|
24292 | 'interpolation': {
|
24293 | // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
|
24294 | pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
|
24295 | lookbehind: true,
|
24296 | inside: {
|
24297 | 'format-spec': {
|
24298 | pattern: /(:)[^:(){}]+(?=\}$)/,
|
24299 | lookbehind: true
|
24300 | },
|
24301 | 'conversion-option': {
|
24302 | pattern: /![sra](?=[:}]$)/,
|
24303 | alias: 'punctuation'
|
24304 | },
|
24305 | rest: null
|
24306 | }
|
24307 | },
|
24308 | 'string': /[\s\S]+/
|
24309 | }
|
24310 | },
|
24311 | 'triple-quoted-string': {
|
24312 | pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
|
24313 | greedy: true,
|
24314 | alias: 'string'
|
24315 | },
|
24316 | 'string': {
|
24317 | pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
|
24318 | greedy: true
|
24319 | },
|
24320 | 'function': {
|
24321 | pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
|
24322 | lookbehind: true
|
24323 | },
|
24324 | 'class-name': {
|
24325 | pattern: /(\bclass\s+)\w+/i,
|
24326 | lookbehind: true
|
24327 | },
|
24328 | 'decorator': {
|
24329 | pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
|
24330 | lookbehind: true,
|
24331 | alias: ['annotation', 'punctuation'],
|
24332 | inside: {
|
24333 | 'punctuation': /\./
|
24334 | }
|
24335 | },
|
24336 | 'keyword': /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
|
24337 | 'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
|
24338 | 'boolean': /\b(?:False|None|True)\b/,
|
24339 | 'number': /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
|
24340 | 'operator': /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
|
24341 | 'punctuation': /[{}[\];(),.:]/
|
24342 | };
|
24343 |
|
24344 | Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
|
24345 |
|
24346 | Prism.languages.py = Prism.languages.python;
|
24347 |
|
24348 |
|
24349 | /***/ }),
|
24350 |
|
24351 | /***/ 358:
|
24352 | /***/ (() => {
|
24353 |
|
24354 | (function (Prism) {
|
24355 |
|
24356 | // https://yaml.org/spec/1.2/spec.html#c-ns-anchor-property
|
24357 | // https://yaml.org/spec/1.2/spec.html#c-ns-alias-node
|
24358 | var anchorOrAlias = /[*&][^\s[\]{},]+/;
|
24359 | // https://yaml.org/spec/1.2/spec.html#c-ns-tag-property
|
24360 | var tag = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/;
|
24361 | // https://yaml.org/spec/1.2/spec.html#c-ns-properties(n,c)
|
24362 | var properties = '(?:' + tag.source + '(?:[ \t]+' + anchorOrAlias.source + ')?|'
|
24363 | + anchorOrAlias.source + '(?:[ \t]+' + tag.source + ')?)';
|
24364 | // https://yaml.org/spec/1.2/spec.html#ns-plain(n,c)
|
24365 | // This is a simplified version that doesn't support "#" and multiline keys
|
24366 | // All these long scarry character classes are simplified versions of YAML's characters
|
24367 | var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source
|
24368 | .replace(/<PLAIN>/g, function () { return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source; });
|
24369 | var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
|
24370 |
|
24371 | /**
|
24372 | *
|
24373 | * @param {string} value
|
24374 | * @param {string} [flags]
|
24375 | * @returns {RegExp}
|
24376 | */
|
24377 | function createValuePattern(value, flags) {
|
24378 | flags = (flags || '').replace(/m/g, '') + 'm'; // add m flag
|
24379 | var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source
|
24380 | .replace(/<<prop>>/g, function () { return properties; }).replace(/<<value>>/g, function () { return value; });
|
24381 | return RegExp(pattern, flags);
|
24382 | }
|
24383 |
|
24384 | Prism.languages.yaml = {
|
24385 | 'scalar': {
|
24386 | pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source
|
24387 | .replace(/<<prop>>/g, function () { return properties; })),
|
24388 | lookbehind: true,
|
24389 | alias: 'string'
|
24390 | },
|
24391 | 'comment': /#.*/,
|
24392 | 'key': {
|
24393 | pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source
|
24394 | .replace(/<<prop>>/g, function () { return properties; })
|
24395 | .replace(/<<key>>/g, function () { return '(?:' + plainKey + '|' + string + ')'; })),
|
24396 | lookbehind: true,
|
24397 | greedy: true,
|
24398 | alias: 'atrule'
|
24399 | },
|
24400 | 'directive': {
|
24401 | pattern: /(^[ \t]*)%.+/m,
|
24402 | lookbehind: true,
|
24403 | alias: 'important'
|
24404 | },
|
24405 | 'datetime': {
|
24406 | pattern: createValuePattern(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),
|
24407 | lookbehind: true,
|
24408 | alias: 'number'
|
24409 | },
|
24410 | 'boolean': {
|
24411 | pattern: createValuePattern(/false|true/.source, 'i'),
|
24412 | lookbehind: true,
|
24413 | alias: 'important'
|
24414 | },
|
24415 | 'null': {
|
24416 | pattern: createValuePattern(/null|~/.source, 'i'),
|
24417 | lookbehind: true,
|
24418 | alias: 'important'
|
24419 | },
|
24420 | 'string': {
|
24421 | pattern: createValuePattern(string),
|
24422 | lookbehind: true,
|
24423 | greedy: true
|
24424 | },
|
24425 | 'number': {
|
24426 | pattern: createValuePattern(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, 'i'),
|
24427 | lookbehind: true
|
24428 | },
|
24429 | 'tag': tag,
|
24430 | 'important': anchorOrAlias,
|
24431 | 'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./
|
24432 | };
|
24433 |
|
24434 | Prism.languages.yml = Prism.languages.yaml;
|
24435 |
|
24436 | }(Prism));
|
24437 |
|
24438 |
|
24439 | /***/ }),
|
24440 |
|
24441 | /***/ 660:
|
24442 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
24443 |
|
24444 |
|
24445 | /* **********************************************
|
24446 | Begin prism-core.js
|
24447 | ********************************************** */
|
24448 |
|
24449 | /// <reference lib="WebWorker"/>
|
24450 |
|
24451 | var _self = (typeof window !== 'undefined')
|
24452 | ? window // if in browser
|
24453 | : (
|
24454 | (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
|
24455 | ? self // if in worker
|
24456 | : {} // if in node js
|
24457 | );
|
24458 |
|
24459 | /**
|
24460 | * Prism: Lightweight, robust, elegant syntax highlighting
|
24461 | *
|
24462 | * @license MIT <https://opensource.org/licenses/MIT>
|
24463 | * @author Lea Verou <https://lea.verou.me>
|
24464 | * @namespace
|
24465 | * @public
|
24466 | */
|
24467 | var Prism = (function (_self) {
|
24468 |
|
24469 | // Private helper vars
|
24470 | var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
|
24471 | var uniqueId = 0;
|
24472 |
|
24473 | // The grammar object for plaintext
|
24474 | var plainTextGrammar = {};
|
24475 |
|
24476 |
|
24477 | var _ = {
|
24478 | /**
|
24479 | * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
|
24480 | * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
|
24481 | * additional languages or plugins yourself.
|
24482 | *
|
24483 | * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
|
24484 | *
|
24485 | * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
|
24486 | * empty Prism object into the global scope before loading the Prism script like this:
|
24487 | *
|
24488 | * ```js
|
24489 | * window.Prism = window.Prism || {};
|
24490 | * Prism.manual = true;
|
24491 | * // add a new <script> to load Prism's script
|
24492 | * ```
|
24493 | *
|
24494 | * @default false
|
24495 | * @type {boolean}
|
24496 | * @memberof Prism
|
24497 | * @public
|
24498 | */
|
24499 | manual: _self.Prism && _self.Prism.manual,
|
24500 | /**
|
24501 | * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
|
24502 | * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
|
24503 | * own worker, you don't want it to do this.
|
24504 | *
|
24505 | * By setting this value to `true`, Prism will not add its own listeners to the worker.
|
24506 | *
|
24507 | * You obviously have to change this value before Prism executes. To do this, you can add an
|
24508 | * empty Prism object into the global scope before loading the Prism script like this:
|
24509 | *
|
24510 | * ```js
|
24511 | * window.Prism = window.Prism || {};
|
24512 | * Prism.disableWorkerMessageHandler = true;
|
24513 | * // Load Prism's script
|
24514 | * ```
|
24515 | *
|
24516 | * @default false
|
24517 | * @type {boolean}
|
24518 | * @memberof Prism
|
24519 | * @public
|
24520 | */
|
24521 | disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
|
24522 |
|
24523 | /**
|
24524 | * A namespace for utility methods.
|
24525 | *
|
24526 | * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
|
24527 | * change or disappear at any time.
|
24528 | *
|
24529 | * @namespace
|
24530 | * @memberof Prism
|
24531 | */
|
24532 | util: {
|
24533 | encode: function encode(tokens) {
|
24534 | if (tokens instanceof Token) {
|
24535 | return new Token(tokens.type, encode(tokens.content), tokens.alias);
|
24536 | } else if (Array.isArray(tokens)) {
|
24537 | return tokens.map(encode);
|
24538 | } else {
|
24539 | return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' ');
|
24540 | }
|
24541 | },
|
24542 |
|
24543 | /**
|
24544 | * Returns the name of the type of the given value.
|
24545 | *
|
24546 | * @param {any} o
|
24547 | * @returns {string}
|
24548 | * @example
|
24549 | * type(null) === 'Null'
|
24550 | * type(undefined) === 'Undefined'
|
24551 | * type(123) === 'Number'
|
24552 | * type('foo') === 'String'
|
24553 | * type(true) === 'Boolean'
|
24554 | * type([1, 2]) === 'Array'
|
24555 | * type({}) === 'Object'
|
24556 | * type(String) === 'Function'
|
24557 | * type(/abc+/) === 'RegExp'
|
24558 | */
|
24559 | type: function (o) {
|
24560 | return Object.prototype.toString.call(o).slice(8, -1);
|
24561 | },
|
24562 |
|
24563 | /**
|
24564 | * Returns a unique number for the given object. Later calls will still return the same number.
|
24565 | *
|
24566 | * @param {Object} obj
|
24567 | * @returns {number}
|
24568 | */
|
24569 | objId: function (obj) {
|
24570 | if (!obj['__id']) {
|
24571 | Object.defineProperty(obj, '__id', { value: ++uniqueId });
|
24572 | }
|
24573 | return obj['__id'];
|
24574 | },
|
24575 |
|
24576 | /**
|
24577 | * Creates a deep clone of the given object.
|
24578 | *
|
24579 | * The main intended use of this function is to clone language definitions.
|
24580 | *
|
24581 | * @param {T} o
|
24582 | * @param {Record<number, any>} [visited]
|
24583 | * @returns {T}
|
24584 | * @template T
|
24585 | */
|
24586 | clone: function deepClone(o, visited) {
|
24587 | visited = visited || {};
|
24588 |
|
24589 | var clone; var id;
|
24590 | switch (_.util.type(o)) {
|
24591 | case 'Object':
|
24592 | id = _.util.objId(o);
|
24593 | if (visited[id]) {
|
24594 | return visited[id];
|
24595 | }
|
24596 | clone = /** @type {Record<string, any>} */ ({});
|
24597 | visited[id] = clone;
|
24598 |
|
24599 | for (var key in o) {
|
24600 | if (o.hasOwnProperty(key)) {
|
24601 | clone[key] = deepClone(o[key], visited);
|
24602 | }
|
24603 | }
|
24604 |
|
24605 | return /** @type {any} */ (clone);
|
24606 |
|
24607 | case 'Array':
|
24608 | id = _.util.objId(o);
|
24609 | if (visited[id]) {
|
24610 | return visited[id];
|
24611 | }
|
24612 | clone = [];
|
24613 | visited[id] = clone;
|
24614 |
|
24615 | (/** @type {Array} */(/** @type {any} */(o))).forEach(function (v, i) {
|
24616 | clone[i] = deepClone(v, visited);
|
24617 | });
|
24618 |
|
24619 | return /** @type {any} */ (clone);
|
24620 |
|
24621 | default:
|
24622 | return o;
|
24623 | }
|
24624 | },
|
24625 |
|
24626 | /**
|
24627 | * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
|
24628 | *
|
24629 | * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
|
24630 | *
|
24631 | * @param {Element} element
|
24632 | * @returns {string}
|
24633 | */
|
24634 | getLanguage: function (element) {
|
24635 | while (element) {
|
24636 | var m = lang.exec(element.className);
|
24637 | if (m) {
|
24638 | return m[1].toLowerCase();
|
24639 | }
|
24640 | element = element.parentElement;
|
24641 | }
|
24642 | return 'none';
|
24643 | },
|
24644 |
|
24645 | /**
|
24646 | * Sets the Prism `language-xxxx` class of the given element.
|
24647 | *
|
24648 | * @param {Element} element
|
24649 | * @param {string} language
|
24650 | * @returns {void}
|
24651 | */
|
24652 | setLanguage: function (element, language) {
|
24653 | // remove all `language-xxxx` classes
|
24654 | // (this might leave behind a leading space)
|
24655 | element.className = element.className.replace(RegExp(lang, 'gi'), '');
|
24656 |
|
24657 | // add the new `language-xxxx` class
|
24658 | // (using `classList` will automatically clean up spaces for us)
|
24659 | element.classList.add('language-' + language);
|
24660 | },
|
24661 |
|
24662 | /**
|
24663 | * Returns the script element that is currently executing.
|
24664 | *
|
24665 | * This does __not__ work for line script element.
|
24666 | *
|
24667 | * @returns {HTMLScriptElement | null}
|
24668 | */
|
24669 | currentScript: function () {
|
24670 | if (typeof document === 'undefined') {
|
24671 | return null;
|
24672 | }
|
24673 | if ('currentScript' in document && 1 < 2 /* hack to trip TS' flow analysis */) {
|
24674 | return /** @type {any} */ (document.currentScript);
|
24675 | }
|
24676 |
|
24677 | // IE11 workaround
|
24678 | // we'll get the src of the current script by parsing IE11's error stack trace
|
24679 | // this will not work for inline scripts
|
24680 |
|
24681 | try {
|
24682 | throw new Error();
|
24683 | } catch (err) {
|
24684 | // Get file src url from stack. Specifically works with the format of stack traces in IE.
|
24685 | // A stack will look like this:
|
24686 | //
|
24687 | // Error
|
24688 | // at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
|
24689 | // at Global code (http://localhost/components/prism-core.js:606:1)
|
24690 |
|
24691 | var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
|
24692 | if (src) {
|
24693 | var scripts = document.getElementsByTagName('script');
|
24694 | for (var i in scripts) {
|
24695 | if (scripts[i].src == src) {
|
24696 | return scripts[i];
|
24697 | }
|
24698 | }
|
24699 | }
|
24700 | return null;
|
24701 | }
|
24702 | },
|
24703 |
|
24704 | /**
|
24705 | * Returns whether a given class is active for `element`.
|
24706 | *
|
24707 | * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
|
24708 | * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
|
24709 | * given class is just the given class with a `no-` prefix.
|
24710 | *
|
24711 | * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
|
24712 | * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
|
24713 | * ancestors have the given class or the negated version of it, then the default activation will be returned.
|
24714 | *
|
24715 | * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
|
24716 | * version of it, the class is considered active.
|
24717 | *
|
24718 | * @param {Element} element
|
24719 | * @param {string} className
|
24720 | * @param {boolean} [defaultActivation=false]
|
24721 | * @returns {boolean}
|
24722 | */
|
24723 | isActive: function (element, className, defaultActivation) {
|
24724 | var no = 'no-' + className;
|
24725 |
|
24726 | while (element) {
|
24727 | var classList = element.classList;
|
24728 | if (classList.contains(className)) {
|
24729 | return true;
|
24730 | }
|
24731 | if (classList.contains(no)) {
|
24732 | return false;
|
24733 | }
|
24734 | element = element.parentElement;
|
24735 | }
|
24736 | return !!defaultActivation;
|
24737 | }
|
24738 | },
|
24739 |
|
24740 | /**
|
24741 | * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
|
24742 | *
|
24743 | * @namespace
|
24744 | * @memberof Prism
|
24745 | * @public
|
24746 | */
|
24747 | languages: {
|
24748 | /**
|
24749 | * The grammar for plain, unformatted text.
|
24750 | */
|
24751 | plain: plainTextGrammar,
|
24752 | plaintext: plainTextGrammar,
|
24753 | text: plainTextGrammar,
|
24754 | txt: plainTextGrammar,
|
24755 |
|
24756 | /**
|
24757 | * Creates a deep copy of the language with the given id and appends the given tokens.
|
24758 | *
|
24759 | * If a token in `redef` also appears in the copied language, then the existing token in the copied language
|
24760 | * will be overwritten at its original position.
|
24761 | *
|
24762 | * ## Best practices
|
24763 | *
|
24764 | * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
|
24765 | * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
|
24766 | * understand the language definition because, normally, the order of tokens matters in Prism grammars.
|
24767 | *
|
24768 | * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
|
24769 | * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
|
24770 | *
|
24771 | * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
|
24772 | * @param {Grammar} redef The new tokens to append.
|
24773 | * @returns {Grammar} The new language created.
|
24774 | * @public
|
24775 | * @example
|
24776 | * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
|
24777 | * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
|
24778 | * // at its original position
|
24779 | * 'comment': { ... },
|
24780 | * // CSS doesn't have a 'color' token, so this token will be appended
|
24781 | * 'color': /\b(?:red|green|blue)\b/
|
24782 | * });
|
24783 | */
|
24784 | extend: function (id, redef) {
|
24785 | var lang = _.util.clone(_.languages[id]);
|
24786 |
|
24787 | for (var key in redef) {
|
24788 | lang[key] = redef[key];
|
24789 | }
|
24790 |
|
24791 | return lang;
|
24792 | },
|
24793 |
|
24794 | /**
|
24795 | * Inserts tokens _before_ another token in a language definition or any other grammar.
|
24796 | *
|
24797 | * ## Usage
|
24798 | *
|
24799 | * This helper method makes it easy to modify existing languages. For example, the CSS language definition
|
24800 | * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
|
24801 | * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
|
24802 | * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
|
24803 | * this:
|
24804 | *
|
24805 | * ```js
|
24806 | * Prism.languages.markup.style = {
|
24807 | * // token
|
24808 | * };
|
24809 | * ```
|
24810 | *
|
24811 | * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
|
24812 | * before existing tokens. For the CSS example above, you would use it like this:
|
24813 | *
|
24814 | * ```js
|
24815 | * Prism.languages.insertBefore('markup', 'cdata', {
|
24816 | * 'style': {
|
24817 | * // token
|
24818 | * }
|
24819 | * });
|
24820 | * ```
|
24821 | *
|
24822 | * ## Special cases
|
24823 | *
|
24824 | * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
|
24825 | * will be ignored.
|
24826 | *
|
24827 | * This behavior can be used to insert tokens after `before`:
|
24828 | *
|
24829 | * ```js
|
24830 | * Prism.languages.insertBefore('markup', 'comment', {
|
24831 | * 'comment': Prism.languages.markup.comment,
|
24832 | * // tokens after 'comment'
|
24833 | * });
|
24834 | * ```
|
24835 | *
|
24836 | * ## Limitations
|
24837 | *
|
24838 | * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
|
24839 | * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
|
24840 | * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
|
24841 | * deleting properties which is necessary to insert at arbitrary positions.
|
24842 | *
|
24843 | * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
|
24844 | * Instead, it will create a new object and replace all references to the target object with the new one. This
|
24845 | * can be done without temporarily deleting properties, so the iteration order is well-defined.
|
24846 | *
|
24847 | * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
|
24848 | * you hold the target object in a variable, then the value of the variable will not change.
|
24849 | *
|
24850 | * ```js
|
24851 | * var oldMarkup = Prism.languages.markup;
|
24852 | * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
|
24853 | *
|
24854 | * assert(oldMarkup !== Prism.languages.markup);
|
24855 | * assert(newMarkup === Prism.languages.markup);
|
24856 | * ```
|
24857 | *
|
24858 | * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
|
24859 | * object to be modified.
|
24860 | * @param {string} before The key to insert before.
|
24861 | * @param {Grammar} insert An object containing the key-value pairs to be inserted.
|
24862 | * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
|
24863 | * object to be modified.
|
24864 | *
|
24865 | * Defaults to `Prism.languages`.
|
24866 | * @returns {Grammar} The new grammar object.
|
24867 | * @public
|
24868 | */
|
24869 | insertBefore: function (inside, before, insert, root) {
|
24870 | root = root || /** @type {any} */ (_.languages);
|
24871 | var grammar = root[inside];
|
24872 | /** @type {Grammar} */
|
24873 | var ret = {};
|
24874 |
|
24875 | for (var token in grammar) {
|
24876 | if (grammar.hasOwnProperty(token)) {
|
24877 |
|
24878 | if (token == before) {
|
24879 | for (var newToken in insert) {
|
24880 | if (insert.hasOwnProperty(newToken)) {
|
24881 | ret[newToken] = insert[newToken];
|
24882 | }
|
24883 | }
|
24884 | }
|
24885 |
|
24886 | // Do not insert token which also occur in insert. See #1525
|
24887 | if (!insert.hasOwnProperty(token)) {
|
24888 | ret[token] = grammar[token];
|
24889 | }
|
24890 | }
|
24891 | }
|
24892 |
|
24893 | var old = root[inside];
|
24894 | root[inside] = ret;
|
24895 |
|
24896 | // Update references in other language definitions
|
24897 | _.languages.DFS(_.languages, function (key, value) {
|
24898 | if (value === old && key != inside) {
|
24899 | this[key] = ret;
|
24900 | }
|
24901 | });
|
24902 |
|
24903 | return ret;
|
24904 | },
|
24905 |
|
24906 | // Traverse a language definition with Depth First Search
|
24907 | DFS: function DFS(o, callback, type, visited) {
|
24908 | visited = visited || {};
|
24909 |
|
24910 | var objId = _.util.objId;
|
24911 |
|
24912 | for (var i in o) {
|
24913 | if (o.hasOwnProperty(i)) {
|
24914 | callback.call(o, i, o[i], type || i);
|
24915 |
|
24916 | var property = o[i];
|
24917 | var propertyType = _.util.type(property);
|
24918 |
|
24919 | if (propertyType === 'Object' && !visited[objId(property)]) {
|
24920 | visited[objId(property)] = true;
|
24921 | DFS(property, callback, null, visited);
|
24922 | } else if (propertyType === 'Array' && !visited[objId(property)]) {
|
24923 | visited[objId(property)] = true;
|
24924 | DFS(property, callback, i, visited);
|
24925 | }
|
24926 | }
|
24927 | }
|
24928 | }
|
24929 | },
|
24930 |
|
24931 | plugins: {},
|
24932 |
|
24933 | /**
|
24934 | * This is the most high-level function in Prism’s API.
|
24935 | * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
|
24936 | * each one of them.
|
24937 | *
|
24938 | * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
|
24939 | *
|
24940 | * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
|
24941 | * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
|
24942 | * @memberof Prism
|
24943 | * @public
|
24944 | */
|
24945 | highlightAll: function (async, callback) {
|
24946 | _.highlightAllUnder(document, async, callback);
|
24947 | },
|
24948 |
|
24949 | /**
|
24950 | * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
|
24951 | * {@link Prism.highlightElement} on each one of them.
|
24952 | *
|
24953 | * The following hooks will be run:
|
24954 | * 1. `before-highlightall`
|
24955 | * 2. `before-all-elements-highlight`
|
24956 | * 3. All hooks of {@link Prism.highlightElement} for each element.
|
24957 | *
|
24958 | * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
|
24959 | * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
|
24960 | * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
|
24961 | * @memberof Prism
|
24962 | * @public
|
24963 | */
|
24964 | highlightAllUnder: function (container, async, callback) {
|
24965 | var env = {
|
24966 | callback: callback,
|
24967 | container: container,
|
24968 | selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
|
24969 | };
|
24970 |
|
24971 | _.hooks.run('before-highlightall', env);
|
24972 |
|
24973 | env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
|
24974 |
|
24975 | _.hooks.run('before-all-elements-highlight', env);
|
24976 |
|
24977 | for (var i = 0, element; (element = env.elements[i++]);) {
|
24978 | _.highlightElement(element, async === true, env.callback);
|
24979 | }
|
24980 | },
|
24981 |
|
24982 | /**
|
24983 | * Highlights the code inside a single element.
|
24984 | *
|
24985 | * The following hooks will be run:
|
24986 | * 1. `before-sanity-check`
|
24987 | * 2. `before-highlight`
|
24988 | * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
|
24989 | * 4. `before-insert`
|
24990 | * 5. `after-highlight`
|
24991 | * 6. `complete`
|
24992 | *
|
24993 | * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
|
24994 | * the element's language.
|
24995 | *
|
24996 | * @param {Element} element The element containing the code.
|
24997 | * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
|
24998 | * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
|
24999 | * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
|
25000 | * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
|
25001 | *
|
25002 | * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
|
25003 | * asynchronous highlighting to work. You can build your own bundle on the
|
25004 | * [Download page](https://prismjs.com/download.html).
|
25005 | * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
|
25006 | * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
|
25007 | * @memberof Prism
|
25008 | * @public
|
25009 | */
|
25010 | highlightElement: function (element, async, callback) {
|
25011 | // Find language
|
25012 | var language = _.util.getLanguage(element);
|
25013 | var grammar = _.languages[language];
|
25014 |
|
25015 | // Set language on the element, if not present
|
25016 | _.util.setLanguage(element, language);
|
25017 |
|
25018 | // Set language on the parent, for styling
|
25019 | var parent = element.parentElement;
|
25020 | if (parent && parent.nodeName.toLowerCase() === 'pre') {
|
25021 | _.util.setLanguage(parent, language);
|
25022 | }
|
25023 |
|
25024 | var code = element.textContent;
|
25025 |
|
25026 | var env = {
|
25027 | element: element,
|
25028 | language: language,
|
25029 | grammar: grammar,
|
25030 | code: code
|
25031 | };
|
25032 |
|
25033 | function insertHighlightedCode(highlightedCode) {
|
25034 | env.highlightedCode = highlightedCode;
|
25035 |
|
25036 | _.hooks.run('before-insert', env);
|
25037 |
|
25038 | env.element.innerHTML = env.highlightedCode;
|
25039 |
|
25040 | _.hooks.run('after-highlight', env);
|
25041 | _.hooks.run('complete', env);
|
25042 | callback && callback.call(env.element);
|
25043 | }
|
25044 |
|
25045 | _.hooks.run('before-sanity-check', env);
|
25046 |
|
25047 | // plugins may change/add the parent/element
|
25048 | parent = env.element.parentElement;
|
25049 | if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
|
25050 | parent.setAttribute('tabindex', '0');
|
25051 | }
|
25052 |
|
25053 | if (!env.code) {
|
25054 | _.hooks.run('complete', env);
|
25055 | callback && callback.call(env.element);
|
25056 | return;
|
25057 | }
|
25058 |
|
25059 | _.hooks.run('before-highlight', env);
|
25060 |
|
25061 | if (!env.grammar) {
|
25062 | insertHighlightedCode(_.util.encode(env.code));
|
25063 | return;
|
25064 | }
|
25065 |
|
25066 | if (async && _self.Worker) {
|
25067 | var worker = new Worker(_.filename);
|
25068 |
|
25069 | worker.onmessage = function (evt) {
|
25070 | insertHighlightedCode(evt.data);
|
25071 | };
|
25072 |
|
25073 | worker.postMessage(JSON.stringify({
|
25074 | language: env.language,
|
25075 | code: env.code,
|
25076 | immediateClose: true
|
25077 | }));
|
25078 | } else {
|
25079 | insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
|
25080 | }
|
25081 | },
|
25082 |
|
25083 | /**
|
25084 | * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
|
25085 | * and the language definitions to use, and returns a string with the HTML produced.
|
25086 | *
|
25087 | * The following hooks will be run:
|
25088 | * 1. `before-tokenize`
|
25089 | * 2. `after-tokenize`
|
25090 | * 3. `wrap`: On each {@link Token}.
|
25091 | *
|
25092 | * @param {string} text A string with the code to be highlighted.
|
25093 | * @param {Grammar} grammar An object containing the tokens to use.
|
25094 | *
|
25095 | * Usually a language definition like `Prism.languages.markup`.
|
25096 | * @param {string} language The name of the language definition passed to `grammar`.
|
25097 | * @returns {string} The highlighted HTML.
|
25098 | * @memberof Prism
|
25099 | * @public
|
25100 | * @example
|
25101 | * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
|
25102 | */
|
25103 | highlight: function (text, grammar, language) {
|
25104 | var env = {
|
25105 | code: text,
|
25106 | grammar: grammar,
|
25107 | language: language
|
25108 | };
|
25109 | _.hooks.run('before-tokenize', env);
|
25110 | if (!env.grammar) {
|
25111 | throw new Error('The language "' + env.language + '" has no grammar.');
|
25112 | }
|
25113 | env.tokens = _.tokenize(env.code, env.grammar);
|
25114 | _.hooks.run('after-tokenize', env);
|
25115 | return Token.stringify(_.util.encode(env.tokens), env.language);
|
25116 | },
|
25117 |
|
25118 | /**
|
25119 | * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
|
25120 | * and the language definitions to use, and returns an array with the tokenized code.
|
25121 | *
|
25122 | * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
|
25123 | *
|
25124 | * This method could be useful in other contexts as well, as a very crude parser.
|
25125 | *
|
25126 | * @param {string} text A string with the code to be highlighted.
|
25127 | * @param {Grammar} grammar An object containing the tokens to use.
|
25128 | *
|
25129 | * Usually a language definition like `Prism.languages.markup`.
|
25130 | * @returns {TokenStream} An array of strings and tokens, a token stream.
|
25131 | * @memberof Prism
|
25132 | * @public
|
25133 | * @example
|
25134 | * let code = `var foo = 0;`;
|
25135 | * let tokens = Prism.tokenize(code, Prism.languages.javascript);
|
25136 | * tokens.forEach(token => {
|
25137 | * if (token instanceof Prism.Token && token.type === 'number') {
|
25138 | * console.log(`Found numeric literal: ${token.content}`);
|
25139 | * }
|
25140 | * });
|
25141 | */
|
25142 | tokenize: function (text, grammar) {
|
25143 | var rest = grammar.rest;
|
25144 | if (rest) {
|
25145 | for (var token in rest) {
|
25146 | grammar[token] = rest[token];
|
25147 | }
|
25148 |
|
25149 | delete grammar.rest;
|
25150 | }
|
25151 |
|
25152 | var tokenList = new LinkedList();
|
25153 | addAfter(tokenList, tokenList.head, text);
|
25154 |
|
25155 | matchGrammar(text, tokenList, grammar, tokenList.head, 0);
|
25156 |
|
25157 | return toArray(tokenList);
|
25158 | },
|
25159 |
|
25160 | /**
|
25161 | * @namespace
|
25162 | * @memberof Prism
|
25163 | * @public
|
25164 | */
|
25165 | hooks: {
|
25166 | all: {},
|
25167 |
|
25168 | /**
|
25169 | * Adds the given callback to the list of callbacks for the given hook.
|
25170 | *
|
25171 | * The callback will be invoked when the hook it is registered for is run.
|
25172 | * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
|
25173 | *
|
25174 | * One callback function can be registered to multiple hooks and the same hook multiple times.
|
25175 | *
|
25176 | * @param {string} name The name of the hook.
|
25177 | * @param {HookCallback} callback The callback function which is given environment variables.
|
25178 | * @public
|
25179 | */
|
25180 | add: function (name, callback) {
|
25181 | var hooks = _.hooks.all;
|
25182 |
|
25183 | hooks[name] = hooks[name] || [];
|
25184 |
|
25185 | hooks[name].push(callback);
|
25186 | },
|
25187 |
|
25188 | /**
|
25189 | * Runs a hook invoking all registered callbacks with the given environment variables.
|
25190 | *
|
25191 | * Callbacks will be invoked synchronously and in the order in which they were registered.
|
25192 | *
|
25193 | * @param {string} name The name of the hook.
|
25194 | * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
|
25195 | * @public
|
25196 | */
|
25197 | run: function (name, env) {
|
25198 | var callbacks = _.hooks.all[name];
|
25199 |
|
25200 | if (!callbacks || !callbacks.length) {
|
25201 | return;
|
25202 | }
|
25203 |
|
25204 | for (var i = 0, callback; (callback = callbacks[i++]);) {
|
25205 | callback(env);
|
25206 | }
|
25207 | }
|
25208 | },
|
25209 |
|
25210 | Token: Token
|
25211 | };
|
25212 | _self.Prism = _;
|
25213 |
|
25214 |
|
25215 | // Typescript note:
|
25216 | // The following can be used to import the Token type in JSDoc:
|
25217 | //
|
25218 | // @typedef {InstanceType<import("./prism-core")["Token"]>} Token
|
25219 |
|
25220 | /**
|
25221 | * Creates a new token.
|
25222 | *
|
25223 | * @param {string} type See {@link Token#type type}
|
25224 | * @param {string | TokenStream} content See {@link Token#content content}
|
25225 | * @param {string|string[]} [alias] The alias(es) of the token.
|
25226 | * @param {string} [matchedStr=""] A copy of the full string this token was created from.
|
25227 | * @class
|
25228 | * @global
|
25229 | * @public
|
25230 | */
|
25231 | function Token(type, content, alias, matchedStr) {
|
25232 | /**
|
25233 | * The type of the token.
|
25234 | *
|
25235 | * This is usually the key of a pattern in a {@link Grammar}.
|
25236 | *
|
25237 | * @type {string}
|
25238 | * @see GrammarToken
|
25239 | * @public
|
25240 | */
|
25241 | this.type = type;
|
25242 | /**
|
25243 | * The strings or tokens contained by this token.
|
25244 | *
|
25245 | * This will be a token stream if the pattern matched also defined an `inside` grammar.
|
25246 | *
|
25247 | * @type {string | TokenStream}
|
25248 | * @public
|
25249 | */
|
25250 | this.content = content;
|
25251 | /**
|
25252 | * The alias(es) of the token.
|
25253 | *
|
25254 | * @type {string|string[]}
|
25255 | * @see GrammarToken
|
25256 | * @public
|
25257 | */
|
25258 | this.alias = alias;
|
25259 | // Copy of the full string this token was created from
|
25260 | this.length = (matchedStr || '').length | 0;
|
25261 | }
|
25262 |
|
25263 | /**
|
25264 | * A token stream is an array of strings and {@link Token Token} objects.
|
25265 | *
|
25266 | * Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
|
25267 | * them.
|
25268 | *
|
25269 | * 1. No adjacent strings.
|
25270 | * 2. No empty strings.
|
25271 | *
|
25272 | * The only exception here is the token stream that only contains the empty string and nothing else.
|
25273 | *
|
25274 | * @typedef {Array<string | Token>} TokenStream
|
25275 | * @global
|
25276 | * @public
|
25277 | */
|
25278 |
|
25279 | /**
|
25280 | * Converts the given token or token stream to an HTML representation.
|
25281 | *
|
25282 | * The following hooks will be run:
|
25283 | * 1. `wrap`: On each {@link Token}.
|
25284 | *
|
25285 | * @param {string | Token | TokenStream} o The token or token stream to be converted.
|
25286 | * @param {string} language The name of current language.
|
25287 | * @returns {string} The HTML representation of the token or token stream.
|
25288 | * @memberof Token
|
25289 | * @static
|
25290 | */
|
25291 | Token.stringify = function stringify(o, language) {
|
25292 | if (typeof o == 'string') {
|
25293 | return o;
|
25294 | }
|
25295 | if (Array.isArray(o)) {
|
25296 | var s = '';
|
25297 | o.forEach(function (e) {
|
25298 | s += stringify(e, language);
|
25299 | });
|
25300 | return s;
|
25301 | }
|
25302 |
|
25303 | var env = {
|
25304 | type: o.type,
|
25305 | content: stringify(o.content, language),
|
25306 | tag: 'span',
|
25307 | classes: ['token', o.type],
|
25308 | attributes: {},
|
25309 | language: language
|
25310 | };
|
25311 |
|
25312 | var aliases = o.alias;
|
25313 | if (aliases) {
|
25314 | if (Array.isArray(aliases)) {
|
25315 | Array.prototype.push.apply(env.classes, aliases);
|
25316 | } else {
|
25317 | env.classes.push(aliases);
|
25318 | }
|
25319 | }
|
25320 |
|
25321 | _.hooks.run('wrap', env);
|
25322 |
|
25323 | var attributes = '';
|
25324 | for (var name in env.attributes) {
|
25325 | attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"';
|
25326 | }
|
25327 |
|
25328 | return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
|
25329 | };
|
25330 |
|
25331 | /**
|
25332 | * @param {RegExp} pattern
|
25333 | * @param {number} pos
|
25334 | * @param {string} text
|
25335 | * @param {boolean} lookbehind
|
25336 | * @returns {RegExpExecArray | null}
|
25337 | */
|
25338 | function matchPattern(pattern, pos, text, lookbehind) {
|
25339 | pattern.lastIndex = pos;
|
25340 | var match = pattern.exec(text);
|
25341 | if (match && lookbehind && match[1]) {
|
25342 | // change the match to remove the text matched by the Prism lookbehind group
|
25343 | var lookbehindLength = match[1].length;
|
25344 | match.index += lookbehindLength;
|
25345 | match[0] = match[0].slice(lookbehindLength);
|
25346 | }
|
25347 | return match;
|
25348 | }
|
25349 |
|
25350 | /**
|
25351 | * @param {string} text
|
25352 | * @param {LinkedList<string | Token>} tokenList
|
25353 | * @param {any} grammar
|
25354 | * @param {LinkedListNode<string | Token>} startNode
|
25355 | * @param {number} startPos
|
25356 | * @param {RematchOptions} [rematch]
|
25357 | * @returns {void}
|
25358 | * @private
|
25359 | *
|
25360 | * @typedef RematchOptions
|
25361 | * @property {string} cause
|
25362 | * @property {number} reach
|
25363 | */
|
25364 | function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
|
25365 | for (var token in grammar) {
|
25366 | if (!grammar.hasOwnProperty(token) || !grammar[token]) {
|
25367 | continue;
|
25368 | }
|
25369 |
|
25370 | var patterns = grammar[token];
|
25371 | patterns = Array.isArray(patterns) ? patterns : [patterns];
|
25372 |
|
25373 | for (var j = 0; j < patterns.length; ++j) {
|
25374 | if (rematch && rematch.cause == token + ',' + j) {
|
25375 | return;
|
25376 | }
|
25377 |
|
25378 | var patternObj = patterns[j];
|
25379 | var inside = patternObj.inside;
|
25380 | var lookbehind = !!patternObj.lookbehind;
|
25381 | var greedy = !!patternObj.greedy;
|
25382 | var alias = patternObj.alias;
|
25383 |
|
25384 | if (greedy && !patternObj.pattern.global) {
|
25385 | // Without the global flag, lastIndex won't work
|
25386 | var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
|
25387 | patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
|
25388 | }
|
25389 |
|
25390 | /** @type {RegExp} */
|
25391 | var pattern = patternObj.pattern || patternObj;
|
25392 |
|
25393 | for ( // iterate the token list and keep track of the current token/string position
|
25394 | var currentNode = startNode.next, pos = startPos;
|
25395 | currentNode !== tokenList.tail;
|
25396 | pos += currentNode.value.length, currentNode = currentNode.next
|
25397 | ) {
|
25398 |
|
25399 | if (rematch && pos >= rematch.reach) {
|
25400 | break;
|
25401 | }
|
25402 |
|
25403 | var str = currentNode.value;
|
25404 |
|
25405 | if (tokenList.length > text.length) {
|
25406 | // Something went terribly wrong, ABORT, ABORT!
|
25407 | return;
|
25408 | }
|
25409 |
|
25410 | if (str instanceof Token) {
|
25411 | continue;
|
25412 | }
|
25413 |
|
25414 | var removeCount = 1; // this is the to parameter of removeBetween
|
25415 | var match;
|
25416 |
|
25417 | if (greedy) {
|
25418 | match = matchPattern(pattern, pos, text, lookbehind);
|
25419 | if (!match || match.index >= text.length) {
|
25420 | break;
|
25421 | }
|
25422 |
|
25423 | var from = match.index;
|
25424 | var to = match.index + match[0].length;
|
25425 | var p = pos;
|
25426 |
|
25427 | // find the node that contains the match
|
25428 | p += currentNode.value.length;
|
25429 | while (from >= p) {
|
25430 | currentNode = currentNode.next;
|
25431 | p += currentNode.value.length;
|
25432 | }
|
25433 | // adjust pos (and p)
|
25434 | p -= currentNode.value.length;
|
25435 | pos = p;
|
25436 |
|
25437 | // the current node is a Token, then the match starts inside another Token, which is invalid
|
25438 | if (currentNode.value instanceof Token) {
|
25439 | continue;
|
25440 | }
|
25441 |
|
25442 | // find the last node which is affected by this match
|
25443 | for (
|
25444 | var k = currentNode;
|
25445 | k !== tokenList.tail && (p < to || typeof k.value === 'string');
|
25446 | k = k.next
|
25447 | ) {
|
25448 | removeCount++;
|
25449 | p += k.value.length;
|
25450 | }
|
25451 | removeCount--;
|
25452 |
|
25453 | // replace with the new match
|
25454 | str = text.slice(pos, p);
|
25455 | match.index -= pos;
|
25456 | } else {
|
25457 | match = matchPattern(pattern, 0, str, lookbehind);
|
25458 | if (!match) {
|
25459 | continue;
|
25460 | }
|
25461 | }
|
25462 |
|
25463 | // eslint-disable-next-line no-redeclare
|
25464 | var from = match.index;
|
25465 | var matchStr = match[0];
|
25466 | var before = str.slice(0, from);
|
25467 | var after = str.slice(from + matchStr.length);
|
25468 |
|
25469 | var reach = pos + str.length;
|
25470 | if (rematch && reach > rematch.reach) {
|
25471 | rematch.reach = reach;
|
25472 | }
|
25473 |
|
25474 | var removeFrom = currentNode.prev;
|
25475 |
|
25476 | if (before) {
|
25477 | removeFrom = addAfter(tokenList, removeFrom, before);
|
25478 | pos += before.length;
|
25479 | }
|
25480 |
|
25481 | removeRange(tokenList, removeFrom, removeCount);
|
25482 |
|
25483 | var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
|
25484 | currentNode = addAfter(tokenList, removeFrom, wrapped);
|
25485 |
|
25486 | if (after) {
|
25487 | addAfter(tokenList, currentNode, after);
|
25488 | }
|
25489 |
|
25490 | if (removeCount > 1) {
|
25491 | // at least one Token object was removed, so we have to do some rematching
|
25492 | // this can only happen if the current pattern is greedy
|
25493 |
|
25494 | /** @type {RematchOptions} */
|
25495 | var nestedRematch = {
|
25496 | cause: token + ',' + j,
|
25497 | reach: reach
|
25498 | };
|
25499 | matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
|
25500 |
|
25501 | // the reach might have been extended because of the rematching
|
25502 | if (rematch && nestedRematch.reach > rematch.reach) {
|
25503 | rematch.reach = nestedRematch.reach;
|
25504 | }
|
25505 | }
|
25506 | }
|
25507 | }
|
25508 | }
|
25509 | }
|
25510 |
|
25511 | /**
|
25512 | * @typedef LinkedListNode
|
25513 | * @property {T} value
|
25514 | * @property {LinkedListNode<T> | null} prev The previous node.
|
25515 | * @property {LinkedListNode<T> | null} next The next node.
|
25516 | * @template T
|
25517 | * @private
|
25518 | */
|
25519 |
|
25520 | /**
|
25521 | * @template T
|
25522 | * @private
|
25523 | */
|
25524 | function LinkedList() {
|
25525 | /** @type {LinkedListNode<T>} */
|
25526 | var head = { value: null, prev: null, next: null };
|
25527 | /** @type {LinkedListNode<T>} */
|
25528 | var tail = { value: null, prev: head, next: null };
|
25529 | head.next = tail;
|
25530 |
|
25531 | /** @type {LinkedListNode<T>} */
|
25532 | this.head = head;
|
25533 | /** @type {LinkedListNode<T>} */
|
25534 | this.tail = tail;
|
25535 | this.length = 0;
|
25536 | }
|
25537 |
|
25538 | /**
|
25539 | * Adds a new node with the given value to the list.
|
25540 | *
|
25541 | * @param {LinkedList<T>} list
|
25542 | * @param {LinkedListNode<T>} node
|
25543 | * @param {T} value
|
25544 | * @returns {LinkedListNode<T>} The added node.
|
25545 | * @template T
|
25546 | */
|
25547 | function addAfter(list, node, value) {
|
25548 | // assumes that node != list.tail && values.length >= 0
|
25549 | var next = node.next;
|
25550 |
|
25551 | var newNode = { value: value, prev: node, next: next };
|
25552 | node.next = newNode;
|
25553 | next.prev = newNode;
|
25554 | list.length++;
|
25555 |
|
25556 | return newNode;
|
25557 | }
|
25558 | /**
|
25559 | * Removes `count` nodes after the given node. The given node will not be removed.
|
25560 | *
|
25561 | * @param {LinkedList<T>} list
|
25562 | * @param {LinkedListNode<T>} node
|
25563 | * @param {number} count
|
25564 | * @template T
|
25565 | */
|
25566 | function removeRange(list, node, count) {
|
25567 | var next = node.next;
|
25568 | for (var i = 0; i < count && next !== list.tail; i++) {
|
25569 | next = next.next;
|
25570 | }
|
25571 | node.next = next;
|
25572 | next.prev = node;
|
25573 | list.length -= i;
|
25574 | }
|
25575 | /**
|
25576 | * @param {LinkedList<T>} list
|
25577 | * @returns {T[]}
|
25578 | * @template T
|
25579 | */
|
25580 | function toArray(list) {
|
25581 | var array = [];
|
25582 | var node = list.head.next;
|
25583 | while (node !== list.tail) {
|
25584 | array.push(node.value);
|
25585 | node = node.next;
|
25586 | }
|
25587 | return array;
|
25588 | }
|
25589 |
|
25590 |
|
25591 | if (!_self.document) {
|
25592 | if (!_self.addEventListener) {
|
25593 | // in Node.js
|
25594 | return _;
|
25595 | }
|
25596 |
|
25597 | if (!_.disableWorkerMessageHandler) {
|
25598 | // In worker
|
25599 | _self.addEventListener('message', function (evt) {
|
25600 | var message = JSON.parse(evt.data);
|
25601 | var lang = message.language;
|
25602 | var code = message.code;
|
25603 | var immediateClose = message.immediateClose;
|
25604 |
|
25605 | _self.postMessage(_.highlight(code, _.languages[lang], lang));
|
25606 | if (immediateClose) {
|
25607 | _self.close();
|
25608 | }
|
25609 | }, false);
|
25610 | }
|
25611 |
|
25612 | return _;
|
25613 | }
|
25614 |
|
25615 | // Get current script and highlight
|
25616 | var script = _.util.currentScript();
|
25617 |
|
25618 | if (script) {
|
25619 | _.filename = script.src;
|
25620 |
|
25621 | if (script.hasAttribute('data-manual')) {
|
25622 | _.manual = true;
|
25623 | }
|
25624 | }
|
25625 |
|
25626 | function highlightAutomaticallyCallback() {
|
25627 | if (!_.manual) {
|
25628 | _.highlightAll();
|
25629 | }
|
25630 | }
|
25631 |
|
25632 | if (!_.manual) {
|
25633 | // If the document state is "loading", then we'll use DOMContentLoaded.
|
25634 | // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
|
25635 | // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
|
25636 | // might take longer one animation frame to execute which can create a race condition where only some plugins have
|
25637 | // been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
|
25638 | // See https://github.com/PrismJS/prism/issues/2102
|
25639 | var readyState = document.readyState;
|
25640 | if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
|
25641 | document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
|
25642 | } else {
|
25643 | if (window.requestAnimationFrame) {
|
25644 | window.requestAnimationFrame(highlightAutomaticallyCallback);
|
25645 | } else {
|
25646 | window.setTimeout(highlightAutomaticallyCallback, 16);
|
25647 | }
|
25648 | }
|
25649 | }
|
25650 |
|
25651 | return _;
|
25652 |
|
25653 | }(_self));
|
25654 |
|
25655 | if ( true && module.exports) {
|
25656 | module.exports = Prism;
|
25657 | }
|
25658 |
|
25659 | // hack for components to work correctly in node.js
|
25660 | if (typeof __webpack_require__.g !== 'undefined') {
|
25661 | __webpack_require__.g.Prism = Prism;
|
25662 | }
|
25663 |
|
25664 | // some additional documentation/types
|
25665 |
|
25666 | /**
|
25667 | * The expansion of a simple `RegExp` literal to support additional properties.
|
25668 | *
|
25669 | * @typedef GrammarToken
|
25670 | * @property {RegExp} pattern The regular expression of the token.
|
25671 | * @property {boolean} [lookbehind=false] If `true`, then the first capturing group of `pattern` will (effectively)
|
25672 | * behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.
|
25673 | * @property {boolean} [greedy=false] Whether the token is greedy.
|
25674 | * @property {string|string[]} [alias] An optional alias or list of aliases.
|
25675 | * @property {Grammar} [inside] The nested grammar of this token.
|
25676 | *
|
25677 | * The `inside` grammar will be used to tokenize the text value of each token of this kind.
|
25678 | *
|
25679 | * This can be used to make nested and even recursive language definitions.
|
25680 | *
|
25681 | * Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
|
25682 | * each another.
|
25683 | * @global
|
25684 | * @public
|
25685 | */
|
25686 |
|
25687 | /**
|
25688 | * @typedef Grammar
|
25689 | * @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
|
25690 | * @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
|
25691 | * @global
|
25692 | * @public
|
25693 | */
|
25694 |
|
25695 | /**
|
25696 | * A function which will invoked after an element was successfully highlighted.
|
25697 | *
|
25698 | * @callback HighlightCallback
|
25699 | * @param {Element} element The element successfully highlighted.
|
25700 | * @returns {void}
|
25701 | * @global
|
25702 | * @public
|
25703 | */
|
25704 |
|
25705 | /**
|
25706 | * @callback HookCallback
|
25707 | * @param {Object<string, any>} env The environment variables of the hook.
|
25708 | * @returns {void}
|
25709 | * @global
|
25710 | * @public
|
25711 | */
|
25712 |
|
25713 |
|
25714 | /* **********************************************
|
25715 | Begin prism-markup.js
|
25716 | ********************************************** */
|
25717 |
|
25718 | Prism.languages.markup = {
|
25719 | 'comment': {
|
25720 | pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
25721 | greedy: true
|
25722 | },
|
25723 | 'prolog': {
|
25724 | pattern: /<\?[\s\S]+?\?>/,
|
25725 | greedy: true
|
25726 | },
|
25727 | 'doctype': {
|
25728 | // https://www.w3.org/TR/xml/#NT-doctypedecl
|
25729 | pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
|
25730 | greedy: true,
|
25731 | inside: {
|
25732 | 'internal-subset': {
|
25733 | pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
|
25734 | lookbehind: true,
|
25735 | greedy: true,
|
25736 | inside: null // see below
|
25737 | },
|
25738 | 'string': {
|
25739 | pattern: /"[^"]*"|'[^']*'/,
|
25740 | greedy: true
|
25741 | },
|
25742 | 'punctuation': /^<!|>$|[[\]]/,
|
25743 | 'doctype-tag': /^DOCTYPE/i,
|
25744 | 'name': /[^\s<>'"]+/
|
25745 | }
|
25746 | },
|
25747 | 'cdata': {
|
25748 | pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
25749 | greedy: true
|
25750 | },
|
25751 | 'tag': {
|
25752 | pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
|
25753 | greedy: true,
|
25754 | inside: {
|
25755 | 'tag': {
|
25756 | pattern: /^<\/?[^\s>\/]+/,
|
25757 | inside: {
|
25758 | 'punctuation': /^<\/?/,
|
25759 | 'namespace': /^[^\s>\/:]+:/
|
25760 | }
|
25761 | },
|
25762 | 'special-attr': [],
|
25763 | 'attr-value': {
|
25764 | pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
|
25765 | inside: {
|
25766 | 'punctuation': [
|
25767 | {
|
25768 | pattern: /^=/,
|
25769 | alias: 'attr-equals'
|
25770 | },
|
25771 | {
|
25772 | pattern: /^(\s*)["']|["']$/,
|
25773 | lookbehind: true
|
25774 | }
|
25775 | ]
|
25776 | }
|
25777 | },
|
25778 | 'punctuation': /\/?>/,
|
25779 | 'attr-name': {
|
25780 | pattern: /[^\s>\/]+/,
|
25781 | inside: {
|
25782 | 'namespace': /^[^\s>\/:]+:/
|
25783 | }
|
25784 | }
|
25785 |
|
25786 | }
|
25787 | },
|
25788 | 'entity': [
|
25789 | {
|
25790 | pattern: /&[\da-z]{1,8};/i,
|
25791 | alias: 'named-entity'
|
25792 | },
|
25793 | /&#x?[\da-f]{1,8};/i
|
25794 | ]
|
25795 | };
|
25796 |
|
25797 | Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
|
25798 | Prism.languages.markup['entity'];
|
25799 | Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
|
25800 |
|
25801 | // Plugin to make entity title show the real entity, idea by Roman Komarov
|
25802 | Prism.hooks.add('wrap', function (env) {
|
25803 |
|
25804 | if (env.type === 'entity') {
|
25805 | env.attributes['title'] = env.content.replace(/&/, '&');
|
25806 | }
|
25807 | });
|
25808 |
|
25809 | Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
|
25810 | /**
|
25811 | * Adds an inlined language to markup.
|
25812 | *
|
25813 | * An example of an inlined language is CSS with `<style>` tags.
|
25814 | *
|
25815 | * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
|
25816 | * case insensitive.
|
25817 | * @param {string} lang The language key.
|
25818 | * @example
|
25819 | * addInlined('style', 'css');
|
25820 | */
|
25821 | value: function addInlined(tagName, lang) {
|
25822 | var includedCdataInside = {};
|
25823 | includedCdataInside['language-' + lang] = {
|
25824 | pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
25825 | lookbehind: true,
|
25826 | inside: Prism.languages[lang]
|
25827 | };
|
25828 | includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
|
25829 |
|
25830 | var inside = {
|
25831 | 'included-cdata': {
|
25832 | pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
25833 | inside: includedCdataInside
|
25834 | }
|
25835 | };
|
25836 | inside['language-' + lang] = {
|
25837 | pattern: /[\s\S]+/,
|
25838 | inside: Prism.languages[lang]
|
25839 | };
|
25840 |
|
25841 | var def = {};
|
25842 | def[tagName] = {
|
25843 | pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
|
25844 | lookbehind: true,
|
25845 | greedy: true,
|
25846 | inside: inside
|
25847 | };
|
25848 |
|
25849 | Prism.languages.insertBefore('markup', 'cdata', def);
|
25850 | }
|
25851 | });
|
25852 | Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
|
25853 | /**
|
25854 | * Adds an pattern to highlight languages embedded in HTML attributes.
|
25855 | *
|
25856 | * An example of an inlined language is CSS with `style` attributes.
|
25857 | *
|
25858 | * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
|
25859 | * case insensitive.
|
25860 | * @param {string} lang The language key.
|
25861 | * @example
|
25862 | * addAttribute('style', 'css');
|
25863 | */
|
25864 | value: function (attrName, lang) {
|
25865 | Prism.languages.markup.tag.inside['special-attr'].push({
|
25866 | pattern: RegExp(
|
25867 | /(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
|
25868 | 'i'
|
25869 | ),
|
25870 | lookbehind: true,
|
25871 | inside: {
|
25872 | 'attr-name': /^[^\s=]+/,
|
25873 | 'attr-value': {
|
25874 | pattern: /=[\s\S]+/,
|
25875 | inside: {
|
25876 | 'value': {
|
25877 | pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
25878 | lookbehind: true,
|
25879 | alias: [lang, 'language-' + lang],
|
25880 | inside: Prism.languages[lang]
|
25881 | },
|
25882 | 'punctuation': [
|
25883 | {
|
25884 | pattern: /^=/,
|
25885 | alias: 'attr-equals'
|
25886 | },
|
25887 | /"|'/
|
25888 | ]
|
25889 | }
|
25890 | }
|
25891 | }
|
25892 | });
|
25893 | }
|
25894 | });
|
25895 |
|
25896 | Prism.languages.html = Prism.languages.markup;
|
25897 | Prism.languages.mathml = Prism.languages.markup;
|
25898 | Prism.languages.svg = Prism.languages.markup;
|
25899 |
|
25900 | Prism.languages.xml = Prism.languages.extend('markup', {});
|
25901 | Prism.languages.ssml = Prism.languages.xml;
|
25902 | Prism.languages.atom = Prism.languages.xml;
|
25903 | Prism.languages.rss = Prism.languages.xml;
|
25904 |
|
25905 |
|
25906 | /* **********************************************
|
25907 | Begin prism-css.js
|
25908 | ********************************************** */
|
25909 |
|
25910 | (function (Prism) {
|
25911 |
|
25912 | var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
25913 |
|
25914 | Prism.languages.css = {
|
25915 | 'comment': /\/\*[\s\S]*?\*\//,
|
25916 | 'atrule': {
|
25917 | pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
|
25918 | inside: {
|
25919 | 'rule': /^@[\w-]+/,
|
25920 | 'selector-function-argument': {
|
25921 | pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
25922 | lookbehind: true,
|
25923 | alias: 'selector'
|
25924 | },
|
25925 | 'keyword': {
|
25926 | pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
25927 | lookbehind: true
|
25928 | }
|
25929 | // See rest below
|
25930 | }
|
25931 | },
|
25932 | 'url': {
|
25933 | // https://drafts.csswg.org/css-values-3/#urls
|
25934 | pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
|
25935 | greedy: true,
|
25936 | inside: {
|
25937 | 'function': /^url/i,
|
25938 | 'punctuation': /^\(|\)$/,
|
25939 | 'string': {
|
25940 | pattern: RegExp('^' + string.source + '$'),
|
25941 | alias: 'url'
|
25942 | }
|
25943 | }
|
25944 | },
|
25945 | 'selector': {
|
25946 | pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
|
25947 | lookbehind: true
|
25948 | },
|
25949 | 'string': {
|
25950 | pattern: string,
|
25951 | greedy: true
|
25952 | },
|
25953 | 'property': {
|
25954 | pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
25955 | lookbehind: true
|
25956 | },
|
25957 | 'important': /!important\b/i,
|
25958 | 'function': {
|
25959 | pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
25960 | lookbehind: true
|
25961 | },
|
25962 | 'punctuation': /[(){};:,]/
|
25963 | };
|
25964 |
|
25965 | Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
|
25966 |
|
25967 | var markup = Prism.languages.markup;
|
25968 | if (markup) {
|
25969 | markup.tag.addInlined('style', 'css');
|
25970 | markup.tag.addAttribute('style', 'css');
|
25971 | }
|
25972 |
|
25973 | }(Prism));
|
25974 |
|
25975 |
|
25976 | /* **********************************************
|
25977 | Begin prism-clike.js
|
25978 | ********************************************** */
|
25979 |
|
25980 | Prism.languages.clike = {
|
25981 | 'comment': [
|
25982 | {
|
25983 | pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
25984 | lookbehind: true,
|
25985 | greedy: true
|
25986 | },
|
25987 | {
|
25988 | pattern: /(^|[^\\:])\/\/.*/,
|
25989 | lookbehind: true,
|
25990 | greedy: true
|
25991 | }
|
25992 | ],
|
25993 | 'string': {
|
25994 | pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
25995 | greedy: true
|
25996 | },
|
25997 | 'class-name': {
|
25998 | pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
|
25999 | lookbehind: true,
|
26000 | inside: {
|
26001 | 'punctuation': /[.\\]/
|
26002 | }
|
26003 | },
|
26004 | 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
|
26005 | 'boolean': /\b(?:false|true)\b/,
|
26006 | 'function': /\b\w+(?=\()/,
|
26007 | 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
26008 | 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
26009 | 'punctuation': /[{}[\];(),.:]/
|
26010 | };
|
26011 |
|
26012 |
|
26013 | /* **********************************************
|
26014 | Begin prism-javascript.js
|
26015 | ********************************************** */
|
26016 |
|
26017 | Prism.languages.javascript = Prism.languages.extend('clike', {
|
26018 | 'class-name': [
|
26019 | Prism.languages.clike['class-name'],
|
26020 | {
|
26021 | pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
|
26022 | lookbehind: true
|
26023 | }
|
26024 | ],
|
26025 | 'keyword': [
|
26026 | {
|
26027 | pattern: /((?:^|\})\s*)catch\b/,
|
26028 | lookbehind: true
|
26029 | },
|
26030 | {
|
26031 | pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
|
26032 | lookbehind: true
|
26033 | },
|
26034 | ],
|
26035 | // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
|
26036 | 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
|
26037 | 'number': {
|
26038 | pattern: RegExp(
|
26039 | /(^|[^\w$])/.source +
|
26040 | '(?:' +
|
26041 | (
|
26042 | // constant
|
26043 | /NaN|Infinity/.source +
|
26044 | '|' +
|
26045 | // binary integer
|
26046 | /0[bB][01]+(?:_[01]+)*n?/.source +
|
26047 | '|' +
|
26048 | // octal integer
|
26049 | /0[oO][0-7]+(?:_[0-7]+)*n?/.source +
|
26050 | '|' +
|
26051 | // hexadecimal integer
|
26052 | /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
|
26053 | '|' +
|
26054 | // decimal bigint
|
26055 | /\d+(?:_\d+)*n/.source +
|
26056 | '|' +
|
26057 | // decimal number (integer or float) but no bigint
|
26058 | /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
|
26059 | ) +
|
26060 | ')' +
|
26061 | /(?![\w$])/.source
|
26062 | ),
|
26063 | lookbehind: true
|
26064 | },
|
26065 | 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
|
26066 | });
|
26067 |
|
26068 | Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
|
26069 |
|
26070 | Prism.languages.insertBefore('javascript', 'keyword', {
|
26071 | 'regex': {
|
26072 | pattern: RegExp(
|
26073 | // lookbehind
|
26074 | // eslint-disable-next-line regexp/no-dupe-characters-character-class
|
26075 | /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
|
26076 | // Regex pattern:
|
26077 | // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
|
26078 | // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
|
26079 | // with the only syntax, so we have to define 2 different regex patterns.
|
26080 | /\//.source +
|
26081 | '(?:' +
|
26082 | /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source +
|
26083 | '|' +
|
26084 | // `v` flag syntax. This supports 3 levels of nested character classes.
|
26085 | /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source +
|
26086 | ')' +
|
26087 | // lookahead
|
26088 | /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
|
26089 | ),
|
26090 | lookbehind: true,
|
26091 | greedy: true,
|
26092 | inside: {
|
26093 | 'regex-source': {
|
26094 | pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
|
26095 | lookbehind: true,
|
26096 | alias: 'language-regex',
|
26097 | inside: Prism.languages.regex
|
26098 | },
|
26099 | 'regex-delimiter': /^\/|\/$/,
|
26100 | 'regex-flags': /^[a-z]+$/,
|
26101 | }
|
26102 | },
|
26103 | // This must be declared before keyword because we use "function" inside the look-forward
|
26104 | 'function-variable': {
|
26105 | pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
|
26106 | alias: 'function'
|
26107 | },
|
26108 | 'parameter': [
|
26109 | {
|
26110 | pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
|
26111 | lookbehind: true,
|
26112 | inside: Prism.languages.javascript
|
26113 | },
|
26114 | {
|
26115 | pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
|
26116 | lookbehind: true,
|
26117 | inside: Prism.languages.javascript
|
26118 | },
|
26119 | {
|
26120 | pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
26121 | lookbehind: true,
|
26122 | inside: Prism.languages.javascript
|
26123 | },
|
26124 | {
|
26125 | pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
|
26126 | lookbehind: true,
|
26127 | inside: Prism.languages.javascript
|
26128 | }
|
26129 | ],
|
26130 | 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
|
26131 | });
|
26132 |
|
26133 | Prism.languages.insertBefore('javascript', 'string', {
|
26134 | 'hashbang': {
|
26135 | pattern: /^#!.*/,
|
26136 | greedy: true,
|
26137 | alias: 'comment'
|
26138 | },
|
26139 | 'template-string': {
|
26140 | pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
|
26141 | greedy: true,
|
26142 | inside: {
|
26143 | 'template-punctuation': {
|
26144 | pattern: /^`|`$/,
|
26145 | alias: 'string'
|
26146 | },
|
26147 | 'interpolation': {
|
26148 | pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
|
26149 | lookbehind: true,
|
26150 | inside: {
|
26151 | 'interpolation-punctuation': {
|
26152 | pattern: /^\$\{|\}$/,
|
26153 | alias: 'punctuation'
|
26154 | },
|
26155 | rest: Prism.languages.javascript
|
26156 | }
|
26157 | },
|
26158 | 'string': /[\s\S]+/
|
26159 | }
|
26160 | },
|
26161 | 'string-property': {
|
26162 | pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
|
26163 | lookbehind: true,
|
26164 | greedy: true,
|
26165 | alias: 'property'
|
26166 | }
|
26167 | });
|
26168 |
|
26169 | Prism.languages.insertBefore('javascript', 'operator', {
|
26170 | 'literal-property': {
|
26171 | pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
|
26172 | lookbehind: true,
|
26173 | alias: 'property'
|
26174 | },
|
26175 | });
|
26176 |
|
26177 | if (Prism.languages.markup) {
|
26178 | Prism.languages.markup.tag.addInlined('script', 'javascript');
|
26179 |
|
26180 | // add attribute support for all DOM events.
|
26181 | // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
|
26182 | Prism.languages.markup.tag.addAttribute(
|
26183 | /on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
|
26184 | 'javascript'
|
26185 | );
|
26186 | }
|
26187 |
|
26188 | Prism.languages.js = Prism.languages.javascript;
|
26189 |
|
26190 |
|
26191 | /* **********************************************
|
26192 | Begin prism-file-highlight.js
|
26193 | ********************************************** */
|
26194 |
|
26195 | (function () {
|
26196 |
|
26197 | if (typeof Prism === 'undefined' || typeof document === 'undefined') {
|
26198 | return;
|
26199 | }
|
26200 |
|
26201 | // https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
|
26202 | if (!Element.prototype.matches) {
|
26203 | Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
26204 | }
|
26205 |
|
26206 | var LOADING_MESSAGE = 'Loading…';
|
26207 | var FAILURE_MESSAGE = function (status, message) {
|
26208 | return '✖ Error ' + status + ' while fetching file: ' + message;
|
26209 | };
|
26210 | var FAILURE_EMPTY_MESSAGE = '✖ Error: File does not exist or is empty';
|
26211 |
|
26212 | var EXTENSIONS = {
|
26213 | 'js': 'javascript',
|
26214 | 'py': 'python',
|
26215 | 'rb': 'ruby',
|
26216 | 'ps1': 'powershell',
|
26217 | 'psm1': 'powershell',
|
26218 | 'sh': 'bash',
|
26219 | 'bat': 'batch',
|
26220 | 'h': 'c',
|
26221 | 'tex': 'latex'
|
26222 | };
|
26223 |
|
26224 | var STATUS_ATTR = 'data-src-status';
|
26225 | var STATUS_LOADING = 'loading';
|
26226 | var STATUS_LOADED = 'loaded';
|
26227 | var STATUS_FAILED = 'failed';
|
26228 |
|
26229 | var SELECTOR = 'pre[data-src]:not([' + STATUS_ATTR + '="' + STATUS_LOADED + '"])'
|
26230 | + ':not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
|
26231 |
|
26232 | /**
|
26233 | * Loads the given file.
|
26234 | *
|
26235 | * @param {string} src The URL or path of the source file to load.
|
26236 | * @param {(result: string) => void} success
|
26237 | * @param {(reason: string) => void} error
|
26238 | */
|
26239 | function loadFile(src, success, error) {
|
26240 | var xhr = new XMLHttpRequest();
|
26241 | xhr.open('GET', src, true);
|
26242 | xhr.onreadystatechange = function () {
|
26243 | if (xhr.readyState == 4) {
|
26244 | if (xhr.status < 400 && xhr.responseText) {
|
26245 | success(xhr.responseText);
|
26246 | } else {
|
26247 | if (xhr.status >= 400) {
|
26248 | error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
|
26249 | } else {
|
26250 | error(FAILURE_EMPTY_MESSAGE);
|
26251 | }
|
26252 | }
|
26253 | }
|
26254 | };
|
26255 | xhr.send(null);
|
26256 | }
|
26257 |
|
26258 | /**
|
26259 | * Parses the given range.
|
26260 | *
|
26261 | * This returns a range with inclusive ends.
|
26262 | *
|
26263 | * @param {string | null | undefined} range
|
26264 | * @returns {[number, number | undefined] | undefined}
|
26265 | */
|
26266 | function parseRange(range) {
|
26267 | var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || '');
|
26268 | if (m) {
|
26269 | var start = Number(m[1]);
|
26270 | var comma = m[2];
|
26271 | var end = m[3];
|
26272 |
|
26273 | if (!comma) {
|
26274 | return [start, start];
|
26275 | }
|
26276 | if (!end) {
|
26277 | return [start, undefined];
|
26278 | }
|
26279 | return [start, Number(end)];
|
26280 | }
|
26281 | return undefined;
|
26282 | }
|
26283 |
|
26284 | Prism.hooks.add('before-highlightall', function (env) {
|
26285 | env.selector += ', ' + SELECTOR;
|
26286 | });
|
26287 |
|
26288 | Prism.hooks.add('before-sanity-check', function (env) {
|
26289 | var pre = /** @type {HTMLPreElement} */ (env.element);
|
26290 | if (pre.matches(SELECTOR)) {
|
26291 | env.code = ''; // fast-path the whole thing and go to complete
|
26292 |
|
26293 | pre.setAttribute(STATUS_ATTR, STATUS_LOADING); // mark as loading
|
26294 |
|
26295 | // add code element with loading message
|
26296 | var code = pre.appendChild(document.createElement('CODE'));
|
26297 | code.textContent = LOADING_MESSAGE;
|
26298 |
|
26299 | var src = pre.getAttribute('data-src');
|
26300 |
|
26301 | var language = env.language;
|
26302 | if (language === 'none') {
|
26303 | // the language might be 'none' because there is no language set;
|
26304 | // in this case, we want to use the extension as the language
|
26305 | var extension = (/\.(\w+)$/.exec(src) || [, 'none'])[1];
|
26306 | language = EXTENSIONS[extension] || extension;
|
26307 | }
|
26308 |
|
26309 | // set language classes
|
26310 | Prism.util.setLanguage(code, language);
|
26311 | Prism.util.setLanguage(pre, language);
|
26312 |
|
26313 | // preload the language
|
26314 | var autoloader = Prism.plugins.autoloader;
|
26315 | if (autoloader) {
|
26316 | autoloader.loadLanguages(language);
|
26317 | }
|
26318 |
|
26319 | // load file
|
26320 | loadFile(
|
26321 | src,
|
26322 | function (text) {
|
26323 | // mark as loaded
|
26324 | pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
|
26325 |
|
26326 | // handle data-range
|
26327 | var range = parseRange(pre.getAttribute('data-range'));
|
26328 | if (range) {
|
26329 | var lines = text.split(/\r\n?|\n/g);
|
26330 |
|
26331 | // the range is one-based and inclusive on both ends
|
26332 | var start = range[0];
|
26333 | var end = range[1] == null ? lines.length : range[1];
|
26334 |
|
26335 | if (start < 0) { start += lines.length; }
|
26336 | start = Math.max(0, Math.min(start - 1, lines.length));
|
26337 | if (end < 0) { end += lines.length; }
|
26338 | end = Math.max(0, Math.min(end, lines.length));
|
26339 |
|
26340 | text = lines.slice(start, end).join('\n');
|
26341 |
|
26342 | // add data-start for line numbers
|
26343 | if (!pre.hasAttribute('data-start')) {
|
26344 | pre.setAttribute('data-start', String(start + 1));
|
26345 | }
|
26346 | }
|
26347 |
|
26348 | // highlight code
|
26349 | code.textContent = text;
|
26350 | Prism.highlightElement(code);
|
26351 | },
|
26352 | function (error) {
|
26353 | // mark as failed
|
26354 | pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
|
26355 |
|
26356 | code.textContent = error;
|
26357 | }
|
26358 | );
|
26359 | }
|
26360 | });
|
26361 |
|
26362 | Prism.plugins.fileHighlight = {
|
26363 | /**
|
26364 | * Executes the File Highlight plugin for all matching `pre` elements under the given container.
|
26365 | *
|
26366 | * Note: Elements which are already loaded or currently loading will not be touched by this method.
|
26367 | *
|
26368 | * @param {ParentNode} [container=document]
|
26369 | */
|
26370 | highlight: function highlight(container) {
|
26371 | var elements = (container || document).querySelectorAll(SELECTOR);
|
26372 |
|
26373 | for (var i = 0, element; (element = elements[i++]);) {
|
26374 | Prism.highlightElement(element);
|
26375 | }
|
26376 | }
|
26377 | };
|
26378 |
|
26379 | var logged = false;
|
26380 | /** @deprecated Use `Prism.plugins.fileHighlight.highlight` instead. */
|
26381 | Prism.fileHighlight = function () {
|
26382 | if (!logged) {
|
26383 | console.warn('Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.');
|
26384 | logged = true;
|
26385 | }
|
26386 | Prism.plugins.fileHighlight.highlight.apply(this, arguments);
|
26387 | };
|
26388 |
|
26389 | }());
|
26390 |
|
26391 |
|
26392 | /***/ }),
|
26393 |
|
26394 | /***/ 464:
|
26395 | /***/ ((module) => {
|
26396 |
|
26397 | "use strict";
|
26398 | /*!
|
26399 | * repeat-string <https://github.com/jonschlinkert/repeat-string>
|
26400 | *
|
26401 | * Copyright (c) 2014-2015, Jon Schlinkert.
|
26402 | * Licensed under the MIT License.
|
26403 | */
|
26404 |
|
26405 |
|
26406 |
|
26407 | /**
|
26408 | * Results cache
|
26409 | */
|
26410 |
|
26411 | var res = '';
|
26412 | var cache;
|
26413 |
|
26414 | /**
|
26415 | * Expose `repeat`
|
26416 | */
|
26417 |
|
26418 | module.exports = repeat;
|
26419 |
|
26420 | /**
|
26421 | * Repeat the given `string` the specified `number`
|
26422 | * of times.
|
26423 | *
|
26424 | * **Example:**
|
26425 | *
|
26426 | * ```js
|
26427 | * var repeat = require('repeat-string');
|
26428 | * repeat('A', 5);
|
26429 | * //=> AAAAA
|
26430 | * ```
|
26431 | *
|
26432 | * @param {String} `string` The string to repeat
|
26433 | * @param {Number} `number` The number of times to repeat the string
|
26434 | * @return {String} Repeated string
|
26435 | * @api public
|
26436 | */
|
26437 |
|
26438 | function repeat(str, num) {
|
26439 | if (typeof str !== 'string') {
|
26440 | throw new TypeError('expected a string');
|
26441 | }
|
26442 |
|
26443 | // cover common, quick use cases
|
26444 | if (num === 1) return str;
|
26445 | if (num === 2) return str + str;
|
26446 |
|
26447 | var max = str.length * num;
|
26448 | if (cache !== str || typeof cache === 'undefined') {
|
26449 | cache = str;
|
26450 | res = '';
|
26451 | } else if (res.length >= max) {
|
26452 | return res.substr(0, max);
|
26453 | }
|
26454 |
|
26455 | while (max > res.length && num > 1) {
|
26456 | if (num & 1) {
|
26457 | res += str;
|
26458 | }
|
26459 |
|
26460 | num >>= 1;
|
26461 | str += str;
|
26462 | }
|
26463 |
|
26464 | res += str;
|
26465 | res = res.substr(0, max);
|
26466 | return res;
|
26467 | }
|
26468 |
|
26469 |
|
26470 | /***/ }),
|
26471 |
|
26472 | /***/ 131:
|
26473 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
26474 |
|
26475 | "use strict";
|
26476 |
|
26477 |
|
26478 | var repeat = __webpack_require__(464);
|
26479 |
|
26480 | var splitOnTags = function splitOnTags(str) {
|
26481 | return str.split(/(<\/?[^>]+>)/g).filter(function (line) {
|
26482 | return line.trim() !== '';
|
26483 | });
|
26484 | };
|
26485 | var isTag = function isTag(str) {
|
26486 | return (/<[^>!]+>/.test(str)
|
26487 | );
|
26488 | };
|
26489 | var isClosingTag = function isClosingTag(str) {
|
26490 | return (/<\/+[^>]+>/.test(str)
|
26491 | );
|
26492 | };
|
26493 | var isSelfClosingTag = function isSelfClosingTag(str) {
|
26494 | return (/<[^>]+\/>/.test(str)
|
26495 | );
|
26496 | };
|
26497 | var isOpeningTag = function isOpeningTag(str) {
|
26498 | return isTag(str) && !isClosingTag(str) && !isSelfClosingTag(str);
|
26499 | };
|
26500 |
|
26501 | module.exports = function (xml) {
|
26502 | var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
26503 | var indentor = config.indentor,
|
26504 | textNodesOnSameLine = config.textNodesOnSameLine;
|
26505 |
|
26506 | var depth = 0;
|
26507 | var indicesToRemove = [];
|
26508 | indentor = indentor || ' ';
|
26509 |
|
26510 | var rawResult = lexer(xml).map(function (element, i, arr) {
|
26511 | var value = element.value,
|
26512 | type = element.type;
|
26513 |
|
26514 | if (type === 'ClosingTag') {
|
26515 | depth--;
|
26516 | }
|
26517 |
|
26518 | var indentation = repeat(indentor, depth);
|
26519 | var line = indentation + value;
|
26520 |
|
26521 | if (type === 'OpeningTag') {
|
26522 | depth++;
|
26523 | }
|
26524 |
|
26525 | if (textNodesOnSameLine) {
|
26526 | // Lookbehind for [OpeningTag][Text][ClosingTag]
|
26527 | var oneBefore = arr[i - 1];
|
26528 | var twoBefore = arr[i - 2];
|
26529 |
|
26530 | if (type === "ClosingTag" && oneBefore.type === "Text" && twoBefore.type === "OpeningTag") {
|
26531 | // collapse into a single line
|
26532 | line = '' + indentation + twoBefore.value + oneBefore.value + value;
|
26533 | indicesToRemove.push(i - 2, i - 1);
|
26534 | }
|
26535 | }
|
26536 |
|
26537 | return line;
|
26538 | });
|
26539 |
|
26540 | indicesToRemove.forEach(function (idx) {
|
26541 | return rawResult[idx] = null;
|
26542 | });
|
26543 |
|
26544 | return rawResult.filter(function (val) {
|
26545 | return !!val;
|
26546 | }).join('\n');
|
26547 | };
|
26548 |
|
26549 | function lexer(xmlStr) {
|
26550 | var values = splitOnTags(xmlStr);
|
26551 | return values.map(function (value) {
|
26552 | return {
|
26553 | value: value,
|
26554 | type: getType(value)
|
26555 | };
|
26556 | });
|
26557 | }
|
26558 |
|
26559 | // Helpers
|
26560 |
|
26561 | function getType(str) {
|
26562 | if (isClosingTag(str)) {
|
26563 | return 'ClosingTag';
|
26564 | }
|
26565 |
|
26566 | if (isOpeningTag(str)) {
|
26567 | return 'OpeningTag';
|
26568 | }
|
26569 |
|
26570 | if (isSelfClosingTag(str)) {
|
26571 | return 'SelfClosingTag';
|
26572 | }
|
26573 |
|
26574 | return 'Text';
|
26575 | }
|
26576 |
|
26577 | /***/ })
|
26578 |
|
26579 | /******/ });
|
26580 | /************************************************************************/
|
26581 | /******/ // The module cache
|
26582 | /******/ var __webpack_module_cache__ = {};
|
26583 | /******/
|
26584 | /******/ // The require function
|
26585 | /******/ function __webpack_require__(moduleId) {
|
26586 | /******/ // Check if module is in cache
|
26587 | /******/ var cachedModule = __webpack_module_cache__[moduleId];
|
26588 | /******/ if (cachedModule !== undefined) {
|
26589 | /******/ if (cachedModule.error !== undefined) throw cachedModule.error;
|
26590 | /******/ return cachedModule.exports;
|
26591 | /******/ }
|
26592 | /******/ // Create a new module (and put it into the cache)
|
26593 | /******/ var module = __webpack_module_cache__[moduleId] = {
|
26594 | /******/ // no module.id needed
|
26595 | /******/ // no module.loaded needed
|
26596 | /******/ exports: {}
|
26597 | /******/ };
|
26598 | /******/
|
26599 | /******/ // Execute the module function
|
26600 | /******/ try {
|
26601 | /******/ var execOptions = { id: moduleId, module: module, factory: __webpack_modules__[moduleId], require: __webpack_require__ };
|
26602 | /******/ __webpack_require__.i.forEach(function(handler) { handler(execOptions); });
|
26603 | /******/ module = execOptions.module;
|
26604 | /******/ execOptions.factory.call(module.exports, module, module.exports, execOptions.require);
|
26605 | /******/ } catch(e) {
|
26606 | /******/ module.error = e;
|
26607 | /******/ throw e;
|
26608 | /******/ }
|
26609 | /******/
|
26610 | /******/ // Return the exports of the module
|
26611 | /******/ return module.exports;
|
26612 | /******/ }
|
26613 | /******/
|
26614 | /******/ // expose the modules object (__webpack_modules__)
|
26615 | /******/ __webpack_require__.m = __webpack_modules__;
|
26616 | /******/
|
26617 | /******/ // expose the module cache
|
26618 | /******/ __webpack_require__.c = __webpack_module_cache__;
|
26619 | /******/
|
26620 | /******/ // expose the module execution interceptor
|
26621 | /******/ __webpack_require__.i = [];
|
26622 | /******/
|
26623 | /************************************************************************/
|
26624 | /******/ /* webpack/runtime/compat get default export */
|
26625 | /******/ (() => {
|
26626 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
26627 | /******/ __webpack_require__.n = (module) => {
|
26628 | /******/ var getter = module && module.__esModule ?
|
26629 | /******/ () => (module['default']) :
|
26630 | /******/ () => (module);
|
26631 | /******/ __webpack_require__.d(getter, { a: getter });
|
26632 | /******/ return getter;
|
26633 | /******/ };
|
26634 | /******/ })();
|
26635 | /******/
|
26636 | /******/ /* webpack/runtime/define property getters */
|
26637 | /******/ (() => {
|
26638 | /******/ // define getter functions for harmony exports
|
26639 | /******/ __webpack_require__.d = (exports, definition) => {
|
26640 | /******/ for(var key in definition) {
|
26641 | /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
26642 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
26643 | /******/ }
|
26644 | /******/ }
|
26645 | /******/ };
|
26646 | /******/ })();
|
26647 | /******/
|
26648 | /******/ /* webpack/runtime/get javascript update chunk filename */
|
26649 | /******/ (() => {
|
26650 | /******/ // This function allow to reference all chunks
|
26651 | /******/ __webpack_require__.hu = (chunkId) => {
|
26652 | /******/ // return url for filenames based on template
|
26653 | /******/ return "" + chunkId + "." + __webpack_require__.h() + ".hot-update.js";
|
26654 | /******/ };
|
26655 | /******/ })();
|
26656 | /******/
|
26657 | /******/ /* webpack/runtime/get update manifest filename */
|
26658 | /******/ (() => {
|
26659 | /******/ __webpack_require__.hmrF = () => ("main." + __webpack_require__.h() + ".hot-update.json");
|
26660 | /******/ })();
|
26661 | /******/
|
26662 | /******/ /* webpack/runtime/getFullHash */
|
26663 | /******/ (() => {
|
26664 | /******/ __webpack_require__.h = () => ("fdf734afd7a6f574c7ff")
|
26665 | /******/ })();
|
26666 | /******/
|
26667 | /******/ /* webpack/runtime/global */
|
26668 | /******/ (() => {
|
26669 | /******/ __webpack_require__.g = (function() {
|
26670 | /******/ if (typeof globalThis === 'object') return globalThis;
|
26671 | /******/ try {
|
26672 | /******/ return this || new Function('return this')();
|
26673 | /******/ } catch (e) {
|
26674 | /******/ if (typeof window === 'object') return window;
|
26675 | /******/ }
|
26676 | /******/ })();
|
26677 | /******/ })();
|
26678 | /******/
|
26679 | /******/ /* webpack/runtime/hasOwnProperty shorthand */
|
26680 | /******/ (() => {
|
26681 | /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
26682 | /******/ })();
|
26683 | /******/
|
26684 | /******/ /* webpack/runtime/load script */
|
26685 | /******/ (() => {
|
26686 | /******/ var inProgress = {};
|
26687 | /******/ var dataWebpackPrefix = "rapidoc:";
|
26688 | /******/ // loadScript function to load a script via script tag
|
26689 | /******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
26690 | /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
26691 | /******/ var script, needAttach;
|
26692 | /******/ if(key !== undefined) {
|
26693 | /******/ var scripts = document.getElementsByTagName("script");
|
26694 | /******/ for(var i = 0; i < scripts.length; i++) {
|
26695 | /******/ var s = scripts[i];
|
26696 | /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
26697 | /******/ }
|
26698 | /******/ }
|
26699 | /******/ if(!script) {
|
26700 | /******/ needAttach = true;
|
26701 | /******/ script = document.createElement('script');
|
26702 | /******/
|
26703 | /******/ script.charset = 'utf-8';
|
26704 | /******/ script.timeout = 120;
|
26705 | /******/ if (__webpack_require__.nc) {
|
26706 | /******/ script.setAttribute("nonce", __webpack_require__.nc);
|
26707 | /******/ }
|
26708 | /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
26709 | /******/ script.src = url;
|
26710 | /******/ }
|
26711 | /******/ inProgress[url] = [done];
|
26712 | /******/ var onScriptComplete = (prev, event) => {
|
26713 | /******/ // avoid mem leaks in IE.
|
26714 | /******/ script.onerror = script.onload = null;
|
26715 | /******/ clearTimeout(timeout);
|
26716 | /******/ var doneFns = inProgress[url];
|
26717 | /******/ delete inProgress[url];
|
26718 | /******/ script.parentNode && script.parentNode.removeChild(script);
|
26719 | /******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
26720 | /******/ if(prev) return prev(event);
|
26721 | /******/ };
|
26722 | /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
26723 | /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
26724 | /******/ script.onload = onScriptComplete.bind(null, script.onload);
|
26725 | /******/ needAttach && document.head.appendChild(script);
|
26726 | /******/ };
|
26727 | /******/ })();
|
26728 | /******/
|
26729 | /******/ /* webpack/runtime/hot module replacement */
|
26730 | /******/ (() => {
|
26731 | /******/ var currentModuleData = {};
|
26732 | /******/ var installedModules = __webpack_require__.c;
|
26733 | /******/
|
26734 | /******/ // module and require creation
|
26735 | /******/ var currentChildModule;
|
26736 | /******/ var currentParents = [];
|
26737 | /******/
|
26738 | /******/ // status
|
26739 | /******/ var registeredStatusHandlers = [];
|
26740 | /******/ var currentStatus = "idle";
|
26741 | /******/
|
26742 | /******/ // while downloading
|
26743 | /******/ var blockingPromises = 0;
|
26744 | /******/ var blockingPromisesWaiting = [];
|
26745 | /******/
|
26746 | /******/ // The update info
|
26747 | /******/ var currentUpdateApplyHandlers;
|
26748 | /******/ var queuedInvalidatedModules;
|
26749 | /******/
|
26750 | /******/ // eslint-disable-next-line no-unused-vars
|
26751 | /******/ __webpack_require__.hmrD = currentModuleData;
|
26752 | /******/
|
26753 | /******/ __webpack_require__.i.push(function (options) {
|
26754 | /******/ var module = options.module;
|
26755 | /******/ var require = createRequire(options.require, options.id);
|
26756 | /******/ module.hot = createModuleHotObject(options.id, module);
|
26757 | /******/ module.parents = currentParents;
|
26758 | /******/ module.children = [];
|
26759 | /******/ currentParents = [];
|
26760 | /******/ options.require = require;
|
26761 | /******/ });
|
26762 | /******/
|
26763 | /******/ __webpack_require__.hmrC = {};
|
26764 | /******/ __webpack_require__.hmrI = {};
|
26765 | /******/
|
26766 | /******/ function createRequire(require, moduleId) {
|
26767 | /******/ var me = installedModules[moduleId];
|
26768 | /******/ if (!me) return require;
|
26769 | /******/ var fn = function (request) {
|
26770 | /******/ if (me.hot.active) {
|
26771 | /******/ if (installedModules[request]) {
|
26772 | /******/ var parents = installedModules[request].parents;
|
26773 | /******/ if (parents.indexOf(moduleId) === -1) {
|
26774 | /******/ parents.push(moduleId);
|
26775 | /******/ }
|
26776 | /******/ } else {
|
26777 | /******/ currentParents = [moduleId];
|
26778 | /******/ currentChildModule = request;
|
26779 | /******/ }
|
26780 | /******/ if (me.children.indexOf(request) === -1) {
|
26781 | /******/ me.children.push(request);
|
26782 | /******/ }
|
26783 | /******/ } else {
|
26784 | /******/ console.warn(
|
26785 | /******/ "[HMR] unexpected require(" +
|
26786 | /******/ request +
|
26787 | /******/ ") from disposed module " +
|
26788 | /******/ moduleId
|
26789 | /******/ );
|
26790 | /******/ currentParents = [];
|
26791 | /******/ }
|
26792 | /******/ return require(request);
|
26793 | /******/ };
|
26794 | /******/ var createPropertyDescriptor = function (name) {
|
26795 | /******/ return {
|
26796 | /******/ configurable: true,
|
26797 | /******/ enumerable: true,
|
26798 | /******/ get: function () {
|
26799 | /******/ return require[name];
|
26800 | /******/ },
|
26801 | /******/ set: function (value) {
|
26802 | /******/ require[name] = value;
|
26803 | /******/ }
|
26804 | /******/ };
|
26805 | /******/ };
|
26806 | /******/ for (var name in require) {
|
26807 | /******/ if (Object.prototype.hasOwnProperty.call(require, name) && name !== "e") {
|
26808 | /******/ Object.defineProperty(fn, name, createPropertyDescriptor(name));
|
26809 | /******/ }
|
26810 | /******/ }
|
26811 | /******/ fn.e = function (chunkId) {
|
26812 | /******/ return trackBlockingPromise(require.e(chunkId));
|
26813 | /******/ };
|
26814 | /******/ return fn;
|
26815 | /******/ }
|
26816 | /******/
|
26817 | /******/ function createModuleHotObject(moduleId, me) {
|
26818 | /******/ var _main = currentChildModule !== moduleId;
|
26819 | /******/ var hot = {
|
26820 | /******/ // private stuff
|
26821 | /******/ _acceptedDependencies: {},
|
26822 | /******/ _acceptedErrorHandlers: {},
|
26823 | /******/ _declinedDependencies: {},
|
26824 | /******/ _selfAccepted: false,
|
26825 | /******/ _selfDeclined: false,
|
26826 | /******/ _selfInvalidated: false,
|
26827 | /******/ _disposeHandlers: [],
|
26828 | /******/ _main: _main,
|
26829 | /******/ _requireSelf: function () {
|
26830 | /******/ currentParents = me.parents.slice();
|
26831 | /******/ currentChildModule = _main ? undefined : moduleId;
|
26832 | /******/ __webpack_require__(moduleId);
|
26833 | /******/ },
|
26834 | /******/
|
26835 | /******/ // Module API
|
26836 | /******/ active: true,
|
26837 | /******/ accept: function (dep, callback, errorHandler) {
|
26838 | /******/ if (dep === undefined) hot._selfAccepted = true;
|
26839 | /******/ else if (typeof dep === "function") hot._selfAccepted = dep;
|
26840 | /******/ else if (typeof dep === "object" && dep !== null) {
|
26841 | /******/ for (var i = 0; i < dep.length; i++) {
|
26842 | /******/ hot._acceptedDependencies[dep[i]] = callback || function () {};
|
26843 | /******/ hot._acceptedErrorHandlers[dep[i]] = errorHandler;
|
26844 | /******/ }
|
26845 | /******/ } else {
|
26846 | /******/ hot._acceptedDependencies[dep] = callback || function () {};
|
26847 | /******/ hot._acceptedErrorHandlers[dep] = errorHandler;
|
26848 | /******/ }
|
26849 | /******/ },
|
26850 | /******/ decline: function (dep) {
|
26851 | /******/ if (dep === undefined) hot._selfDeclined = true;
|
26852 | /******/ else if (typeof dep === "object" && dep !== null)
|
26853 | /******/ for (var i = 0; i < dep.length; i++)
|
26854 | /******/ hot._declinedDependencies[dep[i]] = true;
|
26855 | /******/ else hot._declinedDependencies[dep] = true;
|
26856 | /******/ },
|
26857 | /******/ dispose: function (callback) {
|
26858 | /******/ hot._disposeHandlers.push(callback);
|
26859 | /******/ },
|
26860 | /******/ addDisposeHandler: function (callback) {
|
26861 | /******/ hot._disposeHandlers.push(callback);
|
26862 | /******/ },
|
26863 | /******/ removeDisposeHandler: function (callback) {
|
26864 | /******/ var idx = hot._disposeHandlers.indexOf(callback);
|
26865 | /******/ if (idx >= 0) hot._disposeHandlers.splice(idx, 1);
|
26866 | /******/ },
|
26867 | /******/ invalidate: function () {
|
26868 | /******/ this._selfInvalidated = true;
|
26869 | /******/ switch (currentStatus) {
|
26870 | /******/ case "idle":
|
26871 | /******/ currentUpdateApplyHandlers = [];
|
26872 | /******/ Object.keys(__webpack_require__.hmrI).forEach(function (key) {
|
26873 | /******/ __webpack_require__.hmrI[key](
|
26874 | /******/ moduleId,
|
26875 | /******/ currentUpdateApplyHandlers
|
26876 | /******/ );
|
26877 | /******/ });
|
26878 | /******/ setStatus("ready");
|
26879 | /******/ break;
|
26880 | /******/ case "ready":
|
26881 | /******/ Object.keys(__webpack_require__.hmrI).forEach(function (key) {
|
26882 | /******/ __webpack_require__.hmrI[key](
|
26883 | /******/ moduleId,
|
26884 | /******/ currentUpdateApplyHandlers
|
26885 | /******/ );
|
26886 | /******/ });
|
26887 | /******/ break;
|
26888 | /******/ case "prepare":
|
26889 | /******/ case "check":
|
26890 | /******/ case "dispose":
|
26891 | /******/ case "apply":
|
26892 | /******/ (queuedInvalidatedModules = queuedInvalidatedModules || []).push(
|
26893 | /******/ moduleId
|
26894 | /******/ );
|
26895 | /******/ break;
|
26896 | /******/ default:
|
26897 | /******/ // ignore requests in error states
|
26898 | /******/ break;
|
26899 | /******/ }
|
26900 | /******/ },
|
26901 | /******/
|
26902 | /******/ // Management API
|
26903 | /******/ check: hotCheck,
|
26904 | /******/ apply: hotApply,
|
26905 | /******/ status: function (l) {
|
26906 | /******/ if (!l) return currentStatus;
|
26907 | /******/ registeredStatusHandlers.push(l);
|
26908 | /******/ },
|
26909 | /******/ addStatusHandler: function (l) {
|
26910 | /******/ registeredStatusHandlers.push(l);
|
26911 | /******/ },
|
26912 | /******/ removeStatusHandler: function (l) {
|
26913 | /******/ var idx = registeredStatusHandlers.indexOf(l);
|
26914 | /******/ if (idx >= 0) registeredStatusHandlers.splice(idx, 1);
|
26915 | /******/ },
|
26916 | /******/
|
26917 | /******/ //inherit from previous dispose call
|
26918 | /******/ data: currentModuleData[moduleId]
|
26919 | /******/ };
|
26920 | /******/ currentChildModule = undefined;
|
26921 | /******/ return hot;
|
26922 | /******/ }
|
26923 | /******/
|
26924 | /******/ function setStatus(newStatus) {
|
26925 | /******/ currentStatus = newStatus;
|
26926 | /******/ var results = [];
|
26927 | /******/
|
26928 | /******/ for (var i = 0; i < registeredStatusHandlers.length; i++)
|
26929 | /******/ results[i] = registeredStatusHandlers[i].call(null, newStatus);
|
26930 | /******/
|
26931 | /******/ return Promise.all(results);
|
26932 | /******/ }
|
26933 | /******/
|
26934 | /******/ function unblock() {
|
26935 | /******/ if (--blockingPromises === 0) {
|
26936 | /******/ setStatus("ready").then(function () {
|
26937 | /******/ if (blockingPromises === 0) {
|
26938 | /******/ var list = blockingPromisesWaiting;
|
26939 | /******/ blockingPromisesWaiting = [];
|
26940 | /******/ for (var i = 0; i < list.length; i++) {
|
26941 | /******/ list[i]();
|
26942 | /******/ }
|
26943 | /******/ }
|
26944 | /******/ });
|
26945 | /******/ }
|
26946 | /******/ }
|
26947 | /******/
|
26948 | /******/ function trackBlockingPromise(promise) {
|
26949 | /******/ switch (currentStatus) {
|
26950 | /******/ case "ready":
|
26951 | /******/ setStatus("prepare");
|
26952 | /******/ /* fallthrough */
|
26953 | /******/ case "prepare":
|
26954 | /******/ blockingPromises++;
|
26955 | /******/ promise.then(unblock, unblock);
|
26956 | /******/ return promise;
|
26957 | /******/ default:
|
26958 | /******/ return promise;
|
26959 | /******/ }
|
26960 | /******/ }
|
26961 | /******/
|
26962 | /******/ function waitForBlockingPromises(fn) {
|
26963 | /******/ if (blockingPromises === 0) return fn();
|
26964 | /******/ return new Promise(function (resolve) {
|
26965 | /******/ blockingPromisesWaiting.push(function () {
|
26966 | /******/ resolve(fn());
|
26967 | /******/ });
|
26968 | /******/ });
|
26969 | /******/ }
|
26970 | /******/
|
26971 | /******/ function hotCheck(applyOnUpdate) {
|
26972 | /******/ if (currentStatus !== "idle") {
|
26973 | /******/ throw new Error("check() is only allowed in idle status");
|
26974 | /******/ }
|
26975 | /******/ return setStatus("check")
|
26976 | /******/ .then(__webpack_require__.hmrM)
|
26977 | /******/ .then(function (update) {
|
26978 | /******/ if (!update) {
|
26979 | /******/ return setStatus(applyInvalidatedModules() ? "ready" : "idle").then(
|
26980 | /******/ function () {
|
26981 | /******/ return null;
|
26982 | /******/ }
|
26983 | /******/ );
|
26984 | /******/ }
|
26985 | /******/
|
26986 | /******/ return setStatus("prepare").then(function () {
|
26987 | /******/ var updatedModules = [];
|
26988 | /******/ currentUpdateApplyHandlers = [];
|
26989 | /******/
|
26990 | /******/ return Promise.all(
|
26991 | /******/ Object.keys(__webpack_require__.hmrC).reduce(function (
|
26992 | /******/ promises,
|
26993 | /******/ key
|
26994 | /******/ ) {
|
26995 | /******/ __webpack_require__.hmrC[key](
|
26996 | /******/ update.c,
|
26997 | /******/ update.r,
|
26998 | /******/ update.m,
|
26999 | /******/ promises,
|
27000 | /******/ currentUpdateApplyHandlers,
|
27001 | /******/ updatedModules
|
27002 | /******/ );
|
27003 | /******/ return promises;
|
27004 | /******/ },
|
27005 | /******/ [])
|
27006 | /******/ ).then(function () {
|
27007 | /******/ return waitForBlockingPromises(function () {
|
27008 | /******/ if (applyOnUpdate) {
|
27009 | /******/ return internalApply(applyOnUpdate);
|
27010 | /******/ } else {
|
27011 | /******/ return setStatus("ready").then(function () {
|
27012 | /******/ return updatedModules;
|
27013 | /******/ });
|
27014 | /******/ }
|
27015 | /******/ });
|
27016 | /******/ });
|
27017 | /******/ });
|
27018 | /******/ });
|
27019 | /******/ }
|
27020 | /******/
|
27021 | /******/ function hotApply(options) {
|
27022 | /******/ if (currentStatus !== "ready") {
|
27023 | /******/ return Promise.resolve().then(function () {
|
27024 | /******/ throw new Error(
|
27025 | /******/ "apply() is only allowed in ready status (state: " +
|
27026 | /******/ currentStatus +
|
27027 | /******/ ")"
|
27028 | /******/ );
|
27029 | /******/ });
|
27030 | /******/ }
|
27031 | /******/ return internalApply(options);
|
27032 | /******/ }
|
27033 | /******/
|
27034 | /******/ function internalApply(options) {
|
27035 | /******/ options = options || {};
|
27036 | /******/
|
27037 | /******/ applyInvalidatedModules();
|
27038 | /******/
|
27039 | /******/ var results = currentUpdateApplyHandlers.map(function (handler) {
|
27040 | /******/ return handler(options);
|
27041 | /******/ });
|
27042 | /******/ currentUpdateApplyHandlers = undefined;
|
27043 | /******/
|
27044 | /******/ var errors = results
|
27045 | /******/ .map(function (r) {
|
27046 | /******/ return r.error;
|
27047 | /******/ })
|
27048 | /******/ .filter(Boolean);
|
27049 | /******/
|
27050 | /******/ if (errors.length > 0) {
|
27051 | /******/ return setStatus("abort").then(function () {
|
27052 | /******/ throw errors[0];
|
27053 | /******/ });
|
27054 | /******/ }
|
27055 | /******/
|
27056 | /******/ // Now in "dispose" phase
|
27057 | /******/ var disposePromise = setStatus("dispose");
|
27058 | /******/
|
27059 | /******/ results.forEach(function (result) {
|
27060 | /******/ if (result.dispose) result.dispose();
|
27061 | /******/ });
|
27062 | /******/
|
27063 | /******/ // Now in "apply" phase
|
27064 | /******/ var applyPromise = setStatus("apply");
|
27065 | /******/
|
27066 | /******/ var error;
|
27067 | /******/ var reportError = function (err) {
|
27068 | /******/ if (!error) error = err;
|
27069 | /******/ };
|
27070 | /******/
|
27071 | /******/ var outdatedModules = [];
|
27072 | /******/ results.forEach(function (result) {
|
27073 | /******/ if (result.apply) {
|
27074 | /******/ var modules = result.apply(reportError);
|
27075 | /******/ if (modules) {
|
27076 | /******/ for (var i = 0; i < modules.length; i++) {
|
27077 | /******/ outdatedModules.push(modules[i]);
|
27078 | /******/ }
|
27079 | /******/ }
|
27080 | /******/ }
|
27081 | /******/ });
|
27082 | /******/
|
27083 | /******/ return Promise.all([disposePromise, applyPromise]).then(function () {
|
27084 | /******/ // handle errors in accept handlers and self accepted module load
|
27085 | /******/ if (error) {
|
27086 | /******/ return setStatus("fail").then(function () {
|
27087 | /******/ throw error;
|
27088 | /******/ });
|
27089 | /******/ }
|
27090 | /******/
|
27091 | /******/ if (queuedInvalidatedModules) {
|
27092 | /******/ return internalApply(options).then(function (list) {
|
27093 | /******/ outdatedModules.forEach(function (moduleId) {
|
27094 | /******/ if (list.indexOf(moduleId) < 0) list.push(moduleId);
|
27095 | /******/ });
|
27096 | /******/ return list;
|
27097 | /******/ });
|
27098 | /******/ }
|
27099 | /******/
|
27100 | /******/ return setStatus("idle").then(function () {
|
27101 | /******/ return outdatedModules;
|
27102 | /******/ });
|
27103 | /******/ });
|
27104 | /******/ }
|
27105 | /******/
|
27106 | /******/ function applyInvalidatedModules() {
|
27107 | /******/ if (queuedInvalidatedModules) {
|
27108 | /******/ if (!currentUpdateApplyHandlers) currentUpdateApplyHandlers = [];
|
27109 | /******/ Object.keys(__webpack_require__.hmrI).forEach(function (key) {
|
27110 | /******/ queuedInvalidatedModules.forEach(function (moduleId) {
|
27111 | /******/ __webpack_require__.hmrI[key](
|
27112 | /******/ moduleId,
|
27113 | /******/ currentUpdateApplyHandlers
|
27114 | /******/ );
|
27115 | /******/ });
|
27116 | /******/ });
|
27117 | /******/ queuedInvalidatedModules = undefined;
|
27118 | /******/ return true;
|
27119 | /******/ }
|
27120 | /******/ }
|
27121 | /******/ })();
|
27122 | /******/
|
27123 | /******/ /* webpack/runtime/publicPath */
|
27124 | /******/ (() => {
|
27125 | /******/ __webpack_require__.p = "";
|
27126 | /******/ })();
|
27127 | /******/
|
27128 | /******/ /* webpack/runtime/jsonp chunk loading */
|
27129 | /******/ (() => {
|
27130 | /******/ // no baseURI
|
27131 | /******/
|
27132 | /******/ // object to store loaded and loading chunks
|
27133 | /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
27134 | /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
27135 | /******/ var installedChunks = __webpack_require__.hmrS_jsonp = __webpack_require__.hmrS_jsonp || {
|
27136 | /******/ 179: 0
|
27137 | /******/ };
|
27138 | /******/
|
27139 | /******/ // no chunk on demand loading
|
27140 | /******/
|
27141 | /******/ // no prefetching
|
27142 | /******/
|
27143 | /******/ // no preloaded
|
27144 | /******/
|
27145 | /******/ var currentUpdatedModulesList;
|
27146 | /******/ var waitingUpdateResolves = {};
|
27147 | /******/ function loadUpdateChunk(chunkId, updatedModulesList) {
|
27148 | /******/ currentUpdatedModulesList = updatedModulesList;
|
27149 | /******/ return new Promise((resolve, reject) => {
|
27150 | /******/ waitingUpdateResolves[chunkId] = resolve;
|
27151 | /******/ // start update chunk loading
|
27152 | /******/ var url = __webpack_require__.p + __webpack_require__.hu(chunkId);
|
27153 | /******/ // create error before stack unwound to get useful stacktrace later
|
27154 | /******/ var error = new Error();
|
27155 | /******/ var loadingEnded = (event) => {
|
27156 | /******/ if(waitingUpdateResolves[chunkId]) {
|
27157 | /******/ waitingUpdateResolves[chunkId] = undefined
|
27158 | /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
27159 | /******/ var realSrc = event && event.target && event.target.src;
|
27160 | /******/ error.message = 'Loading hot update chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
27161 | /******/ error.name = 'ChunkLoadError';
|
27162 | /******/ error.type = errorType;
|
27163 | /******/ error.request = realSrc;
|
27164 | /******/ reject(error);
|
27165 | /******/ }
|
27166 | /******/ };
|
27167 | /******/ __webpack_require__.l(url, loadingEnded);
|
27168 | /******/ });
|
27169 | /******/ }
|
27170 | /******/
|
27171 | /******/ self["webpackHotUpdaterapidoc"] = (chunkId, moreModules, runtime) => {
|
27172 | /******/ for(var moduleId in moreModules) {
|
27173 | /******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
27174 | /******/ currentUpdate[moduleId] = moreModules[moduleId];
|
27175 | /******/ if(currentUpdatedModulesList) currentUpdatedModulesList.push(moduleId);
|
27176 | /******/ }
|
27177 | /******/ }
|
27178 | /******/ if(runtime) currentUpdateRuntime.push(runtime);
|
27179 | /******/ if(waitingUpdateResolves[chunkId]) {
|
27180 | /******/ waitingUpdateResolves[chunkId]();
|
27181 | /******/ waitingUpdateResolves[chunkId] = undefined;
|
27182 | /******/ }
|
27183 | /******/ };
|
27184 | /******/
|
27185 | /******/ var currentUpdateChunks;
|
27186 | /******/ var currentUpdate;
|
27187 | /******/ var currentUpdateRemovedChunks;
|
27188 | /******/ var currentUpdateRuntime;
|
27189 | /******/ function applyHandler(options) {
|
27190 | /******/ if (__webpack_require__.f) delete __webpack_require__.f.jsonpHmr;
|
27191 | /******/ currentUpdateChunks = undefined;
|
27192 | /******/ function getAffectedModuleEffects(updateModuleId) {
|
27193 | /******/ var outdatedModules = [updateModuleId];
|
27194 | /******/ var outdatedDependencies = {};
|
27195 | /******/
|
27196 | /******/ var queue = outdatedModules.map(function (id) {
|
27197 | /******/ return {
|
27198 | /******/ chain: [id],
|
27199 | /******/ id: id
|
27200 | /******/ };
|
27201 | /******/ });
|
27202 | /******/ while (queue.length > 0) {
|
27203 | /******/ var queueItem = queue.pop();
|
27204 | /******/ var moduleId = queueItem.id;
|
27205 | /******/ var chain = queueItem.chain;
|
27206 | /******/ var module = __webpack_require__.c[moduleId];
|
27207 | /******/ if (
|
27208 | /******/ !module ||
|
27209 | /******/ (module.hot._selfAccepted && !module.hot._selfInvalidated)
|
27210 | /******/ )
|
27211 | /******/ continue;
|
27212 | /******/ if (module.hot._selfDeclined) {
|
27213 | /******/ return {
|
27214 | /******/ type: "self-declined",
|
27215 | /******/ chain: chain,
|
27216 | /******/ moduleId: moduleId
|
27217 | /******/ };
|
27218 | /******/ }
|
27219 | /******/ if (module.hot._main) {
|
27220 | /******/ return {
|
27221 | /******/ type: "unaccepted",
|
27222 | /******/ chain: chain,
|
27223 | /******/ moduleId: moduleId
|
27224 | /******/ };
|
27225 | /******/ }
|
27226 | /******/ for (var i = 0; i < module.parents.length; i++) {
|
27227 | /******/ var parentId = module.parents[i];
|
27228 | /******/ var parent = __webpack_require__.c[parentId];
|
27229 | /******/ if (!parent) continue;
|
27230 | /******/ if (parent.hot._declinedDependencies[moduleId]) {
|
27231 | /******/ return {
|
27232 | /******/ type: "declined",
|
27233 | /******/ chain: chain.concat([parentId]),
|
27234 | /******/ moduleId: moduleId,
|
27235 | /******/ parentId: parentId
|
27236 | /******/ };
|
27237 | /******/ }
|
27238 | /******/ if (outdatedModules.indexOf(parentId) !== -1) continue;
|
27239 | /******/ if (parent.hot._acceptedDependencies[moduleId]) {
|
27240 | /******/ if (!outdatedDependencies[parentId])
|
27241 | /******/ outdatedDependencies[parentId] = [];
|
27242 | /******/ addAllToSet(outdatedDependencies[parentId], [moduleId]);
|
27243 | /******/ continue;
|
27244 | /******/ }
|
27245 | /******/ delete outdatedDependencies[parentId];
|
27246 | /******/ outdatedModules.push(parentId);
|
27247 | /******/ queue.push({
|
27248 | /******/ chain: chain.concat([parentId]),
|
27249 | /******/ id: parentId
|
27250 | /******/ });
|
27251 | /******/ }
|
27252 | /******/ }
|
27253 | /******/
|
27254 | /******/ return {
|
27255 | /******/ type: "accepted",
|
27256 | /******/ moduleId: updateModuleId,
|
27257 | /******/ outdatedModules: outdatedModules,
|
27258 | /******/ outdatedDependencies: outdatedDependencies
|
27259 | /******/ };
|
27260 | /******/ }
|
27261 | /******/
|
27262 | /******/ function addAllToSet(a, b) {
|
27263 | /******/ for (var i = 0; i < b.length; i++) {
|
27264 | /******/ var item = b[i];
|
27265 | /******/ if (a.indexOf(item) === -1) a.push(item);
|
27266 | /******/ }
|
27267 | /******/ }
|
27268 | /******/
|
27269 | /******/ // at begin all updates modules are outdated
|
27270 | /******/ // the "outdated" status can propagate to parents if they don't accept the children
|
27271 | /******/ var outdatedDependencies = {};
|
27272 | /******/ var outdatedModules = [];
|
27273 | /******/ var appliedUpdate = {};
|
27274 | /******/
|
27275 | /******/ var warnUnexpectedRequire = function warnUnexpectedRequire(module) {
|
27276 | /******/ console.warn(
|
27277 | /******/ "[HMR] unexpected require(" + module.id + ") to disposed module"
|
27278 | /******/ );
|
27279 | /******/ };
|
27280 | /******/
|
27281 | /******/ for (var moduleId in currentUpdate) {
|
27282 | /******/ if (__webpack_require__.o(currentUpdate, moduleId)) {
|
27283 | /******/ var newModuleFactory = currentUpdate[moduleId];
|
27284 | /******/ /** @type {TODO} */
|
27285 | /******/ var result;
|
27286 | /******/ if (newModuleFactory) {
|
27287 | /******/ result = getAffectedModuleEffects(moduleId);
|
27288 | /******/ } else {
|
27289 | /******/ result = {
|
27290 | /******/ type: "disposed",
|
27291 | /******/ moduleId: moduleId
|
27292 | /******/ };
|
27293 | /******/ }
|
27294 | /******/ /** @type {Error|false} */
|
27295 | /******/ var abortError = false;
|
27296 | /******/ var doApply = false;
|
27297 | /******/ var doDispose = false;
|
27298 | /******/ var chainInfo = "";
|
27299 | /******/ if (result.chain) {
|
27300 | /******/ chainInfo = "\nUpdate propagation: " + result.chain.join(" -> ");
|
27301 | /******/ }
|
27302 | /******/ switch (result.type) {
|
27303 | /******/ case "self-declined":
|
27304 | /******/ if (options.onDeclined) options.onDeclined(result);
|
27305 | /******/ if (!options.ignoreDeclined)
|
27306 | /******/ abortError = new Error(
|
27307 | /******/ "Aborted because of self decline: " +
|
27308 | /******/ result.moduleId +
|
27309 | /******/ chainInfo
|
27310 | /******/ );
|
27311 | /******/ break;
|
27312 | /******/ case "declined":
|
27313 | /******/ if (options.onDeclined) options.onDeclined(result);
|
27314 | /******/ if (!options.ignoreDeclined)
|
27315 | /******/ abortError = new Error(
|
27316 | /******/ "Aborted because of declined dependency: " +
|
27317 | /******/ result.moduleId +
|
27318 | /******/ " in " +
|
27319 | /******/ result.parentId +
|
27320 | /******/ chainInfo
|
27321 | /******/ );
|
27322 | /******/ break;
|
27323 | /******/ case "unaccepted":
|
27324 | /******/ if (options.onUnaccepted) options.onUnaccepted(result);
|
27325 | /******/ if (!options.ignoreUnaccepted)
|
27326 | /******/ abortError = new Error(
|
27327 | /******/ "Aborted because " + moduleId + " is not accepted" + chainInfo
|
27328 | /******/ );
|
27329 | /******/ break;
|
27330 | /******/ case "accepted":
|
27331 | /******/ if (options.onAccepted) options.onAccepted(result);
|
27332 | /******/ doApply = true;
|
27333 | /******/ break;
|
27334 | /******/ case "disposed":
|
27335 | /******/ if (options.onDisposed) options.onDisposed(result);
|
27336 | /******/ doDispose = true;
|
27337 | /******/ break;
|
27338 | /******/ default:
|
27339 | /******/ throw new Error("Unexception type " + result.type);
|
27340 | /******/ }
|
27341 | /******/ if (abortError) {
|
27342 | /******/ return {
|
27343 | /******/ error: abortError
|
27344 | /******/ };
|
27345 | /******/ }
|
27346 | /******/ if (doApply) {
|
27347 | /******/ appliedUpdate[moduleId] = newModuleFactory;
|
27348 | /******/ addAllToSet(outdatedModules, result.outdatedModules);
|
27349 | /******/ for (moduleId in result.outdatedDependencies) {
|
27350 | /******/ if (__webpack_require__.o(result.outdatedDependencies, moduleId)) {
|
27351 | /******/ if (!outdatedDependencies[moduleId])
|
27352 | /******/ outdatedDependencies[moduleId] = [];
|
27353 | /******/ addAllToSet(
|
27354 | /******/ outdatedDependencies[moduleId],
|
27355 | /******/ result.outdatedDependencies[moduleId]
|
27356 | /******/ );
|
27357 | /******/ }
|
27358 | /******/ }
|
27359 | /******/ }
|
27360 | /******/ if (doDispose) {
|
27361 | /******/ addAllToSet(outdatedModules, [result.moduleId]);
|
27362 | /******/ appliedUpdate[moduleId] = warnUnexpectedRequire;
|
27363 | /******/ }
|
27364 | /******/ }
|
27365 | /******/ }
|
27366 | /******/ currentUpdate = undefined;
|
27367 | /******/
|
27368 | /******/ // Store self accepted outdated modules to require them later by the module system
|
27369 | /******/ var outdatedSelfAcceptedModules = [];
|
27370 | /******/ for (var j = 0; j < outdatedModules.length; j++) {
|
27371 | /******/ var outdatedModuleId = outdatedModules[j];
|
27372 | /******/ var module = __webpack_require__.c[outdatedModuleId];
|
27373 | /******/ if (
|
27374 | /******/ module &&
|
27375 | /******/ (module.hot._selfAccepted || module.hot._main) &&
|
27376 | /******/ // removed self-accepted modules should not be required
|
27377 | /******/ appliedUpdate[outdatedModuleId] !== warnUnexpectedRequire &&
|
27378 | /******/ // when called invalidate self-accepting is not possible
|
27379 | /******/ !module.hot._selfInvalidated
|
27380 | /******/ ) {
|
27381 | /******/ outdatedSelfAcceptedModules.push({
|
27382 | /******/ module: outdatedModuleId,
|
27383 | /******/ require: module.hot._requireSelf,
|
27384 | /******/ errorHandler: module.hot._selfAccepted
|
27385 | /******/ });
|
27386 | /******/ }
|
27387 | /******/ }
|
27388 | /******/
|
27389 | /******/ var moduleOutdatedDependencies;
|
27390 | /******/
|
27391 | /******/ return {
|
27392 | /******/ dispose: function () {
|
27393 | /******/ currentUpdateRemovedChunks.forEach(function (chunkId) {
|
27394 | /******/ delete installedChunks[chunkId];
|
27395 | /******/ });
|
27396 | /******/ currentUpdateRemovedChunks = undefined;
|
27397 | /******/
|
27398 | /******/ var idx;
|
27399 | /******/ var queue = outdatedModules.slice();
|
27400 | /******/ while (queue.length > 0) {
|
27401 | /******/ var moduleId = queue.pop();
|
27402 | /******/ var module = __webpack_require__.c[moduleId];
|
27403 | /******/ if (!module) continue;
|
27404 | /******/
|
27405 | /******/ var data = {};
|
27406 | /******/
|
27407 | /******/ // Call dispose handlers
|
27408 | /******/ var disposeHandlers = module.hot._disposeHandlers;
|
27409 | /******/ for (j = 0; j < disposeHandlers.length; j++) {
|
27410 | /******/ disposeHandlers[j].call(null, data);
|
27411 | /******/ }
|
27412 | /******/ __webpack_require__.hmrD[moduleId] = data;
|
27413 | /******/
|
27414 | /******/ // disable module (this disables requires from this module)
|
27415 | /******/ module.hot.active = false;
|
27416 | /******/
|
27417 | /******/ // remove module from cache
|
27418 | /******/ delete __webpack_require__.c[moduleId];
|
27419 | /******/
|
27420 | /******/ // when disposing there is no need to call dispose handler
|
27421 | /******/ delete outdatedDependencies[moduleId];
|
27422 | /******/
|
27423 | /******/ // remove "parents" references from all children
|
27424 | /******/ for (j = 0; j < module.children.length; j++) {
|
27425 | /******/ var child = __webpack_require__.c[module.children[j]];
|
27426 | /******/ if (!child) continue;
|
27427 | /******/ idx = child.parents.indexOf(moduleId);
|
27428 | /******/ if (idx >= 0) {
|
27429 | /******/ child.parents.splice(idx, 1);
|
27430 | /******/ }
|
27431 | /******/ }
|
27432 | /******/ }
|
27433 | /******/
|
27434 | /******/ // remove outdated dependency from module children
|
27435 | /******/ var dependency;
|
27436 | /******/ for (var outdatedModuleId in outdatedDependencies) {
|
27437 | /******/ if (__webpack_require__.o(outdatedDependencies, outdatedModuleId)) {
|
27438 | /******/ module = __webpack_require__.c[outdatedModuleId];
|
27439 | /******/ if (module) {
|
27440 | /******/ moduleOutdatedDependencies =
|
27441 | /******/ outdatedDependencies[outdatedModuleId];
|
27442 | /******/ for (j = 0; j < moduleOutdatedDependencies.length; j++) {
|
27443 | /******/ dependency = moduleOutdatedDependencies[j];
|
27444 | /******/ idx = module.children.indexOf(dependency);
|
27445 | /******/ if (idx >= 0) module.children.splice(idx, 1);
|
27446 | /******/ }
|
27447 | /******/ }
|
27448 | /******/ }
|
27449 | /******/ }
|
27450 | /******/ },
|
27451 | /******/ apply: function (reportError) {
|
27452 | /******/ // insert new code
|
27453 | /******/ for (var updateModuleId in appliedUpdate) {
|
27454 | /******/ if (__webpack_require__.o(appliedUpdate, updateModuleId)) {
|
27455 | /******/ __webpack_require__.m[updateModuleId] = appliedUpdate[updateModuleId];
|
27456 | /******/ }
|
27457 | /******/ }
|
27458 | /******/
|
27459 | /******/ // run new runtime modules
|
27460 | /******/ for (var i = 0; i < currentUpdateRuntime.length; i++) {
|
27461 | /******/ currentUpdateRuntime[i](__webpack_require__);
|
27462 | /******/ }
|
27463 | /******/
|
27464 | /******/ // call accept handlers
|
27465 | /******/ for (var outdatedModuleId in outdatedDependencies) {
|
27466 | /******/ if (__webpack_require__.o(outdatedDependencies, outdatedModuleId)) {
|
27467 | /******/ var module = __webpack_require__.c[outdatedModuleId];
|
27468 | /******/ if (module) {
|
27469 | /******/ moduleOutdatedDependencies =
|
27470 | /******/ outdatedDependencies[outdatedModuleId];
|
27471 | /******/ var callbacks = [];
|
27472 | /******/ var errorHandlers = [];
|
27473 | /******/ var dependenciesForCallbacks = [];
|
27474 | /******/ for (var j = 0; j < moduleOutdatedDependencies.length; j++) {
|
27475 | /******/ var dependency = moduleOutdatedDependencies[j];
|
27476 | /******/ var acceptCallback =
|
27477 | /******/ module.hot._acceptedDependencies[dependency];
|
27478 | /******/ var errorHandler =
|
27479 | /******/ module.hot._acceptedErrorHandlers[dependency];
|
27480 | /******/ if (acceptCallback) {
|
27481 | /******/ if (callbacks.indexOf(acceptCallback) !== -1) continue;
|
27482 | /******/ callbacks.push(acceptCallback);
|
27483 | /******/ errorHandlers.push(errorHandler);
|
27484 | /******/ dependenciesForCallbacks.push(dependency);
|
27485 | /******/ }
|
27486 | /******/ }
|
27487 | /******/ for (var k = 0; k < callbacks.length; k++) {
|
27488 | /******/ try {
|
27489 | /******/ callbacks[k].call(null, moduleOutdatedDependencies);
|
27490 | /******/ } catch (err) {
|
27491 | /******/ if (typeof errorHandlers[k] === "function") {
|
27492 | /******/ try {
|
27493 | /******/ errorHandlers[k](err, {
|
27494 | /******/ moduleId: outdatedModuleId,
|
27495 | /******/ dependencyId: dependenciesForCallbacks[k]
|
27496 | /******/ });
|
27497 | /******/ } catch (err2) {
|
27498 | /******/ if (options.onErrored) {
|
27499 | /******/ options.onErrored({
|
27500 | /******/ type: "accept-error-handler-errored",
|
27501 | /******/ moduleId: outdatedModuleId,
|
27502 | /******/ dependencyId: dependenciesForCallbacks[k],
|
27503 | /******/ error: err2,
|
27504 | /******/ originalError: err
|
27505 | /******/ });
|
27506 | /******/ }
|
27507 | /******/ if (!options.ignoreErrored) {
|
27508 | /******/ reportError(err2);
|
27509 | /******/ reportError(err);
|
27510 | /******/ }
|
27511 | /******/ }
|
27512 | /******/ } else {
|
27513 | /******/ if (options.onErrored) {
|
27514 | /******/ options.onErrored({
|
27515 | /******/ type: "accept-errored",
|
27516 | /******/ moduleId: outdatedModuleId,
|
27517 | /******/ dependencyId: dependenciesForCallbacks[k],
|
27518 | /******/ error: err
|
27519 | /******/ });
|
27520 | /******/ }
|
27521 | /******/ if (!options.ignoreErrored) {
|
27522 | /******/ reportError(err);
|
27523 | /******/ }
|
27524 | /******/ }
|
27525 | /******/ }
|
27526 | /******/ }
|
27527 | /******/ }
|
27528 | /******/ }
|
27529 | /******/ }
|
27530 | /******/
|
27531 | /******/ // Load self accepted modules
|
27532 | /******/ for (var o = 0; o < outdatedSelfAcceptedModules.length; o++) {
|
27533 | /******/ var item = outdatedSelfAcceptedModules[o];
|
27534 | /******/ var moduleId = item.module;
|
27535 | /******/ try {
|
27536 | /******/ item.require(moduleId);
|
27537 | /******/ } catch (err) {
|
27538 | /******/ if (typeof item.errorHandler === "function") {
|
27539 | /******/ try {
|
27540 | /******/ item.errorHandler(err, {
|
27541 | /******/ moduleId: moduleId,
|
27542 | /******/ module: __webpack_require__.c[moduleId]
|
27543 | /******/ });
|
27544 | /******/ } catch (err2) {
|
27545 | /******/ if (options.onErrored) {
|
27546 | /******/ options.onErrored({
|
27547 | /******/ type: "self-accept-error-handler-errored",
|
27548 | /******/ moduleId: moduleId,
|
27549 | /******/ error: err2,
|
27550 | /******/ originalError: err
|
27551 | /******/ });
|
27552 | /******/ }
|
27553 | /******/ if (!options.ignoreErrored) {
|
27554 | /******/ reportError(err2);
|
27555 | /******/ reportError(err);
|
27556 | /******/ }
|
27557 | /******/ }
|
27558 | /******/ } else {
|
27559 | /******/ if (options.onErrored) {
|
27560 | /******/ options.onErrored({
|
27561 | /******/ type: "self-accept-errored",
|
27562 | /******/ moduleId: moduleId,
|
27563 | /******/ error: err
|
27564 | /******/ });
|
27565 | /******/ }
|
27566 | /******/ if (!options.ignoreErrored) {
|
27567 | /******/ reportError(err);
|
27568 | /******/ }
|
27569 | /******/ }
|
27570 | /******/ }
|
27571 | /******/ }
|
27572 | /******/
|
27573 | /******/ return outdatedModules;
|
27574 | /******/ }
|
27575 | /******/ };
|
27576 | /******/ }
|
27577 | /******/ __webpack_require__.hmrI.jsonp = function (moduleId, applyHandlers) {
|
27578 | /******/ if (!currentUpdate) {
|
27579 | /******/ currentUpdate = {};
|
27580 | /******/ currentUpdateRuntime = [];
|
27581 | /******/ currentUpdateRemovedChunks = [];
|
27582 | /******/ applyHandlers.push(applyHandler);
|
27583 | /******/ }
|
27584 | /******/ if (!__webpack_require__.o(currentUpdate, moduleId)) {
|
27585 | /******/ currentUpdate[moduleId] = __webpack_require__.m[moduleId];
|
27586 | /******/ }
|
27587 | /******/ };
|
27588 | /******/ __webpack_require__.hmrC.jsonp = function (
|
27589 | /******/ chunkIds,
|
27590 | /******/ removedChunks,
|
27591 | /******/ removedModules,
|
27592 | /******/ promises,
|
27593 | /******/ applyHandlers,
|
27594 | /******/ updatedModulesList
|
27595 | /******/ ) {
|
27596 | /******/ applyHandlers.push(applyHandler);
|
27597 | /******/ currentUpdateChunks = {};
|
27598 | /******/ currentUpdateRemovedChunks = removedChunks;
|
27599 | /******/ currentUpdate = removedModules.reduce(function (obj, key) {
|
27600 | /******/ obj[key] = false;
|
27601 | /******/ return obj;
|
27602 | /******/ }, {});
|
27603 | /******/ currentUpdateRuntime = [];
|
27604 | /******/ chunkIds.forEach(function (chunkId) {
|
27605 | /******/ if (
|
27606 | /******/ __webpack_require__.o(installedChunks, chunkId) &&
|
27607 | /******/ installedChunks[chunkId] !== undefined
|
27608 | /******/ ) {
|
27609 | /******/ promises.push(loadUpdateChunk(chunkId, updatedModulesList));
|
27610 | /******/ currentUpdateChunks[chunkId] = true;
|
27611 | /******/ } else {
|
27612 | /******/ currentUpdateChunks[chunkId] = false;
|
27613 | /******/ }
|
27614 | /******/ });
|
27615 | /******/ if (__webpack_require__.f) {
|
27616 | /******/ __webpack_require__.f.jsonpHmr = function (chunkId, promises) {
|
27617 | /******/ if (
|
27618 | /******/ currentUpdateChunks &&
|
27619 | /******/ __webpack_require__.o(currentUpdateChunks, chunkId) &&
|
27620 | /******/ !currentUpdateChunks[chunkId]
|
27621 | /******/ ) {
|
27622 | /******/ promises.push(loadUpdateChunk(chunkId));
|
27623 | /******/ currentUpdateChunks[chunkId] = true;
|
27624 | /******/ }
|
27625 | /******/ };
|
27626 | /******/ }
|
27627 | /******/ };
|
27628 | /******/
|
27629 | /******/ __webpack_require__.hmrM = () => {
|
27630 | /******/ if (typeof fetch === "undefined") throw new Error("No browser support: need fetch API");
|
27631 | /******/ return fetch(__webpack_require__.p + __webpack_require__.hmrF()).then((response) => {
|
27632 | /******/ if(response.status === 404) return; // no update available
|
27633 | /******/ if(!response.ok) throw new Error("Failed to fetch update manifest " + response.statusText);
|
27634 | /******/ return response.json();
|
27635 | /******/ });
|
27636 | /******/ };
|
27637 | /******/
|
27638 | /******/ // no on chunks loaded
|
27639 | /******/
|
27640 | /******/ // no jsonp function
|
27641 | /******/ })();
|
27642 | /******/
|
27643 | /************************************************************************/
|
27644 | /******/
|
27645 | /******/ // module cache are used so entry inlining is disabled
|
27646 | /******/ // startup
|
27647 | /******/ // Load entry module and return exports
|
27648 | /******/ var __webpack_exports__ = __webpack_require__(656);
|
27649 | /******/
|
27650 | /******/ })()
|
27651 | ; |
\ | No newline at end of file |