@redocly/reference-docs 2.7.9 → 2.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Schema=void 0;var tslib_1=require("tslib"),mobx_react_1=require("mobx-react"),React=(0,tslib_1.__importStar)(require("react")),fields_1=require("../../common-elements/fields"),FieldDetails_1=require("../Fields/FieldDetails"),ArraySchema_1=require("./ArraySchema"),ObjectSchema_1=require("./ObjectSchema"),OneOfSchema_1=require("./OneOfSchema"),Labels_1=require("../../services/Labels"),Schema=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,tslib_1.__extends)(t,e),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t=this.props.schema;if(!t)return React.createElement("em",null," Schema not provided ");var r=t.type,i=t.oneOf,a=t.discriminatorProp,l=t.isCircular,s=(this.props.level||0)+1;if(l)return React.createElement("div",null,React.createElement(fields_1.TypeName,null,t.displayType),t.title&&React.createElement(fields_1.TypeTitle,null," ",t.title," "),React.createElement(fields_1.RecursiveLabel,null,(0,Labels_1.l)("recursive")));if(void 0!==a)return i&&i.length?React.createElement(ObjectSchema_1.ObjectSchema,(0,tslib_1.__assign)({},(0,tslib_1.__assign)((0,tslib_1.__assign)({},this.props),{schema:i[t.activeOneOf],level:s}),{discriminator:{fieldName:a,parentSchema:t}})):(console.warn("Looks like you are using discriminator wrong: you don't have any definition inherited from the "+t.title),null);if(void 0!==i)return React.createElement(OneOfSchema_1.OneOfSchema,(0,tslib_1.__assign)({schema:t},this.props));var n=Array.isArray(r)?r:[r];if(n.includes("object")){if(null===(e=t.fields)||void 0===e?void 0:e.length)return React.createElement(ObjectSchema_1.ObjectSchema,(0,tslib_1.__assign)({},(0,tslib_1.__assign)((0,tslib_1.__assign)({},this.props),{level:s})))}else if(n.includes("array"))return React.createElement(ArraySchema_1.ArraySchema,(0,tslib_1.__assign)({},(0,tslib_1.__assign)((0,tslib_1.__assign)({},this.props),{level:s})));var c={schema:t,name:"",required:!1,description:t.description,externalDocs:t.externalDocs,deprecated:!1,toggle:function(){return null},expanded:!1};return React.createElement("div",null,React.createElement(FieldDetails_1.FieldDetails,{field:c}))}}),t=(0,tslib_1.__decorate)([mobx_react_1.observer],t)}(React.Component);exports.Schema=Schema;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Schema=void 0;var tslib_1=require("tslib"),mobx_react_1=require("mobx-react"),React=(0,tslib_1.__importStar)(require("react")),fields_1=require("../../common-elements/fields"),FieldDetails_1=require("../Fields/FieldDetails"),ArraySchema_1=require("./ArraySchema"),ObjectSchema_1=require("./ObjectSchema"),OneOfSchema_1=require("./OneOfSchema"),Labels_1=require("../../services/Labels"),Schema=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,tslib_1.__extends)(t,e),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t=this.props.schema;if(!t)return React.createElement("em",null," Schema not provided ");var r=t.type,i=t.oneOf,a=t.discriminatorProp,l=t.isCircular,s=(this.props.level||0)+1;if(l)return React.createElement("div",null,React.createElement(fields_1.TypeName,null,t.displayType),t.title&&React.createElement(fields_1.TypeTitle,null," ",t.title," "),React.createElement(fields_1.RecursiveLabel,null," ",(0,Labels_1.l)("recursive")," "));if(void 0!==a)return i&&i.length?React.createElement(ObjectSchema_1.ObjectSchema,(0,tslib_1.__assign)({},(0,tslib_1.__assign)((0,tslib_1.__assign)({},this.props),{schema:i[t.activeOneOf],level:s}),{discriminator:{fieldName:a,parentSchema:t}})):(console.warn("Looks like you are using discriminator wrong: you don't have any definition inherited from the "+t.title),null);if(void 0!==i)return React.createElement(OneOfSchema_1.OneOfSchema,(0,tslib_1.__assign)({schema:t},this.props));var n=Array.isArray(r)?r:[r];if(n.includes("object")){if(null===(e=t.fields)||void 0===e?void 0:e.length)return React.createElement(ObjectSchema_1.ObjectSchema,(0,tslib_1.__assign)({},(0,tslib_1.__assign)((0,tslib_1.__assign)({},this.props),{level:s})))}else if(n.includes("array"))return React.createElement(ArraySchema_1.ArraySchema,(0,tslib_1.__assign)({},(0,tslib_1.__assign)((0,tslib_1.__assign)({},this.props),{level:s})));var c={schema:t,name:"",required:!1,description:t.description,externalDocs:t.externalDocs,deprecated:!1,toggle:function(){return null},expanded:!1};return React.createElement("div",null,React.createElement(FieldDetails_1.FieldDetails,{field:c}))}}),t=(0,tslib_1.__decorate)([mobx_react_1.observer],t)}(React.Component);exports.Schema=Schema;
2
2
  //# sourceMappingURL=Schema.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OpenAPIParser=void 0;var tslib_1=require("tslib"),url_1=require("url"),utils_1=require("../utils/"),JsonPointer_1=require("../utils/JsonPointer"),utils_2=require("../utils"),MarkdownRenderer_1=require("./MarkdownRenderer"),RedocNormalizedOptions_1=require("./RedocNormalizedOptions"),RefCounter=function(){function e(){Object.defineProperty(this,"_counter",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e.prototype,"reset",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._counter={}}}),Object.defineProperty(e.prototype,"visit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._counter[e]=this._counter[e]?this._counter[e]+1:1}}),Object.defineProperty(e.prototype,"exit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._counter[e]=this._counter[e]&&this._counter[e]-1}}),Object.defineProperty(e.prototype,"visited",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._counter[e]}}),e}(),OpenAPIParser=function(){function e(e,r,t){var i=this;void 0===t&&(t=new RedocNormalizedOptions_1.RedocNormalizedOptions({})),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"definitionUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasSecurityDefinitions",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_refCounter",{enumerable:!0,configurable:!0,writable:!0,value:new RefCounter}),Object.defineProperty(this,"allowMergeRefs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"byRef",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var r;if(i.definition){"#"!==e.charAt(0)&&(e="#"+e),e=decodeURIComponent(e);try{r=JsonPointer_1.JsonPointer.get(i.definition,e)}catch(e){}return r||{}}}}),this.validate(e),this.preprocess(e),this.definition=e,this.hasSecurityDefinitions=this.containsSecurity(e),this.allowMergeRefs=e.openapi.startsWith("3.1");var n=utils_1.IS_BROWSER?window.location.href:"";"string"==typeof r&&(this.definitionUrl=(0,url_1.resolve)(n,r))}return Object.defineProperty(e.prototype,"validate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0===e.openapi)throw new Error("Document must be valid OpenAPI 3.0.0 definition")}}),Object.defineProperty(e.prototype,"containsSecurity",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.info&&e.info.description||"";return MarkdownRenderer_1.MarkdownRenderer.containsComponent(r,utils_2.SECURITY_DEFINITIONS_COMPONENT_NAME)||MarkdownRenderer_1.MarkdownRenderer.containsComponent(r,utils_2.SECURITY_DEFINITIONS_JSX_NAME)}}),Object.defineProperty(e.prototype,"preprocess",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.info&&this.options.hideInfoDescription)e.info.description="";else if(!this.options.noAutoAuth&&e.info&&e.components&&e.components.securitySchemes){var r=e.info.description||"";if(!this.containsSecurity(e)){var t=(0,MarkdownRenderer_1.buildComponentComment)(utils_2.SECURITY_DEFINITIONS_COMPONENT_NAME);e.info.description=(0,utils_1.appendToMdHeading)(r,"Authentication",t)}}}}),Object.defineProperty(e.prototype,"isRef",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!e&&(void 0!==e.$ref&&null!==e.$ref)}}),Object.defineProperty(e.prototype,"resetVisited",{enumerable:!1,configurable:!0,writable:!0,value:function(){if("production"!==process.env.NODE_ENV)for(var e in this._refCounter._counter)this._refCounter._counter[e]>0&&console.warn("Not exited reference: "+e);this._refCounter=new RefCounter}}),Object.defineProperty(e.prototype,"exitRef",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isRef(e)&&this._refCounter.exit(e.$ref)}}),Object.defineProperty(e.prototype,"deref",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t){if(void 0===r&&(r=!1),void 0===t&&(t=!1),this.isRef(e)){var i=(0,utils_2.getDefinitionName)(e.$ref);if(i&&this.options.ignoreNamedSchemas.has(i))return{type:"object",title:i};var n=this.byRef(e.$ref),o=this._refCounter.visited(e.$ref);if(this._refCounter.visit(e.$ref),o&&!r)return Object.assign({},n,{"x-circular-ref":!0});var s=n;return this.isRef(n)&&(s=this.deref(n,!1,t),this.exitRef(n)),this.allowMergeRefs?this.mergeRefs(e,n,t):s}return e}}),Object.defineProperty(e.prototype,"mergeRefs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t){e.$ref;var i=(0,tslib_1.__rest)(e,["$ref"]),n=Object.keys(i);return 0===n.length?r:t&&n.some((function(e){return"description"!==e&&"title"!==e&&"externalDocs"!==e}))?{allOf:[i,r]}:(0,tslib_1.__assign)((0,tslib_1.__assign)({},r),i)}}),Object.defineProperty(e.prototype,"shallowDeref",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.isRef(e)){var r=(0,utils_2.getDefinitionName)(e.$ref);if(r&&this.options.ignoreNamedSchemas.has(r))return{type:"object",title:r};var t=this.byRef(e.$ref);return this.allowMergeRefs?this.mergeRefs(e,t,!1):t}return e}}),Object.defineProperty(e.prototype,"mergeAllOf",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t,i){var n,o=this;if(void 0===t&&(t=!1),void 0===i&&(i=new Set),r&&i.add(r),void 0===(e=this.hoistOneOfs(e)).allOf)return e;var s=(0,tslib_1.__assign)((0,tslib_1.__assign)({},e),{allOf:void 0,parentRefs:[],title:e.title||(0,utils_2.getDefinitionName)(r)});void 0!==s.properties&&"object"==typeof s.properties&&(s.properties=(0,tslib_1.__assign)({},s.properties)),void 0!==s.items&&"object"==typeof s.items&&(s.items=(0,tslib_1.__assign)({},s.items));for(var a=e.allOf.map((function(e){var r;if(!(e&&e.$ref&&i.has(e.$ref))){var n=o.deref(e,t,!0),a=e.$ref||void 0,l=o.mergeAllOf(n,a,t,i);return null===(r=s.parentRefs)||void 0===r||r.push.apply(r,l.parentRefs||[]),{$ref:a,schema:l}}})).filter((function(e){return void 0!==e})),l=0,f=a;l<f.length;l++){var u=f[l],p=u.$ref,c=u.schema;if(s.type!==c.type&&void 0!==s.type&&void 0!==c.type&&console.warn('Incompatible types in allOf at "'+r+'": "'+s.type+'" and "'+c.type+'"'),void 0!==c.type&&(s.type=c.type),void 0!==c.properties)for(var d in s.properties=s.properties||{},c.properties)if(s.properties[d]){var b=this.mergeAllOf({allOf:[s.properties[d],c.properties[d]]},r+"/properties/"+d);s.properties[d]=b,this.exitParents(b)}else s.properties[d]=c.properties[d];void 0!==c.items&&(s.items=s.items||{},s.items=this.mergeAllOf({allOf:[s.items,c.items]},r+"/items")),void 0!==c.required&&(s.required=(s.required||[]).concat(c.required)),s=(0,tslib_1.__assign)((0,tslib_1.__assign)({},c),s),p&&(null===(n=s.parentRefs)||void 0===n||n.push(p),void 0===s.title&&(0,utils_2.isNamedDefinition)(p))}return s}}),Object.defineProperty(e.prototype,"findDerived",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r={},t=this.definition.components&&this.definition.components.schemas||{};for(var i in t){var n=this.deref(t[i]);void 0!==n.allOf&&n.allOf.find((function(r){return void 0!==r.$ref&&e.indexOf(r.$ref)>-1}))&&(r["#/components/schemas/"+i]=[n["x-discriminator-value"]||i])}return r}}),Object.defineProperty(e.prototype,"exitParents",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var r=0,t=e.parentRefs||[];r<t.length;r++){var i=t[r];this.exitRef({$ref:i})}}}),Object.defineProperty(e.prototype,"hoistOneOfs",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this;if(void 0===e.allOf)return e;for(var t=e.allOf,i=function(e){var i=t[e];if(Array.isArray(i.oneOf)){var n=t.slice(0,e),o=t.slice(e+1);return{value:{oneOf:i.oneOf.map((function(e){var t=r.mergeAllOf({allOf:(0,tslib_1.__spreadArray)((0,tslib_1.__spreadArray)((0,tslib_1.__spreadArray)([],n,!0),[e],!1),o,!0)});return r.exitParents(t),t}))}}}},n=0;n<t.length;n++){var o=i(n);if("object"==typeof o)return o.value}return e}}),e}();exports.OpenAPIParser=OpenAPIParser;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OpenAPIParser=void 0;var tslib_1=require("tslib"),url_1=require("url"),utils_1=require("../utils/"),JsonPointer_1=require("../utils/JsonPointer"),utils_2=require("../utils"),MarkdownRenderer_1=require("./MarkdownRenderer"),RedocNormalizedOptions_1=require("./RedocNormalizedOptions"),RefCounter=function(){function e(){Object.defineProperty(this,"_counter",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e.prototype,"reset",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._counter={}}}),Object.defineProperty(e.prototype,"visit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._counter[e]=this._counter[e]?this._counter[e]+1:1}}),Object.defineProperty(e.prototype,"exit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._counter[e]=this._counter[e]&&this._counter[e]-1}}),Object.defineProperty(e.prototype,"visited",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._counter[e]}}),e}(),OpenAPIParser=function(){function e(e,r,t){var i=this;void 0===t&&(t=new RedocNormalizedOptions_1.RedocNormalizedOptions({})),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"definitionUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasSecurityDefinitions",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_refCounter",{enumerable:!0,configurable:!0,writable:!0,value:new RefCounter}),Object.defineProperty(this,"allowMergeRefs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"byRef",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var r;if(i.definition){"#"!==e.charAt(0)&&(e="#"+e),e=decodeURIComponent(e);try{r=JsonPointer_1.JsonPointer.get(i.definition,e)}catch(e){}return r||{}}}}),this.validate(e),this.preprocess(e),this.definition=e,this.hasSecurityDefinitions=this.containsSecurity(e),this.allowMergeRefs=e.openapi.startsWith("3.1");var n=utils_1.IS_BROWSER?window.location.href:"";"string"==typeof r&&(this.definitionUrl=(0,url_1.resolve)(n,r))}return Object.defineProperty(e.prototype,"validate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0===e.openapi)throw new Error("Document must be valid OpenAPI 3.0.0 definition")}}),Object.defineProperty(e.prototype,"containsSecurity",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.info&&e.info.description||"";return MarkdownRenderer_1.MarkdownRenderer.containsComponent(r,utils_2.SECURITY_DEFINITIONS_COMPONENT_NAME)||MarkdownRenderer_1.MarkdownRenderer.containsComponent(r,utils_2.SECURITY_DEFINITIONS_JSX_NAME)}}),Object.defineProperty(e.prototype,"preprocess",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.info&&this.options.hideInfoDescription)e.info.description="";else if(!this.options.noAutoAuth&&e.info&&e.components&&e.components.securitySchemes){var r=e.info.description||"";if(!this.containsSecurity(e)){var t=(0,MarkdownRenderer_1.buildComponentComment)(utils_2.SECURITY_DEFINITIONS_COMPONENT_NAME);e.info.description=(0,utils_1.appendToMdHeading)(r,"Authentication",t)}}}}),Object.defineProperty(e.prototype,"isRef",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!e&&(void 0!==e.$ref&&null!==e.$ref)}}),Object.defineProperty(e.prototype,"resetVisited",{enumerable:!1,configurable:!0,writable:!0,value:function(){if("production"!==process.env.NODE_ENV)for(var e in this._refCounter._counter)this._refCounter._counter[e]>0&&console.warn("Not exited reference: "+e);this._refCounter=new RefCounter}}),Object.defineProperty(e.prototype,"exitRef",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isRef(e)&&this._refCounter.exit(e.$ref)}}),Object.defineProperty(e.prototype,"deref",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t){if(void 0===r&&(r=!1),void 0===t&&(t=!1),this.isRef(e)){var i=(0,utils_2.getDefinitionName)(e.$ref);if(i&&this.options.ignoreNamedSchemas.has(i))return{type:"object",title:i};var n=this.byRef(e.$ref),o=this._refCounter.visited(e.$ref);if(this._refCounter.visit(e.$ref),o&&!r)return Object.assign({},n,{"x-circular-ref":!0});var s=n;return this.isRef(n)&&(s=this.deref(n,!1,t),this.exitRef(n)),this.allowMergeRefs?this.mergeRefs(e,n,t):s}return e}}),Object.defineProperty(e.prototype,"mergeRefs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t){e.$ref;var i=(0,tslib_1.__rest)(e,["$ref"]),n=Object.keys(i);return 0===n.length?r:t&&n.some((function(e){return"description"!==e&&"title"!==e&&"externalDocs"!==e}))?{allOf:[i,r]}:(0,tslib_1.__assign)((0,tslib_1.__assign)({},r),i)}}),Object.defineProperty(e.prototype,"shallowDeref",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.isRef(e)){var r=(0,utils_2.getDefinitionName)(e.$ref);if(r&&this.options.ignoreNamedSchemas.has(r))return{type:"object",title:r};var t=this.byRef(e.$ref);return this.allowMergeRefs?this.mergeRefs(e,t,!1):t}return e}}),Object.defineProperty(e.prototype,"mergeAllOf",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t,i){var n,o=this;if(void 0===t&&(t=!1),void 0===i&&(i=new Set),r&&i.add(r),void 0===(e=this.hoistOneOfs(e)).allOf)return e;var s=(0,tslib_1.__assign)((0,tslib_1.__assign)({},e),{allOf:void 0,parentRefs:[],title:e.title||(0,utils_2.getDefinitionName)(r)});void 0!==s.properties&&"object"==typeof s.properties&&(s.properties=(0,tslib_1.__assign)({},s.properties)),void 0!==s.items&&"object"==typeof s.items&&(s.items=(0,tslib_1.__assign)({},s.items));for(var a=e.allOf.map((function(e){var r;if(e&&e.$ref&&i.has(e.$ref))return{$ref:e.$ref,schema:{"x-circular-ref":!0}};var n=o.deref(e,t,!0),a=e.$ref||void 0,l=o.mergeAllOf(n,a,t,i);return null===(r=s.parentRefs)||void 0===r||r.push.apply(r,l.parentRefs||[]),{$ref:a,schema:l}})).filter((function(e){return void 0!==e})),l=0,f=a;l<f.length;l++){var u=f[l],p=u.$ref,c=u.schema;if(s.type!==c.type&&void 0!==s.type&&void 0!==c.type&&console.warn('Incompatible types in allOf at "'+r+'": "'+s.type+'" and "'+c.type+'"'),void 0!==c.type&&(s.type=c.type),void 0!==c.properties)for(var d in s.properties=s.properties||{},c.properties)if(s.properties[d]){var b=this.mergeAllOf({allOf:[s.properties[d],c.properties[d]]},r+"/properties/"+d);s.properties[d]=b,this.exitParents(b)}else s.properties[d]=c.properties[d];void 0!==c.items&&(s.items=s.items||{},s.items=this.mergeAllOf({allOf:[s.items,c.items]},r+"/items",!1,i)),void 0!==c.required&&(s.required=(s.required||[]).concat(c.required)),s=(0,tslib_1.__assign)((0,tslib_1.__assign)({},c),s),p&&(null===(n=s.parentRefs)||void 0===n||n.push(p),void 0===s.title&&(0,utils_2.isNamedDefinition)(p))}return s}}),Object.defineProperty(e.prototype,"findDerived",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r={},t=this.definition.components&&this.definition.components.schemas||{};for(var i in t){var n=this.deref(t[i]);void 0!==n.allOf&&n.allOf.find((function(r){return void 0!==r.$ref&&e.indexOf(r.$ref)>-1}))&&(r["#/components/schemas/"+i]=[n["x-discriminator-value"]||i])}return r}}),Object.defineProperty(e.prototype,"exitParents",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var r=0,t=e.parentRefs||[];r<t.length;r++){var i=t[r];this.exitRef({$ref:i})}}}),Object.defineProperty(e.prototype,"hoistOneOfs",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this;if(void 0===e.allOf)return e;for(var t=e.allOf,i=function(e){var i=t[e];if(Array.isArray(i.oneOf)){var n=t.slice(0,e),o=t.slice(e+1);return{value:{oneOf:i.oneOf.map((function(e){var t=r.mergeAllOf({allOf:(0,tslib_1.__spreadArray)((0,tslib_1.__spreadArray)((0,tslib_1.__spreadArray)([],n,!0),[e],!1),o,!0)});return r.exitParents(t),t}))}}}},n=0;n<t.length;n++){var o=i(n);if("object"==typeof o)return o.value}return e}}),e}();exports.OpenAPIParser=OpenAPIParser;
2
2
  //# sourceMappingURL=OpenAPIParser.js.map
@@ -1,2 +1,2 @@
1
- "use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProStore=exports.NestingGroup=void 0;var tslib_1=require("tslib"),mobx_1=require("mobx"),openapi_core_1=require("@redocly/openapi-core"),redoc_lib_1=require("../redoc-lib"),history_1=require("./history"),ProMenu_1=require("./ProMenu"),SearchStore_1=require("./SearchStore"),extendTheme_1=require("./extendTheme"),pluggable_1=require("../components/pluggable"),MultipleSpecsStore_1=require("./MultipleSpecsStore"),VersionedSpecStore_1=require("./VersionedSpecStore"),check_1=(0,tslib_1.__importDefault)(require("./check")),utils_1=require("./utils"),utils_2=require("../utils"),store_types_1=require("./store-types"),global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),(0,mobx_1.makeObservable)(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"active",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"expanded",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"activate",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"expand",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"collapse",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"deactivate",null),e}();function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}exports.NestingGroup=NestingGroup;var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new redoc_lib_1.MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:store_types_1.LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activateSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:(0,utils_2.debounce)((function(e){return n.setActiveSampleLanguage(e)}),500)}),(0,mobx_1.makeObservable)(this),this.initProOptions(i),redoc_lib_1.IS_BROWSER&&(this.l=(0,check_1.default)(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r=Array.isArray(e),a=e&&Array.isArray(e.versions),s=this.options.disableSidebar?new history_1.FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new history_1.PushStateHistoryService(this.options,r||a):new history_1.ProHashHistoryService(this.options,r||a);this.definition=r?new MultipleSpecsStore_1.MultipleSpecsStore(e,this.options):a?new VersionedSpecStore_1.VersionedSpecStore(e,this.options,s.currentId.split("/")[0]):new redoc_lib_1.SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadLink=i.downloadDefinitionUrl,this.definition.info.downloadFileName=""),this.scroll=new redoc_lib_1.ScrollService(this.options),this.options.disableSidebar||ProMenu_1.ProMenu.updateOnHistory(s.currentId,this.scroll),this.menu=new ProMenu_1.ProMenu(this.definition,this.scroll,this.options,s),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=(0,mobx_1.observe)(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),(0,utils_2.setGlobalStore)(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r;e=deepClone(e),this.rawOptions=(0,extendTheme_1.extendTheme)(e),this.options=new redoc_lib_1.RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),this.options.showConsole=null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||store_types_1.LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||"summary-only",this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var a="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy="none"===this.options.pagination?"hash":"browser",!(null===(r=this.rawOptions)||void 0===r?void 0:r.pagination)&&(null==a?void 0:a.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==a?void 0:a.scope){case"all":default:this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&(0,utils_1.normalizePath)(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||SearchStore_1.SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new SearchStore_1.RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new SearchStore_1.DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore_1.VersionedSpecStore&&(0,mobx_1.observe)(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new SearchStore_1.DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(redoc_lib_1.IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),redoc_lib_1.IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=(0,utils_2.fromLocalStorage)("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=(0,utils_2.fromLocalStorage)("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=(0,utils_2.fromStorage)("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,(0,utils_2.toStorage)("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=store_types_1.LayoutVariant.THREE_PANEL),this.layout=e,(0,utils_2.toLocalStorage)("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,(0,utils_2.toLocalStorage)("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i,o,n,r;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var a,s,l,p,u,c,h,d;return(0,tslib_1.__generator)(this,(function(b){switch(b.label){case 0:return a=void 0!==e&&this.definition.specs?this.definition.specs[e].parser.definition:this.definition.parser.definition,s=JSON.parse(JSON.stringify(a)),l=(0,tslib_1.__assign)((0,tslib_1.__assign)({},getSpecVersionObj(s)),{components:s.components,paths:(h={},h[t.path]=(d={},d[t.httpVerb]=null===(o=null===(i=s.paths)||void 0===i?void 0:i[t.path])||void 0===o?void 0:o[t.httpVerb],d.parameters=null===(r=null===(n=s.paths)||void 0===n?void 0:n[t.path])||void 0===r?void 0:r.parameters,d),h)}),p=new openapi_core_1.Config({}),u=(0,redoc_lib_1.createParsedDocument)(l),c={config:p,doc:u,dereference:!0},[4,(0,openapi_core_1.bundle)(c)];case 1:return b.sent(),[2,s]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];(0,mobx_1.observe)(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&(0,mobx_1.observe)(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);(0,utils_2.setGlobalStore)(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore_1.VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var t,i;return(0,tslib_1.__generator)(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof MultipleSpecsStore_1.MultipleSpecsStore||this.definition instanceof VersionedSpecStore_1.VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,i=Math.max(0,e),o=Math.min(this.menu.flatItems.length,i+5),n=[],r=i;r<o;r++){var a;(a=this.menu.getElementAt(r))&&(a&&n.push(a))}"item"===this.options.pagination&&(this.menu.flatItems[e]&&this.menu.flatItems[e].parent&&(a=this.menu.getElementAt(null===(t=this.menu.flatItems[e].parent)||void 0===t?void 0:t.absoluteIdx))&&n.push(a));this.marker.addOnly(n),this.marker.mark()}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"search",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"tryItOperation",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"showRightPanel",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"layout",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"activeSampleLanguage",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"isLoading",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"onDidMount",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleRightPanel",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleLayout",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"disableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"enableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"tryItOut",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"setActiveSampleLanguage",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"startLoader",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"stopLoader",null),e}();exports.ProStore=ProStore;var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:pluggable_1.RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:pluggable_1.PullRight,propsSelector:function(){return{}}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_COMPONENT_NAME]={component:redoc_lib_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_JSX_NAME]={component:redoc_lib_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[redoc_lib_1.SCHEMA_DEFINITION_JSX_NAME]={component:redoc_lib_1.SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
1
+ "use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProStore=exports.NestingGroup=void 0;var tslib_1=require("tslib"),mobx_1=require("mobx"),openapi_core_1=require("@redocly/openapi-core"),redoc_lib_1=require("../redoc-lib"),history_1=require("./history"),ProMenu_1=require("./ProMenu"),SearchStore_1=require("./SearchStore"),extendTheme_1=require("./extendTheme"),pluggable_1=require("../components/pluggable"),MultipleSpecsStore_1=require("./MultipleSpecsStore"),VersionedSpecStore_1=require("./VersionedSpecStore"),check_1=(0,tslib_1.__importDefault)(require("./check")),utils_1=require("./utils"),utils_2=require("../utils"),store_types_1=require("./store-types"),global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),(0,mobx_1.makeObservable)(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"active",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"expanded",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"activate",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"expand",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"collapse",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"deactivate",null),e}();function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}exports.NestingGroup=NestingGroup;var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new redoc_lib_1.MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:store_types_1.LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activateSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:(0,utils_2.debounce)((function(e){return n.setActiveSampleLanguage(e)}),500)}),(0,mobx_1.makeObservable)(this),this.initProOptions(i),redoc_lib_1.IS_BROWSER&&(this.l=(0,check_1.default)(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r=Array.isArray(e),a=e&&Array.isArray(e.versions),s=this.options.disableSidebar?new history_1.FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new history_1.PushStateHistoryService(this.options,r||a):new history_1.ProHashHistoryService(this.options,r||a);this.definition=r?new MultipleSpecsStore_1.MultipleSpecsStore(e,this.options):a?new VersionedSpecStore_1.VersionedSpecStore(e,this.options,s.currentId.split("/")[0]):new redoc_lib_1.SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadLink=i.downloadDefinitionUrl,this.definition.info.downloadFileName=""),this.scroll=new redoc_lib_1.ScrollService(this.options),this.options.disableSidebar||ProMenu_1.ProMenu.updateOnHistory(s.currentId,this.scroll),this.menu=new ProMenu_1.ProMenu(this.definition,this.scroll,this.options,s),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=(0,mobx_1.observe)(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),(0,utils_2.setGlobalStore)(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r;e=deepClone(e),this.rawOptions=(0,extendTheme_1.extendTheme)(e),this.options=new redoc_lib_1.RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),this.options.showConsole=null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||store_types_1.LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||"summary-only",this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var a="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy="none"===this.options.pagination?"hash":"browser",!(null===(r=this.rawOptions)||void 0===r?void 0:r.pagination)&&(null==a?void 0:a.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==a?void 0:a.scope){case"all":default:this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&(0,utils_1.normalizePath)(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||SearchStore_1.DEFAULT_SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new SearchStore_1.RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new SearchStore_1.DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore_1.VersionedSpecStore&&(0,mobx_1.observe)(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new SearchStore_1.DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(redoc_lib_1.IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),redoc_lib_1.IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=(0,utils_2.fromLocalStorage)("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=(0,utils_2.fromLocalStorage)("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=(0,utils_2.fromStorage)("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,(0,utils_2.toStorage)("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=store_types_1.LayoutVariant.THREE_PANEL),this.layout=e,(0,utils_2.toLocalStorage)("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,(0,utils_2.toLocalStorage)("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i,o,n,r;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var a,s,l,p,u,c,h,d;return(0,tslib_1.__generator)(this,(function(b){switch(b.label){case 0:return a=void 0!==e&&this.definition.specs?this.definition.specs[e].parser.definition:this.definition.parser.definition,s=JSON.parse(JSON.stringify(a)),l=(0,tslib_1.__assign)((0,tslib_1.__assign)({},getSpecVersionObj(s)),{components:s.components,paths:(h={},h[t.path]=(d={},d[t.httpVerb]=null===(o=null===(i=s.paths)||void 0===i?void 0:i[t.path])||void 0===o?void 0:o[t.httpVerb],d.parameters=null===(r=null===(n=s.paths)||void 0===n?void 0:n[t.path])||void 0===r?void 0:r.parameters,d),h)}),p=new openapi_core_1.Config({}),u=(0,redoc_lib_1.createParsedDocument)(l),c={config:p,doc:u,dereference:!0},[4,(0,openapi_core_1.bundle)(c)];case 1:return b.sent(),[2,s]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];(0,mobx_1.observe)(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&(0,mobx_1.observe)(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);(0,utils_2.setGlobalStore)(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore_1.VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var t,i;return(0,tslib_1.__generator)(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof MultipleSpecsStore_1.MultipleSpecsStore||this.definition instanceof VersionedSpecStore_1.VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,i=Math.max(0,e),o=Math.min(this.menu.flatItems.length,i+5),n=[],r=i;r<o;r++){var a;(a=this.menu.getElementAt(r))&&(a&&n.push(a))}"item"===this.options.pagination&&(this.menu.flatItems[e]&&this.menu.flatItems[e].parent&&(a=this.menu.getElementAt(null===(t=this.menu.flatItems[e].parent)||void 0===t?void 0:t.absoluteIdx))&&n.push(a));this.marker.addOnly(n),this.marker.mark()}}),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"search",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"tryItOperation",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"showRightPanel",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"layout",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"activeSampleLanguage",void 0),(0,tslib_1.__decorate)([mobx_1.observable],e.prototype,"isLoading",void 0),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"onDidMount",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleRightPanel",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"toggleLayout",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"disableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"enableConsole",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"tryItOut",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"setActiveSampleLanguage",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"startLoader",null),(0,tslib_1.__decorate)([mobx_1.action],e.prototype,"stopLoader",null),e}();exports.ProStore=ProStore;var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:pluggable_1.RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:pluggable_1.PullRight,propsSelector:function(){return{}}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_COMPONENT_NAME]={component:redoc_lib_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[redoc_lib_1.SECURITY_DEFINITIONS_JSX_NAME]={component:redoc_lib_1.SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[redoc_lib_1.SCHEMA_DEFINITION_JSX_NAME]={component:redoc_lib_1.SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
2
2
  //# sourceMappingURL=ProStore.js.map
@@ -6,7 +6,7 @@ export declare type SearchResultMeta = {
6
6
  menuId: string;
7
7
  boost?: number;
8
8
  };
9
- export declare const SEARCH_MAX_DEPTH = 8;
9
+ export declare const DEFAULT_SEARCH_MAX_DEPTH = 1;
10
10
  export declare class DeepSearchStore extends SearchStore<SearchResultMeta> {
11
11
  operationTitleBoost: number;
12
12
  tagTitleBoost: number;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RemoteSearch=exports.DeepSearchStore=exports.SEARCH_MAX_DEPTH=void 0;var tslib_1=require("tslib"),redoc_lib_1=require("../redoc-lib");function removeMarkdown(e){return e.replace(/\[(.*?)][[(].*?[\])]/g,"$1")}exports.SEARCH_MAX_DEPTH=8;var DeepSearchStore=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"operationTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:4}),Object.defineProperty(r,"tagTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:8}),Object.defineProperty(r,"fieldLevelBoost",{enumerable:!0,configurable:!0,writable:!0,value:.95}),Object.defineProperty(r,"pathOnly",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(r,"searchMaxDepth",{enumerable:!0,configurable:!0,writable:!0,value:exports.SEARCH_MAX_DEPTH}),t.searchOperationTitleBoost&&(r.operationTitleBoost=parseInt(t.searchOperationTitleBoost,10)),t.searchTagTitleBoost&&(r.tagTitleBoost=parseInt(t.searchTagTitleBoost,10)),t.searchFieldLevelBoost&&(r.fieldLevelBoost=parseInt(t.searchFieldLevelBoost,10)),"path-only"===t.searchMode&&(r.pathOnly=!0),t.searchMaxDepth&&(r.searchMaxDepth=t.searchMaxDepth),r}return(0,tslib_1.__extends)(t,e),Object.defineProperty(t.prototype,"indexItems",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=function(e){e.forEach((function(e){if("operation"===e.type&&t.pathOnly){var o=e;t.add(o.path,"",{menuId:o.id,boost:t.operationTitleBoost})}else{if("group"===e.type||t.pathOnly||(t.add(e.name,"operation"===e.type?e.path:"",{menuId:e.id,boost:"operation"===e.type?t.operationTitleBoost:t.tagTitleBoost}),e.description&&t.add("",removeMarkdown(e.description||""),{menuId:e.id})),"operation"===e.type){for(var a=0,i=(o=e).parameters||[];a<i.length;a++){var n=i[a];t.add(n.name,removeMarkdown(n.description),{menuId:e.id,place:"parameters",path:[n.name]})}var s=o.requestBody&&o.requestBody.content&&o.requestBody.content.active&&o.requestBody.content.active.schema;t.indexSchema(s,e.id,"request fields"),o.responses.forEach((function(r){var o=r.content&&r.content.active&&r.content.active.schema;o&&t.indexSchema(o,e.id,"response "+r.code+" fields")}))}r(e.items)}}))};r(e),this.searchWorker.done()}}),Object.defineProperty(t.prototype,"indexSchema",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,o,a){if(void 0===o&&(o=[]),void 0===a&&(a=0),e&&!(a>this.searchMaxDepth||e.isCircular)){if((e=e.oneOf&&e.oneOf[e.activeOneOf]||e).fields)for(var i=0,n=e.fields;i<n.length;i++){var s=n[i],l=o.concat([s.name]);"additionalProperties"!==s.kind&&(this.add(s.name,removeMarkdown(s.description),{menuId:t,place:r,path:l,boost:Math.pow(this.fieldLevelBoost,a)}),this.indexSchema(s.schema,t,r,l,a+1))}e.items&&this.indexSchema(e.items,t,r,o,a+1)}}}),Object.defineProperty(t.prototype,"add",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this.searchWorker.add(e,t,r)}}),Object.defineProperty(t.prototype,"search",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){return(0,tslib_1.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.searchWorker.search(e)];case 1:return[2,t.sent()]}}))}))}}),Object.defineProperty(t.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){return(0,tslib_1.__generator)(this,(function(e){return[2,this.searchWorker.toJS()]}))}))}}),Object.defineProperty(t.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){"terminate"in this.searchWorker&&this.searchWorker.terminate(),this.searchWorker.dispose&&this.searchWorker.dispose()}}),t}(redoc_lib_1.SearchStore);exports.DeepSearchStore=DeepSearchStore;var RemoteSearch=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"url",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"operationTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:4}),Object.defineProperty(r,"tagTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:8}),Object.defineProperty(r,"fieldLevelBoost",{enumerable:!0,configurable:!0,writable:!0,value:.95}),r}return(0,tslib_1.__extends)(t,e),Object.defineProperty(t.prototype,"indexItems",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),Object.defineProperty(t.prototype,"add",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){throw new Error("Not implemented")}}),Object.defineProperty(t.prototype,"search",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var t,r;return(0,tslib_1.__generator)(this,(function(o){switch(o.label){case 0:t=[],o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch(this.url+"?q="+encodeURIComponent(e))];case 2:return[4,o.sent().json()];case 3:if(t=o.sent(),!Array.isArray(t))throw t=[],new Error("wrong search results format");return[3,5];case 4:return r=o.sent(),console.error("Failed to load search results: "+r.message),[3,5];case 5:return[2,t]}}))}))}}),Object.defineProperty(t.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype.dispose.call(this)}}),Object.defineProperty(t.prototype,"load",{enumerable:!1,configurable:!0,writable:!0,value:function(){}}),Object.defineProperty(t.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){return(0,tslib_1.__generator)(this,(function(e){throw new Error("Not implemented")}))}))}}),t}(redoc_lib_1.SearchStore);exports.RemoteSearch=RemoteSearch;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RemoteSearch=exports.DeepSearchStore=exports.DEFAULT_SEARCH_MAX_DEPTH=void 0;var tslib_1=require("tslib"),redoc_lib_1=require("../redoc-lib");function removeMarkdown(e){return e.replace(/\[(.*?)][[(].*?[\])]/g,"$1")}exports.DEFAULT_SEARCH_MAX_DEPTH=1;var DeepSearchStore=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"operationTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:4}),Object.defineProperty(r,"tagTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:8}),Object.defineProperty(r,"fieldLevelBoost",{enumerable:!0,configurable:!0,writable:!0,value:.95}),Object.defineProperty(r,"pathOnly",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(r,"searchMaxDepth",{enumerable:!0,configurable:!0,writable:!0,value:exports.DEFAULT_SEARCH_MAX_DEPTH}),t.searchOperationTitleBoost&&(r.operationTitleBoost=parseInt(t.searchOperationTitleBoost,10)),t.searchTagTitleBoost&&(r.tagTitleBoost=parseInt(t.searchTagTitleBoost,10)),t.searchFieldLevelBoost&&(r.fieldLevelBoost=parseInt(t.searchFieldLevelBoost,10)),"path-only"===t.searchMode&&(r.pathOnly=!0),t.searchMaxDepth&&(r.searchMaxDepth=t.searchMaxDepth),r}return(0,tslib_1.__extends)(t,e),Object.defineProperty(t.prototype,"indexItems",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=function(e){e.forEach((function(e){if("operation"===e.type&&t.pathOnly){var o=e;t.add(o.path,"",{menuId:o.id,boost:t.operationTitleBoost})}else{if("group"===e.type||t.pathOnly||(t.add(e.name,"operation"===e.type?e.path:"",{menuId:e.id,boost:"operation"===e.type?t.operationTitleBoost:t.tagTitleBoost}),e.description&&t.add("",removeMarkdown(e.description||""),{menuId:e.id})),"operation"===e.type){for(var a=0,i=(o=e).parameters||[];a<i.length;a++){var n=i[a];t.add(n.name,removeMarkdown(n.description),{menuId:e.id,place:"parameters",path:[n.name]})}var s=o.requestBody&&o.requestBody.content&&o.requestBody.content.active&&o.requestBody.content.active.schema;t.indexSchema(s,e.id,"request fields"),o.responses.forEach((function(r){var o=r.content&&r.content.active&&r.content.active.schema;o&&t.indexSchema(o,e.id,"response "+r.code+" fields")}))}r(e.items)}}))};r(e),this.searchWorker.done()}}),Object.defineProperty(t.prototype,"indexSchema",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,o,a){if(void 0===o&&(o=[]),void 0===a&&(a=0),e&&!(a>this.searchMaxDepth||e.isCircular)){if((e=e.oneOf&&e.oneOf[e.activeOneOf]||e).fields)for(var i=0,n=e.fields;i<n.length;i++){var s=n[i],l=o.concat([s.name]);"additionalProperties"!==s.kind&&(this.add(s.name,removeMarkdown(s.description),{menuId:t,place:r,path:l,boost:Math.pow(this.fieldLevelBoost,a)}),this.indexSchema(s.schema,t,r,l,a+1))}e.items&&this.indexSchema(e.items,t,r,o,a+1)}}}),Object.defineProperty(t.prototype,"add",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this.searchWorker.add(e,t,r)}}),Object.defineProperty(t.prototype,"search",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){return(0,tslib_1.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.searchWorker.search(e)];case 1:return[2,t.sent()]}}))}))}}),Object.defineProperty(t.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){return(0,tslib_1.__generator)(this,(function(e){return[2,this.searchWorker.toJS()]}))}))}}),Object.defineProperty(t.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){"terminate"in this.searchWorker&&this.searchWorker.terminate(),this.searchWorker.dispose&&this.searchWorker.dispose()}}),t}(redoc_lib_1.SearchStore);exports.DeepSearchStore=DeepSearchStore;var RemoteSearch=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"url",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"operationTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:4}),Object.defineProperty(r,"tagTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:8}),Object.defineProperty(r,"fieldLevelBoost",{enumerable:!0,configurable:!0,writable:!0,value:.95}),r}return(0,tslib_1.__extends)(t,e),Object.defineProperty(t.prototype,"indexItems",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),Object.defineProperty(t.prototype,"add",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){throw new Error("Not implemented")}}),Object.defineProperty(t.prototype,"search",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var t,r;return(0,tslib_1.__generator)(this,(function(o){switch(o.label){case 0:t=[],o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch(this.url+"?q="+encodeURIComponent(e))];case 2:return[4,o.sent().json()];case 3:if(t=o.sent(),!Array.isArray(t))throw t=[],new Error("wrong search results format");return[3,5];case 4:return r=o.sent(),console.error("Failed to load search results: "+r.message),[3,5];case 5:return[2,t]}}))}))}}),Object.defineProperty(t.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype.dispose.call(this)}}),Object.defineProperty(t.prototype,"load",{enumerable:!1,configurable:!0,writable:!0,value:function(){}}),Object.defineProperty(t.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){return(0,tslib_1.__generator)(this,(function(e){throw new Error("Not implemented")}))}))}}),t}(redoc_lib_1.SearchStore);exports.RemoteSearch=RemoteSearch;
2
2
  //# sourceMappingURL=SearchStore.js.map
@@ -1,2 +1,2 @@
1
- import{__assign,__decorate,__extends}from"tslib";import{observer}from"mobx-react";import*as React from"react";import{RecursiveLabel,TypeName,TypeTitle}from"../../common-elements/fields";import{FieldDetails}from"../Fields/FieldDetails";import{ArraySchema}from"./ArraySchema";import{ObjectSchema}from"./ObjectSchema";import{OneOfSchema}from"./OneOfSchema";import{l}from"../../services/Labels";var Schema=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return __extends(r,e),Object.defineProperty(r.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,r=this.props.schema;if(!r)return React.createElement("em",null," Schema not provided ");var t=r.type,a=r.oneOf,i=r.discriminatorProp,n=r.isCircular,c=(this.props.level||0)+1;if(n)return React.createElement("div",null,React.createElement(TypeName,null,r.displayType),r.title&&React.createElement(TypeTitle,null," ",r.title," "),React.createElement(RecursiveLabel,null,l("recursive")));if(void 0!==i)return a&&a.length?React.createElement(ObjectSchema,__assign({},__assign(__assign({},this.props),{schema:a[r.activeOneOf],level:c}),{discriminator:{fieldName:i,parentSchema:r}})):(console.warn("Looks like you are using discriminator wrong: you don't have any definition inherited from the "+r.title),null);if(void 0!==a)return React.createElement(OneOfSchema,__assign({schema:r},this.props));var s=Array.isArray(t)?t:[t];if(s.includes("object")){if(null===(e=r.fields)||void 0===e?void 0:e.length)return React.createElement(ObjectSchema,__assign({},__assign(__assign({},this.props),{level:c})))}else if(s.includes("array"))return React.createElement(ArraySchema,__assign({},__assign(__assign({},this.props),{level:c})));var o={schema:r,name:"",required:!1,description:r.description,externalDocs:r.externalDocs,deprecated:!1,toggle:function(){return null},expanded:!1};return React.createElement("div",null,React.createElement(FieldDetails,{field:o}))}}),r=__decorate([observer],r)}(React.Component);export{Schema};
1
+ import{__assign,__decorate,__extends}from"tslib";import{observer}from"mobx-react";import*as React from"react";import{RecursiveLabel,TypeName,TypeTitle}from"../../common-elements/fields";import{FieldDetails}from"../Fields/FieldDetails";import{ArraySchema}from"./ArraySchema";import{ObjectSchema}from"./ObjectSchema";import{OneOfSchema}from"./OneOfSchema";import{l}from"../../services/Labels";var Schema=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return __extends(r,e),Object.defineProperty(r.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,r=this.props.schema;if(!r)return React.createElement("em",null," Schema not provided ");var t=r.type,a=r.oneOf,i=r.discriminatorProp,n=r.isCircular,c=(this.props.level||0)+1;if(n)return React.createElement("div",null,React.createElement(TypeName,null,r.displayType),r.title&&React.createElement(TypeTitle,null," ",r.title," "),React.createElement(RecursiveLabel,null," ",l("recursive")," "));if(void 0!==i)return a&&a.length?React.createElement(ObjectSchema,__assign({},__assign(__assign({},this.props),{schema:a[r.activeOneOf],level:c}),{discriminator:{fieldName:i,parentSchema:r}})):(console.warn("Looks like you are using discriminator wrong: you don't have any definition inherited from the "+r.title),null);if(void 0!==a)return React.createElement(OneOfSchema,__assign({schema:r},this.props));var s=Array.isArray(t)?t:[t];if(s.includes("object")){if(null===(e=r.fields)||void 0===e?void 0:e.length)return React.createElement(ObjectSchema,__assign({},__assign(__assign({},this.props),{level:c})))}else if(s.includes("array"))return React.createElement(ArraySchema,__assign({},__assign(__assign({},this.props),{level:c})));var o={schema:r,name:"",required:!1,description:r.description,externalDocs:r.externalDocs,deprecated:!1,toggle:function(){return null},expanded:!1};return React.createElement("div",null,React.createElement(FieldDetails,{field:o}))}}),r=__decorate([observer],r)}(React.Component);export{Schema};
2
2
  //# sourceMappingURL=Schema.js.map
@@ -1,2 +1,2 @@
1
- import{__assign,__rest,__spreadArray}from"tslib";import{resolve as urlResolve}from"url";import{appendToMdHeading,IS_BROWSER}from"../utils/";import{JsonPointer}from"../utils/JsonPointer";import{getDefinitionName,isNamedDefinition,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME}from"../utils";import{buildComponentComment,MarkdownRenderer}from"./MarkdownRenderer";import{RedocNormalizedOptions}from"./RedocNormalizedOptions";var RefCounter=function(){function e(){Object.defineProperty(this,"_counter",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e.prototype,"reset",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._counter={}}}),Object.defineProperty(e.prototype,"visit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._counter[e]=this._counter[e]?this._counter[e]+1:1}}),Object.defineProperty(e.prototype,"exit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._counter[e]=this._counter[e]&&this._counter[e]-1}}),Object.defineProperty(e.prototype,"visited",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._counter[e]}}),e}(),OpenAPIParser=function(){function e(e,r,t){var i=this;void 0===t&&(t=new RedocNormalizedOptions({})),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"definitionUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasSecurityDefinitions",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_refCounter",{enumerable:!0,configurable:!0,writable:!0,value:new RefCounter}),Object.defineProperty(this,"allowMergeRefs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"byRef",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var r;if(i.definition){"#"!==e.charAt(0)&&(e="#"+e),e=decodeURIComponent(e);try{r=JsonPointer.get(i.definition,e)}catch(e){}return r||{}}}}),this.validate(e),this.preprocess(e),this.definition=e,this.hasSecurityDefinitions=this.containsSecurity(e),this.allowMergeRefs=e.openapi.startsWith("3.1");var n=IS_BROWSER?window.location.href:"";"string"==typeof r&&(this.definitionUrl=urlResolve(n,r))}return Object.defineProperty(e.prototype,"validate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0===e.openapi)throw new Error("Document must be valid OpenAPI 3.0.0 definition")}}),Object.defineProperty(e.prototype,"containsSecurity",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.info&&e.info.description||"";return MarkdownRenderer.containsComponent(r,SECURITY_DEFINITIONS_COMPONENT_NAME)||MarkdownRenderer.containsComponent(r,SECURITY_DEFINITIONS_JSX_NAME)}}),Object.defineProperty(e.prototype,"preprocess",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.info&&this.options.hideInfoDescription)e.info.description="";else if(!this.options.noAutoAuth&&e.info&&e.components&&e.components.securitySchemes){var r=e.info.description||"";if(!this.containsSecurity(e)){var t=buildComponentComment(SECURITY_DEFINITIONS_COMPONENT_NAME);e.info.description=appendToMdHeading(r,"Authentication",t)}}}}),Object.defineProperty(e.prototype,"isRef",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!e&&(void 0!==e.$ref&&null!==e.$ref)}}),Object.defineProperty(e.prototype,"resetVisited",{enumerable:!1,configurable:!0,writable:!0,value:function(){if("production"!==process.env.NODE_ENV)for(var e in this._refCounter._counter)this._refCounter._counter[e]>0&&console.warn("Not exited reference: "+e);this._refCounter=new RefCounter}}),Object.defineProperty(e.prototype,"exitRef",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isRef(e)&&this._refCounter.exit(e.$ref)}}),Object.defineProperty(e.prototype,"deref",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t){if(void 0===r&&(r=!1),void 0===t&&(t=!1),this.isRef(e)){var i=getDefinitionName(e.$ref);if(i&&this.options.ignoreNamedSchemas.has(i))return{type:"object",title:i};var n=this.byRef(e.$ref),o=this._refCounter.visited(e.$ref);if(this._refCounter.visit(e.$ref),o&&!r)return Object.assign({},n,{"x-circular-ref":!0});var a=n;return this.isRef(n)&&(a=this.deref(n,!1,t),this.exitRef(n)),this.allowMergeRefs?this.mergeRefs(e,n,t):a}return e}}),Object.defineProperty(e.prototype,"mergeRefs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t){e.$ref;var i=__rest(e,["$ref"]),n=Object.keys(i);return 0===n.length?r:t&&n.some((function(e){return"description"!==e&&"title"!==e&&"externalDocs"!==e}))?{allOf:[i,r]}:__assign(__assign({},r),i)}}),Object.defineProperty(e.prototype,"shallowDeref",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.isRef(e)){var r=getDefinitionName(e.$ref);if(r&&this.options.ignoreNamedSchemas.has(r))return{type:"object",title:r};var t=this.byRef(e.$ref);return this.allowMergeRefs?this.mergeRefs(e,t,!1):t}return e}}),Object.defineProperty(e.prototype,"mergeAllOf",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t,i){var n,o=this;if(void 0===t&&(t=!1),void 0===i&&(i=new Set),r&&i.add(r),void 0===(e=this.hoistOneOfs(e)).allOf)return e;var a=__assign(__assign({},e),{allOf:void 0,parentRefs:[],title:e.title||getDefinitionName(r)});void 0!==a.properties&&"object"==typeof a.properties&&(a.properties=__assign({},a.properties)),void 0!==a.items&&"object"==typeof a.items&&(a.items=__assign({},a.items));for(var f=e.allOf.map((function(e){var r;if(!(e&&e.$ref&&i.has(e.$ref))){var n=o.deref(e,t,!0),f=e.$ref||void 0,s=o.mergeAllOf(n,f,t,i);return null===(r=a.parentRefs)||void 0===r||r.push.apply(r,s.parentRefs||[]),{$ref:f,schema:s}}})).filter((function(e){return void 0!==e})),s=0,l=f;s<l.length;s++){var u=l[s],p=u.$ref,c=u.schema;if(a.type!==c.type&&void 0!==a.type&&void 0!==c.type&&console.warn('Incompatible types in allOf at "'+r+'": "'+a.type+'" and "'+c.type+'"'),void 0!==c.type&&(a.type=c.type),void 0!==c.properties)for(var d in a.properties=a.properties||{},c.properties)if(a.properties[d]){var b=this.mergeAllOf({allOf:[a.properties[d],c.properties[d]]},r+"/properties/"+d);a.properties[d]=b,this.exitParents(b)}else a.properties[d]=c.properties[d];void 0!==c.items&&(a.items=a.items||{},a.items=this.mergeAllOf({allOf:[a.items,c.items]},r+"/items")),void 0!==c.required&&(a.required=(a.required||[]).concat(c.required)),a=__assign(__assign({},c),a),p&&(null===(n=a.parentRefs)||void 0===n||n.push(p),void 0===a.title&&isNamedDefinition(p))}return a}}),Object.defineProperty(e.prototype,"findDerived",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r={},t=this.definition.components&&this.definition.components.schemas||{};for(var i in t){var n=this.deref(t[i]);void 0!==n.allOf&&n.allOf.find((function(r){return void 0!==r.$ref&&e.indexOf(r.$ref)>-1}))&&(r["#/components/schemas/"+i]=[n["x-discriminator-value"]||i])}return r}}),Object.defineProperty(e.prototype,"exitParents",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var r=0,t=e.parentRefs||[];r<t.length;r++){var i=t[r];this.exitRef({$ref:i})}}}),Object.defineProperty(e.prototype,"hoistOneOfs",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this;if(void 0===e.allOf)return e;for(var t=e.allOf,i=function(e){var i=t[e];if(Array.isArray(i.oneOf)){var n=t.slice(0,e),o=t.slice(e+1);return{value:{oneOf:i.oneOf.map((function(e){var t=r.mergeAllOf({allOf:__spreadArray(__spreadArray(__spreadArray([],n,!0),[e],!1),o,!0)});return r.exitParents(t),t}))}}}},n=0;n<t.length;n++){var o=i(n);if("object"==typeof o)return o.value}return e}}),e}();export{OpenAPIParser};
1
+ import{__assign,__rest,__spreadArray}from"tslib";import{resolve as urlResolve}from"url";import{appendToMdHeading,IS_BROWSER}from"../utils/";import{JsonPointer}from"../utils/JsonPointer";import{getDefinitionName,isNamedDefinition,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME}from"../utils";import{buildComponentComment,MarkdownRenderer}from"./MarkdownRenderer";import{RedocNormalizedOptions}from"./RedocNormalizedOptions";var RefCounter=function(){function e(){Object.defineProperty(this,"_counter",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e.prototype,"reset",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._counter={}}}),Object.defineProperty(e.prototype,"visit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._counter[e]=this._counter[e]?this._counter[e]+1:1}}),Object.defineProperty(e.prototype,"exit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._counter[e]=this._counter[e]&&this._counter[e]-1}}),Object.defineProperty(e.prototype,"visited",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._counter[e]}}),e}(),OpenAPIParser=function(){function e(e,r,t){var i=this;void 0===t&&(t=new RedocNormalizedOptions({})),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"definitionUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hasSecurityDefinitions",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_refCounter",{enumerable:!0,configurable:!0,writable:!0,value:new RefCounter}),Object.defineProperty(this,"allowMergeRefs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"byRef",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var r;if(i.definition){"#"!==e.charAt(0)&&(e="#"+e),e=decodeURIComponent(e);try{r=JsonPointer.get(i.definition,e)}catch(e){}return r||{}}}}),this.validate(e),this.preprocess(e),this.definition=e,this.hasSecurityDefinitions=this.containsSecurity(e),this.allowMergeRefs=e.openapi.startsWith("3.1");var n=IS_BROWSER?window.location.href:"";"string"==typeof r&&(this.definitionUrl=urlResolve(n,r))}return Object.defineProperty(e.prototype,"validate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0===e.openapi)throw new Error("Document must be valid OpenAPI 3.0.0 definition")}}),Object.defineProperty(e.prototype,"containsSecurity",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.info&&e.info.description||"";return MarkdownRenderer.containsComponent(r,SECURITY_DEFINITIONS_COMPONENT_NAME)||MarkdownRenderer.containsComponent(r,SECURITY_DEFINITIONS_JSX_NAME)}}),Object.defineProperty(e.prototype,"preprocess",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.info&&this.options.hideInfoDescription)e.info.description="";else if(!this.options.noAutoAuth&&e.info&&e.components&&e.components.securitySchemes){var r=e.info.description||"";if(!this.containsSecurity(e)){var t=buildComponentComment(SECURITY_DEFINITIONS_COMPONENT_NAME);e.info.description=appendToMdHeading(r,"Authentication",t)}}}}),Object.defineProperty(e.prototype,"isRef",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!e&&(void 0!==e.$ref&&null!==e.$ref)}}),Object.defineProperty(e.prototype,"resetVisited",{enumerable:!1,configurable:!0,writable:!0,value:function(){if("production"!==process.env.NODE_ENV)for(var e in this._refCounter._counter)this._refCounter._counter[e]>0&&console.warn("Not exited reference: "+e);this._refCounter=new RefCounter}}),Object.defineProperty(e.prototype,"exitRef",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isRef(e)&&this._refCounter.exit(e.$ref)}}),Object.defineProperty(e.prototype,"deref",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t){if(void 0===r&&(r=!1),void 0===t&&(t=!1),this.isRef(e)){var i=getDefinitionName(e.$ref);if(i&&this.options.ignoreNamedSchemas.has(i))return{type:"object",title:i};var n=this.byRef(e.$ref),o=this._refCounter.visited(e.$ref);if(this._refCounter.visit(e.$ref),o&&!r)return Object.assign({},n,{"x-circular-ref":!0});var a=n;return this.isRef(n)&&(a=this.deref(n,!1,t),this.exitRef(n)),this.allowMergeRefs?this.mergeRefs(e,n,t):a}return e}}),Object.defineProperty(e.prototype,"mergeRefs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t){e.$ref;var i=__rest(e,["$ref"]),n=Object.keys(i);return 0===n.length?r:t&&n.some((function(e){return"description"!==e&&"title"!==e&&"externalDocs"!==e}))?{allOf:[i,r]}:__assign(__assign({},r),i)}}),Object.defineProperty(e.prototype,"shallowDeref",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.isRef(e)){var r=getDefinitionName(e.$ref);if(r&&this.options.ignoreNamedSchemas.has(r))return{type:"object",title:r};var t=this.byRef(e.$ref);return this.allowMergeRefs?this.mergeRefs(e,t,!1):t}return e}}),Object.defineProperty(e.prototype,"mergeAllOf",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,t,i){var n,o=this;if(void 0===t&&(t=!1),void 0===i&&(i=new Set),r&&i.add(r),void 0===(e=this.hoistOneOfs(e)).allOf)return e;var a=__assign(__assign({},e),{allOf:void 0,parentRefs:[],title:e.title||getDefinitionName(r)});void 0!==a.properties&&"object"==typeof a.properties&&(a.properties=__assign({},a.properties)),void 0!==a.items&&"object"==typeof a.items&&(a.items=__assign({},a.items));for(var f=e.allOf.map((function(e){var r;if(e&&e.$ref&&i.has(e.$ref))return{$ref:e.$ref,schema:{"x-circular-ref":!0}};var n=o.deref(e,t,!0),f=e.$ref||void 0,s=o.mergeAllOf(n,f,t,i);return null===(r=a.parentRefs)||void 0===r||r.push.apply(r,s.parentRefs||[]),{$ref:f,schema:s}})).filter((function(e){return void 0!==e})),s=0,l=f;s<l.length;s++){var u=l[s],p=u.$ref,c=u.schema;if(a.type!==c.type&&void 0!==a.type&&void 0!==c.type&&console.warn('Incompatible types in allOf at "'+r+'": "'+a.type+'" and "'+c.type+'"'),void 0!==c.type&&(a.type=c.type),void 0!==c.properties)for(var d in a.properties=a.properties||{},c.properties)if(a.properties[d]){var b=this.mergeAllOf({allOf:[a.properties[d],c.properties[d]]},r+"/properties/"+d);a.properties[d]=b,this.exitParents(b)}else a.properties[d]=c.properties[d];void 0!==c.items&&(a.items=a.items||{},a.items=this.mergeAllOf({allOf:[a.items,c.items]},r+"/items",!1,i)),void 0!==c.required&&(a.required=(a.required||[]).concat(c.required)),a=__assign(__assign({},c),a),p&&(null===(n=a.parentRefs)||void 0===n||n.push(p),void 0===a.title&&isNamedDefinition(p))}return a}}),Object.defineProperty(e.prototype,"findDerived",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r={},t=this.definition.components&&this.definition.components.schemas||{};for(var i in t){var n=this.deref(t[i]);void 0!==n.allOf&&n.allOf.find((function(r){return void 0!==r.$ref&&e.indexOf(r.$ref)>-1}))&&(r["#/components/schemas/"+i]=[n["x-discriminator-value"]||i])}return r}}),Object.defineProperty(e.prototype,"exitParents",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var r=0,t=e.parentRefs||[];r<t.length;r++){var i=t[r];this.exitRef({$ref:i})}}}),Object.defineProperty(e.prototype,"hoistOneOfs",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this;if(void 0===e.allOf)return e;for(var t=e.allOf,i=function(e){var i=t[e];if(Array.isArray(i.oneOf)){var n=t.slice(0,e),o=t.slice(e+1);return{value:{oneOf:i.oneOf.map((function(e){var t=r.mergeAllOf({allOf:__spreadArray(__spreadArray(__spreadArray([],n,!0),[e],!1),o,!0)});return r.exitParents(t),t}))}}}},n=0;n<t.length;n++){var o=i(n);if("object"==typeof o)return o.value}return e}}),e}();export{OpenAPIParser};
2
2
  //# sourceMappingURL=OpenAPIParser.js.map
@@ -1,2 +1,2 @@
1
- var _a;import{__assign,__awaiter,__decorate,__generator}from"tslib";import{action,makeObservable,observable,observe}from"mobx";import{bundle,Config}from"@redocly/openapi-core";import{IS_BROWSER,MarkerService,RedocNormalizedOptions,ScrollService,SecurityDefs,SpecStore,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME,SCHEMA_DEFINITION_JSX_NAME,SchemaDefinition,createParsedDocument}from"../redoc-lib";import{FakeHistoryService,ProHashHistoryService,PushStateHistoryService}from"./history";import{ProMenu}from"./ProMenu";import{DeepSearchStore,RemoteSearch,SEARCH_MAX_DEPTH}from"./SearchStore";import{extendTheme}from"./extendTheme";import{RedocResponse,PullRight}from"../components/pluggable";import{MultipleSpecsStore}from"./MultipleSpecsStore";import{VersionedSpecStore}from"./VersionedSpecStore";import parseToken from"./check";import{normalizePath}from"./utils";import{fromStorage,toStorage,toLocalStorage,fromLocalStorage,setGlobalStore,debounce}from"../utils";import{LayoutVariant}from"./store-types";var global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),__decorate([observable],e.prototype,"active",void 0),__decorate([observable],e.prototype,"expanded",void 0),__decorate([action],e.prototype,"activate",null),__decorate([action],e.prototype,"expand",null),__decorate([action],e.prototype,"collapse",null),__decorate([action],e.prototype,"deactivate",null),e}();export{NestingGroup};function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activateSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:debounce((function(e){return n.setActiveSampleLanguage(e)}),500)}),makeObservable(this),this.initProOptions(i),IS_BROWSER&&(this.l=parseToken(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r=Array.isArray(e),a=e&&Array.isArray(e.versions),s=this.options.disableSidebar?new FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new PushStateHistoryService(this.options,r||a):new ProHashHistoryService(this.options,r||a);this.definition=r?new MultipleSpecsStore(e,this.options):a?new VersionedSpecStore(e,this.options,s.currentId.split("/")[0]):new SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadLink=i.downloadDefinitionUrl,this.definition.info.downloadFileName=""),this.scroll=new ScrollService(this.options),this.options.disableSidebar||ProMenu.updateOnHistory(s.currentId,this.scroll),this.menu=new ProMenu(this.definition,this.scroll,this.options,s),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=observe(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),setGlobalStore(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r;e=deepClone(e),this.rawOptions=extendTheme(e),this.options=new RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),this.options.showConsole=null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||"summary-only",this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var a="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy="none"===this.options.pagination?"hash":"browser",!(null===(r=this.rawOptions)||void 0===r?void 0:r.pagination)&&(null==a?void 0:a.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==a?void 0:a.scope){case"all":default:this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&normalizePath(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore&&observe(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=fromLocalStorage("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=fromLocalStorage("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=fromStorage("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,toStorage("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=LayoutVariant.THREE_PANEL),this.layout=e,toLocalStorage("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,toLocalStorage("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i,o,n,r;return __awaiter(this,void 0,void 0,(function(){var a,s,l,p,u,c,h;return __generator(this,(function(d){switch(d.label){case 0:return a=void 0!==e&&this.definition.specs?this.definition.specs[e].parser.definition:this.definition.parser.definition,s=JSON.parse(JSON.stringify(a)),l=__assign(__assign({},getSpecVersionObj(s)),{components:s.components,paths:(c={},c[t.path]=(h={},h[t.httpVerb]=null===(o=null===(i=s.paths)||void 0===i?void 0:i[t.path])||void 0===o?void 0:o[t.httpVerb],h.parameters=null===(r=null===(n=s.paths)||void 0===n?void 0:n[t.path])||void 0===r?void 0:r.parameters,h),c)}),p=new Config({}),u=createParsedDocument(l),[4,bundle({config:p,doc:u,dereference:!0})];case 1:return d.sent(),[2,s]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];observe(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&observe(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);setGlobalStore(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof MultipleSpecsStore||this.definition instanceof VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,i=Math.max(0,e),o=Math.min(this.menu.flatItems.length,i+5),n=[],r=i;r<o;r++){var a;(a=this.menu.getElementAt(r))&&(a&&n.push(a))}"item"===this.options.pagination&&(this.menu.flatItems[e]&&this.menu.flatItems[e].parent&&(a=this.menu.getElementAt(null===(t=this.menu.flatItems[e].parent)||void 0===t?void 0:t.absoluteIdx))&&n.push(a));this.marker.addOnly(n),this.marker.mark()}}),__decorate([observable],e.prototype,"search",void 0),__decorate([observable],e.prototype,"tryItOperation",void 0),__decorate([observable],e.prototype,"showRightPanel",void 0),__decorate([observable],e.prototype,"layout",void 0),__decorate([observable],e.prototype,"activeSampleLanguage",void 0),__decorate([observable],e.prototype,"isLoading",void 0),__decorate([action],e.prototype,"onDidMount",null),__decorate([action],e.prototype,"toggleRightPanel",null),__decorate([action],e.prototype,"toggleLayout",null),__decorate([action],e.prototype,"disableConsole",null),__decorate([action],e.prototype,"enableConsole",null),__decorate([action],e.prototype,"tryItOut",null),__decorate([action],e.prototype,"setActiveSampleLanguage",null),__decorate([action],e.prototype,"startLoader",null),__decorate([action],e.prototype,"stopLoader",null),e}();export{ProStore};var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:PullRight,propsSelector:function(){return{}}}},_a[SECURITY_DEFINITIONS_COMPONENT_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SECURITY_DEFINITIONS_JSX_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SCHEMA_DEFINITION_JSX_NAME]={component:SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
1
+ var _a;import{__assign,__awaiter,__decorate,__generator}from"tslib";import{action,makeObservable,observable,observe}from"mobx";import{bundle,Config}from"@redocly/openapi-core";import{IS_BROWSER,MarkerService,RedocNormalizedOptions,ScrollService,SecurityDefs,SpecStore,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME,SCHEMA_DEFINITION_JSX_NAME,SchemaDefinition,createParsedDocument}from"../redoc-lib";import{FakeHistoryService,ProHashHistoryService,PushStateHistoryService}from"./history";import{ProMenu}from"./ProMenu";import{DeepSearchStore,RemoteSearch,DEFAULT_SEARCH_MAX_DEPTH}from"./SearchStore";import{extendTheme}from"./extendTheme";import{RedocResponse,PullRight}from"../components/pluggable";import{MultipleSpecsStore}from"./MultipleSpecsStore";import{VersionedSpecStore}from"./VersionedSpecStore";import parseToken from"./check";import{normalizePath}from"./utils";import{fromStorage,toStorage,toLocalStorage,fromLocalStorage,setGlobalStore,debounce}from"../utils";import{LayoutVariant}from"./store-types";var global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),__decorate([observable],e.prototype,"active",void 0),__decorate([observable],e.prototype,"expanded",void 0),__decorate([action],e.prototype,"activate",null),__decorate([action],e.prototype,"expand",null),__decorate([action],e.prototype,"collapse",null),__decorate([action],e.prototype,"deactivate",null),e}();export{NestingGroup};function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activateSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:debounce((function(e){return n.setActiveSampleLanguage(e)}),500)}),makeObservable(this),this.initProOptions(i),IS_BROWSER&&(this.l=parseToken(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r=Array.isArray(e),a=e&&Array.isArray(e.versions),s=this.options.disableSidebar?new FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new PushStateHistoryService(this.options,r||a):new ProHashHistoryService(this.options,r||a);this.definition=r?new MultipleSpecsStore(e,this.options):a?new VersionedSpecStore(e,this.options,s.currentId.split("/")[0]):new SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadLink=i.downloadDefinitionUrl,this.definition.info.downloadFileName=""),this.scroll=new ScrollService(this.options),this.options.disableSidebar||ProMenu.updateOnHistory(s.currentId,this.scroll),this.menu=new ProMenu(this.definition,this.scroll,this.options,s),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=observe(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),setGlobalStore(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r;e=deepClone(e),this.rawOptions=extendTheme(e),this.options=new RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),this.options.showConsole=null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||"summary-only",this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var a="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy="none"===this.options.pagination?"hash":"browser",!(null===(r=this.rawOptions)||void 0===r?void 0:r.pagination)&&(null==a?void 0:a.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==a?void 0:a.scope){case"all":default:this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&normalizePath(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||DEFAULT_SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore&&observe(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=fromLocalStorage("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=fromLocalStorage("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=fromStorage("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,toStorage("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=LayoutVariant.THREE_PANEL),this.layout=e,toLocalStorage("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,toLocalStorage("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i,o,n,r;return __awaiter(this,void 0,void 0,(function(){var a,s,l,p,u,c,h;return __generator(this,(function(d){switch(d.label){case 0:return a=void 0!==e&&this.definition.specs?this.definition.specs[e].parser.definition:this.definition.parser.definition,s=JSON.parse(JSON.stringify(a)),l=__assign(__assign({},getSpecVersionObj(s)),{components:s.components,paths:(c={},c[t.path]=(h={},h[t.httpVerb]=null===(o=null===(i=s.paths)||void 0===i?void 0:i[t.path])||void 0===o?void 0:o[t.httpVerb],h.parameters=null===(r=null===(n=s.paths)||void 0===n?void 0:n[t.path])||void 0===r?void 0:r.parameters,h),c)}),p=new Config({}),u=createParsedDocument(l),[4,bundle({config:p,doc:u,dereference:!0})];case 1:return d.sent(),[2,s]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];observe(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&observe(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);setGlobalStore(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof MultipleSpecsStore||this.definition instanceof VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,i=Math.max(0,e),o=Math.min(this.menu.flatItems.length,i+5),n=[],r=i;r<o;r++){var a;(a=this.menu.getElementAt(r))&&(a&&n.push(a))}"item"===this.options.pagination&&(this.menu.flatItems[e]&&this.menu.flatItems[e].parent&&(a=this.menu.getElementAt(null===(t=this.menu.flatItems[e].parent)||void 0===t?void 0:t.absoluteIdx))&&n.push(a));this.marker.addOnly(n),this.marker.mark()}}),__decorate([observable],e.prototype,"search",void 0),__decorate([observable],e.prototype,"tryItOperation",void 0),__decorate([observable],e.prototype,"showRightPanel",void 0),__decorate([observable],e.prototype,"layout",void 0),__decorate([observable],e.prototype,"activeSampleLanguage",void 0),__decorate([observable],e.prototype,"isLoading",void 0),__decorate([action],e.prototype,"onDidMount",null),__decorate([action],e.prototype,"toggleRightPanel",null),__decorate([action],e.prototype,"toggleLayout",null),__decorate([action],e.prototype,"disableConsole",null),__decorate([action],e.prototype,"enableConsole",null),__decorate([action],e.prototype,"tryItOut",null),__decorate([action],e.prototype,"setActiveSampleLanguage",null),__decorate([action],e.prototype,"startLoader",null),__decorate([action],e.prototype,"stopLoader",null),e}();export{ProStore};var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:PullRight,propsSelector:function(){return{}}}},_a[SECURITY_DEFINITIONS_COMPONENT_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SECURITY_DEFINITIONS_JSX_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SCHEMA_DEFINITION_JSX_NAME]={component:SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
2
2
  //# sourceMappingURL=ProStore.js.map
@@ -6,7 +6,7 @@ export declare type SearchResultMeta = {
6
6
  menuId: string;
7
7
  boost?: number;
8
8
  };
9
- export declare const SEARCH_MAX_DEPTH = 8;
9
+ export declare const DEFAULT_SEARCH_MAX_DEPTH = 1;
10
10
  export declare class DeepSearchStore extends SearchStore<SearchResultMeta> {
11
11
  operationTitleBoost: number;
12
12
  tagTitleBoost: number;
@@ -1,2 +1,2 @@
1
- import{__awaiter,__extends,__generator}from"tslib";import{SearchStore}from"../redoc-lib";function removeMarkdown(e){return e.replace(/\[(.*?)][[(].*?[\])]/g,"$1")}export var SEARCH_MAX_DEPTH=8;var DeepSearchStore=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"operationTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:4}),Object.defineProperty(r,"tagTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:8}),Object.defineProperty(r,"fieldLevelBoost",{enumerable:!0,configurable:!0,writable:!0,value:.95}),Object.defineProperty(r,"pathOnly",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(r,"searchMaxDepth",{enumerable:!0,configurable:!0,writable:!0,value:SEARCH_MAX_DEPTH}),t.searchOperationTitleBoost&&(r.operationTitleBoost=parseInt(t.searchOperationTitleBoost,10)),t.searchTagTitleBoost&&(r.tagTitleBoost=parseInt(t.searchTagTitleBoost,10)),t.searchFieldLevelBoost&&(r.fieldLevelBoost=parseInt(t.searchFieldLevelBoost,10)),"path-only"===t.searchMode&&(r.pathOnly=!0),t.searchMaxDepth&&(r.searchMaxDepth=t.searchMaxDepth),r}return __extends(t,e),Object.defineProperty(t.prototype,"indexItems",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=function(e){e.forEach((function(e){if("operation"===e.type&&t.pathOnly){var o=e;t.add(o.path,"",{menuId:o.id,boost:t.operationTitleBoost})}else{if("group"===e.type||t.pathOnly||(t.add(e.name,"operation"===e.type?e.path:"",{menuId:e.id,boost:"operation"===e.type?t.operationTitleBoost:t.tagTitleBoost}),e.description&&t.add("",removeMarkdown(e.description||""),{menuId:e.id})),"operation"===e.type){for(var a=0,n=(o=e).parameters||[];a<n.length;a++){var i=n[a];t.add(i.name,removeMarkdown(i.description),{menuId:e.id,place:"parameters",path:[i.name]})}var c=o.requestBody&&o.requestBody.content&&o.requestBody.content.active&&o.requestBody.content.active.schema;t.indexSchema(c,e.id,"request fields"),o.responses.forEach((function(r){var o=r.content&&r.content.active&&r.content.active.schema;o&&t.indexSchema(o,e.id,"response "+r.code+" fields")}))}r(e.items)}}))};r(e),this.searchWorker.done()}}),Object.defineProperty(t.prototype,"indexSchema",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,o,a){if(void 0===o&&(o=[]),void 0===a&&(a=0),e&&!(a>this.searchMaxDepth||e.isCircular)){if((e=e.oneOf&&e.oneOf[e.activeOneOf]||e).fields)for(var n=0,i=e.fields;n<i.length;n++){var c=i[n],l=o.concat([c.name]);"additionalProperties"!==c.kind&&(this.add(c.name,removeMarkdown(c.description),{menuId:t,place:r,path:l,boost:Math.pow(this.fieldLevelBoost,a)}),this.indexSchema(c.schema,t,r,l,a+1))}e.items&&this.indexSchema(e.items,t,r,o,a+1)}}}),Object.defineProperty(t.prototype,"add",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this.searchWorker.add(e,t,r)}}),Object.defineProperty(t.prototype,"search",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.searchWorker.search(e)];case 1:return[2,t.sent()]}}))}))}}),Object.defineProperty(t.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.searchWorker.toJS()]}))}))}}),Object.defineProperty(t.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){"terminate"in this.searchWorker&&this.searchWorker.terminate(),this.searchWorker.dispose&&this.searchWorker.dispose()}}),t}(SearchStore);export{DeepSearchStore};var RemoteSearch=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"url",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"operationTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:4}),Object.defineProperty(r,"tagTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:8}),Object.defineProperty(r,"fieldLevelBoost",{enumerable:!0,configurable:!0,writable:!0,value:.95}),r}return __extends(t,e),Object.defineProperty(t.prototype,"indexItems",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),Object.defineProperty(t.prototype,"add",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){throw new Error("Not implemented")}}),Object.defineProperty(t.prototype,"search",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return __awaiter(this,void 0,void 0,(function(){var t,r;return __generator(this,(function(o){switch(o.label){case 0:t=[],o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch(this.url+"?q="+encodeURIComponent(e))];case 2:return[4,o.sent().json()];case 3:if(t=o.sent(),!Array.isArray(t))throw t=[],new Error("wrong search results format");return[3,5];case 4:return r=o.sent(),console.error("Failed to load search results: "+r.message),[3,5];case 5:return[2,t]}}))}))}}),Object.defineProperty(t.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype.dispose.call(this)}}),Object.defineProperty(t.prototype,"load",{enumerable:!1,configurable:!0,writable:!0,value:function(){}}),Object.defineProperty(t.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){throw new Error("Not implemented")}))}))}}),t}(SearchStore);export{RemoteSearch};
1
+ import{__awaiter,__extends,__generator}from"tslib";import{SearchStore}from"../redoc-lib";function removeMarkdown(e){return e.replace(/\[(.*?)][[(].*?[\])]/g,"$1")}export var DEFAULT_SEARCH_MAX_DEPTH=1;var DeepSearchStore=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"operationTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:4}),Object.defineProperty(r,"tagTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:8}),Object.defineProperty(r,"fieldLevelBoost",{enumerable:!0,configurable:!0,writable:!0,value:.95}),Object.defineProperty(r,"pathOnly",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(r,"searchMaxDepth",{enumerable:!0,configurable:!0,writable:!0,value:DEFAULT_SEARCH_MAX_DEPTH}),t.searchOperationTitleBoost&&(r.operationTitleBoost=parseInt(t.searchOperationTitleBoost,10)),t.searchTagTitleBoost&&(r.tagTitleBoost=parseInt(t.searchTagTitleBoost,10)),t.searchFieldLevelBoost&&(r.fieldLevelBoost=parseInt(t.searchFieldLevelBoost,10)),"path-only"===t.searchMode&&(r.pathOnly=!0),t.searchMaxDepth&&(r.searchMaxDepth=t.searchMaxDepth),r}return __extends(t,e),Object.defineProperty(t.prototype,"indexItems",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=function(e){e.forEach((function(e){if("operation"===e.type&&t.pathOnly){var o=e;t.add(o.path,"",{menuId:o.id,boost:t.operationTitleBoost})}else{if("group"===e.type||t.pathOnly||(t.add(e.name,"operation"===e.type?e.path:"",{menuId:e.id,boost:"operation"===e.type?t.operationTitleBoost:t.tagTitleBoost}),e.description&&t.add("",removeMarkdown(e.description||""),{menuId:e.id})),"operation"===e.type){for(var a=0,n=(o=e).parameters||[];a<n.length;a++){var i=n[a];t.add(i.name,removeMarkdown(i.description),{menuId:e.id,place:"parameters",path:[i.name]})}var c=o.requestBody&&o.requestBody.content&&o.requestBody.content.active&&o.requestBody.content.active.schema;t.indexSchema(c,e.id,"request fields"),o.responses.forEach((function(r){var o=r.content&&r.content.active&&r.content.active.schema;o&&t.indexSchema(o,e.id,"response "+r.code+" fields")}))}r(e.items)}}))};r(e),this.searchWorker.done()}}),Object.defineProperty(t.prototype,"indexSchema",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,o,a){if(void 0===o&&(o=[]),void 0===a&&(a=0),e&&!(a>this.searchMaxDepth||e.isCircular)){if((e=e.oneOf&&e.oneOf[e.activeOneOf]||e).fields)for(var n=0,i=e.fields;n<i.length;n++){var c=i[n],l=o.concat([c.name]);"additionalProperties"!==c.kind&&(this.add(c.name,removeMarkdown(c.description),{menuId:t,place:r,path:l,boost:Math.pow(this.fieldLevelBoost,a)}),this.indexSchema(c.schema,t,r,l,a+1))}e.items&&this.indexSchema(e.items,t,r,o,a+1)}}}),Object.defineProperty(t.prototype,"add",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this.searchWorker.add(e,t,r)}}),Object.defineProperty(t.prototype,"search",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.searchWorker.search(e)];case 1:return[2,t.sent()]}}))}))}}),Object.defineProperty(t.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.searchWorker.toJS()]}))}))}}),Object.defineProperty(t.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){"terminate"in this.searchWorker&&this.searchWorker.terminate(),this.searchWorker.dispose&&this.searchWorker.dispose()}}),t}(SearchStore);export{DeepSearchStore};var RemoteSearch=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"url",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"operationTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:4}),Object.defineProperty(r,"tagTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:8}),Object.defineProperty(r,"fieldLevelBoost",{enumerable:!0,configurable:!0,writable:!0,value:.95}),r}return __extends(t,e),Object.defineProperty(t.prototype,"indexItems",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),Object.defineProperty(t.prototype,"add",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){throw new Error("Not implemented")}}),Object.defineProperty(t.prototype,"search",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return __awaiter(this,void 0,void 0,(function(){var t,r;return __generator(this,(function(o){switch(o.label){case 0:t=[],o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch(this.url+"?q="+encodeURIComponent(e))];case 2:return[4,o.sent().json()];case 3:if(t=o.sent(),!Array.isArray(t))throw t=[],new Error("wrong search results format");return[3,5];case 4:return r=o.sent(),console.error("Failed to load search results: "+r.message),[3,5];case 5:return[2,t]}}))}))}}),Object.defineProperty(t.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype.dispose.call(this)}}),Object.defineProperty(t.prototype,"load",{enumerable:!1,configurable:!0,writable:!0,value:function(){}}),Object.defineProperty(t.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){throw new Error("Not implemented")}))}))}}),t}(SearchStore);export{RemoteSearch};
2
2
  //# sourceMappingURL=SearchStore.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/reference-docs",
3
- "version": "2.7.9",
3
+ "version": "2.8.3",
4
4
  "description": "Redocly Reference Docs",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "scripts": {
61
61
  "prepublishOnly-local": "npm run clean && npm run bundle && npm run compile-lib && npm run bundle-cli && npm run prepublish-test",
62
- "clean": "rm -rf bin dist lib lib-esm cli-zip",
62
+ "clean": "rm -rf bin dist lib lib-esm cli-zip redocly-static",
63
63
  "bundle": "webpack --mode=production",
64
64
  "compile-lib": "npm run compile-es5 && npm run compile-esm && npm run bundle-worker",
65
65
  "compile-es5": "rm -rf lib && tsc -p tsconfig.lib.json && node scripts/minify.js lib",
@@ -148,7 +148,6 @@
148
148
  "style-loader": "^1.0.1",
149
149
  "terser": "^5.6.1",
150
150
  "ts-jest": "^26.4.4",
151
- "ts-loader": "^6.2.2",
152
151
  "ts-node": "^8.8.1",
153
152
  "typescript": "4.4.2",
154
153
  "unfetch": "^4.1.0",